Domanda

I have a sizable vim script (a .vim file, in viml syntax). I'd like to check (but not execute!) the file for simple syntax errors.

How do I accomplish this?

I just want a very rough syntax check. Something along the lines of perl -c or pyflakes.

È stato utile?

Soluzione

Here is a syntax checker for VimL. https://github.com/syngan/vim-vimlint/

Altri suggerimenti

I don't think (I'm relatively sure, as much as one can be) one exists. VimL is an internal language of Vim (and only Vim), and there aren't many tools developed for it.

I tried searching on vim.org and several other places, with no luck. Not suprising, because I've never heard of one either.

So you're either stuck with running the script, or switching to an outside language like Python, Perl or Ruby.

https://github.com/osyo-manga/vim-watchdogs

vim-watchdogs, apparently, is a syntax checker for vim, it says that it supports many languages, including vimL

if you use vundle, you can just drop this into your vimrc:

Plugin 'git://github.com/osyo-manga/vim-watchdogs.git'

..and then run:

:PluginInstall

..to set it up (vundle is a very nifty plugin manager) If you have syntastic, you might want to be careful and disable it first, and then see if it is an adequate replacement (since it says it supports all those languages anyway).

It is a safe bet that when you have multiple syntax checkers going, you will need to put your "dogs on a leash", so to speak; by configuring one to check languages that the other one does not, and vice-versa. If you do not, there will be at best collisions, duplications, or misdirections. At worst, you will have all of the above and more.

Make sure that you always backup your ~/.vim directory (or your VIMRUNTIME directory if you install things on a global level), you will be glad you did. Hope that helped you or someone else out, good luck! Sorry you had to wait 7.5 months for a response, heh :)

There's now a second option: vim-lint (as opposed to vimlint)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top