You can navigate by word using the arrow keys when combined with the option ( ⌥) key and can delete words using option + delete at the iTerm prompt, like everywhere else on the Mac. In the same preferences window, scroll in the Key Mappings section until you see the ⌥← key combination and double click it to edit.Ĭhange the action to Send Escape Sequence and the value for the Esc+ input to bĭo the same for the ⌥→ key combination and this time use f for the value. Option + Right arrow ( ⌥ + →) – Move one word right.Option + Left arrow ( ⌥ + ←) – Move one word left.(See screenshot.) Then, in your Key Mappings on the same screen, we need to redefine the shortcuts for our desired combination. Here you need to set your left key to act as an escape character. First, in iTerm2, go to Preferences > Profile > Keys. Next we’ll setup the arrows keys to move by word when the option key is held down. I use the command line a lot on my Macs, in particular, I use iTerm2. How to Configure backward-word and forward-word in iTerm2. The change you just made will let your delete by word (instead of single character) at the prompt if you hit the delete key while holding down the option ( ⌥) key. iTerm recommends using +Esc instead in the FAQ. Note: the Terminal.app equivalent of this is the Use Option as Meta key checkbox as shown in this screenshot. Change the Left option key acts as: and Right option key acts as: to the +Esc option. At the bottom of this pane, you’ll see the Keyboard Behaviour section. Open the Preferences pane for iTerm and navigate to Profiles -> Keys. Move the cursor using the cursor keys on the keyboard (see link for more movement. Or you can use copy mode: Cmd + Shift + C to enter copy mode. This requires making a few minor changes to the settings. When using iTerm2, you can either use Cmd + Option +mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app. ![]() The short video below demonstrates what it looks like to have that ability: When I made the switch, I had to figure out how to bring over the ability to move the cursor by word or delete words at the prompt instead of one character at a time. For a more general approach you start your terminal, press Ctrl + V followed by the key combination you want the escape code (the name) of - in this case the key combinations Ctrl + Left Arrow and Ctrl + Right Arrow - and put the output for each key combination in between the two quotes to make a keybind for it. ITerm is a great replacement for the default Terminal app on the Mac, comes with lots of nice features like horizontal & vertical spits, necessities like tmux integration and a whole lot more. 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 +. Sadly this is not working inside my tmux session. Killing a fly with a cannon: Go to Preferences. zshrc to enable jumping words on a bare zsh command line using the ALT+arrow keys: bindkey ' C' forward-word bindkey ' D' backward-word. As my terminal is iTerm2 for both combinations. Move the Cursor by Word at the Command Prompt on the Mac (iTerm) I moved from just using zsh to using zsh inside tmux.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |