3

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

1
  • Note: mswin.vim explicitly remaps <C-[XCV]>, so if you've already loaded the default Windows .vimrc, you (unfortunately) can't turn off the Windows-y settings with a simple behave xterm; instead, you must explicitly unmap the offending mappings. (This is a comment instead of an answer since it doesn't seem to address your particular question, which is how to avoid loading the offending .vimrc file in the first place.) Commented Dec 29, 2014 at 22:41

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

oops, those pathnames were a typo. I just fixed them.
3

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.

Comments

2

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.

1 Comment

Was thinking about why it doesn't work for me now. Found this answer and then, having searched with another query, found my own question with a similar answer vi.stackexchange.com/a/16714/10514 . Yours is certainly more elaborate. But in my case, the problem was in another place...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.