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

Problems with netrw directory listing

Expand Messages
  • Seth Mason
    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
    Message 1 of 4 , Jun 3, 2007
      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.

      Thanks,
      Seth
    • Gary Johnson
      ... 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
      Message 2 of 4 , 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
        problem.

        Regards,
        Gary

        --
        Gary Johnson | Agilent Technologies
        garyjohn@... | Mobile Broadband Division
        | Spokane, Washington, USA
      • Charles E Campbell Jr
        ... Please try netrw v110g available from my website: http://mysite.verizon.net/astronaut/vim/index.html#NETRW I ve tested the fix under Linux; please try it
        Message 3 of 4 , Jun 4, 2007
          Gary Johnson wrote:

          >On 2007-06-03, Seth Mason <seth@...> wrote:
          >
          >
          >>
          >> 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.
          >
          >
          >

          Please try netrw v110g available from my website:
          http://mysite.verizon.net/astronaut/vim/index.html#NETRW

          I've tested the fix under Linux; please try it out under XP.

          Regards,
          Chip Campbell
        • Gary Johnson
          ... It works for me with Cygwin and with native Windows on XP. Thanks! Regards, Gary -- Gary Johnson | Agilent Technologies
          Message 4 of 4 , Jun 4, 2007
            On 2007-06-04, Charles E Campbell Jr <drchip@...> wrote:
            > Gary Johnson wrote:
            >
            > > On 2007-06-03, Seth Mason <seth@...> wrote:
            > >
            > >> 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.
            > >
            >
            > Please try netrw v110g available from my website:
            > http://mysite.verizon.net/astronaut/vim/index.html#NETRW
            >
            > I've tested the fix under Linux; please try it out under XP.

            It works for me with Cygwin and with native Windows on XP. Thanks!

            Regards,
            Gary

            --
            Gary Johnson | Agilent Technologies
            garyjohn@... | Mobile Broadband Division
            | Spokane, Washington, USA
          Your message has been successfully submitted and would be delivered to recipients shortly.