Ensure fzf-lua opens files relative in neovim

This commit is contained in:
Daniel Siepmann 2023-03-08 14:30:02 +01:00
parent d87b854c49
commit 2180d98970
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
2 changed files with 18 additions and 0 deletions

View file

@ -217,6 +217,7 @@ in {
plugin = fzf-lua.overrideAttrs (old: {
patches = (old.patches or []) ++ [
./neovim/patches/fzf-lua-colors.patch
./neovim/patches/fzf-lua-path.patch
];
});

View file

@ -0,0 +1,17 @@
See:
- https://github.com/ibhagwan/fzf-lua/issues/678
- https://github.com/ibhagwan/fzf-lua/pull/679
diff --git a/lua/fzf-lua/path.lua b/lua/fzf-lua/path.lua
index ff5a79b..22b3923 100644
--- a/lua/fzf-lua/path.lua
+++ b/lua/fzf-lua/path.lua
@@ -234,6 +234,7 @@ function M.entry_to_file(entry, opts, force_uri)
if cwd and #cwd > 0 and not isURI and
not M.starts_with_separator(stripped) then
stripped = M.join({ cwd, stripped })
+ stripped = M.relative(stripped, vim.fn.getcwd())
end
-- #336: force LSP jumps using 'vim.lsp.util.jump_to_location'
-- so that LSP entries are added to the tag stack