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. At the bottom under (Left Option) select Esc. Click the Profiles tab at the top and select your profile in the left pane. $ echo 'bindkey "^X\\x7f" backward-kill-line' > ~/.zshrc Step 1 Open iTerm2 and open the Preferences window. # binds hex 0x18 0x7f with deleting everything to the left of the cursor $ echo 'bindkey "^U" backward-kill-line' > ~/.zshrc ⌘ ←Delete and ⇧ ⌘ Z/ ⌘ y by running: # changes hex 0x15 to delete everything to the left of the cursor, ⇧ ⌘ Z or ⌘ y Send Hex Codes: 0x18 0x1fįor zsh, you can setup binding for the not yet functional 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 ⌥ fn ←Delete or ⌥ Delete→ Send Hex Codes: 0x1b 0圆4 #Iterm2 jump word mac#Ctrl as modifier might also work on mac and non-mac keyboards/shells/apps. ⌘ 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. Fast way to jump by words to correct a typo or 'run again' with minor changes to last command. 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 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. For the Jump to start of word command, select the Send Escape Sequence action and send the escape sequence Esc b: Now, whenever youre typing a command in iTerm2, its really easy to jump back to the start of the word (or even multiple words) to insert more text or delete part of the command no more need for repeatedly pressing. 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). If you want this to work for the right option key, well, then you need to configure it as an escape character in step one.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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |