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

61787RE: [Bug][w32] Completion for "filetype" doesn't work on windows

Expand Messages
  • Bram Moolenaar
    Jun 25, 2011
      John Beckett wrote:

      > Dominique Pellé wrote:
      > > It works for me on Linux too. I don't have Windows to test.
      > > I don't see why it would not work on Windows at first sight.
      >
      > I have just performed some tests on Windows XP:
      >
      > These work (pressing Tab provides argument completion):
      > :command! -nargs=* -complete=file Xfil :echo <q-args>
      > :command! -nargs=* -complete=syntax Xsyn :echo <q-args>
      > :command! -nargs=* -complete=environment Xenv :echo <q-args>
      >
      > This fails (pressing Tab for completion does nothing):
      > :command! -nargs=* -complete=filetype Xft :echo <q-args>
      >
      > The reason filetype completion fails on Windows is that
      > dos_expandpath() in misc1.c is asked to expand text like
      > "C:\.../vimfiles/{syntax,indent,ftplugin}/*.vim".
      >
      > The "{dir1,dir2}" syntax is handled by the operating system on
      > Unix based systems, but not on Windows.

      Right. A simplistic solution would be:

      if (xp->xp_context == EXPAND_FILETYPE)
      # ifndef UNIX
      /* don't assume glob() works, syntax should have nearly all filetypes */
      return ExpandRTDir(pat, num_file, file, "syntax");
      # else
      return ExpandRTDir(pat, num_file, file, "{syntax,indent,ftplugin}");
      # endif

      Can you think of something better?

      --
      From the classified section of a city newspaper:
      Dog for sale: eats anything and is fond of children.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      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 14 messages in this topic