![]() I'm unable to find a solution for adding redo in bash or readline, so if anyone know a solution for either of those, please comment below and I'll try to add them in.įor anyone looking for the lookup table on how to convert key sequences to hex, I find this table very helpful. ![]() $ echo 'bindkey "^Xx7f" backward-kill-line' > ~/.zshrc # binds hex 0x18 0x7f with deleting everything to the left of the cursor $ echo 'bindkey "^U" backward-kill-line' > ~/.zshrc Redo typically not bound in bash, zsh or readline, so we can set it to a unused hexcode which we can then fix in zshįor zsh, you can setup binding for the not yet functional ⌘+←Delete and ⇧+⌘+Z/⌘+y by running: # changes hex 0x15 to delete everything to the left of the cursor, ⌥+fn←Delete or ⌥+Delete→ Send Hex Codes: 0x01b 0圆4 ⌘+fn+←Delete or ⌘+Delete→ Send Hex Codes: 0x0bĠx1b 0x08 Breaks in Elixir's IEX, seems to work fine everywhere elseĠx17 Works everywhere, but doesn't stop at normal word breaks in IRB and will instead delete until it sees a literal space. I personally use this and then overwrite my zsh bindkey for ^U to delete only stuff to the left of the cursor (see below).Ġx18 0x7f Less compatible, doesn't work in node and won't work in zsh by default, see below to fix zsh (bash/irb/pry should be fine), performs desired functionality when it does work.ĭelete all characters right of the cursor If the preset doesnt appear, reinstall iTerm2. Also you can delete a word backwards using Option +, delete the whole line using Command +. Open the iTerm preferences ⌘+, and navigate to the Profiles tab (the Keys tab can be used, but adding keybinding to your profile allows you to save your profile and sync it to multiple computers) and keys sub-tab and enter the following:Ġx15 More compatible, but functionality sometimes is to delete the entire line rather than just the characters to the left of the curser. Then, you can move a word backwards using Option + and a word forwards using Option +, move to the start of the line using fn + and to the end of the line with fn +. I verified that this works in ZSH, Bash, node, python -i, iex and irb/pry sessions (using rb-readline gem for readline, but should work for all). I see there's a lot of good answers already, but this should provide the closest to native OSX functionality as possible in more than just your shell. Remove the mappings for key combinations ⌥ + ← and ⌥ + →.To jump between words and start/end of lines in iTerm2 follow these steps: ĭon't forget to remove the previous bindings : In order to get Alt+left/right arrow working correctly for word jumping follow this article.Īdd in iTerm2 the following Profile Shortcut Keys FOR ACTION SEND How to change this to Cmd+left/right arrow? I can see that Ctrl+left/right jumps to the beginning/end of line.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |