Skip to content

Instantly share code, notes, and snippets.

@anokun7
Last active May 6, 2016 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anokun7/fa5b464c2242adbf8c7d0e668ca4c733 to your computer and use it in GitHub Desktop.
Save anokun7/fa5b464c2242adbf8c7d0e668ca4c733 to your computer and use it in GitHub Desktop.
Key mappings for copy paste from Vim on Mac (Yosemite)

Add these key mappings in ~/.vimrc

vmap <C-x> :!pbcopy<CR>
nmap <C-a> ggVG:w !pbcopy<CR><CR>
vmap <C-c> :w !pbcopy<CR><CR>

In visual selection mode, hit Ctrl-c to copy selected text. (Command key will never work within Vim) In visual selection mode, hit Ctrl-x to cut selected text. Hit Ctrl-a to copy the entire file contents in vim.

Use regular keys (Command-v) to paste copied text somewhere else or back into Vim etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment