Dominique Pellé wrote:
I can try to change the behavior.   But just to make sure I understand
the problems:

:setfiletype and :ownsyntax commands currently both perform
completion by looking at syntax/*.vim from both $VIMRUNTIME
and ~/.vim/.

That's almost fine, but it not ideal for 2 reasons:

1/ :setfiletype should actually complete by looking at files matching
  {syntax,ftplugin,indent}/*.vim from both $VIMRUNTIME/ and ~/.vim/
  :ownsyntax completion should only look at syntax/*.vim (as it does now).

2/ there are a few files matching syntax/*.vim which are not syntax
   files such as 2html.vim, syntax.vim, colortest.vim... They can thus
   show up as a spurious completion results.  These special files are
   listed in syntax/README.txt. Any reasons for them to be in the
   syntax/ directory?

In practice, current implementation is almost fine since almost
all files matching $VIMRUNTIME/{ftplugin,indent}/*.vim have a
corresponding file matching $VIMRUNTIME/syntax/*.vim.  Using
the following commands...

I was specifically talking about completion of file types under ~/.vim, otherwise Vim could just include a static list of names. Here's what I (and I assume Ingo) have in mind:

function! IdealFtComplete()
  let types = {}
  let pattern = '{ftplugin,syntax,indent}/*.vim'
  let ignored = ['syntax', 'manual', 'synload', 'nosyntax', '2html',
        \ 'colortest', 'hitest', 'whitespace', 'AppendMatchGroup',
        \ 'GenericIndent']
  for filename in split(globpath(&rtp, pattern, 1), "\n")
    let type = fnamemodify(filename, ":t:r")
    if index(ignored, type) == -1 | let types[type] = 1 | endif
  endfor
  return sort(keys(types))
endfunction

I've excluded the files you identified in your previous message because I agree they probably shouldn't be considered for file type completion.

 - Peter Odding

--
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

Raspunde prin e-mail lui