]> git.phdru.name Git - dotfiles.git/blobdiff - .vimrc
.vimrc: Restore `WrapForTmux`
[dotfiles.git] / .vimrc
diff --git a/.vimrc b/.vimrc
index 849d8acd34511f7a10604cfca00b14f8f13e12d6..41d0e220f5ca14682d5a2dd2ba6607e788f70c9d 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -297,6 +297,31 @@ else
    vmap <expr> <f28> XTermPasteBegin("c")
    cmap <f28> <nop>
    cmap <f29> <nop>
+
+   "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
+
+   " https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes
+   let &t_EI.=WrapForTmux("\e[2 q") "EI = NORMAL mode (ELSE)
+   let &t_SI.=WrapForTmux("\e[6 q") "SI = INSERT mode
+   let &t_SR.=WrapForTmux("\e[4 q") "SR = REPLACE mode
+
+   "Cursor settings:
+   "  1 -> blinking block
+   "  2 -> solid block 
+   "  3 -> blinking underscore
+   "  4 -> solid underscore
+   "  5 -> blinking vertical bar
+   "  6 -> solid vertical bar
 endif
 
 " Multiline comments often confuse vim syntax highlighting - these maps