Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(builtin.marks): add support for cwd and cwd_only options #3324

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lua/telescope/builtin/__internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,13 @@ internal.marks = function(opts)
end
marks_table = vim.fn.extend(marks_table, marks_others)

if opts.cwd_only or opts.cwd then
local cwd = opts.cwd_only and vim.loop.cwd() or opts.cwd
marks_table = vim.tbl_filter(function(row)
return buf_in_cwd(row.filename, cwd)
end, marks_table)
end

pickers
.new(opts, {
prompt_title = "Marks",
Expand Down
2 changes: 2 additions & 0 deletions lua/telescope/builtin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ builtin.colorscheme = require_on_exported_call("telescope.builtin.__internal").c
---@param opts table: options to pass to the picker
---@field file_encoding string: file encoding for the previewer
---@field mark_type string: filter marks by type (default: "all", options: "all"|"global"|"local")
---@field cwd string: specify a working directory to filter marks list by
---@field cwd_only boolean: if true, only show marks in the current working directory (default: false)
builtin.marks = require_on_exported_call("telescope.builtin.__internal").marks

--- Lists vim registers, pastes the contents of the register on `<cr>`
Expand Down
Loading