Search code examples
vimvim-fugitive

Toggling files in :Gstatus window by pressing - displays "Press ENTER or type command to continue" message


I tried everything I found here and here to get rid of the message to no avail.

If I set cmdheight to >1 then it works for a few toggles and then displays the dreaded message again. (I could set cmdheight to e.g 3 to prevent this but the command line looks ugly that way)

I tried to find what message makes it display the message by checking the :file! value:

".git/index" [Not edited][RO] line 10 of 10 --100%-- col 1

That should not be a problem, I guess.

I also checked the :v:scrollstart variable:

1 # On branch master
2 # Your branch is ahead of 'origin/master' by 1 commit.
3 #
4 # Changes not staged for commit:
5 #   (use "git add <file>..." to update what will be committed)
6 #   (use "git checkout -- <file>..." to discard changes in working directory)
7 #
8 # modified:   zshrc
9 #
10 no changes added to commit (use "git add" and/or "git commit -a")

which could be it but I'm not sure about that.

Thank you.


Solution

  • I guess it is the key binding. Try:

    :nnoremap - :<C-U>silent! execute <SNR>20_StageToggle(line('.'),line('.')+v:count1-1)<CR>
    

    If that fixes it, you'll want to update fugitive.vim with the corresponding change

    Beyond that, you can use debug mode

    :debug execute <SNR>20_StageToggle(line('.'),line('.')+v:count1-1)
    

    Lastly, see whether files (especially .git/index or .git/index.lock) are accessible and writable.