diff --git a/.vimrc b/.vimrc index 8edc5f5..590d8dc 100644 --- a/.vimrc +++ b/.vimrc @@ -378,6 +378,9 @@ set wildmenu set wildmode=longest,list,full set wildignore+=*/log/*,*.so,*.swp,*.zip,*/rdoc/* +" Allow inserts in the command bar to autocomplete, e.g. see e +set wildcharm= + if executable('rg') set grepprg=rg\ --vimgrep\ --hidden " Requires ripgrep to be installed. endif @@ -571,9 +574,6 @@ augroup END " Suspend vim process and return to the shell. Can return to vim with `fg`. nnoremap z -" Edit a file -nnoremap e :e - " Open the vimrc file for editing / reload vimrc file. nnoremap ev :vsp $MYVIMRC nnoremap pv :vsp ~/.vimrc.private @@ -629,8 +629,6 @@ noremap aa "A " Backward replace word including cursor character. noremap d cvb -" Forward replace word. -noremap e cw " Allow fast pasting by accessing the system clipboard register. noremap p "+p @@ -762,6 +760,10 @@ call Cabbrev('wq', 'call WriteCurrentFileAndCreateCtagsThenQuit()') call Cabbrev('Wq', 'call WriteCurrentFileAndCreateCtagsThenQuit()') call Cabbrev('WQ', 'call WriteCurrentFileAndCreateCtagsThenQuit()') +" Faster way to open a file in the same directory. +" will autocomplete the expansion here because we set wildcharm to . +nnoremap e :e %:p:h/ + nnoremap w :call WriteCurrentFileAndCreateCtags() nnoremap x :call WriteCurrentFileAndCreateCtagsThenQuit() nnoremap q :q @@ -1224,9 +1226,9 @@ fu! Build(optimized=0, silent=0) if l:ext == "jai" let l:is_jai = 1 - " Check for a build file in the current directory or one directory back + " Check for a build file in the current directory or one directory back when one directory back isn't the root of a drive. " (e.g. we're in modules/ or src/, code/, etc) - if filereadable(l:current_dir . "/build.jai") || filereadable(l:one_dir_back . "/build.jai") || filereadable(l:current_dir . "/first.jai") || filereadable(l:one_dir_back . "/first.jai") + if filereadable(l:current_dir . "/build.jai") || filereadable(l:current_dir . "/first.jai") || ((l:one_dir_back != "/") && (filereadable(l:one_dir_back . "/build.jai") || filereadable(l:one_dir_back . "/first.jai"))) let l:has_jai_build_file = 1 if filereadable(l:current_dir . "/build.jai") == 1