Common User Access (CUA) cut, copy, and paste for Vim.
The default keybindings Vim provides for interacting with the system clipboard
are quite cumbersome: in normal mode, actions involving the clipboard must be
"+. In insert mode, Vim provides several keybindings, but these
all have problems:
<C-R>+ interprets control characters, so is unsafe;
<C-R><C-R>+ inserts linebreaks that don't exist in the original text; and
<C-R><C-P>+ can paste outside of surrounding quote marks.
Each of these is also cumbersome to type.
This plugin attempts to simplify access to the clipboard in the spirit of
mswin.vim, which is included (but not loaded) in stock Vim.
itself is not suitable because it goes beyond mappings that deal with the
clipboard, and also has its own problems with pasting.
- Clobber no more keybindings than
- Provide secure pasting, i.e. ASCII control sequences should not be interpreted
- Keep CUA keybindings
- If the user pastes when the cursor is between two quote marks, the pasted text is always inserted between the two quote marks
I think these desiderata are pretty "commonsense": gedit follows all of them.
In addition to following the desiderata listed above, this plugin offers the following:
Stripping of leading and trailing newlines. If text is copied in Vim using visual line mode and standard mappings (e.g.
V"+y), a trailing newline is included in the clipboard. I rarely want this, so this plugin strips these newlines, both when copying out of Vim and when pasting into Vim. If you want to disable this, add
let g:pasteurize_no_strip_newlines = 1to your vimrc.
Selective mappings. All mappings are provided using
<Plug>mappings. If you want to disable the provided mappings so you can map them on your own, just add
let g:pasteurize_no_mappings = 1to your vimrc.
The plugin works with the major plugin and runtime path managers.
With vim-plug, place in your vimrc:
cd ~/.vim/bundle && \ git clone https://github.com/riceissa/vim-pasteurize.git
Distributed under the same terms as Vim itself. See