Using Ubuntu 12.
I installed jshint with
sudo npm install jshint -g
which jshint
shows
/usr/local/bin/jshint, which is also in the PATH variable
Then, I downloaded https://github.com/walm/jshint.vim/blob/master/plugin/jshint.vim
and put it in ~/.vim/bundle/jshint.vim (I am using Pathogen)
Now, when opening a js-File, such as
vim test.js
errors are not detected.
:JSHint
results in “Not an editor command: JSHint”
:Helptags
results in, well, nothing.. I don’t really see what that command is for, anyway..
I am a vim noob, but other pathogen bundles seem to work, so I do not really know what is not working here..
The default way to install plugins is to put their individual pieces in some subdirectories of your
~/.vim/directory. Taking this plugin as example:The
:Helptagscommand is used to generate the index (tags) used by Vim to navigate through the documentation of third party plugins. You are supposed to use it like that:The idea behind Pathogen and other plugin managers is that each plugin should be in its own directory rather than be scattered through your
~/.vim/directory. In Pathogen’s case (and others followed, but there’s no standard), that’s the bundle directory:~/.vim/bundle/.Therefore, the correct location for your plugin should be:
In order for pathogen to work its magic, you are supposed to add these two lines to your
~/.vimrc:The first line takes care of “registering” and loading each plugin found in
~/.vim/bundle/. The second line indexes their documentation, the equivalent of:Helptags …that you don’t need to run, then.So…
Make sure Pathogen is installed and configured correctly.
Install the JSHint plugin where it should be.
?
Enjoy writing JavaScript in Vim!
To run
:JSHinton the current buffer every time you write it, add this line to your~/.vimrc: