I have the following syntastic settings inside my .vimrc:
"------------SYNTASTIC-----------
let g:syntastic_enable_signs=1
let g:syntastic_mode_map={ 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['html', 'java'] }
let g:syntastic_coffee_checkers = ['coffeelint', 'coffee']
let g:syntastic_coffee_coffeelint_args = "--file [absolute path to]/coffeelint.json"
let g:syntastic_enable_signs=1
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
when I have coffeescript installed to 1.6.0+ (i.e. npm install -g coffee-script#1.6.3) syntastic doesn't seem able to detect any compilation errors, even though both coffee file.coffee and coffeelint file.coffee displays the error fine.
I ran :SyntasticCheck then :messages and no debug error surfaced.
I've also made sure that npm is part of the PATH: PATH="/usr/local/share/npm/bin:$PATH"
On the other hand, when coffeescript is installed at coffee-script#1.5.0 the errors DO in fact surface (everything works!), except that it doesn't pick up the coffeelint_args. This behavior might be expect from https://github.com/scrooloose/syntastic/wiki/CoffeeScript%3A---coffee
Do I need to know something special to get syntastic working w/ coffeescript 1.6.0+ on Mac?
Here's the issue on github: https://github.com/scrooloose/syntastic/issues/694
The fix was to do a git fetch && git rebase or git pull from the syntastic git directory (assuming you're using pathogen)
Related
I installed clang-complete by using Vundle,and downloaded llvm using sudo apt install llvm-4.0, downloaded clang by using sudo apt install libclang-4.0.Here is my .vimrc:
let g:clang_complete_auto=1 " automatically complete after -> . ::
let g:clang_hl_errors=1 " highlight the warnings and error the same way clang does it
let g:clang_complete_copen=0 " open quickfix window on error
let g:clang_periodic_quickfix=0 " periodically update the quickfix window
let g:clang_snippets=0
let g:clang_close_preview=1
let g:clang_use_library=1
let g:clang_library_path='/usr/lib/llvm-4.0/lib'
let g:clang_user_options='-stdlib=libc++ -std=c++11 -I /usr/include/c++/8/'
set completeopt=menu,longest
However, it doesn't run well in this way. When I type std::, the menu only shows some useless items such as size_t but except cout etc.
Follow the Troubleshooting section in the README of your plugin. It says that the first step is to check completefunc and omnifunc when in your C++ buffer, and then to check the output of :messages. I think that knowing what those settings are at runtime of your Vim would show us what's going on.
If completefunc isn't set, then there's something going on with one of your settings; the plugin is trying to do what it does, but one of your settings are improperly formatted (or something like that.) The output of :messages should be able to show you which setting this is, as well.
I want to set up python linting in Vim using the ALE Vim-package. So far it works well in Atom using the Atom-Plugin, but in Vim it somehow is not working. I installed
pylint using pip3,
Vim 8.1 and
ALE using the Vundle Plugin-Manager.
In my .vimrc I set the
let g:ale_linters={
'python': ['pylint'],
.....+other languages....
}
option. Additionally I read the ALE docs and also tried setting the following:
let g:ale_python_executable='python3'
let g:ale_python_pylint_use_global=1
ALE gets installed correctly and works for Javascript, but for Python, there is just nothing happening.
In case of incorrect code (missing ")") like:
print("Hi"
nothing is marked as error.
It would be great if someone knows how to set this up and can provide some help! Thanks.
I was able to get this working, with the following steps:
install pylint
python3 -m pip install pylint
At least for my setup there was a warning:
Installing collected packages: pylint
WARNING: The scripts epylint, pylint, pyreverse and symilar are
installed in '/home/vagrant/.local/bin' which is not on PATH.
so then:
Add pylint to $PATH
export PATH="$HOME/.local/bin:$PATH"
(this can be added to ~/.profile to be configured persistently)
At you should be able to run pylint manually:
$ cat syntaxerr.py
print("hi
$ pylint syntaxerr.py
************* Module syntaxerr
syntaxerr.py:1:10: E0001: EOL while scanning string literal (, line 1) (syntax-error)
Install ALE
git clone https://github.com/dense-analysis/ale.git ~/.vim/pack/git-plugins/start/ale
At this point the syntax check is working as long as syntax is enabled:
$ cat .vimrc
syntax on
If you'd like to configure g:ale_linters, note that you must escape the newline to create a multi-line dictionary:
let g:ale_linters={
\ 'python': ['pylint'],
\}
Finally, to see how ALE is currently configured, you can always run the following command:
:ALEInfo
I would best be described as a dabbler at this point in linux/vim. I'm trying to get started with go. Trying to install the vim-go plugin and i'm having issues. Following the following post.
I added the following to the end of my ~/.bashrc file:
export GOPATH=~/gocode
export PATH=$PATH:$GOPATH/bin
and created the following directory ~/gocode
So i created my ~/.vim/bundle & ~/.vim/autoload directories. I downloaded pathogen.vim to the autoload directory. I cloned the github repository for vim-go into the bundle directory which created a vim-go directory.
I created my ~/.vimrc file and added the following:
call pathogen#infect()
syntax enable
filetype plugin on
set number
let g:go_disable_autoinstall = 0
I executed the following from the vim console (which worked after installing Hg):
:GoInstallBinaries
FYI, i don't use vundle and to be honest don't even know what it is :).
So far the plugin doesn't seem to be working. When i type :help vim-go i get the following error: E149: Sorry, no help for vim-go
What am i do
Using the manual install method (copying vim-go/ to ~/.vim) I was able to get it working but only once I had the following ~/.vimrc file, and of course the Go binaries installed as per the instructions.
set nocompatible
set shell=/bin/sh
syntax on
filetype plugin on
let g:go_disable_autoinstall = 0
This was done on an Ubuntu 14.04 desktop with no other vim plugins or prior ~/.vim directory or ~/.vimrc. Frankly the official install instructions and many of the tutorials out there assume to much to be useful on a fresh install of Ubuntu.
However "help vim-go" was still not working for me. Tried the following command from within the ~/.vim directory and got that working: Vim helptag generation
solution put that in you .vimrc :
set nocompatible
execute pathogen#infect()
syntax on
filetype on
filetype plugin on
filetype plugin indent on
go in your .zshrc ou .bashrc and put :
export GOPATH="$HOME/gocode/"
export PATH=$PATH:~/gocode/bin
and in terminal do :
source .zshrc
or
source .bashrc
and now go to
cd ~/.vim/bundle
and do if youuse pathogen :
git clone https://github.com/fatih/vim-go.git
in vim do :
:GoInstallBinaries
test one of this commands :
:GoFmt
:GoLint
I have installed Syntastic with Pathogen.
Syntastic works for Python files but not for JavaScript files with JSHint.
JSHint works via command line or with other vim plugin like https://github.com/Shutnik/jshint2.vim
→ which jshint
/usr/local/share/npm/bin/jshint
→ jshint --version
jshint v2.1.10
→ echo $PATH
/usr/local/share/npm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
When I run :SyntasticInfo, it doesn't find any checkers.
Syntastic info for filetype: javascript
Available checkers:
Currently active checker(s):
My vimrc
set nocompatible
filetype off
call pathogen#infect()
call pathogen#helptags()
filetype plugin indent on
syntax on
let g:syntastic_check_on_open=1
let g:syntastic_javascript_checkers = ['jshint']
I don't know what I've missed, if you have any idea why Syntastic doesn't detect JSHint. Thanks
Long story short; Syntastic needs the path of jshint.
I encountered a similar problem on Windows 8. After installing nodejs v0.10.22 and syntastic >= 3.2.0, the Vim command :SyntasticInfo would give me:
Syntastic: active mode enabled
Syntastic info for filetype: vim
Available checker(s):
Currently enabled checker(s):
The documentation over at jshint.com/docs suggests that this is sufficient to install the module.
$ npm install jshint -g
This is true, apart from a somewhat surprising meaning of flag -g installs JSHint globally on your system. It means in your user's %AppData% folder:
(abbreviated output from previous command)
C:\Users\jaroslav\AppData\Roaming\npm\jshint -> \
C:\Users\jaroslav\AppData\Roaming\npm\node_modules\jshint\bin\jshint
jshint#2.3.0 C:\Users\jaroslav\AppData\Roaming\npm\node_modules\jshint
├── console-browserify#0.1.6
├── underscore#1.4.4
├── shelljs#0.1.4
├── minimatch#0.2.12 (sigmund#1.0.0, lru-cache#2.5.0)
└── cli#0.4.5 (glob#3.2.7)
Another piece of documentation from the syntastic FAQ reads:
Q. I installed syntastic but it isn't reporting any errors...
A. The most likely reason is that none of the syntax checkers that it requires is installed. For example: python requires either flake8, pyflakes or pylint to be installed and in $PATH. To see which executables are supported, just look in syntax_checkers//*.vim. Note that aliases do not work; the actual executable must be available in your $PATH. Symbolic links are okay. You can see syntastic's idea of available checkers by running :SyntasticInfo.
The solution amounts to setting the path of the jshint command in ~/.vimrc:
let g:syntastic_jshint_exec='C:\Users\jaroslav\AppData\Roaming\npm\jshint.cmd'
:source $HOME/_vimrc
:SyntasticInfo
Syntastic: active mode enabled
Syntastic info for filetype: javascript
Available checker(s): jshint
Currently enabled checker(s): jshint
Alternatively, one could:
> cmd.exe
> cd C:\Users\jaroslav\AppData\Roaming\npm
> setx PATH "%cd%:%PATH%"
and let g:syntastic_jshint_exec='jshint.cmd'. I didn't try the last solution with %PATH% because Winders doesn't like long %PATH% variables.
Hopefully this saves you some time.
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.