Loading ...
Sorry, an error occurred while loading the content.

80893Re: Problems with netrw directory listing

Expand Messages
  • Gary Johnson
    Jun 3, 2007
      On 2007-06-03, Seth Mason <seth@...> wrote:
      > Hi --
      > I'm running version 7.1 under cygwin on a windows xp machine.
      > I'm trying to cd to the current directory with the directory browser
      > (via the 'c' key) but I get the error message:
      > E172: Only one file name allowed: cd /cygdrive/c/Documents and
      > Settings/smason/projec
      > ts/
      > It seems like the spaces in the directory name is causing problems.
      > If I open a file in the directory and then use ':cd %:h' everything
      > works fine so it seems like the problem is not with vim(?).
      > Any help or direction to go from here would be greatly appreciated.

      I see the problem. I believe it is a bug in autoload/netrw.vim (at
      line 1593 in version 109) in the definition of the c command:

      nnoremap <buffer> <silent> c :exe "cd ".b:netrw_curdir<cr>

      Any spaces in b:netrw_curdir are not escaped and the directory name
      is not in quotes, so the cd command sees any spaces as separators.
      I don't know at the moment what the right solution is. The
      following workaround seems to fix this particular problem, but it
      may introduce other problems especially when running vim in a pure
      Unix or pure Windows environment.

      nnoremap <buffer> <silent> c :exe "cd "'"'.b:netrw_curdir.'"'<cr>

      Dr. Chip probably has some preferred solution for this sort of


      Gary Johnson | Agilent Technologies
      garyjohn@... | Mobile Broadband Division
      | Spokane, Washington, USA
    • Show all 4 messages in this topic