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

Cannot Open Files Whose Filename Includes a Dollar Sign #420

Closed
dwtj opened this issue Feb 18, 2015 · 6 comments
Closed

Cannot Open Files Whose Filename Includes a Dollar Sign #420

dwtj opened this issue Feb 18, 2015 · 6 comments

Comments

@dwtj
Copy link

dwtj commented Feb 18, 2015

If I try to use nerdtree to open a file whose file name includes a dollar sign, that file is not necessarily opened correctly. Consider the following example:

screen shot 2015-02-17 at 11 43 25 pm 2

When the first .java file in the nerdtree view is opened (either in the previous window, a vertical split, or a horizontal split), that file is not opened in the expected window. Instead, that window opens the wrong file (potentially one which doesn't exist). As you can see in the status line in the example, type/Panini.java was opened instead of type/Panini$Duck$Array$Types.java.

In case it is helpful, I am running:

  • Mac OS X 10.10.2
  • Vim 7.4.488
  • tmux 1.9a
  • scrooloose/nerdtree commit 3b98a7f (installed via Vundle)
  • jistr/vim-nerdtree-tabs commit 0decec122e9bb3e9328b01fa20a9650e79cc6ca7 (installed via Vundle)
  • Other Vundle-installed Vim plugins, though they probably aren't relevant.
@dwtj
Copy link
Author

dwtj commented Feb 18, 2015

Note that in the given example, the same incorrect behavior happens with the Vim command

:e types/Panini$Duck$Array$Types.java

This will (maybe unexpectedly) start editing types/Panini.java.

One can escaping each dollar sign to make the :e command open the expected file.

:e types/Panini\$Duck\$Array\$Types.java

@yan12125
Copy link

Just a bump. Any progress on this issue? I'm encountering the same problem.

@yan12125
Copy link

Here's a quick hack:

diff --git a/lib/nerdtree/path.vim b/lib/nerdtree/path.vim
index c0242d0..88149de 100644
--- a/lib/nerdtree/path.vim
+++ b/lib/nerdtree/path.vim
@@ -266,7 +266,9 @@ endfunction

 "FUNCTION: Path.edit() {{{1
 function! s:Path.edit()
-    exec "edit " . self.str({'format': 'Edit'})
+    let edit_command = "edit " . self.str({'format': 'Edit'})
+    let edit_command = substitute(edit_command, '\$', '\\$', '')
+    exec edit_command
 endfunction

 "FUNCTION: Path.extractDriveLetter(fullpath) {{{1

With it, nerdtree opens files with '$' correctly while directories with '$' is still in problem.

@nfraser-younility
Copy link

The above workaround needs a 'g' in substitute flags, otherwise it will only replace the first occurrence of '$'.

@PhilRunninger
Copy link
Member

This should be fixed by PR #649, which has been merged.

@yan12125
Copy link

yan12125 commented Jan 2, 2017

Thanks! It's working now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants