use consistent spacing in vim file

This commit is contained in:
rygwdn@gmail.com 2011-04-27 12:37:07 -03:00
parent a63c3f9a18
commit dbeecdbe24

View File

@ -17,46 +17,46 @@ endif
" The trigger used to expand a snippet. " The trigger used to expand a snippet.
" NOTE: expansion and forward jumping can, but needn't be the same trigger " NOTE: expansion and forward jumping can, but needn't be the same trigger
if !exists("g:UltiSnipsExpandTrigger") if !exists("g:UltiSnipsExpandTrigger")
let g:UltiSnipsExpandTrigger = "<tab>" let g:UltiSnipsExpandTrigger = "<tab>"
endif endif
" The trigger used to display all triggers that could possible " The trigger used to display all triggers that could possible
" match in the current position. " match in the current position.
if !exists("g:UltiSnipsListSnippets") if !exists("g:UltiSnipsListSnippets")
let g:UltiSnipsListSnippets = "<c-tab>" let g:UltiSnipsListSnippets = "<c-tab>"
endif endif
" The trigger used to jump forward to the next placeholder. " The trigger used to jump forward to the next placeholder.
" NOTE: expansion and forward jumping can, but needn't be the same trigger " NOTE: expansion and forward jumping can, but needn't be the same trigger
if !exists("g:UltiSnipsJumpForwardTrigger") if !exists("g:UltiSnipsJumpForwardTrigger")
let g:UltiSnipsJumpForwardTrigger = "<c-j>" let g:UltiSnipsJumpForwardTrigger = "<c-j>"
endif endif
" The trigger to jump backward inside a snippet " The trigger to jump backward inside a snippet
if !exists("g:UltiSnipsJumpBackwardTrigger") if !exists("g:UltiSnipsJumpBackwardTrigger")
let g:UltiSnipsJumpBackwardTrigger = "<c-k>" let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
endif endif
" Should UltiSnips unmap select mode mappings automagically? " Should UltiSnips unmap select mode mappings automagically?
if !exists("g:UltiSnipsRemoveSelectModeMappings") if !exists("g:UltiSnipsRemoveSelectModeMappings")
let g:UltiSnipsRemoveSelectModeMappings = 1 let g:UltiSnipsRemoveSelectModeMappings = 1
end end
" If UltiSnips should remove Mappings, which should be ignored " If UltiSnips should remove Mappings, which should be ignored
if !exists("g:UltiSnipsMappingsToIgnore") if !exists("g:UltiSnipsMappingsToIgnore")
let g:UltiSnipsMappingsToIgnore = [] let g:UltiSnipsMappingsToIgnore = []
endif endif
" UltiSnipsEdit will use this variable to decide if a new window " UltiSnipsEdit will use this variable to decide if a new window
" is opened when editing. default is "normal", allowed are also " is opened when editing. default is "normal", allowed are also
" "vertical", "horizontal" " "vertical", "horizontal"
if !exists("g:UltiSnipsEditSplit") if !exists("g:UltiSnipsEditSplit")
let g:UltiSnipsEditSplit = 'normal' let g:UltiSnipsEditSplit = 'normal'
endif endif
" A list of directory names that are searched for snippets. " A list of directory names that are searched for snippets.
if !exists("g:UltiSnipsSnippetDirectories") if !exists("g:UltiSnipsSnippetDirectories")
let g:UltiSnipsSnippetDirectories = [ "UltiSnips" ] let g:UltiSnipsSnippetDirectories = [ "UltiSnips" ]
endif endif
" }}} " }}}
@ -66,35 +66,35 @@ endif
command! -nargs=0 UltiSnipsReset :py UltiSnips_Manager.reset() command! -nargs=0 UltiSnipsReset :py UltiSnips_Manager.reset()
function! UltiSnipsEdit(...) function! UltiSnipsEdit(...)
if a:0 == 1 && a:1 != '' if a:0 == 1 && a:1 != ''
let type = a:1 let type = a:1
elseif &filetype != '' elseif &filetype != ''
let type = split(&filetype, '\.')[0] let type = split(&filetype, '\.')[0]
else else
let type = 'all' let type = 'all'
endif endif
if exists('g:UltiSnipsSnippetsDir') if exists('g:UltiSnipsSnippetsDir')
let mode = 'e' let mode = 'e'
if exists('g:UltiSnipsEditSplit') if exists('g:UltiSnipsEditSplit')
if g:UltiSnipsEditSplit == 'vertical' if g:UltiSnipsEditSplit == 'vertical'
let mode = 'vs' let mode = 'vs'
elseif g:UltiSnipsEditSplit == 'horizontal' elseif g:UltiSnipsEditSplit == 'horizontal'
let mode = 'sp' let mode = 'sp'
endif endif
endif endif
exe ':'.mode.' '.g:UltiSnipsSnippetsDir.'/'.type.'.snippets' exe ':'.mode.' '.g:UltiSnipsSnippetsDir.'/'.type.'.snippets'
else else
for dir in g:UltiSnipsSnippetDirectories for dir in g:UltiSnipsSnippetDirectories
for p in reverse(split(&runtimepath, ',')) for p in reverse(split(&runtimepath, ','))
if isdirectory(p.'/'.dir) if isdirectory(p.'/'.dir)
let g:UltiSnipsSnippetsDir = p.'/'.dir let g:UltiSnipsSnippetsDir = p.'/'.dir
call UltiSnipsEdit(type) call UltiSnipsEdit(type)
break break
endif endif
endfor endfor
endfor endfor
endif endif
endfunction endfunction
" edit snippets, default of current file type or the specified type " edit snippets, default of current file type or the specified type
@ -104,46 +104,46 @@ command! -nargs=? UltiSnipsEdit :call UltiSnipsEdit(<q-args>)
"" FUNCTIONS {{{ "" FUNCTIONS {{{
function! CompensateForPUM() function! CompensateForPUM()
""" The CursorMovedI event is not triggered while the popup-menu is visible, """ The CursorMovedI event is not triggered while the popup-menu is visible,
""" and it's by this event that UltiSnips updates its vim-state. The fix is """ and it's by this event that UltiSnips updates its vim-state. The fix is
""" to explicitly check for the presence of the popup menu, and update """ to explicitly check for the presence of the popup menu, and update
""" the vim-state accordingly. """ the vim-state accordingly.
if pumvisible() if pumvisible()
py UltiSnips_Manager.cursor_moved() py UltiSnips_Manager.cursor_moved()
endif endif
endfunction endfunction
function! UltiSnips_ExpandSnippet() function! UltiSnips_ExpandSnippet()
py UltiSnips_Manager.expand() py UltiSnips_Manager.expand()
return "" return ""
endfunction endfunction
function! UltiSnips_ExpandSnippetOrJump() function! UltiSnips_ExpandSnippetOrJump()
call CompensateForPUM() call CompensateForPUM()
py UltiSnips_Manager.expand_or_jump() py UltiSnips_Manager.expand_or_jump()
return "" return ""
endfunction endfunction
function! UltiSnips_ListSnippets() function! UltiSnips_ListSnippets()
py UltiSnips_Manager.list_snippets() py UltiSnips_Manager.list_snippets()
return "" return ""
endfunction endfunction
function! UltiSnips_JumpBackwards() function! UltiSnips_JumpBackwards()
call CompensateForPUM() call CompensateForPUM()
py UltiSnips_Manager.jump_backwards() py UltiSnips_Manager.jump_backwards()
return "" return ""
endfunction endfunction
function! UltiSnips_JumpForwards() function! UltiSnips_JumpForwards()
call CompensateForPUM() call CompensateForPUM()
py UltiSnips_Manager.jump_forwards() py UltiSnips_Manager.jump_forwards()
return "" return ""
endfunction endfunction
function! UltiSnips_AddSnippet(trigger, value, descr, options, ...) function! UltiSnips_AddSnippet(trigger, value, descr, options, ...)
" Takes the same arguments as SnippetManager.add_snippet: " Takes the same arguments as SnippetManager.add_snippet:
" (trigger, value, descr, options, ft = "all", globals = None) " (trigger, value, descr, options, ft = "all", globals = None)
py << EOB py << EOB
args = vim.eval("a:000") args = vim.eval("a:000")
trigger = vim.eval("a:trigger") trigger = vim.eval("a:trigger")
@ -153,38 +153,38 @@ options = vim.eval("a:options")
UltiSnips_Manager.add_snippet(trigger, value, descr, options, *args) UltiSnips_Manager.add_snippet(trigger, value, descr, options, *args)
EOB EOB
return "" return ""
endfunction endfunction
function! UltiSnips_Anon(value, ...) function! UltiSnips_Anon(value, ...)
" Takes the same arguments as SnippetManager.expand_anon: " Takes the same arguments as SnippetManager.expand_anon:
" (value, trigger="", descr="", options="", globals = None) " (value, trigger="", descr="", options="", globals = None)
py << EOB py << EOB
args = vim.eval("a:000") args = vim.eval("a:000")
value = vim.eval("a:value") value = vim.eval("a:value")
UltiSnips_Manager.expand_anon(value, *args) UltiSnips_Manager.expand_anon(value, *args)
EOB EOB
return "" return ""
endfunction endfunction
function! UltiSnips_MapKeys() function! UltiSnips_MapKeys()
" Map the keys correctly " Map the keys correctly
if g:UltiSnipsExpandTrigger == g:UltiSnipsJumpForwardTrigger if g:UltiSnipsExpandTrigger == g:UltiSnipsJumpForwardTrigger
exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=UltiSnips_ExpandSnippetOrJump()<cr>" exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=UltiSnips_ExpandSnippetOrJump()<cr>"
exec "snoremap <silent> " . g:UltiSnipsExpandTrigger . " <Esc>:call UltiSnips_ExpandSnippetOrJump()<cr>" exec "snoremap <silent> " . g:UltiSnipsExpandTrigger . " <Esc>:call UltiSnips_ExpandSnippetOrJump()<cr>"
else else
exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=UltiSnips_ExpandSnippet()<cr>" exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=UltiSnips_ExpandSnippet()<cr>"
exec "snoremap <silent> " . g:UltiSnipsExpandTrigger . " <Esc>:call UltiSnips_ExpandSnippet()<cr>" exec "snoremap <silent> " . g:UltiSnipsExpandTrigger . " <Esc>:call UltiSnips_ExpandSnippet()<cr>"
exec "inoremap <silent> " . g:UltiSnipsJumpForwardTrigger . " <C-R>=UltiSnips_JumpForwards()<cr>" exec "inoremap <silent> " . g:UltiSnipsJumpForwardTrigger . " <C-R>=UltiSnips_JumpForwards()<cr>"
exec "snoremap <silent> " . g:UltiSnipsJumpForwardTrigger . " <Esc>:call UltiSnips_JumpForwards()<cr>" exec "snoremap <silent> " . g:UltiSnipsJumpForwardTrigger . " <Esc>:call UltiSnips_JumpForwards()<cr>"
endif endif
exec "inoremap <silent> " . g:UltiSnipsJumpBackwardTrigger . " <C-R>=UltiSnips_JumpBackwards()<cr>" exec "inoremap <silent> " . g:UltiSnipsJumpBackwardTrigger . " <C-R>=UltiSnips_JumpBackwards()<cr>"
exec "snoremap <silent> " . g:UltiSnipsJumpBackwardTrigger . " <Esc>:call UltiSnips_JumpBackwards()<cr>" exec "snoremap <silent> " . g:UltiSnipsJumpBackwardTrigger . " <Esc>:call UltiSnips_JumpBackwards()<cr>"
exec "inoremap <silent> " . g:UltiSnipsListSnippets . " <C-R>=UltiSnips_ListSnippets()<cr>" exec "inoremap <silent> " . g:UltiSnipsListSnippets . " <C-R>=UltiSnips_ListSnippets()<cr>"
exec "snoremap <silent> " . g:UltiSnipsListSnippets . " <Esc>:call UltiSnips_ListSnippets()<cr>" exec "snoremap <silent> " . g:UltiSnipsListSnippets . " <Esc>:call UltiSnips_ListSnippets()<cr>"
" Do not remap this. " Do not remap this.
snoremap <silent> <BS> <Esc>:py UltiSnips_Manager.backspace_while_selected()<cr> snoremap <silent> <BS> <Esc>:py UltiSnips_Manager.backspace_while_selected()<cr>
endf endf
" }}} " }}}
@ -207,7 +207,8 @@ 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() call UltiSnips_MapKeys()
let did_UltiSnips_vim=1 let did_UltiSnips_vim=1
" }}} " }}}
" vim: ts=8 sts=4 sw=4