diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-09-21 14:28:39 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-09-21 14:28:39 -0700 |
commit | 3dfeaaff4f637304c589cb3da78fff8c132f31c8 (patch) | |
tree | 415a3959a14fe07b82b6d6ca1456a9bf86adf950 /vimrc.vim | |
parent | ab1bc984476d39c9afe9454036a7764897d3ba12 (diff) | |
download | mu-3dfeaaff4f637304c589cb3da78fff8c132f31c8.tar.gz |
4570
Diffstat (limited to 'vimrc.vim')
-rw-r--r-- | vimrc.vim | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/vimrc.vim b/vimrc.vim index 8334692b..efaee6df 100644 --- a/vimrc.vim +++ b/vimrc.vim @@ -53,11 +53,23 @@ augroup END " reloading an existing file (shouldn't mess up existing highlighting) " assumes CWD is subx/ -command! -nargs=1 EE call EditSubx(<f-args>) -function! EditSubx(arg) +command! -nargs=1 E call EditSubx("edit", <f-args>) +if exists("&splitvertical") + command! -nargs=1 S call EditSubx("vert split", <f-args>) + command! -nargs=1 H call EditSubx("hor split", <f-args>) +else + command! -nargs=1 S call EditSubx("vert split", <f-args>) + command! -nargs=1 H call EditSubx("split", <f-args>) +endif + +function! EditSubx(cmd, arg) + exec "silent! " . a:cmd . " " . SubxPath(a:arg) +endfunction + +function! SubxPath(arg) if a:arg =~ "^ex" - exec "silent! vert split examples/" . a:arg . "*.subx" + return "examples/" . a:arg . "*.subx" else - exec "silent! vert split apps/" . a:arg . "*.subx" + return "apps/" . a:arg . "*.subx" endif endfunction |