Closed rbong closed 2 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.
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.
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.
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.
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 :)
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:
New dark colorscheme:
Old light colorscheme:
New light colorscheme:
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.
I found a decent way to compare highlight performance.
v2 while scrolling through a large repo:
v3 while scrolling through a large repo:
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:
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!
I added accurate commit highlighting in v3, see this comment for a rundown: https://github.com/rbong/vim-flog/issues/66#issuecomment-2311562481
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.
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.
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.
Added a couple last minute improvements:
vim.fn["flog#ExecTmp"]()
is now available as require("flog").exec_tmp()
.flog#Exec('cmd', blur, static, tmp)
to flog#Exec('cmd', { 'blur': blur, 'static': static, 'tmp': tmp })
.
This is a change I wanted to make for a while but I realized it also allows for a much easier deprecated usage detection when coming from v2.
Sorry to those who already had to change flog#Exec()
and now have to change it again.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.
Flog
v3
is coming. Any testing and feedback you can give is appreciated.Here's how it looks:
Some of the changes are already on
master
, but to use all of the features switch to branchv3
. Ex. in Neovim, using pckr.nvim:Alternatively if you want none of these changes for now, please switch to v2.1.0.
Major improvements:
master
). This currently requires the Kitty terminal or flog-symbols. These symbols make merges and forks clearer and make the graph prettier.master
).master
). The Rust repo now loads with 20,000 commits in0.38
seconds Previously, it loaded in0.58
seconds, making this case a more than 1.5x improvement. Performance improvements are non-linear and are better the more commits are included in the output.-auto-update
option to automatically update Flog when there are any changes to the repository (Neovim only).Other enhancements:
y<C-X>
,y<C-T>
. These removes any of the new concealed characters from the yanked text.-default-expanded
and-default-collapsed
options (already onmaster
).g>
,g<
(already onmaster
).-patch
based on implied value if it was not previously set (already onmaster
).-skip
using]]
/[[
(already onmaster
).g:flog_num_branch_colors
g:flog_enable_extra_padding
master
).master
).flog#Version()
to make it easier for plugin authors to detect the version.:Flogsp
as an abbreviation for:Flogsplit
.:Flogspc
as an abbreviation for:Flogsplitcommit
.:Flog
in the current tab if it is empty by default.flog#Exec()
API to be clearer and have better defaults.:Floggit
. Previously, focus returned to the commit graph window by default. This makes the command work similarly to:Git
.Other fixes:
g:flog_jumplist_default_mappings
) silent.Migration instructions:
:Floggit
commands, change:Floggit -f
or:Floggit --focus
to:Floggit
. Change:Floggit
commands that don't use these flags to:Floggit -b
or:Floggit --blur
.flog#Exec()
andflog#ExecTmp()
functions now uses a dictionary for options. Change any references fromflog#Exec(cmd, focus, static, tmp)
toflog#Exec(cmd, { 'blur': !focus, 'static': static, 'tmp': tmp })
.focus
option forflog#Exec()
has been changed toblur
, which has the opposite function. Changeflog#Exec(cmd)
orflog#Exec(cmd, 0)
toflog#Exec(cmd, { "blur": 1 })
. Changeflog#Exec(cmd, 1)
toflog#Exec(cmd, { "blur": 0 })
orflog#Exec(cmd)
.flog#Exec()
with custom functions, be aware temporary windows no longer close dynamically. This means that previous temporary windows close if you setopts.tmp
to true, whether you actually open windows or not. If your command opens temporary windows non-deterministically, please use lower-level functions.g:flog_num_branch_colors
to9
.New configuration options:
g:flog_enable_extended_chars
to1
. This currently requires the Kitty terminal or flog-symbols.g:flog_enable_dynamic_commit_hl
to1
.g:flog_enable_dynamic_branch_hl
to0
.sudo sysctl fs.inotify.max_user_watches=524288
g:flog_permanent_default_opts.auto_update
to1
. (Neovim only)init.lua
file, you may want to switch to the new Lua wrapper functions. For example,vim.fn['flog#ExecTmp']()
is now available asrequire('flog').exec_tmp()
.