mirror of
https://github.com/kristoferssolo/telescope-frecency.nvim.git
synced 2025-10-21 20:10:38 +00:00
fix: respect telescope's path_display (#196)
This commit is contained in:
parent
46c5358929
commit
f8a89691c8
27
README.md
27
README.md
@ -243,6 +243,33 @@ See [default configuration](https://github.com/nvim-telescope/telescope.nvim#tel
|
||||
timestamps when you open the file. It is reasonable to set this value more
|
||||
than or equal to the default value: `10`.
|
||||
|
||||
- `path_display` (default: `nil`)
|
||||
|
||||
Overwrite the `path_display` setting in telescope.nvim itself. See
|
||||
`:h telescope.defaults.path_display` for acceptable values. This setting will
|
||||
be used by these priorities below.
|
||||
|
||||
1. Option specified with the command or Lua code.
|
||||
- `:Telescope frecency path_display={"absolute"}`.
|
||||
- or `:lua require("telescope").extensions.frecency.frecency { path_display = { "absolute" } }`.
|
||||
2. `opts.extensions.frecency.path_display` in setup.
|
||||
3. `opts.defaults.path_display` in setup.
|
||||
|
||||
```lua
|
||||
require("telescope").setup {
|
||||
defaults = {
|
||||
-- This has the 3rd precedence.
|
||||
path_display = { "absolute" },
|
||||
},
|
||||
extensions = {
|
||||
frecency = {
|
||||
-- This has the 2nd precedence.
|
||||
path_display = { "shorten" },
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
- `recency_values` (default: see below)
|
||||
|
||||
Set weighting factors for calculating “frecency”. This option does not affect
|
||||
|
||||
@ -18,6 +18,7 @@ local Config = {}
|
||||
---@field matcher "default"|"fuzzy" default: "default"
|
||||
---@field scoring_function fun(recency: integer, fzy_score: number): number default: see lua/frecency/config.lua
|
||||
---@field max_timestamps integer default: 10
|
||||
---@field path_display? table default: nil
|
||||
---@field show_filter_column boolean|string[] default: true
|
||||
---@field show_scores boolean default: false
|
||||
---@field show_unindexed boolean default: true
|
||||
@ -75,6 +76,7 @@ Config.new = function()
|
||||
ignore_patterns = true,
|
||||
matcher = true,
|
||||
max_timestamps = true,
|
||||
path_display = true,
|
||||
scoring_function = true,
|
||||
show_filter_column = true,
|
||||
show_scores = true,
|
||||
|
||||
@ -96,7 +96,7 @@ function Picker:start(opts)
|
||||
path_display = function(picker_opts, path)
|
||||
return self:default_path_display(picker_opts, path)
|
||||
end,
|
||||
}, opts or {}) --[[@as FrecencyPickerOptions]]
|
||||
}, config_values, opts or {}) --[[@as FrecencyPickerOptions]]
|
||||
self.workspace = self:get_workspace(opts.cwd, self.config.initial_workspace_tag or config.default_workspace)
|
||||
log.debug { workspace = self.workspace }
|
||||
|
||||
@ -272,11 +272,6 @@ function Picker:filepath_formatter(picker_opts)
|
||||
opts.cwd = workspace or self.fs.os_homedir
|
||||
|
||||
return function(filename)
|
||||
local path_display = config_values.path_display
|
||||
if type(path_display) == "table" and path_display.filename_first then
|
||||
opts.path_display = path_display
|
||||
end
|
||||
|
||||
return utils.transform_path(opts, filename)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user