Nerdtree: Missing first character in tree structure

Created on 13 Nov 2018  路  7Comments  路  Source: preservim/nerdtree

Environment

  • Operating System: Ubuntu 14.04 TLS
  • Vim version :version: 7.4
  • NERDTree version git rev-parse --short HEAD: f406af3
  • NERDTree settings applied in your vimrc, if any:
    vim

Process

  1. Start Vim

  2. Open NERDTree

Current Result

In directory tree I miss first character of all files and directories names.

Expected Result


I miss the full name of files and directories.

Screenshot(s)

vim_nerdtree

Possible Fix

Most helpful comment

Try setting this variable, and see what happens. A recent pull request changed the way directory names and filenames are kept separate from the rest of the text on the line in NERDTree. Changing the delimiter from a non-breaking space (\u00a0) to a tab might be all that's needed.

let NERDTreeNodeDelimiter = "\t"

All 7 comments

Try setting this variable, and see what happens. A recent pull request changed the way directory names and filenames are kept separate from the rest of the text on the line in NERDTree. Changing the delimiter from a non-breaking space (\u00a0) to a tab might be all that's needed.

let NERDTreeNodeDelimiter = "\t"

Thank you, setting the variable NERDTreeNodeDelimiter to a tab fixed the problem.

I don't understand why the non-breaking space is causing this symptom though. I'm using iTerm2 with Character Encoding set to "Unicode (UTF-8)" and my $LANG is set to en_US.UTF-8.

Under what circumstances does the non-breaking space cause a problem, and in what circumstances does it work as intended?

I will be updating the NERDTree documentation soon, and probably writing a wiki page with more details. I've seen several scenarios where the nbsp isn't working as intended:

  1. It's being used in place of the arrows. See #904.
  2. It's being "eaten up" by other plugins that reformat an expanded definition of whitespace that includes nbsp. See #913.
  3. Non-English languages/encodings may interpret \u00a0 differently. See #911.

With the increasing number of issue related to this change, I may need to choose a different default value for this setting.

I have found that (in Vim 7.4) the cause of the issue is in the following syntax command:
https://github.com/scrooloose/nerdtree/blob/c905a5d7b87051e574c2e72fae57e56c456ba2f4/syntax/nerdtree.vim#L41
If one comment out this line, all file/directory names are displayed OK (but the delimiter character from the NERDTreeNodeDelimiter becomes unconcealed). It is perhaps a bug in Vim syntax highlighting processing which eats out the next character after matching xA0 (u00A0) in a syntax pattern with conceal option.
For example the same issue is observed for xFF character as a NERDTreeNodeDelimiter value.
With uFEFF - zero width no-break space - all works fine, but it is a non-ascii symbol, and there may be problems with non utf-8 setting for Vim's encoding option or for non utf-8 user's locale.

Also, to minimize weird pattern-context effects when composing the string based on the user input value of NERDTreeNodeDelimiter, I would suggest to modify it in the following way:

exec 'syn match NERDTreeNodeDelimiters #\%d' . char2nr(g:NERDTreeNodeDelimiter) . '# conceal containedin=ALL'

@mmaxs, I merged pull request #926 last night, which includes your suggestion to use char2nr(). I also changed the default delimiter to "\x07", the non-printable character BELL. Let me know how that works for you.

Thank you, Phil. It works OK in Vim 7.4 and in just upgraded one to 8.1

Was this page helpful?
0 / 5 - 0 ratings