aboutsummaryrefslogblamecommitdiff
path: root/vim/after/ftplugin/gitcommit.vim
blob: 5699188d4eb800591910be8e4a5d120c32d54fb9 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                             
                                               

        


                                             
                            
                                                           
 
                                                             
                                            







                                                           








                                                              


                                                                  


                                                        


                                            
" Extra configuration for Git commit messages
if &filetype !=# 'gitcommit' || v:version < 700
  finish
endif

" Make angle brackets behave like mail quotes
setlocal comments+=n:>
setlocal formatoptions+=coqr
let b:undo_ftplugin .= '|setlocal comments< formatoptions<'

" Choose the color column depending on non-comment line count
if has('autocmd') && exists('+cursorcolumn')
  augroup gitcommit
    autocmd CursorMoved,CursorMovedI <buffer>
            \ let &l:colorcolumn = gitcommit#CursorColumn()
  augroup END
  let b:undo_ftplugin .= '|autocmd! gitcommit'
        \ . '|augroup! gitcommit'
endif

" Stop here if the user doesn't want ftplugin mappings
if exists('g:no_plugin_maps') || exists('g:no_gitcommit_maps')
  finish
endif

" Mail quote mappings
nnoremap <buffer> <expr> <LocalLeader>q quote#Quote()
nnoremap <buffer> <expr> <LocalLeader>qq quote#Quote().'_'
xnoremap <buffer> <expr> <LocalLeader>q quote#Quote()
nnoremap <buffer> <expr> <LocalLeader>Q quote#QuoteReformat()
nnoremap <buffer> <expr> <LocalLeader>QQ quote#QuoteReformat().'_'
xnoremap <buffer> <expr> <LocalLeader>Q quote#QuoteReformat()
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>q'
      \ . '|nunmap <buffer> <LocalLeader>qq'
      \ . '|xunmap <buffer> <LocalLeader>q'
      \ . '|nunmap <buffer> <LocalLeader>Q'
      \ . '|nunmap <buffer> <LocalLeader>QQ'
      \ . '|xunmap <buffer> <LocalLeader>Q'