列出Vim已知的所有文件类型插件


14

我想列出Vim从其运行时路径识别的所有文件类型。

例如:

ada
arc
c
clojure
common-lisp
elisp
go
python

我该怎么做?

Answers:


18

如果您需要带有文件类型参数的自定义命令,则可以使用:command -complete=filetype。另外,您可以globpath()自己通过函数来导出列表:

echo join(map(split(globpath(&rtp, 'ftplugin/*.vim'), '\n'), 'fnamemodify(v:val, ":t:r")'), "\n")

这将从运行时路径中获取所有ftplugin脚本,然后通过修改filespec fnamemodify()以仅列出文件名的根目录。split()转换为列表,然后join()返回行以进行:echoing。


这也会从中获取文件ftplugin/after吗?
Profpatsch

2
您的意思是after/ftplugin,是的,因为它们包含在中&rtp
Ingo Karkat

这在bash和zsh上都给出了语法错误。
mareoraft 2015年

3
@mareoraft:在Vim内部而不是外壳中尝试!
Ingo Karkat 2015年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.