Mark files from telescope #592
Replies: 1 comment
-
I think I have figured this out. I'm not happy with You'll need to modify your telescope config. This will only work with pickers for files. There is a way to make mappings picker specific, but I'm not going to include that. This function is defined before telescopes setup method local harpoon_add_mark = function(prompt_bufnr)
local entry = require("telescope.actions.state").get_selected_entry()
local list = require("harpoon"):list()
local harpoon_config = list.config
local item = harpoon_config.create_list_item(harpoon_config, entry[1])
list:add(item)
end this is the relevant portion of the setup method: require("telescope").setup({
defaults = {
mappings = {
i = {
["<C-r>"] = harpoon_add_mark,
},
n = {
["<C-r>"] = harpoon_add_mark,
},
},
},
}) I haven't tested this that much and I am using my fork of harpoon which stores marks by their absolute path rather than their relative path from cwd, but I think it should work with the current default config as well. For reference, this is the commit is where I added it to my config. |
Beta Was this translation helpful? Give feedback.
-
I am a neovim newbie and I do not know how I can bring my ideas to live.
I want a way to be able to search for files, select those files and send them to harpoon or just send the one under the cursor to harpoon.
I'll be glad if anyone could give me some hints and how to get going and I'll Google search my way around. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions