mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 19:28:24 +00:00
feat(picker): getters and setters for cwd
This commit is contained in:
parent
32be045f41
commit
2c2ff4caf8
2 changed files with 15 additions and 0 deletions
|
@ -43,6 +43,12 @@ function M.new(picker)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param cwd string
|
||||||
|
function M:set_cwd(cwd)
|
||||||
|
self.cwd = cwd
|
||||||
|
self.cwd = vim.fs.normalize(self.cwd --[[@as string]], { _fast = true })
|
||||||
|
end
|
||||||
|
|
||||||
---@param opts? {trim?:boolean}
|
---@param opts? {trim?:boolean}
|
||||||
---@return snacks.picker.Filter
|
---@return snacks.picker.Filter
|
||||||
function M:clone(opts)
|
function M:clone(opts)
|
||||||
|
|
|
@ -592,6 +592,15 @@ function M:hist_record(force)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:cwd()
|
||||||
|
return self.input.filter.cwd
|
||||||
|
end
|
||||||
|
|
||||||
|
function M:set_cwd(cwd)
|
||||||
|
self.input.filter:set_cwd(cwd)
|
||||||
|
self.opts.cwd = cwd
|
||||||
|
end
|
||||||
|
|
||||||
--- Move the history cursor
|
--- Move the history cursor
|
||||||
---@param forward? boolean
|
---@param forward? boolean
|
||||||
function M:hist(forward)
|
function M:hist(forward)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue