Monday, December 21, 2009

Re: Print All Syntax Highlight File Types

[quoting repaired]
(Please don't top post).

On Tue, December 22, 2009 8:00 am, Stratis Aftousmis wrote:
> On Tue, Dec 22, 2009 at 1:43 AM, Christian Brabandt
>> echo globpath(&rtp, "**/syntax/*.vim")
> Eww that's pretty messy.
>
> I guess I would have to parse the strings for file name...

What would you like to do? This was just a starter. Here is a snippet
that lets you chose your filetype, based on all available syntax items
using a completion:

,----
| if !exists("s:ftdict")
| let s:ftdict={}
| let s:ftlist=map(split(globpath(&rtp, "**/syntax/*.vim"), "\n"),
'fnamemodify(v:val, ":t:r")')
| for val in s:ftlist
| let s:ftdict[val]=1
| endfor
| endif
|
| fu! <SID>FileTypeComplete(ArgLead,CmdLine,CursorPos)
| let l=filter(keys(s:ftdict), 'v:val =~ "^".a:ArgLead')
| return sort(l)
| endfu
|
| :com! -nargs=1 -complete=customlist,<SID>FileTypeComplete Filetype :set
ft=<args>
`----

regards,
Christian

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: