vimrc improvements

This commit is contained in:
Michael Campagnaro 2023-09-20 14:00:23 -04:00
parent 851dc77481
commit f9a06756ca

16
.vimrc
View File

@ -378,6 +378,9 @@ set wildmenu
set wildmode=longest,list,full
set wildignore+=*/log/*,*.so,*.swp,*.zip,*/rdoc/*
" Allow <tab> inserts in the command bar to autocomplete, e.g. see <leader>e
set wildcharm=<tab>
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 <leader>z <c-z>
" Edit a file
nnoremap <leader>e :e
" Open the vimrc file for editing / reload vimrc file.
nnoremap <silent> <leader>ev :vsp $MYVIMRC<cr>
nnoremap <silent> <leader>pv :vsp ~/.vimrc.private<cr>
@ -629,8 +629,6 @@ noremap <leader>aa "A
" Backward replace word including cursor character.
noremap <leader>d cvb
" Forward replace word.
noremap <leader>e cw
" Allow fast pasting by accessing the system clipboard register.
noremap <leader>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.
" <tab> will autocomplete the expansion here because we set wildcharm to <tab>.
nnoremap <leader>e :e %:p:h/<tab>
nnoremap <leader>w :call WriteCurrentFileAndCreateCtags()<cr>
nnoremap <leader>x :call WriteCurrentFileAndCreateCtagsThenQuit()<cr>
nnoremap <leader>q :q<cr>
@ -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