开发者

Is there a way to get basic PHP error underlining in VIM?

开发者 https://www.devze.com 2022-12-17 10:00 出处:网络
I really like VIM but one thing I cannot do without is simple error underlyin开发者_Python百科g like in netbeans and Visual Studio.

I really like VIM but one thing I cannot do without is simple error underlyin开发者_Python百科g like in netbeans and Visual Studio. I often make silly mistakes like

    if checkit($url) 
    {
    }

instead of

if (checkit($url))
{
}

The little squiggly red underline is a lifesaver when it comes to stuff like that. Is there a plugin for VIM that will save me from php silly mistake hell? Thanks.


Use Syntastic

To make it work efficiently you can add this one small customization to your .vimrc:

function! s:SaveAll()
    w | :Error
endfunction
command! -bar -narg=0 W call s:SaveAll()

now using :W for saving your file will also show a location list with any errors.


Have a look at the CheckSyntax plugin for vim, which has support for the equivalent of the 'php -l' and 'php -f' checks.

Vim doesn't have support for the squiggly underline we're all so used to but you might be able to get the "red marker in a column" effect used in Eclipse with help from this blog post.


Syntastic is my life saver. Check it out http://www.vim.org/scripts/script.php?script_id=2736

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号