jreybert / vimagit

Ease your git workflow within Vim
1.31k stars 49 forks source link

Support for "git add -A" #114

Open wleese opened 7 years ago

wleese commented 7 years ago

Basically I'd like a way to stage everything by default, either through an option or key mapping.

jreybert commented 7 years ago

That's something I am thinking since a while. I wonder what might be the default behavior and mapping.

wleese commented 7 years ago

I believe most people dislike this behavior. So I'd suggest:

jreybert commented 7 years ago

What do you mean by "An option to add all by default"? With which mapping? AA is a good mapping, if it is added it should be always enabled. I must look in fugitive if there is already a mapping for this.

wleese commented 7 years ago

What do you mean by "An option to add all by default"? With which mapping?

Maybe my use of words isn't correct VIM terminology, sorry :) From a user standpoint: when I :Magit add all files to Staged if in my .vimrc I have: let g:magit_always_stage_all = true (for example).

But any of the 2 features (or both :)) is good for me.

jreybert commented 7 years ago

From a user standpoint: when I :Magit add all files to Staged if in my .vimrc I have:

Just to be sure: you want that all files to be staged when you open magit buffer with :Magit? In that case, no, it won't be added like that. Good news is that you can already to that.

autocmd User VimagitBufferInit call system(g:magit_git_cmd . " add -A " . magit#git#top_dir())

About the mapping, IMO there are two main behaviors here:

  1. stage all modified files
  2. stage all modified + untracked files Mappings could be:
  3. aa
  4. aA
wleese commented 7 years ago

Good point about the untracked files. Thanks and looking forward to /any/ implementation :)

jreybert commented 7 years ago

You can already add the autocmd User VimagitBufferInit trick in your vimrc, it will do the job.

wleese commented 7 years ago

Done, thanks again

fpnick commented 7 years ago

Great idea. For my personal workflow it would also be convenient if aa/aA would automatically trigger CC.

jreybert commented 7 years ago

@fpnick hm, I'll see how to do that... I am not fan to add another autocmd User or a g:magit_aa_auto_commit just for that (vimagit already have too many options!). I'll think how it could be added. IMO, type aA CC is natural, auto CC would not be a great benefit.

fpnick commented 7 years ago

Sure, it's a matter of taste... It's not crucial of course.