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

57165[patch] fixed E71 & inconsistent completion behavior with % in file names

Expand Messages
  • Dominique Pellé
    May 31 3:40 PM

      Ex command line completion is inconsistent with what Ex commands
      expect when file to complete contains a % character.


      $ cd /tmp
      $ echo 123 > 111%222%333
      $ echo 145 > 111%444%555

      $ vim -u NONE --noplugin -N -c 'set wildmode=longest,list'

      :e 11<Tab> completes to: :e 111\% (OK)
      :e 111\%2<Tab> -----> E71: Invalid character after \% (Not OK!)
      :e 111%2<Tab> completes to: :e 111\%222\%333
      :e 111\%222\%333<CR> --> opens the file 111%222%333 (OK)

      So for <Tab> completion to work, the % characters must not be
      preceded with backslash. However, completion itself adds the
      backslashes in from of %. It's inconsistent. The Ex command
      itself expects the backslash in front of % since % has a special
      meaning in Ex commands (:help c_%):

      I think that the correct behavior for completion should be:

      :e 111\%2<Tab> completes to: e: 111\%222\%333

      Attached patch makes it work that way, but please review it.
      I only tested on Linux.

      I noticed this bug since I have 'set undodir=~/UNDO' in my ~/.vimc.
      The ~/UNDO/ dir contains several file names with this % character and
      trying to use <Tab> completion :e ~/UNDO/<Tab> in that directory
      does not work well.

      -- Dominique

      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 2 messages in this topic