Added new Split() command to split an existing tab

This commit is contained in:
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") execute("wincmd h")
endfunction endfunction
function! splitopen#SplitOpenFile(filename) function s:splitOpenFile(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)
call s:addRightSplit(a:filename) call s:addRightSplit(a:filename)
@ -58,3 +57,12 @@ function! splitopen#SplitOpenFile(filename)
call s:addLeftSplit(a:filename) call s:addLeftSplit(a:filename)
endif endif
endfunction 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! -nargs=1 SplitOpen :call splitopen#SplitOpenFile("<args>")
command! Split :call splitopen#SplitFile()
" map left-split / right-split file extensions " map left-split / right-split file extensions
if !exists("g:splitopen_extensions") if !exists("g:splitopen_extensions")