Add the following lines to your _vimrc or .vimrc
- 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 compiled 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
we put following in .gvimrc to show Ctrl-V besides Paste in the menu:
- If you want Cut/Copy/Paste to work using the “standard” hotkeys, but you don’t want to change any of the other configuration options in gvim, try do add the following to ~/.vimrc.
- Paste only works in Visual and insert mode, so you don’t have to worry about the conflict with Ctrl-V and blockwise Visual Mode.
- This isn’t a problem, because Copy and Cut put you into insert mode, so you can immediately paste afterwards. If you try it out you’ll find that it feels completely natural.
gVim
- If you use gVim, you can get copy-on-select behaviour when using :set guioptions+=a.
- This is enabled by default on X11 systems (copies to PRIMARY), but not on MS Windows & OSX (as selecting any text would override your clipboard).
No +clipboard
- Vim requires the +clipboard feature flag for any of this to work; you can check if your Vim has this by using :echo has(‘clipboard’) from within Vim (if the output is 0, it not present, if it’s 1, it is), or checking the output of vim –version.
Most Linux distributions ship with a “minimal” Vim build by default, which doesn’t have +clipboard, but you can usually install it:
- Debian & Ubuntu: Install vim-gtk or vim-gnome.
- Fedora: install vim-X11, and run vimx instead of vim (more info).
- Arch Linux: install gvim (this will enable +clipboard for normal vim as well).
You could also use xclip, xcopy, or xsel to copy text to the clipboard.