From 19fdcec3586b370e67639eed13c00dcb8d2fa3d2 Mon Sep 17 00:00:00 2001 From: pagedown Date: Mon, 18 Apr 2022 11:54:14 +0800 Subject: [PATCH] ... --- kitty/options/definition.py | 17 ++++++++++------- shell-integration/bash/kitty.bash | 6 +++--- shell-integration/zsh/kitty-integration | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/kitty/options/definition.py b/kitty/options/definition.py index bd5247ec9..e2d5c2e6e 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -3768,18 +3768,21 @@ This will send "Special text" when you press the :kbd:`ctrl+alt+a` key combination. The text to be sent is a python string literal so you can use escapes like :code:`\\x1b` to send control codes or :code:`\\u21fb` to send unicode characters (or you can just input the unicode characters directly as -UTF-8 text). The first argument to :code:`send_text` is the keyboard modes in which to -activate the shortcut. The possible values are :code:`normal` or :code:`application` or :code:`kitty` -or a comma separated combination of them. The special keyword :code:`all` means all -modes. The modes :code:`normal` and :code:`application` refer to the DECCKM cursor key mode for -terminals, and :code:`kitty` refers to the special kitty extended keyboard protocol. +UTF-8 text). You can use the show_key kitten :code:`kitty +kitten show_key` to +get the key escape codes you want to emulate. The first argument to +:code:`send_text` is the keyboard modes in which to activate the shortcut. The +possible values are :code:`normal` or :code:`application` or :code:`kitty` or a +comma separated combination of them. The special keyword :code:`all` means all +modes. The modes :code:`normal` and :code:`application` refer to the DECCKM +cursor key mode forterminals, and :code:`kitty` refers to the special kitty +extended keyboard protocol. Some more examples:: - # Output a word and move the cursor ro the start of the line (like typing and pressing Home) + # Output a word and move the cursor to the start of the line (like typing and pressing Home) map ctrl+alt+a send_text normal Word\\x1b[H map ctrl+alt+a send_text application Word\\x1bOH - # Run a command at a shell prompt (like typing the command and pressing enter) + # Run a command at a shell prompt (like typing the command and pressing Enter) map ctrl+alt+a send_text normal,application some command with arguments\r ''' ) diff --git a/shell-integration/bash/kitty.bash b/shell-integration/bash/kitty.bash index 886d95622..cf0b4186f 100644 --- a/shell-integration/bash/kitty.bash +++ b/shell-integration/bash/kitty.bash @@ -215,7 +215,7 @@ _ksi_main() { builtin let limit=1+$COMP_CWORD src=$(builtin printf "%s\n" "${COMP_WORDS[@]:0:$limit}" | builtin command kitty +complete bash) if [[ $? == 0 ]]; then - builtin eval ${src} + builtin eval "${src}" fi } builtin complete -o nospace -F _ksi_completions kitty @@ -273,13 +273,13 @@ _ksi_main() { if _ksi_s_is_ok "venv" && [ -n "${VIRTUAL_ENV}" -a -r "$venv" ]; then sourced="y" builtin unset VIRTUAL_ENV - . "$venv" + builtin source "$venv" fi; if _ksi_s_is_ok "conda" && [ -n "${CONDA_DEFAULT_ENV}" ] && builtin command -v conda >/dev/null 2>/dev/null && [ "${CONDA_DEFAULT_ENV}" != "$orig_conda_env" ]; then sourced="y" conda activate "${CONDA_DEFAULT_ENV}" fi; if _ksi_s_is_ok "env_var" && [[ -n "${KITTY_CLONE_SOURCE_CODE}" ]]; then sourced="y" - eval "${KITTY_CLONE_SOURCE_CODE}" + builtin eval "${KITTY_CLONE_SOURCE_CODE}" fi; if _ksi_s_is_ok "path" && [[ -r "${KITTY_CLONE_SOURCE_PATH}" ]]; then sourced="y" builtin source "${KITTY_CLONE_SOURCE_PATH}" diff --git a/shell-integration/zsh/kitty-integration b/shell-integration/zsh/kitty-integration index 2433b8ea3..7efe5bc1e 100644 --- a/shell-integration/zsh/kitty-integration +++ b/shell-integration/zsh/kitty-integration @@ -369,7 +369,7 @@ _ksi_deferred_init() { conda activate "${CONDA_DEFAULT_ENV}" fi; if _ksi_s_is_ok "env_var" && [[ -n "${KITTY_CLONE_SOURCE_CODE}" ]]; then sourced="y" - eval "${KITTY_CLONE_SOURCE_CODE}" + builtin eval "${KITTY_CLONE_SOURCE_CODE}" fi; if _ksi_s_is_ok "path" && [[ -r "${KITTY_CLONE_SOURCE_PATH}" ]]; then sourced="y" builtin source "${KITTY_CLONE_SOURCE_PATH}"