telescope-file-browser.nvim
telescope-file-browser.nvim copied to clipboard
'path_display' telescope opt doesn't work properly with the file-browser
Description

Neovim version
NVIM v0.8.0-dev-1000-gc0050b71e
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by inferno@InfernoPC
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/share/nvim"
Operating system and version
Artix Linux
Steps to reproduce
nvim -u minimal_conf.lua
Expected behavior
To have only one slash at the end "/"
Actual behavior
Instead it has two slashes at the end "//"
Minimal config
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
require('packer').startup {
{
'wbthomason/packer.nvim',
{
'nvim-telescope/telescope.nvim',
requires = {
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-file-browser.nvim',
},
},
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
},
config = {
package_root = package_root,
compile_path = install_path .. '/plugin/packer_compiled.lua',
display = { non_interactive = true },
},
}
end
local layout = require('telescope.actions.layout')
local previewers = require("telescope.previewers")
local sorters = require("telescope.sorters")
_G.load_config = function()
require('telescope').setup({
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = ":: ",
selection_caret = "> ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "descending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
mirror = false,
height = 20,
},
vertical = {
mirror = false,
width = 0.5
},
},
file_sorter = sorters.get_fuzzy_file,
file_ignore_patterns = {},
generic_sorter = sorters.get_generic_fuzzy_sorter,
winblend = 10,
border = {},
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
color_devicons = true,
use_less = true,
path_display = { "smart" },
-- set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil,
file_previewer = previewers.vim_buffer_cat.new,
grep_previewer = previewers.vim_buffer_vimgrep.new,
qflist_previewer = previewers.vim_buffer_qflist.new,
mappings = {
i = {
["<C-]>"] = layout.toggle_preview,
-- ["<C-]>"] = layout.cycle_layout_next,
},
}
-- Developer configurations: Not meant for general override
-- buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
},
extensions = {
file_browser = {
hijack_netrw = true,
},
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
},
},
["ui-select"] = {
require("telescope.themes").get_dropdown({
-- even more opts
}),
},
pickers = {
find_files = {
find_command = {
"fd",
"--type",
"f",
"--strip-cwd-prefix",
"-E",
"*cache*"
},
},
},
})
require('telescope').load_extension('file_browser')
-- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
print("Installing Telescope and dependencies.")
vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
Does it happen with a true minimal config?
My best guess is to try commenting out
path_display = { "smart" },
and see whether it works then.
Yes , that was it ! Should i leave this issue open , since i don't think it's an intended behavior of the path_display = { "smart" } ?
Yes , that was it ! Should i leave this issue open , since i don't think it's an intended behavior of the
path_display = { "smart" }?

path_display = { "tail" }
is also broken , and the others I tried also have some strange behaviors.
I noticed that the buildin pickers of telescope follow the path_display as expected but file-browser seems to have a hard time with them.
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
require('packer').startup {
{
'wbthomason/packer.nvim',
{
'nvim-telescope/telescope.nvim',
requires = {
'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-file-browser.nvim',
},
},
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
},
config = {
package_root = package_root,
compile_path = install_path .. '/plugin/packer_compiled.lua',
display = { non_interactive = true },
},
}
end
_G.load_config = function()
require('telescope').setup({
defaults = {
path_display = { "tail" },
},
})
require('telescope').load_extension('file_browser')
-- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
print("Installing Telescope and dependencies.")
vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
Here is the minimal config i managed to make to reproduce the issue.
I also just had this same thing happen. It works on my other PC but when I pulled it to this one from git I started getting double slashes at the end of folders as well.
Am also facing the same issue with "smart" path_display option in telescope;