Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The path to open files is always displayed as an absolute path #2803

Closed
epheien opened this issue Jun 13, 2024 · 5 comments
Closed

The path to open files is always displayed as an absolute path #2803

epheien opened this issue Jun 13, 2024 · 5 comments
Labels
duplicate Tracked via another issue feature request

Comments

@epheien
Copy link

epheien commented Jun 13, 2024

Description

The path to open files is always displayed as an absolute path.
NERDTree work fine.

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

Operating system and version

macOS 12.7.5

Windows variant

No response

nvim-tree version

2086e56

Clean room replication

vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvt-min/site]]
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
  require("packer").startup {
    {
      "wbthomason/packer.nvim",
      "nvim-tree/nvim-tree.lua",
      "nvim-tree/nvim-web-devicons",
      -- 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
if vim.fn.isdirectory(install_path) == 0 then
  print "Installing nvim-tree 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 setup()]]
vim.opt.termguicolors = true
vim.opt.cursorline = true

-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
  require("nvim-tree").setup {}
end

Steps to reproduce

  1. nvim -u nvt-min.lua
  2. cd ~/.vim
  3. :NvimTreeOpen
  4. select init.vim and press <CR>
  5. <C-g>

Expected behavior

"init.vim" xxxx lines --0%-- message in cmdline

Actual behavior

"~/.vim/init.vim" xxxx lines --0%-- message in cmdline

@epheien epheien added the bug Something isn't working label Jun 13, 2024
@CcccX2017
Copy link

I have the same problem with nvim 0.9.5 and lunarvim 1.4-release
image
I just want to show the 'HelloWorld' folder as the root path

@epheien
Copy link
Author

epheien commented Jun 13, 2024

In open_in_new_window() function in open-file.lua

local fname = utils.escape_special_chars(vim.fn.fnameescape(filename))

will be

local fname = utils.escape_special_chars(vim.fn.fnameescape(vim.fn.fnamemodify(filename, ':.')))

but nvim-tree will change cwd, so open_in_new_window() function need vim_cmd parameter

epheien pushed a commit to epheien/nvim-tree.lua that referenced this issue Jun 13, 2024
@gegoune
Copy link
Collaborator

gegoune commented Jun 13, 2024

That was discussed in the past, please search other issues but from top of my head it's a noop.

@alex-courtis
Copy link
Member

alex-courtis commented Jun 15, 2024

@CcccX2017 you can change the vim/nvim-tree root at startup to match your requirements, see wiki Open At Startup for recipes.

@alex-courtis
Copy link
Member

@epheien see #2127 for the feature that will meet your requirements. PRs are always welcome.

Closing as duplicate.

@alex-courtis alex-courtis added feature request duplicate Tracked via another issue and removed bug Something isn't working labels Jun 15, 2024
epheien pushed a commit to epheien/nvim-tree.lua that referenced this issue Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Tracked via another issue feature request
Projects
None yet
Development

No branches or pull requests

4 participants