mirror of
https://github.com/kristoferssolo/telescope-frecency.nvim.git
synced 2025-10-21 20:10:38 +00:00
Enable to specify tags to show the tails (#77)
* Enable to specify tags to show the tails * Add doc for show_filter_column
This commit is contained in:
parent
3ef3d6cabe
commit
9634c3508c
@ -145,6 +145,15 @@ See [default configuration](https://github.com/nvim-telescope/telescope.nvim#tel
|
||||
|
||||
Disable devicons (if available)
|
||||
|
||||
- `show_filter_column` (default: `true`)
|
||||
|
||||
Show the path of the active filter before file paths. In default, it uses the tail of paths for `'LSP'` and `'CWD'` tags. You can configure this by setting a table for this option.
|
||||
|
||||
```lua
|
||||
-- show the tail for "LSP", "CWD" and "FOO"
|
||||
show_filter_column = { "LSP", "CWD", "FOO" }
|
||||
```
|
||||
|
||||
|
||||
### Example Configuration:
|
||||
|
||||
|
||||
@ -94,10 +94,15 @@ local frecency = function(opts)
|
||||
|
||||
fetch_lsp_workspaces(state.previous_buffer)
|
||||
|
||||
local function should_show_tail()
|
||||
local filters = type(state.show_filter_column) == "table" and state.show_filter_column or { "LSP", "CWD" }
|
||||
return vim.tbl_contains(filters, state.active_filter_tag)
|
||||
end
|
||||
|
||||
local function get_display_cols()
|
||||
local directory_col_width = 0
|
||||
if state.active_filter then
|
||||
if state.active_filter_tag == "LSP" or state.active_filter_tag == "CWD" then
|
||||
if should_show_tail() then
|
||||
-- TODO: Only add +1 if opts.show_filter_thing is true, +1 is for the trailing slash
|
||||
directory_col_width = #(utils.path_tail(state.active_filter)) + 1
|
||||
else
|
||||
@ -160,7 +165,7 @@ local frecency = function(opts)
|
||||
if state.show_filter_column then
|
||||
local filter_path = ""
|
||||
if state.active_filter then
|
||||
if state.active_filter_tag == "LSP" or state.active_filter_tag == "CWD" then
|
||||
if should_show_tail() then
|
||||
filter_path = utils.path_tail(state.active_filter) .. os_path_sep
|
||||
else
|
||||
filter_path = Path:new(state.active_filter):make_relative(os_home) .. os_path_sep
|
||||
|
||||
Loading…
Reference in New Issue
Block a user