Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Im wondering if is there any way to go word by word using Ctrl + -> as in the rest of the editors.

share|improve this question
5  
Did you even try? –  romainl Jul 1 '13 at 20:11
4  
If your editor must do just like other editors, vim is not for you. The vim way to move forward one word is w from normal mode (back is b). This was stated in the answer by Amit. –  cforbish Jul 2 '13 at 3:18
add comment

migrated from stackoverflow.com Jul 2 '13 at 10:40

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 5 down vote accepted

Try using w for moving word by word. Wordwise motions are faster in vim. The w, b, e, and ge commands allow us to move forward or backward to the start or end of a word. see :help word in vim for more information.

Here's a link to an excellent answer on vim misuse:

http://stackoverflow.com/a/1737259/975114

share|improve this answer
add comment

After looking at this on multiple computers...

On Linux using Gnome Terminal this feature works right out of the box. (which is why romainl asks if you tried it)

On Mac OS 10.8 (Mountain Lion)

Control + Arrow Key gets caught by Mission Control and change spaces or move the screen around. To disable this go to System Preferences -> Keyboard -> Keyboard Shortcuts -> Mission Control and uncheck all the ones that have ctrl + arrow (Control is represented with a ^)

After this is done. Ctrl + Arrow works in iTerm2 with no fiddling in vim.

It however does not work immediately in vim in Terminal. For some reason control + arrow corresponds to delete till end of line. (Which seems to be the same behavior as in bash).

To fix this you need to change what Terminal sends as a character string when Control Left and Control Right are sent.

In Terminal go to Preferences -> Settings -> (Profile you are using) -> Keyboard

Edit control cursor left to be \033[1;5D and edit control cursor right to be \033[1;5D. (Note: \033 is entered by hitting ESC)

After these changes are made you should be able to use Control Left and Control Right to move forward or backwards words.

Also while Control Left and Control Right there are equivalent one letter commands to do the same in normal mode. (<C-Left> is Control + Left and <S-Left> is Shift + Left)

<C-Left>  == B    <S-Left>  == b
<C-Right> == W    <S-Right> == w

Take a look at :h b and :h w

(Note: <S-Left> and <S-Right> might not work in Termianl unless you change what Terminal sends)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.