Nerdtree: Symlinked One-Child Directories Not Useable

Created on 17 Oct 2017  Â·  7Comments  Â·  Source: preservim/nerdtree

Environment:

  • Operating System: Mac 10.12.6 (16G29)
  • Vim version: 8.0.1175
  • NERDTree version: 8a6ae7c
  • NERDTree settings applied in your vimrc, if any:
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

map <leader>n :NERDTreeToggle<cr>
let NERDTreeShowHidden=1

Process:

  1. Create a a directory with a single child directory (mkdir -p dir_1/child_dir_1)
  2. Create a symlink directory to dir_1 (ln -s ./dir_1 symlink_dir_1)
  3. Create a file_1 in child_dir_1 (echo -n "dir_1/child_dir_1/file_1" > dir_1/child_dir_1/file_1)
  4. Open vim and the nerdtree explore
  5. Navigate to a symlink_dir_1 and press enter to expand it
  6. Open file_1

Current Result:

Nothing happens at all.

Expected Result: _Describe what you would expect to have resulted from this process._

The file in the symlinked directory should open and allow for editing.

Additional Info

The same issues occurs for any directories within the symlinked directory. If you press enter to attempt to expand them, nothing happens.

bug

All 7 comments

This appears to be directly related to NERDTreeCascadeSingleChildDir. If it is set to 1 then I'm unable to enter symlinked directories or open files within.

Two things:

  1. Would you include a sample directory hierarchy so that we can replicate your bug and all discuss the same problem?
  2. I don't have access to a Mac, so debugging will be tough for me. I work on Linux and Windows. I know that, on Windows, shortcuts to directories don't seem to work properly in the NERDTree.

No guarantees here, but, if we can confirm the bug, that's a good start.

@lifecrisis: I just updated the "Process" section to include steps for the directory structure, but I've also included screenshots below.


screen shot 2017-10-17 at 9 04 35 am
NERDTreeCascadeSingleChildDir=1 results in not being able to access files/directories


screen shot 2017-10-17 at 9 06 00 am
NERDTreeCascadeSingleChildDir=0 allows for accessing files/directories properly

Well, you've done your due diligence here. Thanks!

I'll label this as a confirmed bug, but know that this is actually somewhat complex to fix. You'll likely have to live without cascading for the time being if you symlink a lot of directories. I don't know when I or someone else will be able to get to this.

I can't personally confirm on my own system (because I don't have a Mac), but I've had problems with linking directories on Windows, so this is clearly an area where the NERDTree needs more work.

Note: I just confirmed this on Ubuntu 16.04 as well. So, this is definitely a problem on all three platforms.

I can confirm this bug as well. Below is what I see with the 4 combinations of NERDTreeCascadeSingleChildDir and NERDTreeCascadeOpenSingleChildDir. There have been a lot of other issues related to these options, one of which appear to be a workaround for the other one. See #547 and #558. Plenty of opportunity to fix it once and for all.

let NERDTreeCascadeSingleChildDir =     1
let NERDTreeCascadeOpenSingleChildDir = 1

</junk/testing_symlinks2/
â–¾ dir_1/child_dir_1/
    file_1
    file_2
â–¾ symlink/ -> /Users/prunninger/junk/testing_symlinks2/dir_1/child_dir_1/
    file_1
    file_2

---------------------------------------------------------------------------

let NERDTreeCascadeSingleChildDir =     1
let NERDTreeCascadeOpenSingleChildDir = 0

</junk/testing_symlinks2/
â–¾ dir_1/child_dir_1/
    file_1
    file_2
â–¸ symlink/ -> /Users/prunninger/junk/testing_symlinks2/dir_1/child_dir_1/

---------------------------------------------------------------------------

let NERDTreeCascadeSingleChildDir =     0
let NERDTreeCascadeOpenSingleChildDir = 1

</junk/testing_symlinks2/
â–¾ dir_1/
  â–¾ child_dir_1/
      file_1
      file_2
â–¾ symlink/ -> /Users/prunninger/junk/testing_symlinks2/dir_1/
  â–¾ child_dir_1/
      file_1
      file_2

---------------------------------------------------------------------------

let NERDTreeCascadeSingleChildDir =     1
let NERDTreeCascadeOpenSingleChildDir = 1

</junk/testing_symlinks2/
â–¾ dir_1/child_dir_1/
    file_1
    file_2
â–¾ symlink/ -> /Users/prunninger/junk/testing_symlinks2/dir_1/child_dir_1/
    file_1
    file_2

It's been a while since I've looked at this. A solution wasn't too hard to implement. Check out pull request #914, and see if it solves your issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevinSuttle picture kevinSuttle  Â·  4Comments

fncll picture fncll  Â·  4Comments

kristijanhusak picture kristijanhusak  Â·  3Comments

PinheiroCosta picture PinheiroCosta  Â·  4Comments

nicknick63 picture nicknick63  Â·  6Comments