Giter Club home page Giter Club logo

Comments (12)

junegunn avatar junegunn commented on August 18, 2024 3

So here is what I came up with:

function! s:gl(buf, l1, l2)
  if !exists(':Gllog')
    return
  endif
  tab split
  silent! execute a:l1 == 1 && a:l2 == line('$') ? '' : "'<,'>" 'Gllog'
  call setloclist(0, insert(getloclist(0), {'bufnr': a:buf}, 0))
  b #
  lopen
  xnoremap <buffer> o :call <sid>gld()<cr>
  nnoremap <buffer> o <cr><c-w><c-w>
  nnoremap <buffer> q :tabclose<cr>
  call matchadd('Conceal', '^fugitive:///.\{-}\.git//')
  call matchadd('Conceal', '^fugitive:///.\{-}\.git//\x\{7}\zs.\{-}||')
  setlocal concealcursor=nv conceallevel=3 nowrap
endfunction

function! s:gld() range
  let [to, from] = map([a:firstline, a:lastline], 'split(getline(v:val), "|")[0]')
  execute 'tabedit' to
  execute 'vsplit' from
  windo diffthis
endfunction

command! -range=% GL call s:gl(bufnr(''), <line1>, <line2>)

:GL will open a new tab, pressing o over a visual range of revisions will show the split diff between the top and the bottom.

EDIT: Added support for range

from gv.vim.

justinmk avatar justinmk commented on August 18, 2024

You can already do that with fugitive.vim.

from gv.vim.

luisdavim avatar luisdavim commented on August 18, 2024

Yes, but gitv makes it easy to compare revisions whilst browsing through the revisions.

from gv.vim.

junegunn avatar junegunn commented on August 18, 2024

You can list the commits for the current file only with :GV!, but no, there's no such "file mode".

:Glog from fugitive gives a similar view, so maybe we can think of a solution based on it.

Related? tpope/vim-fugitive#329

from gv.vim.

luisdavim avatar luisdavim commented on August 18, 2024

That sounds like what I'm looking for.

Thanks.

from gv.vim.

junegunn avatar junegunn commented on August 18, 2024

Also remembered that I liked that bit from gitv. I'll let you know if I come up with something.

from gv.vim.

luisdavim avatar luisdavim commented on August 18, 2024

Awesome, thanks.

from gv.vim.

luisdavim avatar luisdavim commented on August 18, 2024

Thanks! Did you add this to the code?

from gv.vim.

junegunn avatar junegunn commented on August 18, 2024

Haven't decided if I should add this to gv.vim or not. I currently have it on my vimrc.

from gv.vim.

luisdavim avatar luisdavim commented on August 18, 2024

It is an extra feature that adds functionality to the plugin why would you not?
Meanwhile I'll keep it in my vimrc.

Thanks.

from gv.vim.

junegunn avatar junegunn commented on August 18, 2024

Because in principle it's an extension of fugitive rather than gv.

from gv.vim.

luisdavim avatar luisdavim commented on August 18, 2024

Isn't that what GV is?

from gv.vim.

Related Issues (20)

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.