Your command line navigation will now be faster and more precise. How to Configure backward-word and forward-word in iTerm2 First, in iTerm2, go to Preferences > Profile > Keys. The cursor will now “jump” over entire words as it does on other applications. Now we can skip entire words on the command line interface by. Click “OK”.Ĭlose the menu and begin using the Alt and the left/right arrows immediately. I have been meaning to write this post for quite a while now but have always managed to forget. This time, in the “Esc +” field, type lowercase “f”. Open the same context menu for Alt plus right ⌥→ and again change the action to “Send Escape Sequence”. In the “Esc +” field, type lowercase “b” and click “OK”. Double click it.Ĭhange the action from “Send Hex Code” to “Send Escape Sequence” (you might have to scroll a bit to find this). Within the “Key Mappings” pane, find the mapping for the Alt and left keys, which will look like this: ⌥←. Open the “Preferences” menu: either find it in the “iTerm2” dropdown menu along the top of the screen or press the Cmd and comma keys. You might be familiar with shortcuts to skip a word () or go to start/end of the line (). Note: I refer to the “Alt” key throughout this post, which is the text written on my old 2013 MacBook Pro keyboard, but this is normally called the “Option” key in MacOS. With a little config, you can change this behaviour, which I’ll explain below. However, on first install, you can’t use the Option or Alt key (this key: ⌥) as you would in other applications: you can’t skip or jump over words by pressing Alt and the left or right keys. This can be done going to iTerm2 > Preferences > Profiles > Keys. It has many more handy features than Terminal, is free to download and is also open source □. First you need to set your left key to act as an escape character. Open up iTerm2 preferences (⌘,) -> Profiles -> Keys -> Click on + icon (add new Keyboard shortcut).ITerm2 is a replacement for the default Terminal application on MacOS. iTerm is not set up to work with these shortcuts by default but here’s how you set them up: When I use Vim locally or remotely, option-left works, but option-right does not. Option-left to Esc-H and a one for option-right to Esc-F to skip over words), and this works in the shell locally or when ssh'd to a remote server. You might be familiar with shortcuts to skip a word (⌥) or go to start/end of the line (⌘). My Iterm2 preferences have mappings to do this (e.g. FOOBAR is one word to zsh and 2 words to bash. If you’re using BASH instead of ZSH you can add export CLICOLOR=1 line to your ~/.bash_profile file for nice coloring of listings People interested in this question may also be interested to know that zsh words are not bash words.Source Code Pro can be downloaded from project’s github repository. Change the font to 14pt Source Code Pro Lite.Change the cursor text and cursor color to yellow make it more visible. Download one of iTerm2 color schemes and then set these to your default profile colors.Go to profiles -> Default -> Terminal -> Check silence bell to disable the terminal session from making any sound.Set hot-key to open and close the terminal to command + option + i.Here are some suggested settings you can change or set, they are all optional. Note: Instead of downloading and installing iTerm2 manually, you can use Homebrew brew cask install iterm2 Customization Colors and Font Settings Once downloaded, drag and drop the iTerm application file into your Applications folder. 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. You can get the app from iTerm2 downloads page. Third, repeat for the keyboard shortcut with the following settings: Keyboard Shortcut. It’s highly customizable and comes with a lot of useful features. ITerm2 is an open source replacement for Apple’s Terminal.
0 Comments
Leave a Reply. |