From 3dfeaaff4f637304c589cb3da78fff8c132f31c8 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 21 Sep 2018 14:28:39 -0700 Subject: 4570 --- vimrc.vim | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'vimrc.vim') 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() -function! EditSubx(arg) +command! -nargs=1 E call EditSubx("edit", ) +if exists("&splitvertical") + command! -nargs=1 S call EditSubx("vert split", ) + command! -nargs=1 H call EditSubx("hor split", ) +else + command! -nargs=1 S call EditSubx("vert split", ) + command! -nargs=1 H call EditSubx("split", ) +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 -- cgit 1.4.1-2-gfad0