Added new Split() command to split an existing tab

develop
Michael Mandl 2019-10-30 22:40:30 +01:00
parent 4896a7c3cd
commit 97d53cf45c
2 changed files with 11 additions and 2 deletions

View File

@ -49,8 +49,7 @@ function s:addRightSplit(filename)
execute("wincmd h")
endfunction
function! splitopen#SplitOpenFile(filename)
execute("tabedit " . a:filename)
function s:splitOpenFile(filename)
let extension = s:getFileExtension(a:filename)
if s:isLeftSideExtension(extension)
call s:addRightSplit(a:filename)
@ -58,3 +57,12 @@ function! splitopen#SplitOpenFile(filename)
call s:addLeftSplit(a:filename)
endif
endfunction
function! splitopen#SplitOpenFile(filename)
execute("tabedit " . a:filename)
call s:splitOpenFile(a:filename)
endfunction
function! splitopen#SplitFile()
call s:splitOpenFile(expand("%:p"))
endfunction

View File

@ -1,4 +1,5 @@
command! -nargs=1 SplitOpen :call splitopen#SplitOpenFile("<args>")
command! Split :call splitopen#SplitFile()
" map left-split / right-split file extensions
if !exists("g:splitopen_extensions")