Quantcast
Channel: How can I make Vim paste from (and copy to) the system's clipboard? - Stack Overflow
Viewing all articles
Browse latest Browse all 39

Answer by ericbn for How can I make Vim paste from (and copy to) the system's clipboard?

$
0
0

Based on @lis2 answer, I use a simpler configuration that will not force Insert mode at the end:

" Copy and pasteif has('clipboard') && !has('gui_running')  vnoremap <C-c> "+y  vnoremap <C-x> "+d  vnoremap <C-v> "+p  inoremap <C-v> <C-r><C-o>+endif

Mind that all these override default Vim mappings:

  • v_CTRL-C: stop Visual mode
  • v_CTRL-X: subtract [count] from number
  • v_CTRL-V: blockwise Visual mode
  • i_CTRL-V: insert next non-digit literally, which is also mapped to i_CTRL-Q

As an alternative, one can use keys inspired in the "yank", "delete" and "put" Vim verbs: <C-y>, <C-d> and <C-p> respectively. These would only override one default mapping:

  • i_CTRL-P: backwards search keyword for completion

Viewing all articles
Browse latest Browse all 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>