diff options
| author | Teddy Wing | 2014-05-24 20:58:15 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2014-05-24 21:11:28 -0400 | 
| commit | 2a47d76e47119095e523b9946df423575793acd1 (patch) | |
| tree | a80a2268b9e9efc827b2481f4aef9cec12a2cc04 | |
| parent | 1ea665202290ecac6738e4134396b2509da4f5e2 (diff) | |
| download | dotvim-2a47d76e47119095e523b9946df423575793acd1.tar.bz2 | |
Add tpope's paste helper from unimpaired.vim
Copy of Tim Pope's paste helper. I didn't want the full unimpaired.vim
but this functionality is really useful, so including it here in a
separate plugin.
| -rw-r--r-- | plugin/unimpaired_paste.vim | 35 | 
1 files changed, 35 insertions, 0 deletions
| diff --git a/plugin/unimpaired_paste.vim b/plugin/unimpaired_paste.vim new file mode 100644 index 0000000..5a1a3ef --- /dev/null +++ b/plugin/unimpaired_paste.vim @@ -0,0 +1,35 @@ +" Unimpaired Paste +" Paste helper copied from Tim Pope's unimpaired.vim +" Copied directly from " +" https://github.com/tpope/vim-unimpaired/blob/235be4ce59d3392b7f476814bb0d39de6c91bf2c/plugin/unimpaired.vim#L233-L254 +" +" I didn't want the full Unimpaired plugin, so just copying this part for now  +" because it's something I've wanted for a while. +" +" Note that this file should not be considered to have the same license as the  +" rest of the repo. As the code was copied wholesale from unimpaired.vim, this  +" file retains the license from the plugin as of 2014.05.24, namely the Vim  +" license. + +function! s:setup_paste() abort +  let s:paste = &paste +  let s:mouse = &mouse +  set paste +  set mouse= +endfunction + +nnoremap <silent> <Plug>unimpairedPaste :call <SID>setup_paste()<CR> + +nnoremap <silent> yo  :call <SID>setup_paste()<CR>o +nnoremap <silent> yO  :call <SID>setup_paste()<CR>O + +augroup unimpaired_paste +  autocmd! +  autocmd InsertLeave * +        \ if exists('s:paste') | +        \   let &paste = s:paste | +        \   let &mouse = s:mouse | +        \   unlet s:paste | +        \   unlet s:mouse | +        \ endif +augroup END | 
