kyazdani42 / nvim-tree.lua

A file explorer tree for neovim written in lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

update_focused_file not working when path contains spaces

SimonMandlik opened this issue · comments

OS
macOS 12.1

Neovim version
NVIM v0.6.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey

Nvim-tree version
nvim-tree branch, commmit or tag number
master

Describe the bug
When the path contains spaces, e.g.:

~/With Space
└── test.txt

the file focusing is not working for me

nvim-tree config:

local g = vim.g

g.nvim_tree_quit_on_open = 1 -- closes the tree when you open a file
g.nvim_tree_indent_markers = 1 -- shows indent markers when folders are open
g.nvim_tree_add_trailing = 1 -- append a trailing slash to folder names
g.nvim_tree_group_empty = 1 -- compact folders that only contain a single folder into one node
g.nvim_tree_special_files = {} -- List of filenames that gets highlighted with NvimTreeSpecialFile

require'nvim-tree'.setup {
    view = {
        width = 40,
        mappings = {
            custom_only = true, -- only mappings specified above
            list = NVIM_TREE_MAPPINGS
        }
    },
    auto_close = true,
    update_cwd = true,
    diagnostics = {
        enable = true,
    },
    update_focused_file = {
        enable = true,
        update_cwd = false,
    },
}

cannot reproduce, is this still relevant ?

i don't use plenary, is this issue actually happening with nvim-tree ? update_focused_file works fine for me in files with spaces.

Or maybe you are working with macos, so the issue is with uppercase in your foldernames (macos doesn't distinguish uppercase and lowercase in its filesystem...)

The difference is that when I open the file with telescope :echo expand('%') returns /Users/simon.mandlik//With space/with space.txt whereas when opened from nvim-tree it returns /Users/simon.mandlik/With space/with space.txt

Is the isue with the additional / ? i don't see any difference otherwise, and i don't understand why it is a nvim-tree issue ?

No, I will close this as this problem is resolved once the issue linked above is.

I have narrowed this down to the following:

The following buffer works:

:ls
  1 %a   "~/With space/with space.txt"  line 1

whereas the following doesn't:

:ls
  1 %a   "~//With space/with space.txt" line 1

The weird path in the second case is caused by nvim-telescope/telescope.nvim#1662, but as far as I know it is still a valid unix path.

thanks for the clarification :)

ezoic increase your site revenue