mini.nvim icon indicating copy to clipboard operation
mini.nvim copied to clipboard

Maintain relative directory in plugins which open buffers

Open ldelossa opened this issue 1 year ago • 1 comments

Contributing guidelines

Module(s)

mini.start, mini.pick, (maybe others...)

Description

As described here: https://github.com/echasnovski/mini.nvim/discussions/1038#discussioncomment-10011047

Various mini.nvim plugins do not maintain relative directories when opening buffers. This results in vim's buffer command having fully qualified paths (or close to that) and not relative paths when showing open buffers.

mini.nvim should preserve relative paths when opening buffers by opening them relative and not fully qualified.

ldelossa avatar Jul 10 '24 16:07 ldelossa

Thanks for the suggestion!

I'll take a look.

echasnovski avatar Jul 10 '24 16:07 echasnovski

This should (finally) be resolved on latest main. Fixing it for 'mini.starter' was relatively straightforward (although required some experimentation for the case when there is a swap file for the path), but MiniExtra.pickers.lsp required custom hacky workaround as I couldn't even find why a "normal" vim.fn.bufadd(vim.fn.fnamemodify(path, ':.')) doesn't work inside on_list option of vim.lsp.buf methods.

echasnovski avatar Jan 23 '25 09:01 echasnovski

Awesome! Yes I remember certain scenarios with this specific topic being a bit of a pain. Thanks for the effort :)

ldelossa avatar Jan 23 '25 12:01 ldelossa