From 3095d7338bf244d2e163edc6d6d10c7968122afb Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 8 Jun 2019 03:21:20 +0200 Subject: projects/aodocs.vim: Allow longer Git commit titles Since AODocs commit message style prefers putting Jira IDs at the very start of commit messages, give myself more room in the title. Personally I think references should be at the end of a commit message, so I'm going to take back the extra characters. TODO: Dynamically calculate the issue ID length and adjust the textwidth to 72 + that value. --- projects/aodocs.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'projects/aodocs.vim') diff --git a/projects/aodocs.vim b/projects/aodocs.vim index a9bad91..77c57d6 100644 --- a/projects/aodocs.vim +++ b/projects/aodocs.vim @@ -9,4 +9,27 @@ augroup AODocs autocmd BufRead,BufEnter $VIM_PROJECT_PATH_AODOCS/*.json \ setlocal expandtab tabstop=4 softtabstop=4 shiftwidth=4 + + autocmd BufNewFile,BufRead + \ $VIM_PROJECT_PATH_AODOCS_GO/*/.git/{COMMIT_EDIT,MERGE_,TAG_EDIT}MSG + \,$VIM_PROJECT_PATH_AODOCS/*/.git/{COMMIT_EDIT,MERGE_,TAG_EDIT}MSG + \ call s:CommitWackoTextWidthMappings() + \ | call s:CommitWackoTextWidth() augroup END + + +" Enables a longer-than-72 character first line and 72 character wrapping on +" subsequent lines. +function! s:CommitWackoTextWidth() + if line('.') == 1 + setlocal textwidth=80 + else + setlocal textwidth=72 + endif +endfunction + +function! s:CommitWackoTextWidthMappings() + inoremap :call CommitWackoTextWidth() + nnoremap o :call CommitWackoTextWidth()o + nnoremap O :call CommitWackoTextWidth()O +endfunction -- cgit v1.2.3