diff --git a/vim/.vimrc b/vim/.vimrc index dc23da7..01a69f5 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -192,6 +192,8 @@ let g:UltiSnipsEditSplit="vertical" """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Mappings """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Miscellaneous mappings +"""""""""""""""""""""""" " Yank until the end of line with Y, to be more consistent with D and C nnoremap Y y$ @@ -207,6 +209,7 @@ map es :source $MYVIMRC noremap m :silent! :make! \| :redraw! " Mapping for quickfix bindings +""""""""""""""""""""""""""""""" " Next and previous in quick-fix list nmap fn (qf_qf_next) nmap fp (qf_qf_previous) @@ -218,6 +221,7 @@ nmap tf (qf_qf_toggle) nmap tl (qf_loc_toggle) " Fuzzy file finder bindings +"""""""""""""""""""""""""""" " Only git-tracked files, Vim needs to be in a Git repository nmap fg :GFiles " All files @@ -231,9 +235,26 @@ nmap ft :BTags " Tags in all project files nmap fT :Tags +" Git and diff mappings +""""""""""""""""""""""" +" Visual bindings for merging diffs as in normal mode +xnoremap dp :diffput +xnoremap do :diffget +" Git add current file +nnoremap ga :Git add %:p +" Open status window +nnoremap gs :Gstatus +" Open diff view of current buffer: the right/down window is the new version +nnoremap gd :Gdiffsplit! +" Use git-mv and rename the buffer, backspace and add '!' to use the '-f' flag +nnoremap gm :Gmove +" Open a buffer to the left with blame information +nnoremap gb :Gblame + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Status line """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Show ctags and cscopes generation in status line set statusline+=%{gutentags#statusline()} """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -241,5 +262,5 @@ set statusline+=%{gutentags#statusline()} """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let git_settings = system("git config --get vim.settings") if strlen(git_settings) - exe "set" git_settings + exe "set" git_settings endif