rbong / vim-flog

A blazingly fast, stunningly beautiful, exceptionally powerful git branch viewer for Vim/Neovim.
750 stars 22 forks source link

Flog v2 #73

Closed rbong closed 1 year ago

rbong commented 2 years ago

Requests for changes in v2 and feedback on planned changes welcome.

Major changes:

Deprecations:

Progress:

Prerequisites for finalizing:

kevinhwang91 commented 2 years ago

Thanks, look like the bottleneck is Git diff HEAD commit. It's not relate to flog.

rbong commented 2 years ago

@kevinhwang91 sorry I wasn't more clear, it's a little bit related to Flog, as :Git! causes the command to load instantly, and previously :Floggit had no way to use :Git!.

Fixing this had a cascading effect on changing the API. I wanted to make these changes anyways.

:Floggit has new flags:

:Floggit! no long opens the command in a temporary window, since there's now a flag for that. It now calls :Git! instead, which opens the command in the background.

flog#Exec()/flog#ExecTmp() no longer format commands. You can now do that with flog#Format().

So you can remap bindings now using this format:

nno ... :<C-U>exec flog#Format("Floggit -f -u -t ...")<CR>

Instead of this:

nno ... :<C-U>call flog#Exec("Floggit ...", 1, 1, 1)<CR>

However I wouldn't change your bindings to use Floggit!. I've noticed there are some window bugs in Fugitive. Also in long commands, it causes a lot of lag while the command is finishing, and it takes a lot longer than not using !.

At least it's possible now, and I got to make some changes I wanted to make.

kevinhwang91 commented 2 years ago

exec flog#Format('vertical belowright Floggit -f -u -t diff HEAD %h') is also slow, does it mean the bottleneck is fugitive?

rbong commented 2 years ago

No, the problem is not Fugitive. The changes were not meant to fix the problem, just make :Git! and :Floggit! do the same thing.

kevinhwang91 commented 2 years ago

Thanks, got it.

I found the culprit is my ftplugin/git.vim

setlocal foldmethod=expr
setlocal foldexpr=DiffFold()
setlocal foldlevel=1

function! DiffFold()
    let line = getline(v:lnum)
    if line =~# '^\(diff\|index\)' " file
        return '0'
    elseif line =~# '^--- .*$'
        return '>1'
    elseif line =~# '^==== .*$'
        return '>1'
    elseif line =~# '^@@' " hunk
        return '>2'
    elseif line =~# '^\*\*\* \d\+,\d\+ \*\*\*\*$' " context: file1
        return '>2'
    elseif line =~# '^--- \d\+,\d\+ ----$' " context: file2
        return '>2'
    else
        return '='
    endif
endfunction

It's slow for a large git file.

rbong commented 2 years ago

I don't know if I like that you now have to enter :Floggit -u to update the buffer. I might make it update the buffer by default and replace the option with one that doesn't update the buffer.

rbong commented 2 years ago

I changed it. Sorry if this is inconvenient.

Changes in arguments to :Floggit:

Changes to flog#Exec/flog#ExecTmp:

No deprecation warnings because it's still in alpha.

If you're having trouble keeping track of all the changes, I'm keeping the v2 Migration Guide up to date.

bodograumann commented 2 years ago

Great work on this tool and especially v2. Looking forward to diving ever deeper into the possibilities.

rbong commented 1 year ago

Flog v2 has been merged to the master branch and released.

Unfortunately GitHub has no ways to alias branches, so the v2 branch has been deleted. Please switch back to the master branch if you were already using it.

For other problems, see this issue or post a new issue.