From 3fe43bca71bdc74c36e83fab6c0105c910a990e4 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 29 May 2020 00:35:21 -0700 Subject: 6427 --- vimrc.vim | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'vimrc.vim') 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", ) +command! -nargs=1 E call EditMuFile("edit", ) if exists("&splitvertical") - command! -nargs=1 S call EditSubx("vert split", ) - command! -nargs=1 H call EditSubx("hor split", ) + command! -nargs=1 S call EditMuFile("vert split", ) + command! -nargs=1 H call EditMuFile("hor split", ) else - command! -nargs=1 S call EditSubx("vert split", ) - command! -nargs=1 H call EditSubx("split", ) + command! -nargs=1 S call EditMuFile("vert split", ) + command! -nargs=1 H call EditMuFile("split", ) 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 -- cgit 1.4.1-2-gfad0