tomtom / checksyntax_vim

Check a file's syntax when saving a file (php, ruby, tex ...) with vim
http://www.vim.org/scripts/script.php?script_id=1431
GNU General Public License v3.0
94 stars 9 forks source link

checksyntax_auto doens't work #23

Closed DerpDarako closed 8 years ago

DerpDarako commented 10 years ago

Hello,

I tried your plugin for php file but if I want to check the syntax I have to press F5 because if I save my file with :w nothing happens...

In your doc:

g:checksyntax_auto (default: 1) If 1, enable automatic syntax checks after saving a file. If 2, enable automatic syntax checks when saving and loading a

So I think I don't need to set up checksyntax_auto in my vimrc... I tried with the option in my vimrc:

let checksyntax_auto = 1

Whatever, nothing happens when I press :w

It's weird, isn't it?

tomtom commented 10 years ago

The plugin probably doesn't recognize that php is installed. Is php in your path? Which OS do you use? Windows?

What's the result of

 :echo executable("php")
 :echo checksyntax#MaybeUseCygpath(g:checksyntax#defs#php#cmd)

Regards

DerpDarako commented 10 years ago

Hello,

Thank you for your quick replay. The machine is Linux.

I did your commands:

:echo executable("php") 1 echo checksyntax#MaybeUseCygpath(g:checksyntax#defs#php#cmd) Nothing appears

echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

type php php est /usr/bin/php

If I understand I have to set up something?

tomtom commented 10 years ago

In the past, users had difficulties with php because of certain flags that influence how php reports errors. You might read :help g:checksyntax#defs#php#args and the php-related issues:

 https://github.com/tomtom/checksyntax_vim/issues/7

By default, checksyntax uses

 php -l -n -d display_errors=1 -d error_log= -d error_reporting=E_ALL

You might want to check whether this command reports errors on stdout on your machine.

I think syntastic uses

 -d error_reporting=E_ALL -l -d display_errors=1 -d log_errors=0 -d 

xdebug.cli_color=0

It could be this yields better results.

DerpDarako commented 10 years ago

I'm not sure it's the source of my issue :

checksyntax#defs#php#args looks ok because it works fine when I use your default single key F5.

When I press F5 i got the error window but it doesn't appear when I use :w

tomtom commented 10 years ago

checksyntax#defs#php#args looks ok because it works fine when I use your default single key . Sorry, I got you wrong. I thought it doesn't work either way.

When I press i got the error window but it doesn't appear when I use |:w|

auto checks are now disabled by default. You have to set g:checksyntax#auto_enable_rx so that it matches the filetypes you want to check automatically. E.g. you could use "." to automatically check any files or "^php$" to check only php files.

HTH

DerpDarako commented 10 years ago

Yeah, thank you... I'm so sorry you said it in your doc :

See also |g:checksyntax|, |g:checksyntax#auto_enable_rx

It works fine.

tomtom commented 10 years ago

you said it in your doc :

I will put more emphasis on that part.