Closed amadeus closed 5 years ago
Hasn't been discussed since DirChanged
, but I'm unpersuaded. What happens if I chdir
out of a repository? Am I supposed to manually delete all the commands one by one?
Sorry for the delayed response to this.
It may be tough to convince senpai, however I do think that :Gstatus
should just be a command available anytime from anywhere, which would mean you actually would never have a need to clean it up. Within a CLI, if I you try to git status
on a directory that isn't within git, you simply get the output fatal: Not a git repository (or any of the parent directories): .git
.
I think it would be pretty useful if you could execute :Gstatus
from anywhere - if it's from a buffer with a file, then it uses that file's git repo - if there is none, it attempts to fallback to the working directory, if that still fails, it could either a) open that split with the fatal
error message above, or just echo it to the cmd area. And if the buffer is not a file at all, it just attempts to use the current working directory with a similar output if it's a valid git directory or not.
The difference is that Git provides one command everywhere, whereas Fugitive provides 30ish. I could see doing that for a general purpose SCM plugin, but one SCM just seems like a bridge too far.
Remind me why this is such a big deal? I've begrudgingly covered the VimEnter
case. Is it just about being able to press Cmd-T in MacVim?
My usual workflow using MacVim, is that I generally use a window per project. Often times I will open up a MacVim window, cd into the directory of my project, and want to just do a quick :Gstatus
to pull up where I am at. Currently I have to open up a file from the project before I can do this.
The sort of inverse will also happen sometimes, I'll close out all open buffers from some work I am doing, but then want to call :Gstatus
to monitor git things, but then need to re-open a file.
It's not a huge deal, but I do love the functionality of :Gstatus
and often like to use it as a hub
for what I am working on.
If :Gstatus
from the project root is all you care about, you can just wrap up :pedit .git/index
in whatever way suites you. There's just a few small differences between that and :Gstatus
(which could be eliminated if need be).
Oh interesting, I could probably hack around it then, didn't realize it did so little by default
Another workaround is to do bind FugitiveDetect(getcwd())
to some key and do it manually.
Now one thing is that I'm not sure what events can be used for :sp
or :tabe
if there is no changing directories, I could only find BufWinEnter
even though that does get triggered a lot more.
About cleaning up the commands, I don't know if that's really necessary. They don't really "pollute" the command space, as:
fatal: not a git repository
for most commands (a few have that message as an uncaught exception)If you still want to clean it up, it's not too hard to do as all commands are already contained in s:commands
so a small loop would do the trick.
First, in closely related news, I must report that I have decided :Gstatus
is bad. It's basically a project drawer, which means it's terrible for window management, and the whole open in a new tab thing is a symptom of that. See #569 for discussion about replacing it.
In lieu of :cd
or :lcd
, I recommend using :e
to invoke netrw, then press c
to change directory. It's the same number of characters, and it exchanges the worthless garbage that is an unnamed buffer for a bit of visual context and an additional option for browsing.
Tangentially, note that I am now discouraging the use of .git/tags
and might even take it away in the next major release. I have decided the elegance of avoiding a .gitignore
entry is negated by the unfortunate asymmetry between Git projects and non-Git projects, and it lacks the flexibility to accommodate some use cases I have come to care about (like multiple tag files for multiple languages).
Experimental support is on mater. I may yank it if it turns out to be too confusing or non-performant.
I have not yet made global commands for subcommands that are also available on :Git
, for example :Git commit
.
I have been loving this new support of :G
from basically anywhere, so much appreciated!
I'm confused. This started out as a conversation about updating what fugitive considers to be the current working directory by tying into the DirChanged
autocmd and then ended up discussing the new :Git
as an improvement upon :Gstatus
. But as far as I can tell, it doesn't eliminate the need for using the autocmd.
I'm confused. This started out as a conversation about updating what fugitive considers to be the current working directory by tying into the
DirChanged
autocmd and then ended up discussing the new:Git
as an improvement upon:Gstatus
.
So called discussion is in fact a 3 sentence aside that starts with "in closely related news".
But as far as I can tell, it doesn't eliminate the need for using the autocmd.
No, but the commit that closed this issue did.
the commit that closed this issue did.
Ah, I see that now. Nice work resolving the issue.
For anyone digging on how to make Git fugitive open in a new tab, I added the following keymap that works pretty well:
:G <CR><C-W>T<CR>
You can use :tab G<CR>
to accomplish that without risk of resizing windows in the current tab.
Not sure if this has been discussed before, however It would be rad if
:Gstatus
could work on empty buffer by inheriting the cwd, especially now that aDirChanged
autocmd has been added to Vim since it could update from that event as well.