Closed briandipalma closed 1 year ago
Before working on a PR, check if :h diffview-actions-goto_file_edit
isn't what you're looking for (it sounds like it is).
Yes, it looks like it is. It doesn't answer the workflow concerns. I'd argue the two should be swapped around, gf
should call goto_file_edit
and goto_file
should be unmapped. I think opening a split should be the awkward option. Imagine opening nvim in a fresh branch/worktree that you want to review, opening diffview and gf
ing a file. You end up in your original tab with a split that has the file you want on one side and above it the empty/blank launch page or a greeter like alpha-nvim.
As you go from the diffview tab to your editor tab you have to keep closing splits. It's just more effort for no benefit that I can see. It can also be awkward if you are working on a lower resolution screen like a laptop, splits are the last thing you want as they end up quite small. So I'd still like to change the current behaviour if that's OK?
The keymaps are configurable. You can change the default behavior of gf
in your own config:
local actions = require("diffview.actions")
require("diffview").setup({
keymaps = {
view = {
{ "n", "gf", actions.goto_file_edit },
},
file_panel = {
{ "n", "gf", actions.goto_file_edit },
},
},
})
The reason why goto_file
works the way it does is that it's less destructive this way. Less likely to cause unexpected side effects. Although it is now, it didn't always use to be that 'hidden'
was enabled by default. Meaning that abandoning a buffer would cause it to unload.
I also personally prefer the way goto_file_edit
works, and I might decide to make it the default behavior at some point in the future, seeing as 'hidden'
has been enabled by default for a while now. If you would like to open a PR changing the default, I'd accept it.
Great plugin, I've been looking for something that plugs the holes in lazygit for a long time.
I'd like to use
diffview
for my code reviews. So far my workflow is:DiffviewOpen origin/main...HEAD
gf
to rewrite juniors code :rofl:I'd like to cut out 5. I think Neovim's default
gf
behaviour is an easier workflow. If I raise a PR that makes the required changes (including the help panel description text) would you accept it?