version_control.vim 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. " Version Control - Modeline and Notes {{{
  2. " vim: set sw=2 ts=2 sts=2 et tw=78 foldmarker={{{,}}} foldlevel=0 foldmethod=marker spell:
  3. "
  4. " Settings and functions to do with version control usage. Mostly for using
  5. " git through fugitive.
  6. "
  7. " }}}
  8. " Fugitive Autocommands {{{
  9. if has("autocmd")
  10. " Fugitive - Go up to previous tree object while exploring git tree with '..'
  11. autocmd User fugitive
  12. \ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
  13. \ nnoremap <buffer> .. :edit %:h<CR> |
  14. \ endif
  15. " Fugitive - Delete buffers when they are not active
  16. autocmd BufReadPost fugitive://* set bufhidden=delete
  17. endif
  18. " }}}
  19. " Mappings {{{
  20. " Search for conflict markers {{{
  21. nnoremap <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
  22. " }}}
  23. " Git commands with Fugitive {{{
  24. nnoremap <silent> <leader>gc :Gcommit -v<CR>
  25. nnoremap <silent> <leader>gl :Glog<CR><CR>
  26. nnoremap <silent> <leader>gap :Git add -p<CR>
  27. nnoremap <silent> <leader>gs :Gstatus<CR>
  28. nnoremap <silent> <leader>gd :Gdiff<CR>
  29. nnoremap <silent> <leader>gb :Gblame<CR>
  30. " }}}
  31. " }}}