lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
Cutting, Copying, and Pasting in Vim
Got a new laptop a couple weeks ago and finally jumped in the deep-end of the Linux pool. Probably the most painful part of the transition has been abandoning my reliable old html-kit editor and trying to find a new one. After a few dead-ends, I finally bit the bullet and committed to Vim (gVim to be exact). For the first few hours, I was ready to cry. But after doing some research on key-mappings, I'm starting to get the hang of it.

The biggest frustration was trying to break my Pavlovian conditioning to use Ctrl-X,-C,-V. Of course, once I figured out mapping, I could remap the keys. It is not recommended to remap Ctrl-C, so I compromised and use y like you're supposed to.

Here's the relevant portion of my .gvimrc file:

" --- KEY MAPPINGS --- "
" Visual Cut/Copy/Paste : http://www.vim.org/tips/tip.php?tip_id=866
" Cut -- using register '+' [Ctrl-o -> jump to last pos]
map "+d
vmap "+d
imap "+d
" Copy -- yank to register '+' [not needed for imode]
noremap y "+y
vnoremap y "+y
" Copy All
imap gggHG
vmap gggHGi
" Select Line
map 0v$
vmap 0v$
imap 0v$
" Paste
map "+gP
vmap "+gP
imap "+gP


Still miss html-kit, but I'm adapting.

Labels: