Attemp to work around SuperTabs <tab> claiming when installed in the home vim folder

This commit is contained in:
Holger Rapp 2009-07-27 09:51:09 +02:00
parent e5058084c3
commit cb458a0ce7
2 changed files with 33 additions and 16 deletions

14
after/UltiSnips_after.vim Normal file
View File

@ -0,0 +1,14 @@
" File: UltiSnips_after.vim
" Author: Holger Rapp <SirVer@gmx.de>
" Description: Called after everything else to reclaim keys (Needed for
" Supertab)
" Last Modified: July 27, 2009
if exists('did_UltiSnips_vim_after') || &cp || version < 700 || !exists("did_UltiSnips_vim") || !has("python")
finish
endif
call UltiSnips_MapKeys()
let did_UltiSnips_vim_after=1

View File

@ -56,6 +56,23 @@ function! UltiSnips_JumpForwards()
return "" return ""
endfunction endfunction
function! UltiSnips_MapKeys()
" Map the keys correctly
if g:UltiSnipsExpandTrigger == g:UltiSnipsJumpForwardTrigger
exec "inoremap " . g:UltiSnipsExpandTrigger . " <C-R>=UltiSnips_ExpandSnippetOrJump()<cr>"
exec "snoremap " . g:UltiSnipsExpandTrigger . " <Esc>:call UltiSnips_ExpandSnippetOrJump()<cr>"
else
exec "inoremap " . g:UltiSnipsExpandTrigger . " <C-R>=UltiSnips_ExpandSnippet()<cr>"
exec "snoremap " . g:UltiSnipsExpandTrigger . " <Esc>:call UltiSnips_ExpandSnippet()<cr>"
exec "inoremap " . g:UltiSnipsJumpForwardTrigger . " <C-R>=UltiSnips_JumpForwards()<cr>"
exec "snoremap " . g:UltiSnipsJumpForwardTrigger . " <Esc>:call UltiSnips_JumpForwards()<cr>"
endif
exec "inoremap " . g:UltiSnipsJumpBackwardTrigger . " <C-R>=UltiSnips_JumpBackwards()<cr>"
exec "snoremap " . g:UltiSnipsJumpBackwardTrigger . " <Esc>:call UltiSnips_JumpBackwards()<cr>"
" Do not remap this.
snoremap <BS> <Esc>:py UltiSnips_Manager.backspace_while_selected()<cr>
endf
" }}} " }}}
"" STARTUP CODE {{{ "" STARTUP CODE {{{
@ -77,24 +94,10 @@ UltiSnips_Manager.forward_trigger = vim.eval("g:UltiSnipsJumpForwardTrigger")
UltiSnips_Manager.backward_trigger = vim.eval("g:UltiSnipsJumpBackwardTrigger") UltiSnips_Manager.backward_trigger = vim.eval("g:UltiSnipsJumpBackwardTrigger")
EOF EOF
" Map the keys correctly
if g:UltiSnipsExpandTrigger == g:UltiSnipsJumpForwardTrigger
exec "inoremap " . g:UltiSnipsExpandTrigger . " <C-R>=UltiSnips_ExpandSnippetOrJump()<cr>"
exec "snoremap " . g:UltiSnipsExpandTrigger . " <Esc>:call UltiSnips_ExpandSnippetOrJump()<cr>"
else
exec "inoremap " . g:UltiSnipsExpandTrigger . " <C-R>=UltiSnips_ExpandSnippet()<cr>"
exec "snoremap " . g:UltiSnipsExpandTrigger . " <Esc>:call UltiSnips_ExpandSnippet()<cr>"
exec "inoremap " . g:UltiSnipsJumpForwardTrigger . " <C-R>=UltiSnips_JumpForwards()<cr>"
exec "snoremap " . g:UltiSnipsJumpForwardTrigger . " <Esc>:call UltiSnips_JumpForwards()<cr>"
endif
exec "inoremap " . g:UltiSnipsJumpBackwardTrigger . " <C-R>=UltiSnips_JumpBackwards()<cr>"
exec "snoremap " . g:UltiSnipsJumpBackwardTrigger . " <Esc>:call UltiSnips_JumpBackwards()<cr>"
" Do not remap this.
snoremap <BS> <Esc>:py UltiSnips_Manager.backspace_while_selected()<cr>
au CursorMovedI * py UltiSnips_Manager.cursor_moved() au CursorMovedI * py UltiSnips_Manager.cursor_moved()
au InsertEnter * py UltiSnips_Manager.entered_insert_mode() au InsertEnter * py UltiSnips_Manager.entered_insert_mode()
call UltiSnips_MapKeys()
let did_UltiSnips_vim=1 let did_UltiSnips_vim=1