-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gitcommit autoformat #63
Comments
I'll try to reproduce this in the next week or so. |
I've come across this today too. Here's my example, if it helps... I haven't changed the default message so I receive this as a starting point:
Normally at this point I hit i and start typing the summary and then Enter twice to start the description. However, after pressing i and the first character, the autoformat kicks in and I get:
You can avoid this by hitting O instead which gives the gap required for autoformat to ignore it but that means I'll have to retrain my muscle memory :) My current configuration is: " reedes/vim-pencil {{{
let g:pencil#autoformat_config = {
\ 'gitcommit': {
\ 'black': [
\ 'gitcommit(Blank|Comment|FirstLine|Summary)',
\ ],
\ },
\ }
" }}}
" Prose {{{
augroup prose
autocmd!
autocmd FileType gitcommit,gitsendmail
\ call pencil#init({'wrap': 'hard'})
\ | setlocal spell spelllang=en_gb
augroup END
" }}} |
In my
Those are with an out of the box configuration without even the extra configuration you've used. I wonder what is actually different... |
Strange that it works for you. Did you initialise it like I have ( Looking at the default configuration it appears that nothing special happens for |
Yes, I tried with I wonder if having tpope's |
I tried with and without Here's a minimal runtime defaults.vim
augroup prose
autocmd!
autocmd FileType gitcommit call pencil#init({'wrap': 'hard'})
augroup END
if exists('*minpac#init')
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('reedes/vim-pencil')
" call minpac#add('tpope/vim-fugitive')
endif
command! PackUpdate packadd minpac | source $MYVIMRC |
\ call minpac#update('', {'do': 'call minpac#status()'})
command! PackClean packadd minpac | source $MYVIMRC | call minpac#clean()
command! PackStatus packadd minpac | source $MYVIMRC | call minpac#status() To setup: mkdir -p /tmp/test-vim
cd /tmp/test-vim
# vim package manager
git clone --depth 1 git://github.com/k-takata/minpac.git pack/minpac/opt/minpac
vim vimrc
# copy the above in
# backup current vim setup and move over to test vim setup
mv ~/.vim ~/backup-vim
ln -s /tmp/test-vim ~/.vim
vim
# Run :PackUpdate then :q
git init
EDITOR=vim git commit --allow-empty |
The issue
I use the following git commit template:
So I press
o
to start writing my commit message (e.g., "Fix all the bugs") on the next line, but the text is auto-formatted up to the comment line (cursor starts at line 1 column 1):Attempt to fix
I used this function to find out the highlighting group that applies to the first/comment lines. It is
['gitcommitComment']
.I added this to my .vimrc:
Lines that are not adjacent to comments are auto-formatted properly, but lines that are adjacent get auto-formatted with the comment line. (I get the same results when I remove the
'enforce-previous-line': 1
line, too.)Is there some setting that I'm missing?
The text was updated successfully, but these errors were encountered: