Replies: 5 comments 4 replies
-
https://github.com/ibhagwan/fzf-lua?tab=readme-ov-file#insert-mode-completion Set cursor on any path-like item and |
Beta Was this translation helpful? Give feedback.
-
Just to start with, I think this is a great plugin. The complete_path function does not use the ripgrep style search mechanism. If I use complete_file with grep style searching, when I finally select something, the file gets loaded into a buffer and I can edit it. That's not what I want. When I select something I just want the path string inserted in the first document. I hope this makes sense. |
Beta Was this translation helpful? Give feedback.
-
Hi again. I'm really not much of a lua coder. This is what I've got so far. vim.keymap.set({ "i" }, "<C-x><C-f>",
function()
require("fzf-lua").fzf_exec(
function()
require("fzf-lua").live_grep({
-- cmd = "rg --files",
winopts = { preview = { hidden = "nohidden" } },
complete = true
})
end
, {
exec_empty_query = true,
}) end , { silent = true, desc = "Fuzzy" }
)
This is fine, but it does something I don't want, which is to include all this extra stuff in the output. It prints the path of the file to my document, but it also prints the web devicon and the line number corresponding to the line the text shows up in the file. I would really like just the path info. Is there an easy way to do this?? |
Beta Was this translation helpful? Give feedback.
-
that works like a charm, except the pasted path replaces all the text in that line, whereas I'd like it to be inserted at the cursor. vim.keymap.set({ "i" }, "<C-x><C-f>",
function()
require("fzf-lua").live_grep({
complete = function(selected, opts, line, col)
return require'fzf-lua'.path.entry_to_file(selected[1]).path
end
})
end
, {})
|
Beta Was this translation helpful? Give feedback.
-
thank you. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have this use case where I want to search for a path, and use ripgrep. I'd like to be able to hit a keymap combination and see the rg boxes on the screen and use rg to find the file I'm looking for, and then when I select it, instead of opening that file, having the path for the file inserted at the cursor.
I feel this might be useful when searching for things like hashtags in documents.
Is this possible?
Beta Was this translation helpful? Give feedback.
All reactions