I can't get Syntastic to work for JavaScript files in MacVim. If I save a file with errors in it, nothing is displayed: there is no error margin.
If I run :SyntasticInfo, then I see:
Syntastic info for filetype: javascript
Available checkers: jshint
Currently active checker(s): jshint
If I run jshint directly, using :!jshint %, then I see the errors I expect.
I had a custom syntastic_javascript_jshint_conf setting:
let g:syntastic_javascript_jshint_conf="~/.jshintrc"
...and the ~/.jshintrc file was missing. Recreating it fixed the problem, and now I get the error margin.
Updated to add: I've added a feature to my .vimrc, so that it tracks the "nearest" .jshintrc file: https://github.com/rlipscombe/vimrc/blob/master/vimrc#L176
Related
I have vim's syntastic installed properly along with eslint and jshint. I prefer jshint for most of my javascript programming. However, I'm starting to learn React, and would like to use eslint with syntastic (eslint has superior/proper linting for react).
Is it possible to set vim to use jshint for *.js files, and eslint for *.jsx files?
I see from :help syntastic-checkers that react gets lumped in javascript. Chaining the linters is not what I want, either.
Found it! You were very close #lcd047, but your comment lead me down the right path! To enable eslint on only *jsx files, putting the following in my .vimrc works:
au BufEnter *.jsx let b:syntastic_checkers = ['eslint']
In my case, syntastic will use jshint on javascript by default even if a checker is not set in .vimrc. Setting the above works even if g:syntastic_javascript_checkers is unset or even if it is set, in my case, to jshint.
I recently got vim and have been trying to install some plugins. I installed vim as a plugin manager. I entered some plugins in the _vimrc file just like you are supposed to.
Example: Plugin 'scroolose/nerdtree'
But, when I did :PluginInstall I got a popup saying "vimrun.exe not found in your $PATH". I found the vimrun.exe file and it was not in the right place so I moved it to the vimfiles folder and then the bundle folder and then the Vundle.vim folder I always got the same popup.
After getting the popup message the plugins never install properly. I always get a bunch of errors as vim tries to process the plugins and then at the end it says "done!". When I try using the plugins it never works and it seems like the plugins never got installed.
If you could also help me with my vim syntax problem, that would be great.(only if you wish to)>
So I git cloned the repository to ~/.vim/bundle and had pathogen installed. I can be sure pathogen works fine since my other plugins in bundle are all working fine. After googling for a while, it seems that syntastic should work out of box for c code. I also checked that I have all the executables specified in syntastic/syntax_checkers/c/.
Here is a part of my .vimrc file:
" syntastic
let g:syntastic_auto_loc_list=1
let g:syntastic_disabled_filetypes=['html']
let g:syntastic_enable_signs=1
When I open a *.c file and do :SyntasticCheck, nothing happens. There is no errors complaining command not found, so syntastic is loaded. However, even if the *.c file that's currently opened contains errors syntax error, syntastic is not showing anything.
It is the first time I use syntastic so I don't really know the correct way to invoke it.
I also tried :SyntasticCheck [c] and I get the following error message:
Error detected while processing function <SNR>_22_UpdateErrors..<SNR>22_CacheErrors:
line 16:
E121: Undefined variable: checkers
E15: Invalid expression: checkers
Can someone tell me what I did wrong and how to invoke syntastic?
Thanks!
Try adding this to your vimrc:
let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=1
(This is lifted straight from my vimrc, which has some other Syntastic settings if you'd like.)
I don't really understand the reason, but when I re-installed the YouCompleteMe plugin for vim with ./install.sh --clang-completer. Syntastic works like charm.
Installing clang and/or ctags packages fixed this for me
I did two things and then Syntastic started to behave as expected with JS files and ESlint. Can't tell which one did the trick:
1- In the project's directory ran eslint --init.
2- Started vim opening the file without the -S flag.
Before it failed silently, no errors and no diagnostics. This is how ESlint behaves when there is no configuration file.
To enable effective code formatting, I need to set the following in my .vimrc file
filetype plugin indent on
If I do that, code formatting (gg=G) works perfectly. However, I get the following error when I load up javascript files:
Error detected while parsing function <SNR>78_JSLint:
line 25
could not invoke JSLint
and I have to set it back to
filetype on
Now Javascript Lint works (I don't know why it says 'JSLint', I have Syntastic set up to work with Javascript Lint), but code formatting is now less reliable. How do I make it so I can run Javascript Lint (via Syntastic) and proper code formatting, without one interfering with the other.
You probably have another JS linting plugin somewhere (maybe jslint.vim?) that conflicts with syntastic or you don't have said plugin anymore but there's stil an autocmd in your .vimrc.
Search your ~/.vim folder for "JSLint" with
$ grep JSLint ~/.vim
to see where it's invoked.
Either way, your problem has nothing to do with indenting.
I just downloaded a Vim plugin for Sass syntax highlight.
The instructions say:
install details put it into syntax
directory and add sass filetype
au! BufRead,BufNewFile *.sass
setfiletype sass
in your filetype.vim
I already placed sass.vim in vimfiles/syntax/ (using windows).
And created a filetype.vim file with the code above (au! Buf...) in all the following directories:
vimfiles/
vimfiles/ftdetect
vimfiles/ftplugins
but no one worked (I even typed the au! Buf... code in my vimrc).
My .sass files still looking like this:
alt text http://img193.imageshack.us/img193/4791/sassi.png
any suggestions?
I don't know an easy fix, but try checking some vim settings with the following commands:
Does enabling syntax explicitly fix your problem? :syntax enable
Is filetype detection on? :filetype
Does vim recognize this as a sass file? :set filetype?
Check to make sure your script directories are in the runtime path :set runtimepath?
Does manually loading the syntax file change anything? :runtime! vimfiles/syntax/sass.vim
Also check if syntax highlighting works for other filetypes.