about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-07 13:54:16 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-07 13:54:16 -0700
commitbc394aaf39da72d980933a720b6deb8876036c07 (patch)
tree5da22de61ca44b9126de927d157c003d5808794b
parentbbd9c1f9abf44c90117e0e25b629902f0fb06a73 (diff)
downloadmu-bc394aaf39da72d980933a720b6deb8876036c07.tar.gz
4323
-rwxr-xr-xsubx/edit9
-rwxr-xr-xsubx/run2
-rw-r--r--subx/teensy/vimrc.vim13
-rw-r--r--vimrc.vim13
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