X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=.vimrc;h=4b7fdf81137662374cecbae71c9456d9deda1816;hb=e092cba894b13330558549463d21a1efbe112d32;hp=e0b32985a97dc55725f81739576987702b045bec;hpb=8981f684bb6ea9c87a5fda20196cdccc3e13eb2e;p=dotfiles.git diff --git a/.vimrc b/.vimrc index e0b3298..4b7fdf8 100644 --- a/.vimrc +++ b/.vimrc @@ -262,6 +262,30 @@ else let &t_fs = "\007" endif endif + + " Automatically set paste mode in Vim when pasting in bracketed paste mode + " https://coderwall.com/p/if9mda/automatically-set-paste-mode-in-vim-when-pasting-in-insert-mode + function! WrapForTmux(s) + if !exists('$TMUX') + return a:s + endif + + let tmux_start = "\Ptmux;" + let tmux_end = "\\\" + + return tmux_start . substitute(a:s, "\", "\\", 'g') . tmux_end + endfunction + + let &t_SI .= WrapForTmux("\[?2004h") + let &t_EI .= WrapForTmux("\[?2004l") + + function! XTermPasteBegin() + set pastetoggle=[201~ + set paste + return "" + endfunction + + inoremap [200~ XTermPasteBegin() endif " Multiline comments often confuse vim syntax highlighting - these maps