Last active
August 12, 2021 05:33
-
-
Save jclosure/d780d58e35c0b1beabfeae35bad65628 to your computer and use it in GitHub Desktop.
Fixing zsh's zle cut/copy keys for selected region to be identical to emacs (oh-my-zsh)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Documented in the zsh manual: http://zsh.sourceforge.net/Guide/zshguide04.html | |
| # under sections: "4.1.1: The simple facts" and "4.5.5: Keymaps" | |
| # the default keymap for zle is "Emacs" | |
| # The emacs keymap bindings for kill-region and copy-region-as-kill are a little off from emacs' defaults | |
| # the zsh defaults are: | |
| # M-w => kill-region | |
| # M-W => copy-region-as-kill (that's M-S-w) | |
| # C-w => backward-kill-word | |
| # for emacs proper they should be: | |
| # C-w => kill-region | |
| # M-w => copy-region-as-kill | |
| # in to .zshrc, add the following to rebind these: | |
| source $ZSH/oh-my-zsh.sh | |
| # add these below ^ | |
| # copy | |
| # NOTE: \e == ^[ or ESC, which is bound to <alt> (Meta) in tty | |
| bindkey "\ew" copy-region-as-kill | |
| # cut | |
| bindkey "\C-w" kill-region |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment