Code Monkey home page Code Monkey logo

gv.vim's Introduction

gv.vim

A git commit browser.

gv

gitv is nice. But I needed a faster, and possibly simpler alternative that I can use with a project with thousands of commits.

Installation

Requires fugitive.

Using vim-plug:

Plug 'tpope/vim-fugitive'
Plug 'junegunn/gv.vim'

Usage

Commands

  • :GV to open commit browser
    • You can pass git log options to the command, e.g. :GV -S foobar -- plugins.
  • :GV! will only list commits that affected the current file
  • :GV? fills the location list with the revisions of the current file

:GV or :GV? can be used in visual mode to track the changes in the selected lines.

Mappings

  • o or <cr> on a commit to display the content of it
  • o or <cr> on commits to display the diff in the range
  • O opens a new tab instead
  • gb for :GBrowse
  • ]] and [[ to move between commits
  • . to start command-line with :Git [CURSOR] SHA à la fugitive
  • q or gq to close

Customization

¯\_(ツ)_/¯

gv.vim's People

Contributors

amadeus avatar attomos avatar gauteh avatar idbrii avatar junegunn avatar justinmk avatar maujim avatar mckellyln avatar pgdouyon avatar rsrchboy avatar sbromling avatar shofel avatar vais avatar wookayin avatar yous avatar zeiran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gv.vim's Issues

":GV": consider opening tab *before* current tab

In fugitive's :Gstatus window, cvc/cva opens its tab before the current tab, so that closing the tab returns to the correct original tab. When I q out of a :GV tab, it returns to the wrong tab. Any opposition to following fugitive's behavior?

Press enter twice on the same commit will create a "[no name]" buffer

When enter is pressed on a commit, a split window will appear to show the info about this commit.
But if the enter is pressed again on the same commit, there will be a empty "[no name]" buffer created.
It can be checked by the :ls command.

here is the reproduce mini vimrc:

set nocompatible
set nobackup
set hidden

filetype plugin indent on
syntax enable
syntax on

call plug#begin('~/.vim/plug')

Plug 'junegunn/gv.vim', {'on': 'GV'}
Plug 'tpope/vim-fugitive'

call plug#end()

GV doesn't seem to work with worktrees

I'm getting this message when I try this on a git worktree

Error detected while processing function <SNR>39_gv[13]..<SNR>54_repo_tree[3]..<SNR>54_throw:
line    1:
E605: Exception not caught: fugitive: no work tree
Error detected while processing function <SNR>39_gv[13]..<SNR>54_repo_tree:
line    3:
E171: Missing :endif

Is this expected? Am I doing something wrong?

I'm on commit:

○ → git describe --all --long HEAD
heads/master-0-g72dc64d

Conflicting '?' error with plug 'on' configuration

adding any of the following configuration to my vimrc

Plug 'junegunn/gv.vim', { 'on': ['GV?', 'GV!'] }
Plug 'junegunn/gv.vim', { 'on': 'GV?' }

causes vim to fail to start with the following error

Error detected while processing function plug#end:
line   61:
E182: Invalid command name
Press ENTER or type command to continue

using it without ? works fine

Default diffs to unfolded

Amazing plugin. Thanks for making it.

When I open commits with <cr>, the diff info in the commit details pane on the right is folded. How can I make it unfolded by default?

Location list shows commits for a second

When running :GV? command, the commits populate for a second, but then seem to get overrided by ale populating the location list with lint/syntax errors. I'm at work so I haven't had a chance to explore the plugin, but I'll report on whether I'm able to find out why, unless you or anyone else have an immediate idea as to why this may be occurring.

Edit (6/21/18): I can confirm that Ale plugin is conflicting with my setup. Works fine with Ale disabled.

Error with latest fugitive

Hi! With latest fugitive I'm getting the followin error when pressing Enter on a commit:

Error detected while processing function <SNR>58_open[1]..<SNR>58_type[21]..FugitiveGenerate:
line    1:
E605: Exception not caught: Use FugitiveFind() instead
Error detected while processing function <SNR>58_open[1]..<SNR>58_type:
line   21:
E171: Missing :endif

Thanks in advance for looking into it.

Question: How to map the vizual selection range command

He

While mapping normal GV command is simple.

nnoremap <leader>gv :<C-u>GV<CR>

I have problems mappings the command with a range of selected lines. The one below seems not to work.

xnoremap <leader>gv :<C-u>'<,'>GV<CR>

Can you help me with that?

add format option

hi! thank you for handy tool)
it would be nice to be able to change some format option. for example, i would like to add the author name, i.e. %an placeholder.

Commit diff is not triggered on enter

Hi @junegunn, I've noticed that pressing enter on a commit message doesn't show the giff anymore. I don't if this has something to with fugitive recent changes or something else:

jul-21-2018 11-57-48

Can you reproduce it? Thanks!

not in git repo error ?

Hi, thank you for gv, it is awesome, I use it almost every day.
Since perhaps the most recent fugitive update (just guessing) however it seems gv no longer works ok. I always get the error: not in git repo

This code perhaps no longer determines the git dir correctly ?:

function! s:git_dir()
  if empty(get(b:, 'git_dir', ''))
    return fugitive#extract_git_dir(expand('%:p'))
  endif
  return b:git_dir
endfunction

I will start to debug. @tpope fyi.

Operations on commits

Hi,

Could you implement other actions on commit items such as

  • reset --hard (with confirmation)
  • reset --soft
  • revert
  • format-patch

Unknown function: systemlist

When I run :GV, I receive the following error, and it's unable to continue:

Error detected while processing function <SNR>38_gv:
line   13:
E117: Unknown function: systemlist
E15: Invalid expression: systemlist('git rev-parse --show-toplevel')[0]

I'm running on Windows, and fugitive works as well as a few of your other plugins that I use. Any ideas?

Commit content displays with folded diff

When pressing 'o' or on a commit to display the content of it, the content displays with folded diffs. I think it would be preferable to show the diff unfolded - is there already an option for this that I may have overlooked. Otherwise - great plugin with just the minimal features you always use - easy at hand.

New mapping request in tree type window

Dear Junegunn!

Please consider the situation when one browsing a git tree. It is easy to drill down through the directories, but it’s not obvious how one could go up a level to the parent directory. Running the following command will open the parent tree:

:edit %:h

This problem first addressed by Drew Neil, in his vimcast blog. Drew proposed the following solution:

autocmd User fugitive 
  \ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
  \   nnoremap <buffer> .. :edit %:h<CR> |
  \ endif

However, instead of copy pasting this, I'd like this snippet to be integrated into gv.vim plugin.
The plugin already maps ., so good mapping candidate for this would be just u same as in NERDTree plugin. I think it is pretty obvious to press u, while in tree buffer, to go one level up.

fugitive#detect() deprecated

I got a message: "Third party code is using fugitive#detect() which has been removed. Contact the author if you have a reason to still use it"

So I contacted with you 😅

Revisit the age old "unfolded diff" issue

Similar comments have been made on similar plugins (mostly fugitive itself) and twice here (#30 and #5).

I actually quite appreciate folds. Especially with the addition of the <C-N> and <C-P> mappings, I really like being able to scroll through the history and seeing only commit messages and affected file names. And it's perfect that my cursor stays in the browser window!

However, when I do want to see unfolded diffs, 100% of the time I am jumping to the diff window and unfolding it. While the stripped-down nature of this plugin is why I've settled on it over the alternatives, it would be nice if there was an included mapping that could accomplish this (I suggest go and its gO sibling). Even if its inclusion avoids this discussion ever coming up again, I'd say it's a win 😺

I'm currently solving this with: au FileType GV nnoremap go :normal o<cr><bar>:wincmd w<cr><bar>:normal! zR<cr>. It ain't winning any vim golf awards, but it works.

Diff two arbitrary commits

Hi,

In a process similar to the linediff plugin, would it be possible to select two arbitrary commits and display in a new split the differences between them ?

Colored tree structure

On the command line I use the following command to get a similar view of the history as provided by this plugin:

git log --pretty=format:'%C(auto)%h %cd (%G?) %C(green)[%an]%C(auto)%d%Creset %s' --date=short --graph --full-history --all

This results in a colored representation of the tree structure:
image

It would be nice if this was also available in GV.

Pressing o on commit displays an error

I have neovim + fugitive + GV.
When pressing o on a commit inside the GV window, I get the following error:

Error detected while processing function 182_open:
line 11:
E16: Invalid range: 6190d7945f749d4228f868b4a1d59bc6ed7df3da
Press ENTER or type command to continue

After pressing enter I have an empty split open

Shortcut for next/prev commit

Hi, thank you for GV. I was using Gitv but didn't work that well.

Is there a way to have shortcuts for next/prev commit?

Error when there is some spaces in the path

Hi,
Love this git commit browser, however I have a problem when there is some spaces in the file path :

Error detected while processing function <SNR>28_open:
line   11:
E172: Only one file name allowed: e fugitive:///Users/... containing spaces .../.git//609db6f

Could you fix it ? Or is this coming from me ?

Thanks

Pressing o on commit loses colour syntax

I always start my GV with options like so :
:GV --decorate --all

, which shows colourful git logs.

But when I open a commit by pressing o or /enter, I see my commits on my left with colours, but lose colours in my log tree.

Any help?

Vim(return):E700: Unknown function: <SNR>38_LogParse

I am on Neovim v0.3.8 using the latest vim-fugitive and gv.vim on MacOS and I get the error from the title whenever I do :GV? in any git controlled file. I added some echom to gv.vim and the line that fails is silent execute a:visual ? "'<,'>" : "" 'Gllog' in s:gl. The echom in fugitive are never reached, I placed them in

function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort
function! fugitive#LogComplete(A, L, P) abort
function! s:CompleteSub(subcommand, A, L, P, ...) abort

Running :Gllog manually works and all other :GV commands work as well.

Don't see diff on commit

image

Hi, in the file, I use :GV! and I will see only list commits that affected the current file. But next, I use o and I don't see commit content. I check all my repo, this problem everything.

How I fix it? Thanks.

Add an ability to filter branches

Hey Junegunn,

would it be possilbe to add a functionality to have all lists of branches on either left/right and you can select :
all
branch A
branch B

and toggle them to see the branch you selected only?
This would be so useful in case you have messy branch structure.
Also it would be useful when you have multiple features being developed at the same time.

Cheers!

Chris

Show only list of modified files

Hi,

Would it be possible, when doing on a item, to somehow refresh the list and show beneath the commit the list of files modified/added/deleted etc, much like a git diff --name-status would return ?

Doing on a modified file could open a new split with only the differences for the selected file.

Thanks !

Filter list items

Hi,

Would it be possible to implement some sort of filtering:

  • by author
  • by date
  • by branch
  • by any string (git log -S option)

Thanks !

File mode?

Hi, gitv has a file mode where we can compare, side by side two revisions of the same file, is this possible with gv.vim? If not, are you planing to implement anything like it?

Thanks.

New tab position

execute (tabpagenr()-1).'tabnew'

Is there any reason why the new tab is put in the left of the current tab? This makes quitting gv bring user to another tab rather than the original tab starting gv.

GV! -> fatal: bad flag '--color=never' used after filename

To rep:

  • clone gv.vim and cd gv.vim
  • open vim
  • :e plugin/gv.vim
  • :GV!
  • This opens a scratch buffer with one line of text: fatal: bad flag '--color=never' used after filename

Using the "GV" command without the bang seems to work just fine (brings up the tree view)

System details:
gv.vim at sha: 84b61f0
Lubuntu 15.04
lxterminal
git version 2.1.4
Fugitive is up-to-date (sha: fd36aa9)
Both Fugitive and gv.vim are installed with Pathogen

Default tab place

GV opens a new tab on the left of the current tab by default 47
It would be nice to add an option such that user can specify the new tab is created on the right of the current tab.

GV from within a GV tab causes duplicated git history

Loading GV from within a GV causes duplicated git history. Seems to only be a problem if the two GV commands are identical.

With minimal vimrc ~/.vim/reprovimrc.vim:

let s:plugins = ['sensible']
let s:plugins += ['fugitive']
let s:plugins += ['git-gv']

set runtimepath-=~/.vim
set runtimepath-=~/.vim/after
set runtimepath-=~/vimfiles
set runtimepath-=~/vimfiles/after
for plugin in s:plugins
    exec "set runtimepath^=~/.vim/bundle/". plugin
    exec "set runtimepath+=~/.vim/bundle/". plugin ."/after"
endfor
set viminfofile=NONE

On latest gv run :GV twice:

$ git show --oneline
61d877d (HEAD -> master) Disable modelines in scratch buffers (#81)
$ vim -Nu ~/.vim/reprovimrc.vim -U NONE +GV +GV +g/master\)
$ vim -Nu ~/.vim/reprovimrc.vim -U NONE +"GV --all" +"GV --all"  +g/master\)

You'll see the master branch shows up twice in both cases.

Cosmetic improvement

Hi,

I know this is not really important and I understand if you ignore my erquest.
The git log graph from https://github.com/gregsexton/gitv looks a little bit better in my opinion, specially because it does not have trailing spaces in the lines without text and the paths are colored.

Could you change the git log parameters to address this?
Thanks,
Luis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.