0

So I've been installing Syntastic and JSHint for some Vim JavaScript syntax checking.

which jshint returns /home/myUser/local/bin/jshint

which vim and which gvim return /usr/bin/vim and /usr/bin/gvim` respectively.

If I open a JS file from myUser's terminal, Syntastic works fine - :SyntasticInfo returns

Syntastic version: 3.5.0-72
Info for filetype: javascript
Mode: active
Filetype javascript is active
Available checker: jshint
Currently enabled checker: jshint

However, if I open the same file with GVim, JSHint is not loaded.

Syntastic version: 3.5.0-72
Info for filetype: javascript
Mode: active
Filetype javascript is active
Available checker: -
Currently enabled checker: -

This makes sense given that if I run :!which jshint from vim in the terminal, I get a path and if I run it from GVim I get shell returned 1.

I poked around and noticed that JsHint is not loaded in command line Vim if I sudo su root and then run vim. Conversely, JSHint is loaded if I open GVim as my current user gksudo -u uname -l "gvim".

I'm assuming this means that I somehow need to get /home/myUser/local/bin/jshint on my root $PATH, but I don't know if this is possible or recommended.

  • Just don't work as root, it's as simple as that. – romainl Dec 18 '14 at 21:23
0

PATH is not a global shell variable that you should expect to be the same for all users. You could make it so but that would be pointless: if you want some program to be usable by every user, install it as root.

And… root is used for administrative tasks, not actual work (unless you are a sysadmin but you are not), so don't work as root.

|improve this answer|||||
  • so GVim and similar should not be installed with sudo? – diplosaurus Dec 19 '14 at 17:36
  • Installed as root? yes. Used as root? no. Except for administrative tasks. Editing JavaScript is not an administrative task so there's no reason whatsoever to do that as root. – romainl Dec 19 '14 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.