feat(marks): add support for displaying marks according to the mark_type (#2775)

* Fixes: #2763

* clean up docs type annotations

---------

Co-authored-by: LUCIANO FURTADO <l.furtado@f5.com>
Co-authored-by: James Trew <j.trew10@gmail.com>
This commit is contained in:
LUCIANO FURTADO
2023-11-14 20:42:17 -06:00
committed by GitHub
parent 20bf20500c
commit 4e77d1991d
2 changed files with 12 additions and 1 deletions

View File

@@ -1074,7 +1074,17 @@ internal.marks = function(opts)
local marks_table = {}
local marks_others = {}
local bufname = vim.api.nvim_buf_get_name(opts.bufnr)
for _, cnf in ipairs { local_marks, global_marks } do
local all_marks = {}
opts.mark_type = vim.F.if_nil(opts.mark_type, "all")
if opts.mark_type == "all" then
all_marks = { local_marks, global_marks }
elseif opts.mark_type == "local" then
all_marks = { local_marks }
elseif opts.mark_type == "global" then
all_marks = { global_marks }
end
for _, cnf in ipairs(all_marks) do
for _, v in ipairs(cnf.items) do
-- strip the first single quote character
local mark = string.sub(v.mark, 2, 3)

View File

@@ -359,6 +359,7 @@ builtin.colorscheme = require_on_exported_call("telescope.builtin.__internal").c
--- Lists vim marks and their value, jumps to the mark on `<cr>`
---@param opts table: options to pass to the picker
---@field file_encoding string: file encoding for the previewer
---@field mark_type "all"|"global"|"local": filter marks by type (default: "all")
builtin.marks = require_on_exported_call("telescope.builtin.__internal").marks
--- Lists vim registers, pastes the contents of the register on `<cr>`