Created
March 3, 2013 19:34
-
-
Save BugRoger/5077869 to your computer and use it in GitHub Desktop.
Make console Vim play nice with iTerm2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
set clipboard=unnamed | |
if has('mouse') | |
set mouse=a | |
if exists('$ITERM_PROFILE') | |
autocmd VimEnter * set ttymouse=xterm2 | |
autocmd FocusGained * set ttymouse=xterm2 | |
autocmd BufEnter * set ttymouse=xterm2 | |
endif | |
endif | |
if exists('$ITERM_PROFILE') | |
let &t_ti = &t_ti . "\e[?2004h" | |
let &t_te = "\e[?2004l" . &t_te | |
function XTermPasteBegin(ret) | |
set pastetoggle=<Esc>[201~ | |
set paste | |
return a:ret | |
endfunction | |
map <expr> <Esc>[200~ XTermPasteBegin("i") | |
imap <expr> <Esc>[200~ XTermPasteBegin("") | |
vmap <expr> <Esc>[200~ XTermPasteBegin("c") | |
cmap <Esc>[200~ <nop> | |
cmap <Esc>[201~ <nop> | |
endif | |
if exists('$ITERM_PROFILE') | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment