5

I know that you can use GWrite to stage current file. You can also use GStatus and - to stage the file you are selecting.

Is there a way to GWrite all the files or do git add . without using GStatus ?

CodeCrack
  • 5,253
  • 11
  • 44
  • 72
  • In case you do want to use `:Gstatus` you can use the `-` command on a heading to (un-)stage all the files under that heading. Use fold motions, `zj` and `zk`, to jump between headings. – Peter Rincker Sep 18 '17 at 15:57

4 Answers4

6

Not the answer to your specific question but something I've learned from one of the screencasts specified in github/tpope/vim-fugitive/README.markdown is you can do a visual select all file lines, - to stage them all, then cc to commit, all from within the Gstatus screen.

kabanek
  • 303
  • 3
  • 18
dex
  • 61
  • 1
  • 2
5

See :h :Git, which can

Run an arbitrary git command. Similar to :!git [args] but chdir to the repository tree first.

:Git add .
leaf
  • 1,624
  • 11
  • 16
2

I think you can just add a number before -. E.g. 5- to stage/unstage 5 of them.

nemo
  • 12,241
  • 3
  • 21
  • 26
2

Now I have the following in my .vimrc:

augroup custom_fugitive_mappings
    " delete custom_fugitive_mappings to avoid double runs
    au!
    " map 'A' to stage all in git status window
    au User FugitiveIndex nnoremap <buffer> A :Git add .<cr>
augroup END

Stanislav
  • 4,389
  • 2
  • 33
  • 35