For example ⌥← inserts ^[^[[D by default, where ^[ is escape in caret notation. You can run read and press key combinations to see what characters they insert. for some reason I ended up with iterm2 again and was annoyed that I couldnt do OPTION or to skip through words. Another option is to add this to ~/.inputrc: "\e\e[D": backward-word One really useful productivity shortcut I found was how to skip a word with or or go to start/end of the line with or. You can make ⌥⌦ delete a word forward by assigning it to \ed:Ĭhanging ⌥← and ⌥→ to \eb and \ef in iTerm's preferences would also change them in programs that don't support readline or emacs-style keybindings. An important note here: For the plugins to load in, you will have to restart iTerm Set up some shortcuts:, and. To make ⌘← and ⌘→ go to the beginning and end of line, you can assign them to 0x01 (^A in caret notation) and 0x05 (^E in caret notation): Some sequences of bytes like ANSI escape sequences and even single bytes like ASCII control characters have special meanings in terminals. 0x1b 0x1b 0x5b 0x43 means escape escape [ C. 0xc3 0xa4 would insert ä if you use UTF-8. Unfortunately it does not require typing Ctrl-Backspace to delete the word but works with just the Backspace key. ![]() This inserts the literal Ctrl-Backspace character as the argument for stty werase. For example mapping a key combination to 0圆6 0圆f 0圆f would make it insert foo. Using the stty command I attempted to assign the 'kill word' to Ctrl BckSpc by typing stty werase followed by Ctrl-v Ctrl-Backspace. Now we can skip entire words on the command line interface by holding down the left ⌥ key and hitting ← or →.Those hex codes are just sequences of bytes. After we are done, we may need to restart the iTerm to be able to use the changes that we have just made. Now we need to repeat a similar process for the ⌥→ keyboard shortcut with the following settings: Now we can skip entire words on the command line interface by holding down the left key and hitting or. To make this work for the right option key you need to set the key modifier to act as an Escape Sequence.įirst, you need to set your left ⌥ key key to act as an escape character.Īfter that, you can either change the current shortcut for ⌥ ← or create a new one, in the Profile Shortcut Keys, with the following settings: Following is the default behavior for both iTerm2 and VI: iTerm2. If I add these keys and combinations to iTerm2 Key Binding and profile Key Mappings they work for iTerm2 but stop working for VI. All you have to do is do a few configurations in the iTerm preferences, and you are good to go. At the same time, in VI, these key combinations work in both normal and insert modes. In other words, you do not need to install anything else in your OS X. To make this work for the right option key. You're done Now you can skip entire words on the command line by holding down the left key and hitting or. Copy the installed iTerm2.app application to iRosetta2.app Press command I to Get Info for iRosetta.app. (See screenshot.) Left Option Key Settings Then, in your Key Mappings on the same screen, we need to redefine the shortcuts for our desired combination. Third, repeat for the keyboard shortcut with the following settings: Keyboard Shortcut. Here you need to set your left key to act as an escape character. You only need to make a few keystroke changes in your iTerm preferences and you are done. First, in iTerm2, go to Preferences > Profile > Keys. ![]() You do not need to pay 1 BTC to Apple to get this working. ![]() ![]() It turns out that this is possible quite easily and without much pain and effort from your side. One feature that I wanted to have after my migration from Windows to OS X is the ability to jump between words in the command line, and not having to go through the whole line character by character. ITerm is a really great terminal replacement that I really like to use. Edit a command line Move the insertion point backward one word.
0 Comments
Leave a Reply. |