开发者

Word jumping in iTerm2 or Terminal in OSX Lion

I recently upgraded from Snow Leopard to Lion and Xcode 4.1, and word jumping stopped working in both Terminal and iTerm2. Did the mappings change?开发者_运维知识库

This is with and without a homebrew installation of readline.

My .inputrc looks like this:

"\e[1;5D": backward-word
"\e[1;5C": forward-word

Thanks!


Just add the escape sequences in iTerm settings as global shortcut keys.

Word backward (option-arrowleft):

Word jumping in iTerm2 or Terminal in OSX Lion

Same with word forward, just use F.


The easiest/quickest way I have found is under Profiles > Keys > 'Load Preset...' > 'Natural Text Editing'.

Then use the option key rather than the control key.

(iterm2 version 3)


Killing a fly with a cannon:

  • Go to Preferences... > Profiles > Keys
  • Press Load Preset...
  • Select Natural Text Editing

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 + . Also you can delete a word backwards using Option ⌥ + , delete the whole line using Command ⌘ + .

If the preset doesn't appear, reinstall iTerm2. If you installed it using Homebrew+Cask:

brew cask reinstall iterm2

source and credits https://apple.stackexchange.com/a/293988/330806


mission control took over the same commands as word jumping. thanks to rob cowrie and nicholas riley for the heads-up on that.


I added the following in my /etc/inputrc

# word jump on SHIFT left/right arrows
"\e[1;2D": backward-word
"\e[1;2C": forward-word

it works great


Following the steps listed in the above answers, I found that on my laptop the first bash (1.bash) will not be able to jump words by pressing option + arrow. Instead, it will simply type in "[D","[C". However, if I create a new bash window (2. bash), the word jump works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜