summaryrefslogtreecommitdiff
path: root/lua/telescope/make_entry.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-28 17:03:59 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-09-28 17:03:59 -0400
commit3592b1f8b0ca207462bf945af52026e592afda30 (patch)
tree9e522af7e92425e5050a47a8367043a0af844b56 /lua/telescope/make_entry.lua
parent079773ebee5f18f55c72856049c1a332dabe28e2 (diff)
fix: 126
Diffstat (limited to 'lua/telescope/make_entry.lua')
-rw-r--r--lua/telescope/make_entry.lua14
1 files changed, 3 insertions, 11 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index 1d159be..c62df79 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -1,9 +1,9 @@
local has_devicons, devicons = pcall(require, 'nvim-web-devicons')
+local path = require('telescope.path')
local utils = require('telescope.utils')
local get_default = utils.get_default
-local os_sep = utils.get_separator()
local make_entry = {}
@@ -198,7 +198,7 @@ function make_entry.gen_from_buffer(opts)
local make_display = function(entry)
local display_bufname
if opts.shorten_path then
- display_bufname = utils.path_shorten(entry.filename)
+ display_bufname = path.shorten(entry.filename)
else
display_bufname = entry.filename
end
@@ -209,17 +209,9 @@ function make_entry.gen_from_buffer(opts)
return function(entry)
local bufnr_str = tostring(entry)
- local bufname = vim.api.nvim_buf_get_name(entry)
+ local bufname = path.normalize(vim.api.nvim_buf_get_name(entry), cwd)
-- if bufname is inside the cwd, trim that part of the string
- if bufname:sub(1, #cwd) == cwd then
- local offset = 0
- -- if cwd does ends in the os separator, we need to take it off
- if cwd:sub(#cwd, #cwd) ~= os_sep then
- offset = 1
- end
- bufname = bufname:sub(#cwd + 1 + offset, #bufname)
- end
local position = get_position(entry)