Thursday, August 13, 2015

Instaling Shellcheck and other syntax checking plug-ins in vim

Hello - my first post in this list.

I use vim version 7.4 (2013 Aug 10, compiled Jan  2 2014 19:39:47), 'huge' version with GTK2-GNOME GUI, on Gnome terminal and run an Ubuntu 14.04.3 LTS Desktop on my box.

I use vim to script, to write Python, C and previously Fortran 77 programs. I want to use shellcheck, static analysis for sh and bash, locally (i.e. not online).

I am confused as to how to proceed for the install of shellcheck and other plug-ins in vim..
I need pointers and advice as to how I should go about it. So far I "sort of" gathered that:

1) shellcheck can be used in a terminal front-end of its own when downloaded from https://github.com/koalaman/shellcheck.
If I understand correctly what that implies, beside the fact that it means compiling with all necessary Haskell libraries (no thanks!), I would not want that. Instead I want to keep using Gnome-terminal while using vim and add-on modules and features.

2) it can be run in my editor. Quoting from http://www.shellcheck.net/about.html :
" ShellCheck can output gcc style error messages and checkstyle compatible xml, which allows any editor to show in-lined error messages. It's also supported directly by the vim plug-in  Syntastic in Vim."

Since Syntastic also has syntax checking plug-ins for C, C++ and Python, it probably is the right solution for me. I checked that my vim install  features: autocmd, eval, file_in_path, modify_fname, quickfix, reltime, and user_commands, apparently a prerequisite for syntastic. The Russian puppets game never ends and I discovered than syntastic works best with a plug-in manager called pathogen.vim.

Following those instruction I installed Pathogen and Syntastic.

Q-1: Instead of consulting Syntastic's help within vim (:help syntastic) with only 23 lines of scrolling text in terminal is there an online html doc I can look at ? (I want to improve on default Syntastic settings in my ~/.vimrc file.)

Q-2: How do I install shellcheck for sh / bash and whatever checkers there are for Python, C and C++ ?

Thank you beforehand for your help.

-cedric
GMT+1

No comments: