" 20 the swap file
+let myUndoDir = expand('~/tmp/vim/undo')
+if !isdirectory(myUndoDir)
+ " Create dirs
+ call mkdir(myUndoDir, 'p')
+endif
+
" list of directories for the swap file; remove . (the current directory)
if has("win32")
- set directory=$TEMP//,c:/tmp//,c:/temp//
+ set directory=~/tmp/vim//,$TEMP//,c:/tmp//,c:/temp//
else
set directory=~/tmp/vim//,~/tmp//,/var/tmp//,/tmp//
endif
" Keep undo history across sessions by storing it in a file
if has('persistent_undo')
- let myUndoDir = expand('$HOME/tmp/vim/undo')
- " Create dirs
- call system('mkdir -p ' . myUndoDir)
let &undodir = myUndoDir
set undofile
endif
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 = "\<Esc>Ptmux;"
+ let tmux_end = "\<Esc>\\"
+
+ return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
+ endfunction
+
+ let &t_SI .= WrapForTmux("\<Esc>[?2004h")
+ let &t_EI .= WrapForTmux("\<Esc>[?2004l")
+
+ function! XTermPasteBegin()
+ set pastetoggle=<Esc>[201~
+ set paste
+ return ""
+ endfunction
+
+ inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
endif
" Multiline comments often confuse vim syntax highlighting - these maps