13

Many machines i need to work with have basic NIX installation with vim as text editor. But vim's way to select text is kind of unusual to me :). Is it any easy way to re-configure vim so it will use shift in order to select text and ctrl+c / ctrl+v for copy and paste?

15

Add the following lines to your _vimrc or .vimrc

source $VIMRUNTIME/mswin.vim
behave mswin

But beware, visual mode is then CTRL-Q instead of CTRL-V.

For an overview what mswin.vim does see the mswin.vim sourcode. It is commented very well and if some command is unclear you can easily look it up in vim's help.

Here is a quick overview compile from the source:

  • backspace and cursor keys wrap to previous/next line
  • CTRL-X and SHIFT-Del are Cut
  • CTRL-C and CTRL-Insert are Copy
  • CTRL-V and SHIFT-Insert are Paste
  • Use CTRL-Q to do what CTRL-V used to do
  • Use CTRL-S for saving, also in Insert mode
  • CTRL-Z is Undo; not in cmdline though
  • CTRL-Y is Redo (although not repeat); not in cmdline though
  • Alt-Space is System menu
  • CTRL-A is Select all
  • CTRL-Tab is Next window
  • CTRL-F4 is Close window
5
  • What else this option reconfigures? – Kazimieras Aliulis Jun 18 '09 at 10:31
  • Thanks, that partially works. But on some platforms ctrl+v still don't insert - it just draws a blue '^' O_O. – grigoryvp Jun 18 '09 at 10:57
  • @softly.lt: Added to the answer. – Ludwig Weinzierl Jun 18 '09 at 11:24
  • @Eye of Hell: This is the expected behaviour if mswin.vim is not active, but it's difficult to say why without further information. – Ludwig Weinzierl Jun 18 '09 at 11:26
  • The source link is broken; here's where I found it: github.com/vim/vim/blob/master/runtime/mswin.vim . Hopefully the same file. – BiGYaN Jul 26 '16 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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