about summary refs log tree commit diff stats
path: root/vimrc.vim
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-05-29 00:35:21 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-29 00:35:21 -0700
commit3fe43bca71bdc74c36e83fab6c0105c910a990e4 (patch)
treea6fececaf739099b0fe87c66ff9e18a2a2d21ec1 /vimrc.vim
parentaee83e27521d0d3ba9723837bb9df6fcd2b73751 (diff)
downloadmu-3fe43bca71bdc74c36e83fab6c0105c910a990e4.tar.gz
6427
Diffstat (limited to 'vimrc.vim')
-rw-r--r--vimrc.vim20
1 files changed, 13 insertions, 7 deletions
diff --git a/vimrc.vim b/vimrc.vim
index b852e9df..ad95a63e 100644
--- a/vimrc.vim
+++ b/vimrc.vim
@@ -34,17 +34,23 @@ augroup END
 "   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)
 
-command! -nargs=1 E call EditSubx("edit", <f-args>)
+command! -nargs=1 E call EditMuFile("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>)
+  command! -nargs=1 S call EditMuFile("vert split", <f-args>)
+  command! -nargs=1 H call EditMuFile("hor split", <f-args>)
 else
-  command! -nargs=1 S call EditSubx("vert split", <f-args>)
-  command! -nargs=1 H call EditSubx("split", <f-args>)
+  command! -nargs=1 S call EditMuFile("vert split", <f-args>)
+  command! -nargs=1 H call EditMuFile("split", <f-args>)
 endif
 
-function! EditSubx(cmd, arg)
-  exec "silent! " . a:cmd . " apps/" . a:arg . ".subx"
+function! EditMuFile(cmd, arg)
+  let l:full_path = "apps/" . a:arg
+  if filereadable(l:full_path . ".mu")
+    let l:full_path = l:full_path . ".mu"
+  else
+    let l:full_path = l:full_path . ".subx"
+  endif
+  exec "silent! " . a:cmd . " " . l:full_path
 endfunction
 
 " we often want to crib lines of machine code from other files