diff options
-rwxr-xr-x | subx/edit | 9 | ||||
-rwxr-xr-x | subx/run | 2 | ||||
-rw-r--r-- | subx/teensy/vimrc.vim | 13 | ||||
-rw-r--r-- | vimrc.vim | 13 |
4 files changed, 33 insertions, 4 deletions
diff --git a/subx/edit b/subx/edit index d229c654..7d09fc17 100755 --- a/subx/edit +++ b/subx/edit @@ -3,8 +3,13 @@ if [ $# -eq 0 ] then - echo "edit <suffix>" + echo "edit <file>" exit 1 fi -eval $EDITOR ./teensy/test$1*.[cs] +if [[ $1 == 'test'* ]] +then + eval $EDITOR ./teensy/$1*.[cs] +fi + +eval $EDITOR ./$1.subx diff --git a/subx/run b/subx/run index 332d5786..b0eac8df 100755 --- a/subx/run +++ b/subx/run @@ -3,7 +3,7 @@ if [ $# -eq 0 ] then - echo "run <suffix>" + echo "run <binary>" exit 1 fi diff --git a/subx/teensy/vimrc.vim b/subx/teensy/vimrc.vim index 68b63640..e0fe2c1e 100644 --- a/subx/teensy/vimrc.vim +++ b/subx/teensy/vimrc.vim @@ -1 +1,12 @@ -command! -nargs=1 EE exec "vert split teensy/test" . <args> . "*.[cs]" +" assumes CWD is subx/ +command! -nargs=1 EE call EditSubx(<f-args>) + +function! EditSubx(arg) + " run commands silently because we may get an error loading EditSubx from a + " different directory. + if a:arg =~ "test.*" + exec "silent! vert split teensy/" . a:arg . "*.[cs]" + else + exec "silent! vert split " . a:arg . "*.subx" + endif +endfunction diff --git a/vimrc.vim b/vimrc.vim index 08ab8f13..2e11238b 100644 --- a/vimrc.vim +++ b/vimrc.vim @@ -51,3 +51,16 @@ augroup END " starting vim or opening a buffer without a file name (ok to do nothing) " opening a second file in a new or existing window (shouldn't mess up existing highlighting) " 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) + " run commands silently because we may get an error loading EditSubx from a + " different directory. + if a:arg =~ "test.*" + exec "silent! vert split teensy/" . a:arg . "*.[cs]" + else + exec "silent! vert split " . a:arg . "*.subx" + endif +endfunction |