r/neovim • u/NazgulResebo • 21h ago
Tips and Tricks Minimal mark picker
35
Upvotes
I'm using this tiny marks config (just 14 lines). What do you think? Is it better to just use the picker from Telescope/Fzf, or should we go with the barebones approach (:marks and m + LETTER)?
Anyway, I'm surprised by how easy it is to build a mark picker using the Neovim API!
-- set mark mLETTER
-- show marks sm
local function show_marks()
local marks = vim.fn.getmarklist()
local list = vim.tbl_map(function(m)
return m.mark .. " -> " .. m.file
end, marks)
vim.ui.select(list, { prompt = "Marks" }, function(item, index)
if index == nil then return end
vim.cmd("normal! " .. marks[index].mark)
end)
end
vim.keymap.set("n", "sm", show_marks)