gregsexton / gitv Goto Github PK
View Code? Open in Web Editor NEWgitk for Vim.
gitk for Vim.
I can’t find a way to make the range browser (as described in http://www.gregsexton.org/2011/05/gitv-range/) do a vert split.
I have a terminal that is much wider than it is tall, and some of the functions I wanted to really test/play with this feature on require as much vert space as possible.
I realise a horizontal split is better if you anticipate opening up a diff view on that file later, so that is certainly a good default but it would be nice to be able to override that.
Thanks...
Awesome plugin, congrats!
There is a point of detail that unfortunately prevents me from using it in my daily workfow.
The browser mode opens a lot of buffers, and do not close them. I use buffers a lot more than tabs to navigate in my open files, using lusty juggler by tpope. So having the buffer list cluttered with git revisions buffer is a real pain.
Not sure if this can be fixed, and how. Is it possible to destroy automatically git buffers?
Could You please add an option for displaying or not a "preview window" when starting a browser mode?
I would like to start gitv in browser mode mainly for watching repo history, I don't need diff window all the time.
I dont know, if this is feature request, or bug report O: )
Anyway - when I open a commit in browser mode, nothing is collapsed, but it would be great, if it loads like this - http://d.pr/bGTq
BTW I had removed all my settings in vimrc (except pathogen), and all plugins (except pathogen & gitv & vim-fugitive). Everything is up to date (fugitive is using commit b089a2; gitv 69cfaf).
I'm using this with MacVim in a terminal on the Mac.
To reproduce:
-- Load More --
is.<CR>
It seems to be related to my having set clipboard=unnamed
to share the unnamed register with the clipboard on MacOS. But I can't figure out what in the code is doing it.
Can you help?
Thanks.
Oh, and thanks for a cool plugin. I'm just getting started, but this looks very handy.
When I open a file from a git repository, eg. Ge ^ works as expected.
But if I get a new buffer with Gitv, pressing <CR>
on a line says
E492: Not an editor command Gedit ad61e12
Please see tpope/vim-fugitive#142 for more details.
I've got a remote branch that I want to merge (1 commit, ff possible).
After choosing the two lines and pressing 'm' I get asked 3 questions.
This is especially bothersome if one of the points has a few branches defined on it - then I have to read the list at the bottom, find the one I want, and get the correct ID; in about 10 tests I've err'ed at least 3 times (mixed start and end point, choose wrong branch).
How about optimizing for the trivial case (merging onto the current branch), and allow some hotkey to try a merge without asking that much?
Sadly both "M" and "m" are used for normal mode, although I think "m" could be reused -- or at least switch to that if only part of a single line is marked visually.
Ie. I'm standing on a (syntax colored) branchname "remote/branch" - pressing "m" (or, alternatively, visually marking that branch name and then pressing "m") should just call "git merge " and be done.
Thanks a lot,
Phil
When I run vim -c Gitv
(from inside a directory with a .git/
, of course), it gives an error Not a git repository.
If I run vim
, then :Gitv<CR>
, it works.
(I'd like to alias gitv='vim -c Gitv'
to run it directly from the bash prompt, maybe as a substitute to tig
.)
<C-l>
is a vim command to redraw the screen. I often need to make vim redraw after doing some commands (especially ones that cause several lines of output). I think this used to be a problem for gitv, but it looks like it's not any more.
(I also use nnoremap <silent> <C-l> :nohl<CR><C-l>
to clear highlighting.)
Can the Ctrl-L remapping be optional (either using <unique>
or with a disable variable)?
I'd suggest mapping Ctrl-L for update instead (like netrw).
Hi. I'm not sure if this request is appropriate and/or vim already supplies the means for this but; I'm using these maps:
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
and that conflicts in meaning inside Gitv. I'd like to continue to use my maps. Is this possible?
Hello Greg,
here's a small patch that makes gitv no longer assume that all diff paths start with "a/" or "b/" (diff.noprefix=true).
Furthermore I would have thought that C-CR should open the diff folds by default - is that correct?
I see no difference between C-CR and CR from the commit list view, using a current git checkout and vim 7.3.429.
diff --git plugin/fugitive.vim plugin/fugitive.vim
index 041c8be..a9f68f0 100644
--- plugin/fugitive.vim
+++ plugin/fugitive.vim
@@ -2413,8 +2416,8 @@ function! fugitive#foldtext() abort
let [add, remove] = [-1, -1]
let filename = ''
for lnum in range(v:foldstart, v:foldend)
if filename ==# '' && getline(lnum) =~# '^[+-]{3} [ab]/'
let filename = getline(lnum)[6:-1]
if filename ==# '' && getline(lnum) =~# '^[+-]{3} '
let filename = getline(lnum)[4:-1]
Thank you.
If you find a commit that you’re interested in and you want to view it in more detail you can press ctrl-enter. This will show you the full header of the commit including any extended message. It will also show you a diff so that you can easily view the other changes that this commit made, helping to put things in perspective.
The upper words is from: http://www.gregsexton.org/2011/05/gitv-range/.
I try to press <C-Enter>
on a commit in file mode. but no difference with <Enter>
...
Hi, I'm unable to launch a diff with shortcut D
. Here is the error:
Error detected while processing BufReadCmd Auto commands for "fugitive://**//[0-9a-f][0-9a-f]*":
fugitive: rev-parse aebbbd335eeb2f753b1650180bd31349c4208209:plugin/gitv-1: fatal: Needed a single revision
Anyway, thank you for your hard work.
When executing :Gitv with for example Vim 7.2.330 (from Ubuntu 10.04.3 LTS), this happens:
Error detected while processing function <SNR>14_OpenGitv..<SNR>14_OpenBrowserMode..<SNR>14_LoadGitv..<SNR>14_ConstructAndExecuteCmd..Gitv_OpenGitCommand:
line 54:
E518: Unknown option: norelativenumber
Press ENTER or type command to continue
Setting HEAD to cdccf20 (tag: v1.1) makes it work again.
One feature that I am really missing is to return from a file diff to the diff overview:
What I am missing is a quick way back from 4) to 2). Its the most common use case for me when I am reviewing code: I want to look at all changes in all files .. Should probably not be too hard ?
I'm using the bash alias gitv='vim .git/index -c "Gitv --all" -c "tabonly"
to open gitv. But If you try to quit using the q
command you will get the following error:
Error detected while processing function <SNR>40_CloseGitv:
line 8:
E784: Cannot close last tab page
Doing :Gitv <Ctrl-R>%
gives errors about the file not being versioned; I know that :Gitv %
works, but perhaps the cwd should be used if a path is specified.
Using :Gitv <path-within-repo>
I don't get the correct output, but only
* Local uncommitted changes, not checked in to index.
* Local changes checked in to index but not committed.
fatal: bad flag '--no-color' used after filename
-- Load more --
and the Load more
doesn't work.
Are my expectations wrong? !git log <path>
works fine ...
Just like title said, I hope I can set the heigh value of gitv window, so that I can leave more space for diff preview window.
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.
Similar to commit 64619e4 ("Respect the user's foldlevelstart settings"), the user's foldmethod should not get overwritten to "syntax" probably.
It looks like there are two places where this gets done:
./plugin/gitv.vim: silent setlocal fdm=syntax
./plugin/gitv.vim: call s:MoveIntoPreviewAndExecute('setlocal fdm=syntax', 0)
This should be made either configurable, or documented how to accomplish this using autocommands (e.g. by matching for "fugitive://" buffers).
"foldmethod=syntax" causes the diff hunks to be closed, while I would like to have them open by default instead.
It would be great if there was a way to make the first column in the commit browser shorter so that it would be possible to see who is the author of the commit.
Is this possible already?
Gitk has the option to view file at specific revision. This would be awesome to have in vim plugin.
When hlsearch
is enabled, " " (space) gets highlighted in the preview window during browser mode (after switching to a new commit for example).
It looks like "gitv" does a search for " " somewhere and this gets stuck/remembered in the preview window.
Executing :redraw
or moving to the window fixes it.
Also, highlighting of " " pops up during Gitv initialization in the tree window - this appears to be another (although related) issue and should be avoided.
Pressing return outputs an error before updating the display window. It occurs in both browser mode and single file mode.
Error detected while processing function <SNR>34_OpenGitvCommit..<SNR>34_MoveIntoPreviewAndExecute..<SNR>34_RecordBufferExecAndWipe:
line 7:
E516: No buffers were deleted: bdelete 4
this is just really small "visual bug", and doesnt affect function. But "Local uncommitted changes, not checked in to index" and "Local changes checked in to index but not committed" should have parent as "HEAD", not end of log.
See:
Gitk: http://d.pr/eILB
Gitv: http://d.pr/7PRh
When doing "git rebase -i" it would be nice to have a vertical split, with one side showing the rebase buffer and the other one the files changed and the diff related to the change the cursor is on.
When moving the cursor in the rebase buffer, the other pane should be updated immediately, without any intervention.
The same could be used for (fugitive's) Gstatus - showing the file diff in the other pane, or for Gitv browse mode - don't require an Enter.
Thank you very much for this very nice plugin!
I'm using a vertically split layout, with two source files open.
Using '<,'>Gitv! to see changes in a range of lines works fine - the window is split, and the top half shows the commits.
But pressing on one of the commits closes the other source window!
Thanks for the nice feature, though!
If I try to use browser mode (:Gitv
) from a submodule, it displays the parent repo's history. If I use file mode (:Gitv!
), it correctly displays the history for the current file. Using :GStatus
in the submodule works correctly. I'm using Ubuntu 12.04.
Repro script:
echo Create remote for submodule
mkdir test_remote
cd test_remote
git init
echo first > file
git add file
git ci -m'initial'
cd -
echo Create local
mkdir test_local
cd test_local
git init
echo first > file
git add file
git ci -m'initial'
git submodule add ../test_remote remote
cd remote
echo modify remote >> file
git ci -am'submodule change'
gvim file +Gitv
cd -
The .git file for the submodule is just a text file with the actual location of the .git repo:
$ cat /tmp/tester/test_local/remote/.git
gitdir: /tmp/tester/test_local/.git/modules/remote
Versions:
$ git --version
git version 1.7.9.5
$ cd ~/.vim/bundle/gitv/ ; git log --oneline -1
582e32b Handle a commit having "[" in the message when yanking the sha.
$ cd ../fugitive ; git log --oneline -1
b0c74e2 Support localized `git status`
When I run Gitv! from a file, a blank preview-window opens called "gitv-* [RO]" (where the * is a number like 1, 2, etc). Does anyone have any ideas about why I am not seeing the file history in this window?
I get this error when pressing O
on a commit in browser mode:
Error detected while processing function <SNR>69_OpenGitvCommit..<SNR>69_MoveIntoPreviewAndExecute..<SNR>69_AttemptToCreateAPreviewWindow:
line 5:
No preview window detected.
Aside from that error, the commit is correctly opened in a new tab. I'm not sure why it's trying to use a preview window (or what would be in the preview window).
Using CR
opens the commit in the right pane without error. So I guess something with the new tab handling is trying and failing to open a preview window.
press <Enter>
on gitv's --[plugin/vim.vim]--
can back to opened file.
But after I do press D
on two commits. then, gitv will give out a diff. but I failed to back to file when I press <Enter>
on --[plugin/vim.vim]--
.
This is not a big problem. But still hope gitv can solve this.
Sometimes when browsing history (= I have open browsing mode, and clicking return at commits) appears this :
Error detected while processing function 65_BufReadObject..65_ReplaceCmd:
line 26:
E325: ATTENTION
Error detected while processing function 59_OpenGitvCommit:
line 26:
E171: Missing :endif
For me it appear everytime, when I try open commit 0eaefff from this repository (https://github.com/gregsexton/gitv.git )
Is it possible to change the appearance of the log, for example
Could this be done with a vim variable (or several variables)?
I checked out vim help document, and try some keys like S
, but shows diff state weird.
I think the diff state in file mode should only current file's diff state.
So, I did play a bit with gitv and I have somes questions/suggestions:
So far the plugin is great! I realised it pretty much made the extradite plugin useless?!
Anyway, thanks a lot! It's a sweet plugin!
Philippe
Issuing :Gitv somedir/ fails with this error:
fatal: bad flag '--no-color' used after filename
I quite frequently filter commits by specific directories or files and it would be nice to see the log with gitv.
Hi, I'm using <C-l>
(along with <C-h>
, <C-j>
, and <C-k>
) to navigate windows in vim. <C-l>
is mapped inside the gitv preview window and I cannot come up with a good way to revert it.
Could you perhaps add some configuration where I can disable any bindings I want removed or show me a good way to revert this?
While looking through the source, I stumbled upon s:fugitive_GitComplete. It doesn't sort the output keys. Is this function out of date? There's a comment "These functions are lifted directly from fugitive and modified only to work with gitv." but I can't tell what was modified to make them work with gitv. Are they supposed to be verbatim?
function! s:fugitive_GitComplete(A,L,P) abort "{{{
if !exists('s:exec_path')
let s:exec_path = s:fugitive_sub(system(g:fugitive_git_executable.' --exec-path'),'\n$','')
endif
let cmds = map(split(glob(s:exec_path.'/git-*'),"\n"),'s:fugitive_sub(v:val[strlen(s:exec_path)+5 : -1],"\\.exe$","")')
if a:L =~ ' [[:alnum:]-]\+ '
return fugitive#buffer().repo().superglob(a:A)
elseif a:A == ''
" Fugitive behavior: return sort(cmds+keys(s:repo().aliases()))
return cmds
else
" Fugitive behavior: return filter(sort(cmds+keys(s:repo().aliases())),'v:val[0:strlen(a:A)-1] ==# a:A')
return filter(cmds,'v:val[0 : strlen(a:A)-1] ==# a:A')
endif
endfunction "}}} }}}
Just like what you said in article http://www.gregsexton.org/2011/05/gitv-range/
This doesn’t always work perfectly. For example, if you choose a function that has recently had it’s arguments changed it won’t match that function for long. Once the arguments change in the start line no more commits will match. This is easily solved by pressing enter on either the start or end regex. Vim will prompt you to alter the line to any regex you like.
But I do now know how to get into this "Altering the range".
I hope Gitv commands can support Tab to completion. like complete arguments, for instance:
:Gitv! --sin<Tab>
--> :Gitv! --since=
etc
AWESOME PLUGIN, just what I've been looking for! :Gitv! rules
One suggestion, if there is even one obnoxiously long commit message the buffer is so wide I have to keep hitting $ and ^ to see which names and dates line up with which commits.
An option to wrap or truncate messages would be great. Bonus points for a keystroke to view commit details in case you want to read the whole giant commit message.
I visual selected a block of text. and run command:
:`<,`>Gitv!
And press i
on a commit message try to show the diff. But get error.
Here is the error in :message
Error detected while processing function <SNR>151_OpenGitvCommit..<SNR>151_MoveIntoPreviewAndExecute..<SNR>151_RecordBufferExecAndWipe:
line 3:
E492: Not an editor command: Gedit 25348c1
Hi @gregsexton
1.1 tag seems to have commits 2 years old.
Perhaps 1.2 could be released so distributions can catch up?
Cool plugin, just found it by checking out Tpope's page. So yeah, a few issues: normal q doesn't work in browser-mode and because the '!' character doesn't expand abbreviations (i thought it did...) and gitv! isn't associated with an abbreviation, vim spits out an error message.
Umm... just tried it again and it worked fine after reloading vim. Still would suggest to create the abbreviation as it wasn't expanding the abr. for some reason.
Will play with it more. Cool stuff.
Problem is in plugin/gitv.vim:
cabbrev gitv Gitv
This abbreviation is too general and easy to trigger when undesired. It triggers in searches and other commands.
For example, if I'm searching :h gitv
for the gitv browser
, my search becomes the Gitv browser
and has no results. (I use smartcase
.)
Or :grep gitv -R .
becomes :grep Gitv -R .
This can be avoided with this recipe: Replace a builtin command using cabbrev
I'm not sure if this is related to fugitive or gitv, but when viewing commits in gitv, the patches do not correctly strip out color or display color:
^[[1mdiff --git a/setup.py b/setup.py^[[m
^[[1mindex c323a41..2de261b 100644^[[m
^[[1m--- a/setup.py^[[m
^[[1m+++ b/setup.py^[[m
^[[36m@@ -31,7 +31,7 @@^[[m ^[[msetup(^[[m
(Obviously, special characters converted to text)
This is on git 1.7.4.1, and the HEAD of master for both vim-fugitive (f112f9b830a8f42375183c9a47965270ae8b3ae4) and gitv (efe9404).
Andrew
Please prevent folding when first displaying gitv. After zo
, on each subsequent pressing of RETURN, it no longer folds.
Unfortunately many servers are setup with vim's that do not have this, which makes the 'yc' expand map choke on the "+,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.