mirror of
https://github.com/kristoferssolo/telescope-frecency.nvim.git
synced 2025-10-21 20:10:38 +00:00
only call os_home once; conditionally replace homedir
This commit is contained in:
parent
e52c61c312
commit
84443967fc
@ -13,8 +13,9 @@ local path = require('telescope.path')
|
|||||||
local pickers = require "telescope.pickers"
|
local pickers = require "telescope.pickers"
|
||||||
local sorters = require "telescope.sorters"
|
local sorters = require "telescope.sorters"
|
||||||
local utils = require('telescope.utils')
|
local utils = require('telescope.utils')
|
||||||
|
local frecency_utils = require("telescope._extensions.frecency.util")
|
||||||
|
|
||||||
-- local os_path_sep = vim.loop.os_uname().sysname == "Windows" and "\\" or "/"
|
local os_home = vim.loop.os_homedir()
|
||||||
local os_path_sep = utils.get_separator()
|
local os_path_sep = utils.get_separator()
|
||||||
local show_scores = false
|
local show_scores = false
|
||||||
local db_client
|
local db_client
|
||||||
@ -55,8 +56,9 @@ local frecency = function(opts)
|
|||||||
|
|
||||||
filename = path.make_relative(filename, cwd)
|
filename = path.make_relative(filename, cwd)
|
||||||
|
|
||||||
local homedir = vim.loop.os_homedir()
|
if frecency_utils.string_starts(filename, os_home) then
|
||||||
filename = "~/" .. path.make_relative(filename, homedir)
|
filename = "~/" .. path.make_relative(filename, os_home)
|
||||||
|
end
|
||||||
|
|
||||||
display_items = show_scores and {{entry.score, "Directory"}} or {}
|
display_items = show_scores and {{entry.score, "Directory"}} or {}
|
||||||
table.insert(display_items, {filename, hl_filename})
|
table.insert(display_items, {filename, hl_filename})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user