diff --git a/after/UltiSnips_after.vim b/after/UltiSnips_after.vim new file mode 100644 index 0000000..df6ef75 --- /dev/null +++ b/after/UltiSnips_after.vim @@ -0,0 +1,14 @@ +" File: UltiSnips_after.vim +" Author: Holger Rapp +" 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 + diff --git a/plugin/UltiSnips.vim b/plugin/UltiSnips.vim index af8001e..d7032fb 100644 --- a/plugin/UltiSnips.vim +++ b/plugin/UltiSnips.vim @@ -56,6 +56,23 @@ function! UltiSnips_JumpForwards() return "" endfunction +function! UltiSnips_MapKeys() + " Map the keys correctly + if g:UltiSnipsExpandTrigger == g:UltiSnipsJumpForwardTrigger + exec "inoremap " . g:UltiSnipsExpandTrigger . " =UltiSnips_ExpandSnippetOrJump()" + exec "snoremap " . g:UltiSnipsExpandTrigger . " :call UltiSnips_ExpandSnippetOrJump()" + else + exec "inoremap " . g:UltiSnipsExpandTrigger . " =UltiSnips_ExpandSnippet()" + exec "snoremap " . g:UltiSnipsExpandTrigger . " :call UltiSnips_ExpandSnippet()" + exec "inoremap " . g:UltiSnipsJumpForwardTrigger . " =UltiSnips_JumpForwards()" + exec "snoremap " . g:UltiSnipsJumpForwardTrigger . " :call UltiSnips_JumpForwards()" + endif + exec "inoremap " . g:UltiSnipsJumpBackwardTrigger . " =UltiSnips_JumpBackwards()" + exec "snoremap " . g:UltiSnipsJumpBackwardTrigger . " :call UltiSnips_JumpBackwards()" + + " Do not remap this. + snoremap :py UltiSnips_Manager.backspace_while_selected() +endf " }}} "" STARTUP CODE {{{ @@ -77,24 +94,10 @@ UltiSnips_Manager.forward_trigger = vim.eval("g:UltiSnipsJumpForwardTrigger") UltiSnips_Manager.backward_trigger = vim.eval("g:UltiSnipsJumpBackwardTrigger") EOF -" Map the keys correctly -if g:UltiSnipsExpandTrigger == g:UltiSnipsJumpForwardTrigger - exec "inoremap " . g:UltiSnipsExpandTrigger . " =UltiSnips_ExpandSnippetOrJump()" - exec "snoremap " . g:UltiSnipsExpandTrigger . " :call UltiSnips_ExpandSnippetOrJump()" -else - exec "inoremap " . g:UltiSnipsExpandTrigger . " =UltiSnips_ExpandSnippet()" - exec "snoremap " . g:UltiSnipsExpandTrigger . " :call UltiSnips_ExpandSnippet()" - exec "inoremap " . g:UltiSnipsJumpForwardTrigger . " =UltiSnips_JumpForwards()" - exec "snoremap " . g:UltiSnipsJumpForwardTrigger . " :call UltiSnips_JumpForwards()" -endif -exec "inoremap " . g:UltiSnipsJumpBackwardTrigger . " =UltiSnips_JumpBackwards()" -exec "snoremap " . g:UltiSnipsJumpBackwardTrigger . " :call UltiSnips_JumpBackwards()" - -" Do not remap this. -snoremap :py UltiSnips_Manager.backspace_while_selected() - au CursorMovedI * py UltiSnips_Manager.cursor_moved() au InsertEnter * py UltiSnips_Manager.entered_insert_mode() + +call UltiSnips_MapKeys() let did_UltiSnips_vim=1