gitvimvim-fugitive

How can I commit files currently displayed in Vim with fugitive?


I am editing files opened split into three windows. I want to commit those into the repository. Is there any commands to do that?


Solution

  • There are a few ways to accomplish this task. I will outline the most interactive method which uses :Git.

    For more help with :Git see :h :Git or :G when in the :Git buffer.

    Can use :Gwrite or :Gw and :windo to skip the :Git window to make this a bit faster.

    :windo Gw
    :Git commit
    

    You can also skip the whole commit window by using the -m flag. e.g. :Git commit -m "A short message"

    I recommend official repo on GitHub and Vimcasts videos on Fugitive: The Fugitive Series - a retrospective

    To learn more see:

    :h fugitive
    :h :Git
    :h :Gw
    :h :Git commit
    :h :windo
    :h :x