Skip to content

Instantly share code, notes, and snippets.

@soulshake
Created June 8, 2015 01:33
Show Gist options
  • Save soulshake/5f37713e470cb53a6fab to your computer and use it in GitHub Desktop.
Save soulshake/5f37713e470cb53a6fab to your computer and use it in GitHub Desktop.
toggle paste mode automatically in vim
" never do this again --> :set paste <ctrl-v> :set no paste
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
" hat tip https://coderwall.com/p/if9mda/automatically-set-paste-mode-in-vim-when-pasting-in-insert-mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment