diff --git a/README.md b/README.md index d1bd33f..9418060 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,6 @@ with a .cpp or .h file as filename to open a new tab containing a vertical split with the corresponding header file in the left window and the corresponding source file in the right window. -Use - - :Split - -to open the corresponding header or source file to your currently open file in -a vertical split. - ## Configuration You can configure the following settings: @@ -48,12 +41,6 @@ SplitOpen is GPL-3.0 licensed. See LICENSE file for more info. ## Changelog -v1.1.0 -* Added Split() command - -v1.0.0 -* Fixed error when reloading plugin - v0.0.4 * Add filetype configuraton diff --git a/autoload/splitopen.vim b/autoload/splitopen.vim index 1151120..b4488ba 100644 --- a/autoload/splitopen.vim +++ b/autoload/splitopen.vim @@ -4,18 +4,18 @@ function s:invert_dict(source_dict) let result[value] = key endfor return result -endfunction +endfunc let s:extensions = g:splitopen_extensions let s:extensions_rev = s:invert_dict(s:extensions) function s:isLeftSideExtension(extension) return has_key(s:extensions, a:extension) -endfunction +endfunc function s:isRightSideExtension(extension) return has_key(s:extensions_rev, a:extension) -endfunction +endfunc function s:getFileExtension(filename) return fnamemodify(a:filename, ":e") @@ -23,7 +23,7 @@ endfunction function s:getFileRoot(filename) return fnamemodify(a:filename, ":r") -endfunction +endfunc function s:getSwitchExtension(filename) let extension = s:getFileExtension(a:filename) @@ -32,24 +32,25 @@ function s:getSwitchExtension(filename) elseif s:isRightSideExtension(extension) return s:extensions_rev[extension] endif -endfunction +endfunc function s:getSwitchFile(filename) return s:getFileRoot(a:filename) . "." . s:getSwitchExtension(a:filename) -endfunction +endfunc function s:addLeftSplit(filename) execute("vsplit " . s:getSwitchFile(a:filename)) execute("wincmd l") -endfunction +endfunc function s:addRightSplit(filename) execute("vsplit " . s:getSwitchFile(a:filename)) execute("wincmd L") execute("wincmd h") -endfunction +endfunc -function s:splitOpenFile(filename) +function splitopen#SplitOpenFile(filename) + execute("tabedit " . a:filename) let extension = s:getFileExtension(a:filename) if s:isLeftSideExtension(extension) call s:addRightSplit(a:filename) @@ -57,12 +58,3 @@ function s: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 diff --git a/doc/splitopen.txt b/doc/splitopen.txt index 8d64698..55e954d 100644 --- a/doc/splitopen.txt +++ b/doc/splitopen.txt @@ -21,13 +21,6 @@ with a .cpp or .h file as filename to open a new tab containing a vertical split with the corresponding header file in the left window and the corresponding source file in the right window. -Use - - :Split - -to open the corresponding header or source file to your currently open file in -a vertical split. - ================================================================================ 2. Configuration *SplitOpenConfiguration* @@ -62,10 +55,6 @@ SplitOpen is GPL-3.0 licensed. See LICENSE file for more info. ================================================================================ 4. Changelog *SplitOpenChangelog* -v1.1.0 - * Added Split() command -v1.0.0 - * Fixed error when reloading plugin v0.0.4 * Add filetype configuraton v0.0.3 diff --git a/plugin/splitopen.vim b/plugin/splitopen.vim index 2534fdb..7f54b02 100644 --- a/plugin/splitopen.vim +++ b/plugin/splitopen.vim @@ -1,5 +1,4 @@ -command! -nargs=1 SplitOpen :call splitopen#SplitOpenFile("") -command! Split :call splitopen#SplitFile() +command -nargs=1 SplitOpen :call splitopen#SplitOpenFile("") " map left-split / right-split file extensions if !exists("g:splitopen_extensions")