I just configured my Vim to used Syntastic - which works great !
I use it for javascript validation.
I have two linters installed: jslint and jshint, and I intend to keep the two. But Syntastic does not seem to want to report errors from the two at the same time: I get first errors from jshint, and then only jslint when I fixed the previous ones.
Any way I could have the two at the same time?
You need to set g:syntastic_aggregate_errors option to 1 (it's default value is 0):
let g:syntastic_aggregate_errors = 1
This is from documentation:
When enabled, syntastic runs all checkers that apply to the current filetype,
then aggregates errors found by all checkers and displays them. When disabled,
syntastic runs each checker in turn, and stops to display the results the first
time a checker finds any errors.
Related
I've recently installed the syntastic plugin in my vim installation. However I'm getting annoyed by irrelevant errors reported by syntastic.
I installed in order to make it work code sniffer and phpmd.
How can I tell syntastic to stop giving me such irrelevant errors like:
Missing file doc comment
or
Line indented incorrectly; expected at least 8 spaces, found 4
I'd like to get only real errors like missing a semicolon;
As per the discussion in the comments, you can define which syntax checkers to use with the g:syntastic_<filetype>_checkers = [] variable.
In this case, you might want something like this to disable code sniffer (phpcs):
let g:syntastic_php_checkers = ["php", "phpmd"]
For more information see :h syntastic-filetype-checkers.
Here's the plugin I'm talking about: https://github.com/vim-scripts/EnhancedJumps
The plugin sometimes croaks when navigating backwards:
Error detected while processing function EnhancedJumps#Jump:
line 52:
E121: Undefined variable: mappings
next: vimfiler:default
Could it be caused by my vimfiler plugin?
Your hunch is right. Because the :redir command cannot be nested, there can be conflicts in EnhancedJumps (which I'm the author of) if another plugin has redirection active, too. To work around that, I've added a configuration in version 3.02 to turn that off. Put the following into your ~/.vimrc:
let g:EnhancedJumps_CaptureJumpMessages = 0
You'll lose a tiny bit of functionality (messages reported during jumping may be out of order), but can continue to use both plugins without script errors.
I use a problem set class to type up my problem sets. I often have a main.tex file that looks something like the following.
\documentclass{problemset}
\begin{document}
\input{problem1}
\end{document}
I typically have a different file for each problem. For example, problem1.tex might be as follows.
\begin{problem}
there is a spelling errrrrrrror here
\end{problem}
I would like vim to detect the spelling error in problem1.tex, but unfortunately it does not. As noted in this post, the problem seems to be that vim is not able to identify any syntax region: when I run the command
:echo synIDattr(synID(line("."),col("."),1),"name")
I don't get any output. As another example, if I change problem1.tex to the following, then the spelling error is identified.
\section{dummy section}
\begin{problem}
there is a spelling errrrrror here
\end{problem}
I have tried to create a syntax region for my problem environment, but was unsuccessful. My attempt consisted of creating the following .vim/syntax/tex.vim file.
syntax region texProblem start="\\begin{problem}" end="\\end{problem}" contains=#Spell
Nothing seems to happen when I create this tex.vim file. I used scriptnames to check that that the syntax file is being loaded (the default syntax file is also loaded after mine). I can also get the spelling error to be flagged by setting the filetype to plaintex, as suggested here, but this seems like a terrible hack. It seems like there should be a better way to get spell checking in my problem1.tex file.
The comments above worked for me (syntax spell toplevel) and this setting works for me even when run later (so no need to copy anything from /usr). But I didn't want that setting to be active for all tex files - instead, I customize it for the given file in my .vimrc:
au BufNewFile,BufRead body.tex syntax spell toplevel
I used a hack for this problem. Add the following to the top of your file:
\iffalse{}\section{vim-hack}\fi{}
This way, vim's syntax and spell algorithms find some token to get them started, but due to the "if" the section will be ignored by latex itself.
(I did not test whether more specialized editors ignore this dummy section, so there may be more hackery required if you use both vim and an editor.)
What is the desired behaviour of vim's quickfix feature?
Should the quickfix window (:copen) only contain compiler errors/warnings or should the whole output be displayed?
I want the former, since the output of make can be very long, but I get the latter, even with compiler set to gcc and g:compiler_gcc_ignore_unmatched_lines set.
However, lines inside the quickfix window with warnings/errors are highlighted and :cnext correctly jumps to the next issue.
Furthermore, Lines without issues have a double pipe symbol prefixed, so it seems that vim properly parses the make output.
Are these lines displayed in addition to the warnings/errors and can be hidden or does the errorformat string not exactly match the make output?
I used the avrdude 5.11.1 sources as an example, but I get the same result with many other projects.
Does setting the compiler automatically adapt the errorformat string or do I have to set that string always manually?
Thanks
It's really however you want it to work. I often filter out some of the build output that I'm not interested in by adding grep to my makeprg, but I also want some of the build output even if it's not an error.
I don't think vim will remove non-error lines from the quickfix. If you don't want them there, you need to filter them yourself (or modify efm to include them in an error).
I have a warning I can not easily remove from my build, every time i run ":make" from inside vim the quickfix takes me to some header file I don't care about. How can I prevent VIM from doing this and only showing me warnings and errors I do care about?
As Luc Hermite said, it is possible to ignore warnings using 'errorformat'option.
Adjusting this option is a little bit complicated; it may be helpful to check $VIMRUNTIME/compiler for some examples.
When working with avr-gcc and C++ some annoying warnings like this
tests.cpp:492: warning: only initialized variables can be placed into program memory area
shows up, and it is likely to be result of a compiler fault.
To avoid that this warnings being displayed on quickfix window I've add this to ~/.vimrc:
compiler gcc
set errorformat^=%-G%f:%l:\ %tarning:\ only\ initialized\ varia
\bles\ can\ be\ placed\ into\ program\ memory\ area
The %-G can be used to specify patterns to be ignored.
The ^= in set errorformat^=... is used to prepend the ignored warning pattern to 'errorformat' -- using += (set errorformat+=...) would append to the option and wouldn't work, as 'errorformat' is a list of formats and the first one that matches is used, thus the "normal" warning pattern would apply instead.
Maybe you could adapt these settings for your environment.
Check :h 'errorformat' (aka &efm), there are options to ignore warnings as long as you can recognize them with a pattern.
A quick and dirty way would be to write a simple shell script that runs your make and greps out the warnings you don't want to see. Then have vim use this script instead of make (Add "set makeprg=yourscript.sh" to your .vimrc).
To build on what mMontu suggested, adding this to my .vimrc did the trick for me (ignore all warnings from my gcc compiler)
set errorformat^=%-G%f:%l:\ warning:%m
Learn from Bram himself.
I can vaguely remember he talks about this somewhere in this video.
He adds a filter to ignore some gnome warnings when he's compiling gvim.
The video's well worth watching anyway.
It's around the 30 minute mark.