History Report a problem
Article Edit this page Discussion

Make C-Left C-Right behave as in Windows

From Vim Tips Wiki

(Redirected from VimTip752)
Jump to: navigation, search
 

Tip 752Previous TipNext Tip

Created: June 21, 2004 Complexity: intermediate Author: niastarik Minimum version: 6.0 Karma: 4/8 Imported from: Tip#752


For quite a long time I was annoyed to not be able to use <C-Left> <C-Right> when selecting text in Vim. Actually thoses mappings were working but like the W and B keys instead of w and b. The following mappings correct this problem and make those bindings work like in Windows.

You may have to enable select-mode for this to work . I personnally source the $VIMRUNTIME/mswin.Vim script in my vimrc which make select mode behave like Windows. This script is available in the Windows distribution of Vim. On linux, you may simply put the following command in your vimrc: "behave mswin". This will make selection work like in Windows.

"Edit mapping (make cursor keys work like in Windows: <C-Left><C-Right>
"Move to next word.
nnoremap <C-Left> b
vnoremap <C-S-Left> b
nnoremap <C-S-Left> gh<C-O>b
inoremap <C-S-Left> <C-O>gh<C-O>b

nnoremap <C-Right> w
vnoremap <C-S-Right> w
nnoremap <C-S-Right> gh<C-O>w
inoremap <C-S-Right> <C-O>gh<C-O>w

[edit] References

[edit] Comments

If you want more complete simulation of Windows selection mode try:

set keymodel=startsel,stopsel

Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Terminator Wiki
Legend of Zelda Wiki
Flash Gordon
Everquest II Wiki
Yo-Yo Wiki
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Make C-Left C-Right behave as in Windows"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation