2019-10-20 11:55:10 +00:00
|
|
|
function s:getFileExtension(filename)
|
|
|
|
return fnamemodify(a:filename, ":e")
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function s:getFileRoot(filename)
|
|
|
|
return fnamemodify(a:filename, ":r")
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
function s:getSwitchExtension(extension)
|
|
|
|
if (a:extension == "cpp")
|
|
|
|
return "h"
|
|
|
|
elseif (a:extension == "h")
|
|
|
|
return "cpp"
|
|
|
|
endif
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
function s:getSwitchFile(filename)
|
|
|
|
return s:getFileRoot(a:filename) . "." . s:getSwitchExtension(s:getFileExtension(a:filename))
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
function s:addLeftSplit(filename)
|
|
|
|
execute("vsplit " . s:getSwitchFile(a:filename))
|
|
|
|
endfunc
|
|
|
|
|
2019-10-18 11:46:00 +00:00
|
|
|
function splitopen#SplitOpenFile(filename)
|
2019-10-18 11:25:21 +00:00
|
|
|
execute("tabedit " . a:filename)
|
2019-10-20 11:55:10 +00:00
|
|
|
call s:addLeftSplit(a:filename)
|
2019-10-18 11:25:21 +00:00
|
|
|
endfunction
|