Overwrite exported command and function, used endfunction instead of endfunc
This commit is contained in:
parent
15aa4bf864
commit
7c6d4779f6
2 changed files with 10 additions and 10 deletions
|
@ -4,18 +4,18 @@ function s:invert_dict(source_dict)
|
||||||
let result[value] = key
|
let result[value] = key
|
||||||
endfor
|
endfor
|
||||||
return result
|
return result
|
||||||
endfunc
|
endfunction
|
||||||
|
|
||||||
let s:extensions = g:splitopen_extensions
|
let s:extensions = g:splitopen_extensions
|
||||||
let s:extensions_rev = s:invert_dict(s:extensions)
|
let s:extensions_rev = s:invert_dict(s:extensions)
|
||||||
|
|
||||||
function s:isLeftSideExtension(extension)
|
function s:isLeftSideExtension(extension)
|
||||||
return has_key(s:extensions, a:extension)
|
return has_key(s:extensions, a:extension)
|
||||||
endfunc
|
endfunction
|
||||||
|
|
||||||
function s:isRightSideExtension(extension)
|
function s:isRightSideExtension(extension)
|
||||||
return has_key(s:extensions_rev, a:extension)
|
return has_key(s:extensions_rev, a:extension)
|
||||||
endfunc
|
endfunction
|
||||||
|
|
||||||
function s:getFileExtension(filename)
|
function s:getFileExtension(filename)
|
||||||
return fnamemodify(a:filename, ":e")
|
return fnamemodify(a:filename, ":e")
|
||||||
|
@ -23,7 +23,7 @@ endfunction
|
||||||
|
|
||||||
function s:getFileRoot(filename)
|
function s:getFileRoot(filename)
|
||||||
return fnamemodify(a:filename, ":r")
|
return fnamemodify(a:filename, ":r")
|
||||||
endfunc
|
endfunction
|
||||||
|
|
||||||
function s:getSwitchExtension(filename)
|
function s:getSwitchExtension(filename)
|
||||||
let extension = s:getFileExtension(a:filename)
|
let extension = s:getFileExtension(a:filename)
|
||||||
|
@ -32,24 +32,24 @@ function s:getSwitchExtension(filename)
|
||||||
elseif s:isRightSideExtension(extension)
|
elseif s:isRightSideExtension(extension)
|
||||||
return s:extensions_rev[extension]
|
return s:extensions_rev[extension]
|
||||||
endif
|
endif
|
||||||
endfunc
|
endfunction
|
||||||
|
|
||||||
function s:getSwitchFile(filename)
|
function s:getSwitchFile(filename)
|
||||||
return s:getFileRoot(a:filename) . "." . s:getSwitchExtension(a:filename)
|
return s:getFileRoot(a:filename) . "." . s:getSwitchExtension(a:filename)
|
||||||
endfunc
|
endfunction
|
||||||
|
|
||||||
function s:addLeftSplit(filename)
|
function s:addLeftSplit(filename)
|
||||||
execute("vsplit " . s:getSwitchFile(a:filename))
|
execute("vsplit " . s:getSwitchFile(a:filename))
|
||||||
execute("wincmd l")
|
execute("wincmd l")
|
||||||
endfunc
|
endfunction
|
||||||
|
|
||||||
function s:addRightSplit(filename)
|
function s:addRightSplit(filename)
|
||||||
execute("vsplit " . s:getSwitchFile(a:filename))
|
execute("vsplit " . s:getSwitchFile(a:filename))
|
||||||
execute("wincmd L")
|
execute("wincmd L")
|
||||||
execute("wincmd h")
|
execute("wincmd h")
|
||||||
endfunc
|
endfunction
|
||||||
|
|
||||||
function splitopen#SplitOpenFile(filename)
|
function! splitopen#SplitOpenFile(filename)
|
||||||
execute("tabedit " . a:filename)
|
execute("tabedit " . a:filename)
|
||||||
let extension = s:getFileExtension(a:filename)
|
let extension = s:getFileExtension(a:filename)
|
||||||
if s:isLeftSideExtension(extension)
|
if s:isLeftSideExtension(extension)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
command -nargs=1 SplitOpen :call splitopen#SplitOpenFile("<args>")
|
command! -nargs=1 SplitOpen :call splitopen#SplitOpenFile("<args>")
|
||||||
|
|
||||||
" map left-split / right-split file extensions
|
" map left-split / right-split file extensions
|
||||||
if !exists("g:splitopen_extensions")
|
if !exists("g:splitopen_extensions")
|
||||||
|
|
Loading…
Reference in a new issue