From ce309777fea03e9555ee64461755c6d599cc654d Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Fri, 18 Oct 2019 12:40:12 +0200 Subject: [PATCH 1/2] Added project desription --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 062051b..4cd4129 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ # vim-split-open + +This is my first vim plugin. It provides a command to open a combination of c++ source and header file in a new tab split side-by-side. From 619265f3638447767250343aca58a5a15a0c3771 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Fri, 18 Oct 2019 13:25:21 +0200 Subject: [PATCH 2/2] Implemented simple SplitOpen function and command --- plugin/split-open.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 plugin/split-open.vim diff --git a/plugin/split-open.vim b/plugin/split-open.vim new file mode 100644 index 0000000..43992db --- /dev/null +++ b/plugin/split-open.vim @@ -0,0 +1,13 @@ +function! SplitOpenFile(filename) + execute("tabedit " . a:filename) + let l:file_extension = tolower(fnamemodify(a:filename, ":e")) + if l:file_extension == "cpp" + execute("FSSplitLeft") + execute("wincmd l") + elseif l:file_extension == "h" + execute("FSSplitRight") + execute("wincmd h") + endif +endfunction + +command! -nargs=1 SplitOpen :call SplitOpenFile("")