Closed lucky-bai closed 1 year ago
@luckytoilet Hey mate sorry to ping you on this issue, I can confirm this problem happens when you are accessing WSL files from Windows, I suggest you use Vim inside of the WSL for editing those files as NERDTree has no idea that it is working on files in a Linux machine and may result in some unwanted issues. I suggest that you update your NERDTree and set this flag NERDTreeCaseSensitiveFS
to 1 to prevent some of these problems.
I don't think your case is general enough to change the NERDTree to work nicely in this environment, as it comes with the cost of rebuilding the tree. On the other hand, NERDTree is highly customizable you can just overwrite the u
binding to something like this to fix your problem:
function! NERDTreeCustomCWD(dirnode)
call a:dirnode.path.getParent().changeToDir()
call NERDTreeCWD()
endfunction
function! NERDTreeCustomCWDBinding()
call NERDTreeAddKeyMap({
\ 'key': 'u',
\ 'callback': 'NERDTreeCustomCWD',
\ 'quickhelpText': 'cd to the parent directory',
\ 'scope': 'DirNode' })
endfunction
autocmd VimEnter * call NERDTreeCustomCWDBinding()
read more about this with :help NERDTreeAddKeyMap
.
I'm going to close this issue, feel free to open it if you have any further questions.
Steps to reproduce:
\\wsl.localhost\Ubuntu-20.04\home\bai\blah\test.txt
:NERDTree
)u
shortcut)Expected behavior: I should see my files in
\\wsl.localhost\Ubuntu-20.04\home\bai
, but it appears empty in the NERDTree explorer.My VIM version: 8.2, using GVim and Windows 11. Not sure which version of NERDTree I have, but installed it sometime in 2021.