Delete more variables on exit
This commit is contained in:
parent
bb999c6e34
commit
fc18301af4
1 changed files with 55 additions and 51 deletions
12
c4ctrl.vim
12
c4ctrl.vim
|
@ -12,7 +12,6 @@ if exists("g:loaded_c4ctrl")
|
||||||
endif
|
endif
|
||||||
let g:loaded_c4ctrl = 1
|
let g:loaded_c4ctrl = 1
|
||||||
|
|
||||||
let s:Name = "C4ctrl"
|
|
||||||
|
|
||||||
function s:FindConfigDir()
|
function s:FindConfigDir()
|
||||||
" Run only once
|
" Run only once
|
||||||
|
@ -154,11 +153,13 @@ endfunction
|
||||||
|
|
||||||
" Custom command line completion
|
" Custom command line completion
|
||||||
function s:C4ctrlCompletion(ArgLead, CmdLine, CursorPos)
|
function s:C4ctrlCompletion(ArgLead, CmdLine, CursorPos)
|
||||||
|
let s:Name = "C4ctrl"
|
||||||
" A list of current cmd line arguments excluding leading commands like
|
" A list of current cmd line arguments excluding leading commands like
|
||||||
" :vertical etc.
|
" :vertical etc.
|
||||||
let s:relCmdLine = split(a:CmdLine)
|
let s:relCmdLine = split(a:CmdLine)
|
||||||
let s:relCmdLine = s:relCmdLine[index(s:relCmdLine, s:Name):]
|
let s:relCmdLine = s:relCmdLine[index(s:relCmdLine, s:Name):]
|
||||||
|
|
||||||
|
try " Just for the clean up in the finally statement
|
||||||
if stridx("open", get(s:relCmdLine, 1)) == 0
|
if stridx("open", get(s:relCmdLine, 1)) == 0
|
||||||
if a:ArgLead != ""
|
if a:ArgLead != ""
|
||||||
return "open"
|
return "open"
|
||||||
|
@ -205,14 +206,17 @@ function s:C4ctrlCompletion(ArgLead, CmdLine, CursorPos)
|
||||||
return join(map(glob(s:cfgdir."*", 0, 1), "fnamemodify(v:val, ':t')"), "\n")
|
return join(map(glob(s:cfgdir."*", 0, 1), "fnamemodify(v:val, ':t')"), "\n")
|
||||||
|
|
||||||
elseif get(s:relCmdLine, -1) == s:Name
|
elseif get(s:relCmdLine, -1) == s:Name
|
||||||
unlet s:relCmdLine
|
|
||||||
return "get\nopen\nset\ntext\nwrite"
|
return "get\nopen\nset\ntext\nwrite"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
finally
|
||||||
|
unlet! s:relCmdLine s:Name s:cfgdir
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if !exists(":".s:Name)
|
if !exists(":C4ctrl")
|
||||||
execute "command -nargs=+ -complete=custom,s:C4ctrlCompletion" s:Name "call C4ctrl(<f-args>)"
|
command -nargs=+ -complete=custom,s:C4ctrlCompletion C4ctrl call C4ctrl(<f-args>)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue