Closed Otterpatsch closed 4 months ago
Hi @Otterpatsch, not sure if this is still relevant, but you can take inspiration from how gitlab.nvim does this: You can focus the file panel and then use the diffview.lib.get_current_view()
to get the current view and then you should be able to view:set_file(file)
.
You would be reaching into the internal API for this, which could change at any point. But I believe you could do this (untested):
local DiffView = require("diffview.scene.views.diff.DiffView").DiffView
local async = require("diffview.async")
async.void(function()
local view = require("diffview.lib").get_current_view()
if view and DiffView:ancestorof(view) then
--- @cast view DiffView
async.await(view:set_file_by_path("some/file/path"))
end
end)()
The file path here would be relative to the repository top-level. That can be found from view.adapter.ctx.toplevel
.
Hello there, First of all i very much like your plugin. So much that im trying to use it within the plugin im trying to create (bitbucket.nvim basically just to review PRs of bitbuckets repos).
So i want to jump to a file of the file panel given its relative(or absolut if needed) file path
For example i would like to jump to the file to which a comment is connected
I tried to dig into your code but as im just picked up lua like 4 days ago im struggle a bit. select_entry = function() So how to i "fake" a item for the linked function? Or is there maybe another function which does that?