X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/1a9372b058123ad5d2ff9d1616908795fb1c3059..81e54577d68c9bf2093c1e0766beba7a769e81e7:/vim/vimrc diff --git a/vim/vimrc b/vim/vimrc index 8a623f4..8b9b5c1 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,8 +1,3 @@ -" My vimrc. -" -" Author: Samir Benmendil -" - " runtimepath {{{1 set runtimepath ^=$XDG_CONFIG_HOME/vim set runtimepath +=$XDG_CONFIG_HOME/vim/after @@ -31,7 +26,18 @@ nnoremap ,h :SidewaysLeft:delmarks z nnoremap ,l :SidewaysRight:delmarks z "}}} Plug 'andrewradev/switch.vim' -Plug 'bling/vim-airline' +if !has('nvim') + Plug 'bling/vim-airline' "{{{2 + let g:airline#extensions#whitespace#enabled = 1 + let g:airline#extensions#tabline#enabled = 1 + let g:airline#extensions#searchcount#enabled = 0 + let g:airline_powerline_fonts = 1 + + let g:asyncrun_status = "stopped" + " let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}']) + "}}} +endif + Plug 'chrisbra/checkattach' Plug 'derekwyatt/vim-fswitch' Plug 'elzr/vim-json' @@ -54,6 +60,7 @@ Plug 'sjl/gundo.vim' Plug 'thinca/vim-qfreplace' Plug 'tomtom/tcomment_vim' Plug 'tpope/vim-abolish' +Plug 'tpope/vim-characterize' Plug 'tpope/vim-endwise' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-fugitive' @@ -397,10 +404,14 @@ augroup END map " make -function! Make() +function! MakeWithOpt() + " TODO only do this if makeprg matches make + " if &makeprg =~ "make" let l:make_dir = "" if exists("b:make_dir") let l:make_dir = "-C ".b:make_dir + elseif exists("t:make_dir") + let l:make_dir = "-C ".t:make_dir elseif exists("g:make_dir") let l:make_dir = "-C ".g:make_dir endif @@ -409,9 +420,9 @@ function! Make() if exists("g:make_targets") let l:make_targets = g:make_targets endif - execute "make! ".l:make_dir." ".l:make_targets + execute "Make ".l:make_dir." ".l:make_targets endf -nnoremap r :call Make() +nnoremap r :call MakeWithOpt() " unhighlight search nnoremap / :silent nohl @@ -575,15 +586,6 @@ inoremap gUiwgi nmap qq :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" " plugins options {{{1 -" airline {{{2 -let g:airline#extensions#whitespace#enabled = 1 -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#searchcount#enabled = 0 -let g:airline_powerline_fonts = 1 - -let g:asyncrun_status = "stopped" -let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}']) - " checkattach {{{2 let g:checkattach_filebrowser = 'ranger' let g:checkattach_once = 'y' @@ -608,7 +610,19 @@ nmap dd :tab split \| Gdiff \| wincmd h " delete fugitive buffers when closed autocmd BufReadPost fugitive://* set bufhidden=delete -nnoremap gs :Git +function! GitToggle() + let l:status_buffer = bufname('^fugitive:///*/.git{/worktrees/*,}//$') + if buflisted(l:status_buffer) + execute 'bdelete '.l:status_buffer + else + Git + 16wincmd_ + endif +endfunction +command! GitToggle :call GitToggle() +command! GToggle GitToggle +nnoremap gs :GitToggle + nnoremap gd :Gdiffsplit nnoremap gc :echohl WarningMsg \| echo "use \gcc instead" \| echohl None nnoremap gcc :tab G commit -v @@ -625,7 +639,8 @@ nnoremap gb :G blame augroup fugitive_gstatus au! - autocmd BufWinEnter */.git/index resize 16 + autocmd User FugitiveIndex setlocal winfixheight + autocmd User FugitiveIndex nmap = augroup end " Gundo {{{2 @@ -669,6 +684,9 @@ let g:SignatureMap = { " switch let g:switch_mapping = "s" +let g:switch_custom_definitions = [ + \ ['yes', 'no'] + \ ] " spellrotate nmap z] (SpellRotateForward) @@ -822,8 +840,9 @@ let g:ycm_language_server = " vim-easy-align {{{2 " start interactive EasyAlign in visual mode -vmap (EasyAlign) -nmap ga (EasyAlign) +vmap :echohl WarningMsg \| echo "EasyAlign mapped to a now" \| echohl None +vmap a (EasyAlign) +nmap a (EasyAlign) " vim-gtest {{{2 let g:gtest#highlight_failing_tests = 0