aboutsummaryrefslogtreecommitdiffstats
path: root/projects
diff options
context:
space:
mode:
authorTeddy Wing2019-06-08 03:21:20 +0200
committerTeddy Wing2019-06-08 11:33:03 +0200
commit3095d7338bf244d2e163edc6d6d10c7968122afb (patch)
treed709d31fe53bc10d2ad354cc0eb501326a3eda42 /projects
parent880954b216bf16bbd4503a596e2788b77360816e (diff)
downloaddotvim-3095d7338bf244d2e163edc6d6d10c7968122afb.tar.bz2
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.
Diffstat (limited to 'projects')
-rw-r--r--projects/aodocs.vim23
1 files changed, 23 insertions, 0 deletions
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 <buffer> <CR> <C-o>:call <SID>CommitWackoTextWidth()<CR><CR>
+ nnoremap <buffer> o :call <SID>CommitWackoTextWidth()<CR>o
+ nnoremap <buffer> O :call <SID>CommitWackoTextWidth()<CR>O
+endfunction