" Turn on spell checking.
setlocal spell

" Mapping to insert current git ticket into file.
nnoremap <buffer> <silent> <LocalLeader>t :0read !git ticket<cr>

" Mapping to retrieve commit message after failed commit.
function! GetPrevCommit()
  let l:git_toplevel = glob("`git rev-parse --show-toplevel`/.git/COMMIT_EDITMSG")
  :0read `git rev-parse --show-toplevel`/.git/COMMIT_EDITMSG
endfunction
nnoremap <buffer> <silent> <LocalLeader>b :call GetPrevCommit()<CR>

" vim:fdm=marker ft=vim et sts=2 sw=2 ts=2

" Turn on spell checking.
setlocal spell

" Mapping to insert current git ticket into file.
nnoremap <buffer> <silent> <LocalLeader>t :0read !git ticket<cr>

" Save contents of a buffer to register g.
function! s:SaveBuffer() abort
  silent normal! gg
  silent normal! "gyG
endfunction
autocmd BufWritePre <buffer> call s:SaveBuffer()

" vim:fdm=marker ft=vim et sts=2 sw=2 ts=2

Change git message recovery strategy
Change git message recovery strategy

Trying to load in the built-in git backup of the message doesn't always
work, in that the message file can be empty in my experience, even after
I *have* filled out a message.

Instead, try saving the contents of the git message buffer into the Vim
g register. If the commit fails, I can try again without fear of
overriding that register, since I never use g. If I need to restart Vim,
I can always save it to a file.

bronzehedwick/dotfiles,bronzehedwick/dotfiles,bronzehedwick/dotfiles,bronzehedwick/dotfiles