Skip to content

Completion for path with spaces failing #113

@Grueslayer

Description

@Grueslayer

Filenames needs to be handled differently for some characters (e.g. Space) in the commandline as argument.
Therefore a VimL function fnameescape() can been used. Some characters like Space or Exclamation Mark must be escaped by a backslash.

Let's assume you've a filename file with space.txt and want to open it, you've to write :e file\ with\ space.txt. This is like any Un*x shell behaviour. For windows, where backslash is used for directory structure, weirdly the backslash is still used for escaping those characters c:\dir\ with\ space\subdir\file\ with\ space.txt.

So the path completion must behave differently in the command line, the "standard" vim completion behaves as following:

c:\ and pressing <TAB> gives you a list with

  • c:\Program\ Files\
  • c:\Program\ Files\ (x86)\

and so on. When selection those the commandline would also read as displayed (and can be used).

When using cmp completion you'll see

  • c:\Program Files\
  • c:\Program Files (x86)\

without the escaped spaces.

==> You can not use this in your command line, because it reads that as two arguments (split by space) AND you can not go deeper in the file tree.

So for this case the path completion must call fnameescape() for each entry or you've to unescape the given string from the commandline give that to the path completer and fnameescape() the selected entry before replacing it.

I'm sure this is not a MS Win Problem only but haven't tested it on a Un*x based system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions