Alexander Bird
Alexander Bird

Reputation: 40599

vim: disable mswin (turn off windows shortcut keys)

I just installed vim on Windows XP machine. When logged on to another user a little bit ago, I went to C:\program files\vim\_vimrc and commented out the following lines

"source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin

and then Ctrl-X didn't cut text -- which is good.

However, when I logged in as administrator on the computer and run vim, Ctrl-X went back to cutting text :(. I even renamed C:\program files\vim\vim72\mswin.vim to C:\program files\vim\vim72\mswin.nouse.vim and the silly Windows shortcuts are still in effect.

Where can I fix this? can I put behave nomswin in my ~/.vimrc file to undo those shortcuts?

EDIT: Even logging in as original user now vim uses windows shortcuts.

EDIT: fixed typo in pathname

EDIT: The following are VIM and VIMRUNTIME

echo %VIM% C:\Program Files\Vim

echo %VIMRUNTIME% C:\Program Files\Vim\vim72

Upvotes: 3

Views: 4620

Answers (3)

George Sovetov
George Sovetov

Reputation: 5218

Windows Terminal

It catches and handles Ctrl+V and similar key combinations before they get to Vim.

Go to Settings,
then Actions and
remove Ctrl+C from Copy text
and Ctrl+V from Paste.
Click Save.

Upvotes: 3

chutz
chutz

Reputation: 2576

For what it's worth, reading the :version output and chasing the config files, mswin.win on Vim 8.2 starts with:

if exists("g:skip_loading_mswin") && g:skip_loading_mswin
  finish
endif

Thus, I added

let g:skip_loading_mswin=1

to ~/_vimrc and problem solved.

Upvotes: 2

Luc Hermitte
Luc Hermitte

Reputation: 32926

Your vim installation is really odd when I look at the pathnames you gave.

The usual paths are: $VIM = C:\Program Files\vim and $VIMRUNTIME=C:\Program Files\vim\vim{versionnumber}. (I set neither of these variable)

The default vimrc are $VIM/vimrc and $VIMRC/_vimrc (which I delete both/don't install), and each user is meant to have its own $HOME/_vimrc (not $HOME/.vimrc) (see :version)

PS: In case you have installed vim several times (vim 7.1, vim 7.2, cygwin-vim, ...) you may have to check the value of $VIM and $VIMRUNTIME to know what you are really executing.

Upvotes: 3

Related Questions