Closed sorin-ionescu closed 12 years ago
I must admit I'm not entirely sure what you mean by this. Do you mean the ability to open gitv from the command line?
If so, the problem here is that the workflow is designed to be based around the current file open in Vim. That means that you must specify a file to be opened in order to view the repository; otherwise gitv does not know which repo to display. It can be done from the command line with something like vim -c ":Gitv" <file from repo>
.
That is exactly what I have meant. There are certain Git commands that open gitk. I would like for them to open gitv instead, if possible.
Just curious, what git command opens gitk?
I don't think there's a way to change the application run by gitk. On my machine the gitk executable is the Tcl script for the actual gitk application, rather than a wrapper. I made a one line bash script to run gitv that just contains: vim -c "silent Gitv $@" .
@Silex git-bisect, git-citool, git-gui, some switches on other commands.
@adamreeve You don't change the application run by gitk. You change Git, if possible, to not call gitk but gitv. I have not looked if it's doable via gitconfig or a hook.
I've been thinking about this. gitv was never designed to replace gitk but rather to make a gitk-style view more accessible and integrated with a Vim based workflow. If this would be useful for people I will definitely take a look at a pull request if someone fancies taking this on?
Your choice for a name implied that it was a gitk replacement as opposed to, for example, extradite.vim, a tig replacement.
I don't think extradite is meant to "replace" tig. Nor is gitv meant to replace gitk. They're just inspired from these tools to reflect some of their features into vim.
A full-featured gitk replacement is interesting tho, but it would be a lot of work imho.
I just added this alias to my zshrc.
alias gitv='vim .git/index -c "Gitv --all" -c "tabonly"'
This opens the gitv browser for the current directory's git repo. Hopefully this is helpful. Unfortunately, I think this is as close as I'm going to get to fulfilling this request I'm afraid.
This works if you're in a subdirectory of your git project (assuming you have upsearch) in your .bashrc
alias gitv='vi "$(upsearch .git)/.git/index" -c "Gitv —all" -c "tabonly"'
@blockloop not all repositories will have the git directory as .git
at the top level. Probably the most common reason for that being different is in repositories that are submodules of another repository. You can reliably get the path to the git directory of the current repository using git rev-parse --git-dir
, this also avoids depending on non-standard commands.
alias gitv='vim "$(git rev-parse --git-dir)/index" -c "Gitv --all" -c tabonly'
ah yes, much better
Thank you for creating gitv. It's a promising replacement for gitk and tig. However, make it a true replacement for gitk by adding a Git hook, if possible, to open gitv instead of gitk.