Move the alt+left/right binding into zsh integration

It works OOTB in bash and fish already.
This commit is contained in:
Kovid Goyal 2022-12-19 11:23:31 +05:30
parent e3f6f47f10
commit e4ee2cf995
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 6 additions and 11 deletions

View File

@ -69,7 +69,7 @@ Detailed list of changes
- Remote control: When matching windows allow using negative id numbers to match recently created windows (:iss:`5753`)
- macOS: Bind :kbd:`option+left` and :kbd:`option+right` to :kbd:`alt+b` and :kbd:`alt+f`. This mimics the default bindings in Terminal.app (:iss:`5793`)
- ZSH Integration: Bind :kbd:`alt+left` and :kbd:`alt+right` to move by word if not already bound. This mimics the default bindings in Terminal.app (:iss:`5793`)
0.26.5 [2022-11-07]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -4002,13 +4002,5 @@ map('Open kitty Website',
f'open_kitty_website shift+cmd+/ open_url {website_url()}',
only='macos',
)
map('Move right one word',
'move_right_one_word alt+right send_text normal,application \\x1bf',
only='macos'
)
map('Move left one word',
'move_left_one_word alt+left send_text normal,application \\x1bb',
only='macos'
)
egr() # }}}
egr() # }}}

View File

@ -937,8 +937,6 @@ if is_macos:
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=12, key=44), definition='load_config_file')) # noqa
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=10, key=44), definition='debug_config')) # noqa
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=9, key=47), definition='open_url https://sw.kovidgoyal.net/kitty/')) # noqa
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=2, key=57351), definition='send_text normal,application \\x1bf')) # noqa
defaults.map.append(KeyDefinition(trigger=SingleKey(mods=2, key=57350), definition='send_text normal,application \\x1bb')) # noqa
defaults.mouse_map = [
# click_url_or_select
MouseMapping(repeat_count=-2, definition='mouse_handle_click selection link prompt'), # noqa

View File

@ -388,6 +388,11 @@ _ksi_deferred_init() {
alias edit-in-kitty="kitty-tool edit-in-kitty"
# Map alt+left/right to move by word if not already mapped. This is expected behavior on macOS and I am tired
# of answering questions about it.
[[ $(builtin bindkey "^[1;3C") == *" undefined-key" ]] && builtin bindkey "^[1;3C" "forward-word"
[[ $(builtin bindkey "^[1;3D") == *" undefined-key" ]] && builtin bindkey "^[1;3D" "backward-word"
# Unfunction _ksi_deferred_init to save memory. Don't unfunction
# kitty-integration though because decent public functions aren't supposed to
# to unfunction themselves when invoked. Unfunctioning is done by calling code.