From 3592b1f8b0ca207462bf945af52026e592afda30 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 28 Sep 2020 17:03:59 -0400 Subject: fix: 126 --- lua/telescope/make_entry.lua | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'lua/telescope/make_entry.lua') 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) -- cgit v1.2.3