rbong / vim-flog

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

v3 available for testing/feedback #135

Closed rbong closed 2 months ago

rbong commented 3 months ago

Flog v3 is coming. Any testing and feedback you can give is appreciated.

Here's how it looks:

screen-graph

Some of the changes are already on master, but to use all of the features switch to branch v3. Ex. in Neovim, using pckr.nvim:

require('pckr').add({
  { 'rbong/vim-flog', branch = 'v3' }
})

Alternatively if you want none of these changes for now, please switch to v2.1.0.


Major improvements:

Other enhancements:

Other fixes:

Migration instructions:

New configuration options:

rbong commented 3 months ago

v3 highlighting should be much faster already. I'm recording lower resource usage for it than the old highlight system, although it's hard to precisely measure.

Still, if Flog has always been slow on scroll for you, please share your results.

rbong commented 3 months ago

As of now, I'm changing the branch drawing strategy in v3 to have horizonal lines cut across vertical lines instead of the other way around. I am explaining my thinking below, but I still want feedback.

As of 42b2d51, merges from an existing branch into a commit were simplified:

OLD:

├─┴┬┊─┤
│  ╰┤ │

NEW:
├─┴─┤─┤

It was the other way before - honestly because I just didn't think of the current way before.

This has saved us a lot of vertical space and, frankly, weird looking graphs, but it has made the profile of this type of merge less noticeable.

I didn't notice this until v3 added proper branch highlighting. I have debugged countless cases like this - I couldn't figure out why the branch at the bottom left changed color. Usually when there is only one parent and a commit branch moves to the left, the color will continue with it.

example 1

It turns out not to be a bug. It's because this is a merge commit, so the branch is actually a different branch that was merged into another branch, not a continuation of the parent. This is much more obvious if horizontal lines cut across branches, rather than the other way around.

example 2

It might seem way more obvious when you zoom in on this example, but this is about reading the graph quickly.

If you don't like this, please make your voice heard! Also, if you're not sure, try it out and see if you like it. Thank you.

rbong commented 3 months ago

Added more intelligent branch color selection. New branches will be distinct from the ones to the left, right, above, and from the current merge. This should make it easier to tell branches apart and keep things from being visually "clustered". Note that branches of the same color can end up next to each other if a branch moves, but this is the only case :)

2024-08-21-045129_123x440_scrot

rbong commented 3 months ago

Just pushed new default colorschemes. The old colorschemes had duplicate colors in terminal mode. They had very similar colors that were hard to distinguish in GUI mode, sometimes right next to each other. The colors were not consistent across GUI mode, terminal mode, and brightness modes.

There are now only 8 branch colors. I struggled to find 9 consistently distinct colors that worked, but I am open to any suggestions.

Old dark colorscheme:

old dark

New dark colorscheme:

new dark

Old light colorscheme:

old light

New light colorscheme:

new light

Old terminal colors:

# Dark
magenta
green
yellow
cyan
red
yellow
green
cyan
magenta

# Light
darkyellow
darkgreen
blue
darkmagenta
red
darkyellow
darkgreen
blue
darkmagenta

New terminal colors:

# Dark
green
yellow
darkyellow
blue
cyan
magenta
darkmagenta
red

# Light
darkgreen
darkyellow
yellow
darkblue
darkcyan
darkmagenta
magenta
darkred

As always let me know what you think.

rbong commented 2 months ago

I found a decent way to compare highlight performance.

v2 while scrolling through a large repo:

flog_v2_usage

v3 while scrolling through a large repo:

flog_v3_usage

This doesn't fully capture how much better the v3 experience is, there is much more screen tearing with v2. I don't know why.

Most of the bad performance comes from lingering regex based syntax highlighting. I hope to remove some of that. Here it is with no regex based syntax highlighting:

flog_v3_no_regex_usage

rbong commented 2 months ago

I added the :Flog -auto-update option for Neovim. This will listen to the Git directory for any changes and automatically update the buffer.

If you want to set it by default, you can add this to your init.lua:

vim.g.flog_permanent_default_opts = { auto_update = 1 }

You may find it useful to increase the maximum number of file watches if you are on Linux:

sudo sysctl fs.inotify.max_user_watches=524288

Please let me know of any bugs, questions, or feedback.

I have only one major feature I still want to add in v3, then I will leave some more time for testing. I anticipate being ready in the next 2-3 weeks to call it ready. Any help testing it is greatly appreciated!

rbong commented 2 months ago

I added accurate commit highlighting in v3, see this comment for a rundown: https://github.com/rbong/vim-flog/issues/66#issuecomment-2311562481

rbong commented 2 months ago

Put out what is likely the last version of v2: v2.1.0 It's before any of the recent performance and branch drawing changes on master as well.

Also made a fairly small but wide reaching change: by default, :Floggit/flog#Exec() will retain focus on the window instead of returning it to the graph. This makes it much closer to :Git.

You can use :Floggit -b or :Floggit --blur and flog#Exec(cmd, 1) to return the focus to the commit graph window instead.

rbong commented 2 months ago

All the information has been moved to the ticket description to hopefully make it easier to sort through the changes. This include a screenshot of all the changes and configuration instructions.

rbong commented 2 months ago

Testing and documentation is finished, so outside of any other fixes, v3 is ready. I'll wait for any final feedback or bugs and release sometime next week.

rbong commented 2 months ago

Added a couple last minute improvements:

rbong commented 2 months ago

Added a couple new format specifier items with flog#Format(), it shouldn't impact anything else.

%(h'x,'y) gets all the hashes in the range of commit marks x and y.

%P gets paths prefixed with --, or just returns -- if no path options are specified.

I'm using both of these in my init.lua:

vim.api.nvim_create_autocmd("FileType", {
  group = vim.api.nvim_create_augroup("MyFlogSettings", {}),
  pattern = "floggraph",
  callback = function()
    -- Act like <Tab> if the path is set, act like <CR> otherwise
    vim.keymap.set("n", "<CR>", ":<C-U>exec flog#Format('vertical belowright Floggit -b -s -t show %h %P')<CR>", { buffer = true, silent = true })

    vim.keymap.set("n", "cp", ":<C-U>call flog#Exec(flog#Format('Floggit cherry-pick %h'))<CR>", { buffer = true, silent = true })
    vim.keymap.set("v", "cp", ":<C-U>call flog#Exec(flog#Format(\"Floggit cherry-pick %(h'>,'<)\"))<CR>", { buffer = true, silent = true })
  end,
})

I don't want to replace the default behaviour of <CR> because Gsplit is slightly different from Floggit show, and I don't want to add default cp bindings to avoid future mapping conflicts with Fugitive, but I did want to add these to make customization a little easier.

rbong commented 2 months ago

v3 is out.