mirror of
1
0
Fork 0

Adding submodules and stuff.

This commit is contained in:
Maksim Pecherskiy 2014-02-24 22:22:30 -04:00
parent c07dfbf9d7
commit 17b77b08b1
150 changed files with 11141 additions and 120 deletions

114
maximum_awesome_vimrc Normal file
View File

@ -0,0 +1,114 @@
" set up pathogen, https://github.com/tpope/vim-pathogen
filetype on " without this vim emits a zero exit status, later, because of :ft off
filetype off
call pathogen#infect()
filetype plugin indent on
" don't bother with vi compatibility
set nocompatible
" enable syntax highlighting
syntax enable
set autoindent
set autoread " reload files when changed on disk, i.e. via `git checkout`
set backspace=2 " Fix broken backspace in some setups
set backupcopy=yes " see :help crontab
set clipboard=unnamed " yank and paste with the system clipboard
set directory-=. " don't store swapfiles in the current directory
set encoding=utf-8
set expandtab " expand tabs to spaces
set ignorecase " case-insensitive search
set incsearch " search as you type
set laststatus=2 " always show statusline
set list " show trailing whitespace
set listchars=tab:▸\ ,trail:▫
set number " show line numbers
set ruler " show where you are
set scrolloff=3 " show context above/below cursorline
set shiftwidth=2 " normal mode indentation commands use 2 spaces
set showcmd
set smartcase " case-sensitive search if any caps
set softtabstop=2 " insert mode tab and backspace use 2 spaces
set tabstop=8 " actual tabs occupy 8 characters
set wildignore=log/**,node_modules/**,target/**,tmp/**,*.rbc
set wildmenu " show a navigable menu for tab completion
set wildmode=longest,list,full
" Enable basic mouse behavior such as resizing buffers.
set mouse=a
if exists('$TMUX') " Support resizing in tmux
set ttymouse=xterm2
endif
" keyboard shortcuts
let mapleader = ','
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
map <leader>l :Align
nmap <leader>a :Ack
nmap <leader>b :CtrlPBuffer<CR>
nmap <leader>d :NERDTreeToggle<CR>
nmap <leader>f :NERDTreeFind<CR>
nmap <leader>t :CtrlP<CR>
nmap <leader>T :CtrlPClearCache<CR>:CtrlP<CR>
nmap <leader>] :TagbarToggle<CR>
nmap <leader><space> :call whitespace#strip_trailing()<CR>
nmap <leader>g :GitGutterToggle<CR>
nmap <leader>c <Plug>Kwbd
map <silent> <leader>V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
" plugin settings
let g:ctrlp_match_window = 'order:ttb,max:20'
let g:NERDSpaceDelims=1
let g:gitgutter_enabled = 0
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
let g:ackprg = 'ag --nogroup --column'
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
endif
" fdoc is yaml
autocmd BufRead,BufNewFile *.fdoc set filetype=yaml
" md is markdown
autocmd BufRead,BufNewFile *.md set filetype=markdown
" extra rails.vim help
autocmd User Rails silent! Rnavcommand decorator app/decorators -glob=**/* -suffix=_decorator.rb
autocmd User Rails silent! Rnavcommand observer app/observers -glob=**/* -suffix=_observer.rb
autocmd User Rails silent! Rnavcommand feature features -glob=**/* -suffix=.feature
autocmd User Rails silent! Rnavcommand job app/jobs -glob=**/* -suffix=_job.rb
autocmd User Rails silent! Rnavcommand mediator app/mediators -glob=**/* -suffix=_mediator.rb
autocmd User Rails silent! Rnavcommand stepdefinition features/step_definitions -glob=**/* -suffix=_steps.rb
" automatically rebalance windows on vim resize
autocmd VimResized * :wincmd =
" Fix Cursor in TMUX
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
" Go crazy!
if filereadable(expand("~/.vimrc.local"))
" In your .vimrc.local, you might like:
"
" set autowrite
" set nocursorline
" set nowritebackup
" set whichwrap+=<,>,h,l,[,] " Wrap arrow keys between lines
"
" autocmd! bufwritepost .vimrc source ~/.vimrc
" noremap! jj <ESC>
source ~/.vimrc.local
endif

@ -0,0 +1 @@
Subproject commit fd2e0b6a0ee4561c457bbd9db7f72e1ecc6a5a19

View File

@ -0,0 +1,4 @@
*~
*.swp
tags
.DS_Store

View File

@ -0,0 +1,49 @@
# Bug reports / Github issues
When reporting a bug make sure you search the existing github issues for the
same/similar issues. If you find one, feel free to add a `+1` comment with any
additional information that may help us solve the issue.
When creating a new issue be sure to state the following:
* Steps to reproduce the bug.
* The version of vim you are using.
* The version of syntastic you are using.
For syntax checker bugs also state the version of the checker executable that you are using.
# Submitting a patch
* Fork the repo on github
* Make a [topic branch](https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches) and start hacking
* Submit a pull request based off your topic branch
Small focused patches are preferred.
Large changes to the code should be discussed with the core team first. Create an issue and explain your plan and see what we say.
# General style notes
Following the coding conventions/styles used in the syntastic core:
* Use 4 space indents.
* Don't use abbreviated keywords - e.g. use `endfunction`, not `endfun` (there's always room for more fun!).
* Don't use `l:` prefixes for variables unless actually required (i.e. almost never).
* Code for maintainability. We would rather a function be a couple of lines longer and have (for example) some [explaining variables](http://www.refactoring.com/catalog/introduceExplainingVariable.html) to aid readability.
# Syntax checker style notes
The preferred style for error format strings is one "clause" per line. E.g.
(from the coffeelint checker):
```viml
let errorformat = '%E%f:%l:%c: %trror: %m,' .
\ 'Syntax%trror: In %f\, %m on line %l,' .
\ '%EError: In %f\, Parse error on line %l: %m,' .
\ '%EError: In %f\, %m on line %l,' .
\ '%W%f(%l): lint warning: %m,' .
\ '%W%f(%l): warning: %m,' .
\ '%E%f(%l): SyntaxError: %m,' .
\ '%-Z%p^,' .
\ '%-G%.%#'
```

View File

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -0,0 +1,175 @@
,
/ \,,_ .'|
,{{| /}}}}/_.' _____________________________________________
}}}}` '{{' '. / \
{{{{{ _ ;, \ / Ladies and Gentlemen, \
,}}}}}} /o`\ ` ;) | |
{{{{{{ / ( | this is ... |
}}}}}} | \ | |
{{{{{{{{ \ \ | |
}}}}}}}}} '.__ _ | | _____ __ __ _ |
{{{{{{{{ /`._ (_\ / | / ___/__ ______ / /_____ ______/ /_(_)____ |
}}}}}}' | //___/ --=: \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ |
jgs `{{{{` | '--' | ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ |
}}}` | /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ |
| /____/ |
| /
\_____________________________________________/
Syntastic is a syntax checking plugin that runs files through external syntax
checkers and displays any resulting errors to the user. This can be done on
demand, or automatically as files are saved. If syntax errors are detected, the
user is notified and is happy because they didn't have to compile their code or
execute their script to find them.
At the time of this writing, syntax checking plugins exist for Ada,
AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS,
Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran,
Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript,
JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM,
Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python,
reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX,
Twig, TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page
templates, zsh.
## Screenshot
Below is a screenshot showing the methods that Syntastic uses to display syntax
errors. Note that, in practise, you will only have a subset of these methods
enabled.
![Screenshot 1](https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png)
1. Errors are loaded into the location list for the corresponding window.
2. When the cursor is on a line containing an error, the error message is echoed in the command window.
3. Signs are placed beside lines with errors - note that warnings are displayed in a different color.
4. There is a configurable statusline flag you can include in your statusline config.
5. Hover the mouse over a line containing an error and the error message is displayed as a balloon.
6. (not shown) Highlighting errors with syntax highlighting. Erroneous parts of lines can be highlighted.
## Installation
Installing syntastic is easy but first you need to have the pathogen plugin installed. If you already
have pathogen working then skip Step 1 and go to Step 2.
### Step 1: Install pathogen.vim
First I'll show you how to install tpope's [pathogen.vim](https://github.com/tpope/vim-pathogen) so that
it's easy to install syntastic. Do this in your Terminal so that you get the pathogen.vim file
and the directories it needs:
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -so ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
Next you *need to add this* to your ~/.vimrc:
execute pathogen#infect()
### Step 2: Install syntastic as a pathogen bundle
You now have pathogen installed and can put syntastic into ~/.vim/bundle like this:
cd ~/.vim/bundle
git clone https://github.com/scrooloose/syntastic.git
Quit vim and start it back up to reload it, then type:
:Helptags
If you get an error when you do this, then you probably didn't install pathogen right. Go back to
step 1 and make sure you did the following:
1. Created both the ~/.vim/autoload and ~/.vim/bundle directories.
2. Added the "call pathogen#infect()" line to your ~/.vimrc file
3. Did the git clone of syntastic inside ~/.vim/bundle
4. Have permissions to access all of these directories.
## Google group
To get information or make suggestions check out the [google group](https://groups.google.com/group/vim-syntastic).
## FAQ
__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/<filetype>/*.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`.
Another reason it could fail is that either the command line options or the error output for a syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request.
__Q. Recently some of my syntax checker options have stopped working...__
A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `syntastic#makeprg#build()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options.
e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntastic_php_phpcs_args`.
See `:help syntastic-checker-options` for more information.
__Q. I run a checker and the location list is not updated...__
A. By default, the location list is changed only when you run the `:Errors` command, in order to minimise conflicts with other plugins. If you want the location list to always be updated when you run the checkers, add this line to your vimrc:
```vim
let g:syntastic_always_populate_loc_list=1
```
__Q. How can I pass additional arguments to a checker?__
A. Almost all syntax checkers use the `syntastic#makeprg#build()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are:
```vim
syntastic_<filetype>_<subchecker>_args
```
So, If you wanted to pass "--my --args --here" to the ruby mri checker you would add this line to your vimrc:
```vim
let g:syntastic_ruby_mri_args="--my --args --here"
```
See `:help syntastic-checker-options` for more information.
__Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use?__
A. Stick a line like this in your vimrc:
```vim
let g:syntastic_<filetype>_checkers=['<checker-name>']
```
To see the list of checkers for your filetype, look in `syntax_checkers/<filetype>/`.
e.g. Python has the following checkers: `flake8`, `pyflakes`, `pylint` and a native `python` checker.
To tell syntastic to use `pylint`, you would use this setting:
```vim
let g:syntastic_python_checkers=['pylint']
```
Some filetypes, like PHP, have style checkers as well as syntax checkers. These can be chained together like this:
```vim
let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']
```
This is telling syntastic to run the `php` checker first, and if no errors are found, run `phpcs`, and then `phpmd`.
__Q. How can I jump between the different errors without using the location list at the bottom of the window?__
A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`.
If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired), which provides such mappings (among other things).
__Q. A syntax checker is giving me unwanted/strange style tips?__
A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the [wiki](https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers) to see what options are available.
__Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__
A. There is no safe way to handle that situation automatically, but you can work around it:
```vim
nnoremap <silent> <C-d> :lclose<CR>:bdelete<CR>
cabbrev <silent> bd lclose\|bdelete
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -0,0 +1,239 @@
if exists("g:loaded_syntastic_c_autoload")
finish
endif
let g:loaded_syntastic_c_autoload = 1
let s:save_cpo = &cpo
set cpo&vim
" initialize c/cpp syntax checker handlers
function! s:Init()
let s:handlers = []
let s:cflags = {}
call s:RegHandler('gtk', 'syntastic#c#CheckPKG',
\ ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib'])
call s:RegHandler('glib', 'syntastic#c#CheckPKG',
\ ['glib', 'glib-2.0', 'glib'])
call s:RegHandler('glade', 'syntastic#c#CheckPKG',
\ ['glade', 'libglade-2.0', 'libglade'])
call s:RegHandler('libsoup', 'syntastic#c#CheckPKG',
\ ['libsoup', 'libsoup-2.4', 'libsoup-2.2'])
call s:RegHandler('webkit', 'syntastic#c#CheckPKG',
\ ['webkit', 'webkit-1.0'])
call s:RegHandler('cairo', 'syntastic#c#CheckPKG',
\ ['cairo', 'cairo'])
call s:RegHandler('pango', 'syntastic#c#CheckPKG',
\ ['pango', 'pango'])
call s:RegHandler('libxml', 'syntastic#c#CheckPKG',
\ ['libxml', 'libxml-2.0', 'libxml'])
call s:RegHandler('freetype', 'syntastic#c#CheckPKG',
\ ['freetype', 'freetype2', 'freetype'])
call s:RegHandler('SDL', 'syntastic#c#CheckPKG',
\ ['sdl', 'sdl'])
call s:RegHandler('opengl', 'syntastic#c#CheckPKG',
\ ['opengl', 'gl'])
call s:RegHandler('ruby', 'syntastic#c#CheckRuby', [])
call s:RegHandler('Python\.h', 'syntastic#c#CheckPython', [])
call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', [])
endfunction
" default include directories
let s:default_includes = [ '.', '..', 'include', 'includes',
\ '../include', '../includes' ]
" convenience function to determine the 'null device' parameter
" based on the current operating system
function! syntastic#c#GetNullDevice()
if has('win32')
return '-o nul'
elseif has('unix') || has('mac')
return '-o /dev/null'
endif
return ''
endfunction
" get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! syntastic#c#GetIncludeDirs(filetype)
let include_dirs = []
if !exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') ||
\ !g:syntastic_{a:filetype}_no_default_include_dirs
let include_dirs = copy(s:default_includes)
endif
if exists('g:syntastic_'.a:filetype.'_include_dirs')
call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs)
endif
return join(map(syntastic#util#unique(include_dirs), '"-I" . v:val'), ' ')
endfunction
" read additional compiler flags from the given configuration file
" the file format and its parsing mechanism is inspired by clang_complete
function! syntastic#c#ReadConfig(file)
" search in the current file's directory upwards
let config = findfile(a:file, '.;')
if config == '' || !filereadable(config) | return '' | endif
" convert filename into absolute path
let filepath = substitute(fnamemodify(config, ':p:h'), '\', '/', 'g')
" try to read config file
try
let lines = map(readfile(config),
\ 'substitute(v:val, ''\'', ''/'', ''g'')')
catch /E484/
return ''
endtry
let parameters = []
for line in lines
let matches = matchlist(line, '\C^\s*-I\s*\(\S\+\)')
if matches != [] && matches[1] != ''
" this one looks like an absolute path
if match(matches[1], '^\%(/\|\a:\)') != -1
call add(parameters, '-I' . matches[1])
else
call add(parameters, '-I' . filepath . '/' . matches[1])
endif
else
call add(parameters, line)
endif
endfor
return join(parameters, ' ')
endfunction
" search the first 100 lines for include statements that are
" given in the handlers dictionary
function! syntastic#c#SearchHeaders()
let includes = ''
let files = []
let found = []
let lines = filter(getline(1, 100), 'v:val =~# "#\s*include"')
" search current buffer
for line in lines
let file = matchstr(line, '"\zs\S\+\ze"')
if file != ''
call add(files, file)
continue
endif
for handler in s:handlers
if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"])
call add(found, handler["regex"])
break
endif
endfor
endfor
" search included headers
for hfile in files
if hfile != ''
let filename = expand('%:p:h') . (has('win32') ?
\ '\' : '/') . hfile
try
let lines = readfile(filename, '', 100)
catch /E484/
continue
endtry
let lines = filter(lines, 'v:val =~# "#\s*include"')
for handler in s:handlers
if index(found, handler["regex"]) != -1
continue
endif
for line in lines
if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"])
call add(found, handler["regex"])
break
endif
endfor
endfor
endif
endfor
return includes
endfunction
" try to find library with 'pkg-config'
" search possible libraries from first to last given
" argument until one is found
function! syntastic#c#CheckPKG(name, ...)
if executable('pkg-config')
if !has_key(s:cflags, a:name)
for i in range(a:0)
let l:cflags = system('pkg-config --cflags '.a:000[i])
" since we cannot necessarily trust the pkg-config exit code
" we have to check for an error output as well
if v:shell_error == 0 && l:cflags !~? 'not found'
let l:cflags = ' '.substitute(l:cflags, "\n", '', '')
let s:cflags[a:name] = l:cflags
return l:cflags
endif
endfor
else
return s:cflags[a:name]
endif
endif
return ''
endfunction
" try to find PHP includes with 'php-config'
function! syntastic#c#CheckPhp()
if executable('php-config')
if !exists('s:php_flags')
let s:php_flags = system('php-config --includes')
let s:php_flags = ' ' . substitute(s:php_flags, "\n", '', '')
endif
return s:php_flags
endif
return ''
endfunction
" try to find the ruby headers with 'rbconfig'
function! syntastic#c#CheckRuby()
if executable('ruby')
if !exists('s:ruby_flags')
let s:ruby_flags = system('ruby -r rbconfig -e '
\ . '''puts Config::CONFIG["archdir"]''')
let s:ruby_flags = substitute(s:ruby_flags, "\n", '', '')
let s:ruby_flags = ' -I' . s:ruby_flags
endif
return s:ruby_flags
endif
return ''
endfunction
" try to find the python headers with distutils
function! syntastic#c#CheckPython()
if executable('python')
if !exists('s:python_flags')
let s:python_flags = system('python -c ''from distutils import '
\ . 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''')
let s:python_flags = substitute(s:python_flags, "\n", '', '')
let s:python_flags = ' -I' . s:python_flags
endif
return s:python_flags
endif
return ''
endfunction
" return a handler dictionary object
function! s:RegHandler(regex, function, args)
let handler = {}
let handler["regex"] = a:regex
let handler["func"] = function(a:function)
let handler["args"] = a:args
call add(s:handlers, handler)
endfunction
call s:Init()
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,50 @@
if exists("g:loaded_syntastic_makeprg_autoload")
finish
endif
let g:loaded_syntastic_makeprg_autoload = 1
"Returns a makeprg of the form
"
"[exe] [args] [filename] [post_args] [tail]
"
"A (made up) example:
" ruby -a -b -c test_file.rb --more --args > /tmp/output
"
"To generate this you would call:
"
" let makeprg = syntastic#makeprg#build({
" \ 'exe': 'ruby',
" \ 'args': '-a -b -c',
" \ 'post_args': '--more --args',
" \ 'tail': '> /tmp/output',
" \ 'filetype': 'ruby',
" \ 'subchecker': 'mri' })
"
"Note that the current filename is added by default - but can be overridden by
"passing in an 'fname' arg.
"
"Arguments 'filetype' and 'subchecker' are mandatory, handling of composite
"types and user-defined variables breaks if you omit them.
"
"All other options can be overriden by the user with global variables - even
"when not specified by the checker in syntastic#makeprg#build().
"
"E.g. They could override the checker exe with
"
" let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb"
"
"The general form of the override option is:
" syntastic_[filetype]_[subchecker]_[option-name]
"
function! syntastic#makeprg#build(opts)
let builder = g:SyntasticMakeprgBuilder.New(
\ get(a:opts, 'exe', ''),
\ get(a:opts, 'args', ''),
\ get(a:opts, 'fname', ''),
\ get(a:opts, 'post_args', ''),
\ get(a:opts, 'tail', ''),
\ get(a:opts, 'filetype', ''),
\ get(a:opts, 'subchecker', '') )
return builder.makeprg()
endfunction

View File

@ -0,0 +1,58 @@
if exists("g:loaded_syntastic_postprocess_autoload")
finish
endif
let g:loaded_syntastic_postprocess_autoload = 1
let s:save_cpo = &cpo
set cpo&vim
function! s:compareErrorItems(a, b)
if a:a['bufnr'] != a:b['bufnr']
" group by files
return a:a['bufnr'] - a:b['bufnr']
elseif a:a['lnum'] != a:b['lnum']
return a:a['lnum'] - a:b['lnum']
elseif a:a['type'] !=? a:b['type']
" errors take precedence over warnings
return a:a['type'] ==? 'e' ? -1 : 1
else
return get(a:a, 'col') - get(a:b, 'col')
endif
endfunction
" natural sort
function! syntastic#postprocess#sort(errors)
return sort(a:errors, 's:compareErrorItems')
endfunction
function syntastic#postprocess#compressWhitespace(errors)
let llist = []
for e in a:errors
let e['text'] = substitute(e['text'], '\n', ' ', 'g')
let e['text'] = substitute(e['text'], '\s\{2,}', ' ', 'g')
call add(llist, e)
endfor
return llist
endfunction
" remove spurious CR under Cygwin
function! syntastic#postprocess#cygwinRemoveCR(errors)
if has('win32unix')
let llist = []
for e in a:errors
let e['text'] = substitute(e['text'], '\r', '', 'g')
call add(llist, e)
endfor
else
let llist = a:errors
endif
return llist
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,201 @@
if exists("g:loaded_syntastic_util_autoload")
finish
endif
let g:loaded_syntastic_util_autoload = 1
let s:save_cpo = &cpo
set cpo&vim
if !exists("g:syntastic_debug")
let g:syntastic_debug = 0
endif
let s:deprecationNoticesIssued = []
function! syntastic#util#DevNull()
if has('win32')
return 'NUL'
endif
return '/dev/null'
endfunction
"search the first 5 lines of the file for a magic number and return a map
"containing the args and the executable
"
"e.g.
"
"#!/usr/bin/perl -f -bar
"
"returns
"
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
function! syntastic#util#parseShebang()
for lnum in range(1,5)
let line = getline(lnum)
if line =~ '^#!'
let exe = matchstr(line, '^#!\s*\zs[^ \t]*')
let args = split(matchstr(line, '^#!\s*[^ \t]*\zs.*'))
return {'exe': exe, 'args': args}
endif
endfor
return {'exe': '', 'args': []}
endfunction
" Run 'command' in a shell and parse output as a version string.
" Returns an array of version components.
function! syntastic#util#parseVersion(command)
return split(matchstr( system(a:command), '\v^\D*\zs\d+(\.\d+)+\ze' ), '\.')
endfunction
" Verify that the 'installed' version is at least the 'required' version.
"
" 'installed' and 'required' must be arrays. If they have different lengths,
" the "missing" elements will be assumed to be 0 for the purposes of checking.
"
" See http://semver.org for info about version numbers.
function! syntastic#util#versionIsAtLeast(installed, required)
for index in range(max([len(a:installed), len(a:required)]))
if len(a:installed) <= index
let installed_element = 0
else
let installed_element = a:installed[index]
endif
if len(a:required) <= index
let required_element = 0
else
let required_element = a:required[index]
endif
if installed_element != required_element
return installed_element > required_element
endif
endfor
" Everything matched, so it is at least the required version.
return 1
endfunction
"print as much of a:msg as possible without "Press Enter" prompt appearing
function! syntastic#util#wideMsg(msg)
let old_ruler = &ruler
let old_showcmd = &showcmd
"convert tabs to spaces so that the tabs count towards the window width
"as the proper amount of characters
let msg = substitute(a:msg, "\t", repeat(" ", &tabstop), "g")
let msg = strpart(msg, 0, winwidth(0)-1)
"This is here because it is possible for some error messages to begin with
"\n which will cause a "press enter" prompt. I have noticed this in the
"javascript:jshint checker and have been unable to figure out why it
"happens
let msg = substitute(msg, "\n", "", "g")
set noruler noshowcmd
redraw
echo msg
let &ruler=old_ruler
let &showcmd=old_showcmd
endfunction
" Check whether a buffer is loaded, listed, and not hidden
function! syntastic#util#bufIsActive(buffer)
" convert to number, or hell breaks loose
let buf = str2nr(a:buffer)
if !bufloaded(buf) || !buflisted(buf)
return 0
endif
" get rid of hidden buffers
for tab in range(1, tabpagenr('$'))
if index(tabpagebuflist(tab), buf) >= 0
return 1
endif
endfor
return 0
endfunction
" start in directory a:where and walk up the parent folders until it
" finds a file matching a:what; return path to that file
function! syntastic#util#findInParent(what, where)
let here = fnamemodify(a:where, ':p')
while !empty(here)
let p = split(globpath(here, a:what), '\n')
if !empty(p)
return fnamemodify(p[0], ':p')
elseif here == '/'
break
endif
" we use ':h:h' rather than ':h' since ':p' adds a trailing '/'
" if 'here' is a directory
let here = fnamemodify(here, ':p:h:h')
endwhile
return ''
endfunction
" Returns unique elements in a list
function! syntastic#util#unique(list)
let seen = {}
let uniques = []
for e in a:list
if !has_key(seen, e)
let seen[e] = 1
call add(uniques, e)
endif
endfor
return uniques
endfunction
" A less noisy shellescape()
function! syntastic#util#shescape(string)
return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string, 1)
endfunction
" A less noisy shellescape(expand())
function! syntastic#util#shexpand(string)
return syntastic#util#shescape(escape(expand(a:string), '|'))
endfunction
function! syntastic#util#debug(msg)
if g:syntastic_debug
echomsg "syntastic: debug: " . a:msg
endif
endfunction
function! syntastic#util#info(msg)
echomsg "syntastic: info: " . a:msg
endfunction
function! syntastic#util#warn(msg)
echohl WarningMsg
echomsg "syntastic: warning: " . a:msg
echohl None
endfunction
function! syntastic#util#error(msg)
execute "normal \<Esc>"
echohl ErrorMsg
echomsg "syntastic: error: " . a:msg
echohl None
endfunction
function! syntastic#util#deprecationWarn(msg)
if index(s:deprecationNoticesIssued, a:msg) >= 0
return
endif
call add(s:deprecationNoticesIssued, a:msg)
call syntastic#util#warn(a:msg)
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,455 @@
*syntastic.txt* Syntax checking on the fly has never been so pimp.
*syntastic*
It's a bird! It's a plane! ZOMG It's ... ~
_____ __ __ _ ~
/ ___/__ ______ / /_____ ______/ /_(_)____ ~
\__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ ~
___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ ~
/____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ ~
/____/ ~
Reference Manual~
==============================================================================
CONTENTS *syntastic-contents*
1.Intro...................................|syntastic-intro|
2.Functionality provided..................|syntastic-functionality|
2.1.The statusline flag...............|syntastic-statusline-flag|
2.2.Error signs.......................|syntastic-error-signs|
2.3.Error window......................|syntastic-error-window|
3.Commands................................|syntastic-commands|
4.Global Options..........................|syntastic-global-options|
5.Checker Options.........................|syntastic-checker-options|
6.About...................................|syntastic-about|
7.License.................................|syntastic-license|
==============================================================================
1. Intro *syntastic-intro*
Note: This doc only deals with using syntastic. To learn how to write syntax
checker integrations, see the guide on the github wiki:
https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
Syntastic is a syntax checking plugin that runs files through external syntax
checkers. This can be done on demand, or automatically as files are saved and
opened. If syntax errors are detected, the user is notified and is happy
because they didn't have to compile their code or execute their script to find
them.
Syntastic comes in two parts: the syntax checker plugins, and the core. The
syntax checker plugins are defined on a per-filetype basis where each one wraps
up an external syntax checking program. The core script delegates off to these
plugins and uses their output to provide the syntastic functionality.
Take a look in the syntax_checkers directory for a list of supported filetypes
and checkers.
==============================================================================
2. Functionality provided *syntastic-functionality*
Syntax checking can be done automatically or on demand (see
|'syntastic_mode_map'| for configuring this).
When syntax checking is done, the features below can be used to notify the
user of errors. See |syntastic-options| for how to configure and
activate/deactivate these features.
* A statusline flag
* Signs beside lines with errors
* The |location-list| can be populated with the errors for the associated
buffer.
* Erroneous parts of lines can be highlighted (this functionality is only
provided by some syntax checkers).
* Balloons (if compiled in) can be used to display error messages for
erroneous lines when hovering the mouse over them.
------------------------------------------------------------------------------
2.1. The statusline flag *syntastic-statusline-flag*
To use the statusline flag, this must appear in your |'statusline'| setting >
%{SyntasticStatuslineFlag()}
<
Something like this could be more useful: >
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
<
When syntax errors are detected a flag will be shown. The content of the flag
is derived from the |syntastic_stl_format| option
------------------------------------------------------------------------------
2.2. Error signs *syntastic-error-signs*
Syntastic uses the |:sign| commands to mark lines with errors and warnings in
the sign column. To enable this feature, use the |'syntastic_enable_signs'|
option.
Signs are colored using the Error and Todo syntax highlight groups by default.
If you wish to customize the colors for the signs, you can use the following
groups:
SyntasticErrorSign - For syntax errors, links to 'error' by default
SyntasticWarningSign - For syntax warnings, links to 'todo' by default
SyntasticStyleErrorSign - For style errors, links to 'SyntasticErrorSign'
by default
SyntasticStyleWarningSign - For style warnings, links to
'SyntasticWarningSign' by default
Example: >
highlight SyntasticErrorSign guifg=white guibg=red
<
To set up highlighting for the line where a sign resides, you can use the
following highlight groups:
SyntasticErrorLine
SyntasticWarningLine
SyntasticStyleErrorLine - Links to 'SyntasticErrorLine' by default
SyntasticStyleWarningLine - Links to 'SyntasticWarningLine' by default
Example: >
highlight SyntasticErrorLine guibg=#2f0000
<
------------------------------------------------------------------------------
2.3. The error window *:Errors* *syntastic-error-window*
You can use the :Errors command to display the errors for the current buffer
in the |location-list|.
Note that when you use :Errors, the current location list is overwritten with
Syntastic's own location list.
==============================================================================
3. Commands *syntastic-commands*
:Errors *:SyntasticErrors*
When errors have been detected, use this command to pop up the |location-list|
and display the error messages.
:SyntasticToggleMode *:SyntasticToggleMode*
Toggles syntastic between active and passive mode. See |'syntastic_mode_map'|
for more info.
:SyntasticCheck *:SyntasticCheck*
Manually cause a syntax check to be done. Useful in passive mode, or if the
current filetype is set to passive. See |'syntastic_mode_map'| for more info.
:SyntasticInfo *:SyntasticInfo*
Output info about what checkers are available and in use for the current
filetype.
==============================================================================
4. Global Options *syntastic-global-options*
*'syntastic_check_on_open'*
Default: 0
If enabled, syntastic will do syntax checks when buffers are first loaded as
well as on saving >
let g:syntastic_check_on_open=1
<
*'syntastic_check_on_wq'*
Default: 1
Normally syntastic runs syntax checks whenever buffers are written to disk.
If you want to skip these checks when you issue |:wq|, |:x|, and |:ZZ|, set this
variable to 0. >
let g:syntastic_check_on_wq=0
<
*'syntastic_echo_current_error'*
Default: 1
If enabled, syntastic will echo the error associated with the current line to
the command window. If multiple errors are found, the first will be used. >
let g:syntastic_echo_current_error=1
<
*'syntastic_enable_signs'*
Default: 1
Use this option to tell syntastic whether to use the |:sign| interface to mark
syntax errors: >
let g:syntastic_enable_signs=1
<
*'syntastic_error_symbol'* *'syntastic_style_error_symbol'*
*'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'*
Use this option to control what the syntastic |:sign| text contains. Several
error symobls can be customized:
syntastic_error_symbol - For syntax errors, defaults to '>>'
syntastic_style_error_symbol - For style errors, defaults to 'S>'
syntastic_warning_symbol - For syntax warnings, defaults to '>>'
syntastic_style_warning_symbol - For style warnings, defaults to 'S>'
Example: >
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
<
*'syntastic_enable_balloons'*
Default: 1
Use this option to tell syntastic whether to display error messages in balloons
when the mouse is hovered over erroneous lines: >
let g:syntastic_enable_balloons = 1
<
Note that vim must be compiled with |+balloon_eval|.
*'syntastic_enable_highlighting'*
Default: 1
Use this option to tell syntastic whether to use syntax highlighting to mark
errors (where possible). Highlighting can be turned off with the following >
let g:syntastic_enable_highlighting = 0
<
*'syntastic_always_populate_loc_list'*
Default: 0
Enable this option to tell syntastic to always stick any detected errors into
the loclist: >
let g:syntastic_always_populate_loc_list=1
<
*'syntastic_auto_jump'*
Default: 0
Enable this option if you want the cursor to jump to the first detected error
when saving or opening a file: >
let g:syntastic_auto_jump=1
<
*'syntastic_auto_loc_list'*
Default: 2
Use this option to tell syntastic to automatically open and/or close the
|location-list| (see |syntastic-error-window|).
When set to 0 the error window will not be opened or closed automatically. >
let g:syntastic_auto_loc_list=0
<
When set to 1 the error window will be automatically opened when errors are
detected, and closed when none are detected. >
let g:syntastic_auto_loc_list=1
<
When set to 2 the error window will be automatically closed when no errors are
detected, but not opened automatically. >
let g:syntastic_auto_loc_list=2
<
*'syntastic_loc_list_height'*
Default: 10
Use this option to specify the height of the location lists that syntastic
opens. >
let g:syntastic_loc_list_height=5
<
*'syntastic_ignore_files'*
Default: []
Use this option to specify files that syntastic should neither check, nor
include in error lists. It has to be a list of |regular-expression| patterns.
The full paths of files (see |::p|) are matched against these patterns, and
the matches are case sensitive. Use |\c| if you need case insensitive
patterns. >
let g:syntastic_ignore_files=['^/usr/include/', '\c\.h$']
<
*'syntastic_filetype_map'*
Default: {}
Use this option to map non-standard filetypes to standard ones. Corresponding
checkers are mapped accordingly, which allows syntastic to check files with
non-standard filetypes: >
let g:syntastic_filetype_map = { 'latex': 'tex',
\ 'gentoo-metadata': 'xml' }
<
*'syntastic_mode_map'*
Default: { "mode": "active",
"active_filetypes": [],
"passive_filetypes": [] }
Use this option to fine tune when automatic syntax checking is done (or not
done).
The option should be set to something like: >
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': ['ruby', 'php'],
\ 'passive_filetypes': ['puppet'] }
<
"mode" can be mapped to one of two values - "active" or "passive". When set to
active, syntastic does automatic checking whenever a buffer is saved or
initially opened. When set to "passive" syntastic only checks when the user
calls :SyntasticCheck.
The exceptions to these rules are defined with "active_filetypes" and
"passive_filetypes". In passive mode, automatic checks are still done
for all filetypes in the "active_filetypes" array. In active mode,
automatic checks are not done for any filetypes in the
"passive_filetypes" array.
At runtime, the |:SyntasticToggleMode| command can be used to switch between
active and passive mode.
If any of "mode", "active_filetypes", or "passive_filetypes" are not specified
then they will default to their default value as above.
*'syntastic_quiet_warnings'*
Use this option if you only care about syntax errors, not warnings. When set,
this option has the following effects:
* no |signs| appear unless there is at least one error, whereupon both
errors and warnings are displayed
* the |'syntastic_auto_loc_list'| option only pops up the error window if
there's at least one error, whereupon both errors and warnings are
displayed
>
let g:syntastic_quiet_warnings=1
<
*'syntastic_stl_format'*
Default: [Syntax: line:%F (%t)]
Use this option to control what the syntastic statusline text contains. Several
magic flags are available to insert information:
%e - number of errors
%w - number of warnings
%t - total number of warnings and errors
%fe - line number of first error
%fw - line number of first warning
%F - line number of first warning or error
Several additional flags are available to hide text under certain conditions:
%E{...} - hide the text in the brackets unless there are errors
%W{...} - hide the text in the brackets unless there are warnings
%B{...} - hide the text in the brackets unless there are both warnings AND
errors
These flags cant be nested.
Example: >
let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]'
<
If this format is used and the current buffer has 5 errors and 1 warning
starting on lines 20 and 10 respectively then this would appear on the
statusline: >
[Err: 20 #5, Warn: 10 #1]
<
If the buffer had 2 warnings, starting on line 5 then this would appear: >
[Warn: 5 #2]
<
*'syntastic_full_redraws'*
Default: 0 in GUI Vim and MacVim, 1 otherwise
Controls whether syntastic calls |:redraw| or |:redraw!| for screen redraws.
Changing it can in principle make screen redraws smoother, but it can also
cause screen flicker, or ghost characters. Leaving it to the default should
be safe.
*'syntastic_debug'*
Default: 0
Set this to 1 to enable debugging: >
let g:syntastic_debug = 1
<
Checkers will then add debugging messages to Vim's |message-history|. You can
examine these messages with |:mes|.
==============================================================================
5. Checker Options *syntastic-checker-options*
------------------------------------------------------------------------------
5.1 Telling syntastic which checker to use.
Stick a line like this in your vimrc: >
let g:syntastic_<filetype>_checkers = ['<checker-name>']
<
e.g. >
let g:syntastic_python_checkers = ['flake8']
<
There's also a per-buffer version of this setting, b:syntastic_checkers. Use
this in an autocmd to configure specific checkers for particular paths: >
autocmd FileType python if stridx(expand('%:p'), '/some/path/') == 0 |
\ let b:syntastic_checkers = ['pylint'] | endif
<
To see the list of available checkers for your filetype, look in
`syntax_checkers/<filetype>/`. The names of the files here correspond to
'<checker-name>' above.
e.g. Python has the following checkers: flake8, pyflakes, pylint and a
native python checker.
Some filetypes, like PHP, have style checkers as well as syntax checkers. These
can be chained together like this: >
let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']`
<
This is telling syntastic to run the 'php' checker first, and if no errors are
found, run 'phpcs', and then 'phpmd'.
------------------------------------------------------------------------------
5.2 Configuring specific checkers *syntastic-config-makeprg*
Most checkers use the 'syntastic#makeprg#build()' function and provide many
options by default - in fact you can customise every part of the command
that gets called.
Checkers that use 'syntastic#makeprg#build()' look like this: >
let makeprg = syntastic#makeprg#build({
\ 'exe': 'ruby',
\ 'args': '-a -b -c',
\ 'post_args': '--more --args',
\ 'tail': '> /tmp/output',
\ 'filetype': 'ruby',
\ 'subchecker': 'mri' })
<
The 'filetype' and 'subchecker' parameters are mandatory. All of the other
parameters above are optional (well, you probably need at least 'exe'), and
can be overriden by setting global variables - even parameters not specified
in the call to syntastic#makeprg#build().
E.g. To override the checker exe above, you could do this: >
let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb"
<
To override the args and the tail: >
let g:syntastic_ruby_mri_args="--my --args --here"
let g:syntastic_ruby_mri_tail="> /tmp/my-output-file-biatch"
<
The general form of the override options is: >
syntastic_[filetype]_[subchecker]_[option-name]
<
For checkers that do not use the 'syntastic#makeprg#build()' function you
will have to look at the source code of the checker in question. If there are
specific options that can be set, these are usually documented at the top of
the script.
==============================================================================
6. About *syntastic-about*
The core maintainers of syntastic are:
Martin Grenfell (github: scrooloose)
Gregor Uhlenheuer (github: kongo2002)
Find the latest version of syntastic here:
http://github.com/scrooloose/syntastic
==============================================================================
7. License *syntastic-license*
Syntastic is released under the wtfpl.
See http://sam.zoy.org/wtfpl/COPYING.
vim:tw=78:sw=4:ft=help:norl:

View File

@ -0,0 +1,423 @@
"============================================================================
"File: syntastic.vim
"Description: Vim plugin for on the fly syntax checking.
"Version: 3.0.0
"Released On: 13 April, 2013
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_plugin")
finish
endif
let g:loaded_syntastic_plugin = 1
runtime! plugin/syntastic/*.vim
let s:running_windows = has("win16") || has("win32")
if !exists("g:syntastic_always_populate_loc_list")
let g:syntastic_always_populate_loc_list = 0
endif
if !exists("g:syntastic_auto_jump")
let g:syntastic_auto_jump = 0
endif
if !exists("g:syntastic_quiet_warnings")
let g:syntastic_quiet_warnings = 0
endif
if !exists("g:syntastic_stl_format")
let g:syntastic_stl_format = '[Syntax: line:%F (%t)]'
endif
if !exists("g:syntastic_check_on_open")
let g:syntastic_check_on_open = 0
endif
if !exists("g:syntastic_check_on_wq")
let g:syntastic_check_on_wq = 1
endif
if !exists("g:syntastic_loc_list_height")
let g:syntastic_loc_list_height = 10
endif
if !exists("g:syntastic_ignore_files")
let g:syntastic_ignore_files = []
endif
if !exists("g:syntastic_filetype_map")
let g:syntastic_filetype_map = {}
endif
if !exists("g:syntastic_full_redraws")
let g:syntastic_full_redraws = !( has('gui_running') || has('gui_macvim'))
endif
let s:registry = g:SyntasticRegistry.Instance()
let s:notifiers = g:SyntasticNotifiers.Instance()
let s:modemap = g:SyntasticModeMap.Instance()
function! s:CompleteCheckerName(argLead, cmdLine, cursorPos)
let checker_names = []
for ft in s:CurrentFiletypes()
for checker in s:registry.availableCheckersFor(ft)
call add(checker_names, checker.getName())
endfor
endfor
return join(checker_names, "\n")
endfunction
command! SyntasticToggleMode call s:ToggleMode()
command! -nargs=? -complete=custom,s:CompleteCheckerName SyntasticCheck call s:UpdateErrors(0, <f-args>) <bar> call s:Redraw()
command! Errors call s:ShowLocList()
command! SyntasticInfo call s:registry.echoInfoFor(s:CurrentFiletypes())
highlight link SyntasticError SpellBad
highlight link SyntasticWarning SpellCap
augroup syntastic
autocmd BufReadPost * if g:syntastic_check_on_open | call s:UpdateErrors(1) | endif
autocmd BufWritePost * call s:UpdateErrors(1)
autocmd BufWinEnter * call s:BufWinEnterHook()
" TODO: the next autocmd should be "autocmd BufWinLeave * if empty(&bt) | lclose | endif"
" but in recent versions of Vim lclose can no longer be called from BufWinLeave
autocmd BufEnter * call s:BufEnterHook()
augroup END
if v:version > 703 || (v:version == 703 && has('patch544'))
" QuitPre was added in Vim 7.3.544
augroup syntastic
autocmd QuitPre * call s:QuitPreHook()
augroup END
endif
function! s:BufWinEnterHook()
if empty(&bt)
let loclist = g:SyntasticLoclist.current()
call s:notifiers.refresh(loclist)
endif
endfunction
function! s:BufEnterHook()
" TODO: at this point there is no b:syntastic_loclist
let loclist = filter(getloclist(0), 'v:val["valid"] == 1')
let buffers = syntastic#util#unique(map( loclist, 'v:val["bufnr"]' ))
if &bt=='quickfix' && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
call g:SyntasticLoclistHide()
endif
endfunction
function! s:QuitPreHook()
let b:syntastic_skip_checks = !g:syntastic_check_on_wq
call g:SyntasticLoclistHide()
endfunction
"refresh and redraw all the error info for this buf when saving or reading
function! s:UpdateErrors(auto_invoked, ...)
if s:SkipFile()
return
endif
let run_checks = !a:auto_invoked || s:modemap.allowsAutoChecking(&filetype)
if run_checks
if a:0 >= 1
call s:CacheErrors(a:1)
else
call s:CacheErrors()
endif
end
let loclist = g:SyntasticLoclist.current()
if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump
call setloclist(0, loclist.filteredRaw())
if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay()
silent! lrewind
endif
endif
call s:notifiers.refresh(loclist)
endfunction
"clear the loc list for the buffer
function! s:ClearCache()
call s:notifiers.reset(g:SyntasticLoclist.current())
unlet! b:syntastic_loclist
endfunction
function! s:CurrentFiletypes()
return split(&filetype, '\.')
endfunction
"detect and cache all syntax errors in this buffer
function! s:CacheErrors(...)
call s:ClearCache()
let newLoclist = g:SyntasticLoclist.New([])
if !s:SkipFile()
let active_checkers = 0
for ft in s:CurrentFiletypes()
if a:0
let checker = s:registry.getChecker(ft, a:1)
let checkers = !empty(checker) ? [checker] : []
else
let checkers = s:registry.getActiveCheckers(ft)
endif
for checker in checkers
let active_checkers += 1
call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName())
let loclist = checker.getLocList()
if !loclist.isEmpty()
let newLoclist = newLoclist.extend(loclist)
call newLoclist.setName( checker.getName() . ' ('. checker.getFiletype() . ')' )
"only get errors from one checker at a time
break
endif
endfor
endfor
if !active_checkers
if a:0
call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype)
else
call syntastic#util#debug('no active checkers for filetype ' . &filetype)
endif
endif
endif
let b:syntastic_loclist = newLoclist
endfunction
function! s:ToggleMode()
call s:modemap.toggleMode()
call s:ClearCache()
call s:UpdateErrors(1)
call s:modemap.echoMode()
endfunction
"display the cached errors for this buf in the location list
function! s:ShowLocList()
let loclist = g:SyntasticLoclist.current()
call loclist.show()
endfunction
"the script changes &shellpipe and &shell to stop the screen flicking when
"shelling out to syntax checkers. Not all OSs support the hacks though
function! s:OSSupportsShellpipeHack()
return !s:running_windows && executable('/bin/bash') && (s:uname() !~ "FreeBSD") && (s:uname() !~ "OpenBSD")
endfunction
function! s:IsRedrawRequiredAfterMake()
return !s:running_windows && (s:uname() =~ "FreeBSD" || s:uname() =~ "OpenBSD")
endfunction
"Redraw in a way that doesnt make the screen flicker or leave anomalies behind.
"
"Some terminal versions of vim require `redraw!` - otherwise there can be
"random anomalies left behind.
"
"However, on some versions of gvim using `redraw!` causes the screen to
"flicker - so use redraw.
function! s:Redraw()
if g:syntastic_full_redraws
redraw!
else
redraw
endif
endfunction
function! s:IgnoreFile(filename)
let fname = fnamemodify(a:filename, ':p')
for p in g:syntastic_ignore_files
if fname =~# p
return 1
endif
endfor
return 0
endfunction
" Skip running in special buffers
function! s:SkipFile()
let force_skip = exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0
let fname = expand('%')
return force_skip || !empty(&buftype) || !filereadable(fname) || getwinvar(0, '&diff') || s:IgnoreFile(fname)
endfunction
function! s:uname()
if !exists('s:uname')
let s:uname = system('uname')
endif
return s:uname
endfunction
"return a string representing the state of buffer according to
"g:syntastic_stl_format
"
"return '' if no errors are cached for the buffer
function! SyntasticStatuslineFlag()
let loclist = g:SyntasticLoclist.current()
let issues = loclist.filteredRaw()
let num_issues = loclist.getLength()
if loclist.hasErrorsOrWarningsToDisplay()
let errors = loclist.errors()
let warnings = loclist.warnings()
let num_errors = len(errors)
let num_warnings = len(warnings)
let output = g:syntastic_stl_format
"hide stuff wrapped in %E(...) unless there are errors
let output = substitute(output, '\C%E{\([^}]*\)}', num_errors ? '\1' : '' , 'g')
"hide stuff wrapped in %W(...) unless there are warnings
let output = substitute(output, '\C%W{\([^}]*\)}', num_warnings ? '\1' : '' , 'g')
"hide stuff wrapped in %B(...) unless there are both errors and warnings
let output = substitute(output, '\C%B{\([^}]*\)}', (num_warnings && num_errors) ? '\1' : '' , 'g')
"sub in the total errors/warnings/both
let output = substitute(output, '\C%w', num_warnings, 'g')
let output = substitute(output, '\C%e', num_errors, 'g')
let output = substitute(output, '\C%t', num_issues, 'g')
"first error/warning line num
let output = substitute(output, '\C%F', num_issues ? issues[0]['lnum'] : '', 'g')
"first error line num
let output = substitute(output, '\C%fe', num_errors ? errors[0]['lnum'] : '', 'g')
"first warning line num
let output = substitute(output, '\C%fw', num_warnings ? warnings[0]['lnum'] : '', 'g')
return output
else
return ''
endif
endfunction
"A wrapper for the :lmake command. Sets up the make environment according to
"the options given, runs make, resets the environment, returns the location
"list
"
"a:options can contain the following keys:
" 'makeprg'
" 'errorformat'
"
"The corresponding options are set for the duration of the function call. They
"are set with :let, so dont escape spaces.
"
"a:options may also contain:
" 'defaults' - a dict containing default values for the returned errors
" 'subtype' - all errors will be assigned the given subtype
" 'postprocess' - a list of functions to be applied to the error list
" 'cwd' - change directory to the given path before running the checker
" 'returns' - a list of valid exit codes for the checker
function! SyntasticMake(options)
call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options))
let old_loclist = getloclist(0)
let old_makeprg = &l:makeprg
let old_shellpipe = &shellpipe
let old_shell = &shell
let old_errorformat = &l:errorformat
let old_cwd = getcwd()
let old_lc_all = $LC_ALL
if s:OSSupportsShellpipeHack()
"this is a hack to stop the screen needing to be ':redraw'n when
"when :lmake is run. Otherwise the screen flickers annoyingly
let &shellpipe='&>'
let &shell = '/bin/bash'
endif
if has_key(a:options, 'makeprg')
let &l:makeprg = a:options['makeprg']
endif
if has_key(a:options, 'errorformat')
let &l:errorformat = a:options['errorformat']
endif
if has_key(a:options, 'cwd')
exec 'lcd ' . fnameescape(a:options['cwd'])
endif
let $LC_ALL = 'C'
silent lmake!
let $LC_ALL = old_lc_all
let errors = getloclist(0)
if has_key(a:options, 'cwd')
exec 'lcd ' . fnameescape(old_cwd)
endif
call setloclist(0, old_loclist)
let &l:makeprg = old_makeprg
let &l:errorformat = old_errorformat
let &shellpipe=old_shellpipe
let &shell=old_shell
if s:IsRedrawRequiredAfterMake()
call s:Redraw()
endif
if has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1
throw 'Syntastic: checker error'
endif
if has_key(a:options, 'defaults')
call SyntasticAddToErrors(errors, a:options['defaults'])
endif
" Apply ignore patterns
let ignore = {}
for buf in syntastic#util#unique(map(copy(errors), 'v:val["bufnr"]'))
let ignore[buf] = s:IgnoreFile(bufname(str2nr(buf)))
endfor
call filter(errors, '!ignore[v:val["bufnr"]]')
" Add subtype info if present.
if has_key(a:options, 'subtype')
call SyntasticAddToErrors(errors, {'subtype': a:options['subtype']})
endif
if has_key(a:options, 'postprocess') && !empty(a:options['postprocess'])
for rule in a:options['postprocess']
let errors = call('syntastic#postprocess#' . rule, [errors])
endfor
endif
return errors
endfunction
"take a list of errors and add default values to them from a:options
function! SyntasticAddToErrors(errors, options)
for i in range(0, len(a:errors)-1)
for key in keys(a:options)
if !has_key(a:errors[i], key) || empty(a:errors[i][key])
let a:errors[i][key] = a:options[key]
endif
endfor
endfor
return a:errors
endfunction
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,38 @@
if exists("g:loaded_syntastic_notifier_autoloclist")
finish
endif
let g:loaded_syntastic_notifier_autoloclist = 1
if !exists("g:syntastic_auto_loc_list")
let g:syntastic_auto_loc_list = 2
endif
let g:SyntasticAutoloclistNotifier = {}
" Public methods {{{1
"
function! g:SyntasticAutoloclistNotifier.New()
let newObj = copy(self)
return newObj
endfunction
function! g:SyntasticAutoloclistNotifier.refresh(loclist)
call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist)
endfunction
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist)
if a:loclist.hasErrorsOrWarningsToDisplay()
if g:syntastic_auto_loc_list == 1
call a:loclist.show()
endif
else
if g:syntastic_auto_loc_list > 0
"TODO: this will close the loc list window if one was opened by
"something other than syntastic
lclose
endif
endif
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,64 @@
if exists("g:loaded_syntastic_notifier_balloons")
finish
endif
let g:loaded_syntastic_notifier_balloons = 1
if !exists("g:syntastic_enable_balloons")
let g:syntastic_enable_balloons = 1
endif
if !has('balloon_eval')
let g:syntastic_enable_balloons = 0
endif
let g:SyntasticBalloonsNotifier = {}
" Public methods {{{1
function! g:SyntasticBalloonsNotifier.New()
let newObj = copy(self)
return newObj
endfunction
function! g:SyntasticBalloonsNotifier.enabled()
return
\ has('balloon_eval') &&
\ (exists('b:syntastic_enable_balloons') ? b:syntastic_enable_balloons : g:syntastic_enable_balloons)
endfunction
" Update the error balloons
function! g:SyntasticBalloonsNotifier.refresh(loclist)
let b:syntastic_balloons = {}
if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay()
let buf = bufnr('')
let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf')
if !empty(issues)
for i in issues
if has_key(b:syntastic_balloons, i['lnum'])
let b:syntastic_balloons[i['lnum']] .= "\n" . i['text']
else
let b:syntastic_balloons[i['lnum']] = i['text']
endif
endfor
set beval bexpr=SyntasticBalloonsExprNotifier()
endif
endif
endfunction
" Reset the error balloons
function! g:SyntasticBalloonsNotifier.reset(loclist)
if has('balloon_eval')
set nobeval
endif
endfunction
" Private functions {{{1
function! SyntasticBalloonsExprNotifier()
if !exists('b:syntastic_balloons')
return ''
endif
return get(b:syntastic_balloons, v:beval_lnum, '')
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,79 @@
if exists("g:loaded_syntastic_checker")
finish
endif
let g:loaded_syntastic_checker = 1
let g:SyntasticChecker = {}
" Public methods {{{1
function! g:SyntasticChecker.New(args)
let newObj = copy(self)
let newObj._filetype = a:args['filetype']
let newObj._name = a:args['name']
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
let newObj._locListFunc = function(prefix . 'GetLocList')
let newObj._isAvailableFunc = function(prefix . 'IsAvailable')
if exists('*' . prefix . 'GetHighlightRegex')
let newObj._highlightRegexFunc = function(prefix. 'GetHighlightRegex')
else
let newObj._highlightRegexFunc = ''
endif
return newObj
endfunction
function! g:SyntasticChecker.getFiletype()
return self._filetype
endfunction
function! g:SyntasticChecker.getName()
return self._name
endfunction
function! g:SyntasticChecker.getLocList()
try
let list = self._locListFunc()
call syntastic#util#debug('getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error)
catch /\m\C^Syntastic: checker error$/
let list = []
call syntastic#util#error('checker ' . self._filetype . '/' . self._name . ' returned abnormal status ' . v:shell_error)
endtry
call self._populateHighlightRegexes(list)
return g:SyntasticLoclist.New(list)
endfunction
function! g:SyntasticChecker.getHighlightRegexFor(error)
if empty(self._highlightRegexFunc)
return []
endif
return self._highlightRegexFunc(error)
endfunction
function! g:SyntasticChecker.isAvailable()
return self._isAvailableFunc()
endfunction
" Private methods {{{1
function! g:SyntasticChecker._populateHighlightRegexes(list)
let list = a:list
if !empty(self._highlightRegexFunc)
for i in range(0, len(list)-1)
if list[i]['valid']
let term = self._highlightRegexFunc(list[i])
if len(term) > 0
let list[i]['hl'] = term
endif
endif
endfor
endif
return list
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,63 @@
if exists("g:loaded_syntastic_notifier_cursor")
finish
endif
let g:loaded_syntastic_notifier_cursor = 1
if !exists('g:syntastic_echo_current_error')
let g:syntastic_echo_current_error = 1
endif
let g:SyntasticCursorNotifier = {}
" Public methods {{{1
function! g:SyntasticCursorNotifier.New()
let newObj = copy(self)
return newObj
endfunction
function! g:SyntasticCursorNotifier.enabled()
return exists('b:syntastic_echo_current_error') ? b:syntastic_echo_current_error : g:syntastic_echo_current_error
endfunction
function! g:SyntasticCursorNotifier.refresh(loclist)
if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay()
let b:syntastic_messages = copy(a:loclist.messages(bufnr('')))
let b:oldLine = -1
autocmd! syntastic CursorMoved
autocmd syntastic CursorMoved * call g:SyntasticRefreshCursor()
endif
endfunction
function! g:SyntasticCursorNotifier.reset(loclist)
autocmd! syntastic CursorMoved
unlet! b:syntastic_messages
let b:oldLine = -1
endfunction
" Private methods {{{1
" The following defensive nonsense is needed because of the nature of autocmd
function! g:SyntasticRefreshCursor()
if !exists('b:syntastic_messages') || empty(b:syntastic_messages)
" file not checked
return
endif
if !exists('b:oldLine')
let b:oldLine = -1
endif
let l = line('.')
if l == b:oldLine
return
endif
let b:oldLine = l
if has_key(b:syntastic_messages, l)
call syntastic#util#wideMsg(b:syntastic_messages[l])
else
echo
endif
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,66 @@
if exists("g:loaded_syntastic_notifier_highlighting")
finish
endif
let g:loaded_syntastic_notifier_highlighting = 1
" Highlighting requires getmatches introduced in 7.1.040
let s:has_highlighting = v:version > 701 || (v:version == 701 && has('patch040'))
if !exists("g:syntastic_enable_highlighting")
let g:syntastic_enable_highlighting = 1
endif
let g:SyntasticHighlightingNotifier = {}
" Public methods {{{1
function! g:SyntasticHighlightingNotifier.New()
let newObj = copy(self)
return newObj
endfunction
function! g:SyntasticHighlightingNotifier.enabled()
return
\ s:has_highlighting &&
\ (exists('b:syntastic_enable_highlighting') ? b:syntastic_enable_highlighting : g:syntastic_enable_highlighting)
endfunction
" Sets error highlights in the cuirrent window
function! g:SyntasticHighlightingNotifier.refresh(loclist)
if self.enabled()
call self.reset(a:loclist)
let buf = bufnr('')
let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf')
for item in issues
let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning'
" The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is
" used to override default highlighting.
if has_key(item, 'hl')
call matchadd(group, '\%' . item['lnum'] . 'l' . item['hl'])
elseif get(item, 'col')
let lastcol = col([item['lnum'], '$'])
let lcol = min([lastcol, item['col']])
" a bug in vim can sometimes cause there to be no 'vcol' key,
" so check for its existence
let coltype = has_key(item, 'vcol') && item['vcol'] ? 'v' : 'c'
call matchadd(group, '\%' . item['lnum'] . 'l\%' . lcol . coltype)
endif
endfor
endif
endfunction
" Remove all error highlights from the window
function! g:SyntasticHighlightingNotifier.reset(loclist)
if s:has_highlighting
for match in getmatches()
if stridx(match['group'], 'Syntastic') == 0
call matchdelete(match['id'])
endif
endfor
endif
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,173 @@
if exists("g:loaded_syntastic_loclist")
finish
endif
let g:loaded_syntastic_loclist = 1
let g:SyntasticLoclist = {}
" Public methods {{{1
function! g:SyntasticLoclist.New(rawLoclist)
let newObj = copy(self)
let newObj._quietWarnings = g:syntastic_quiet_warnings
let llist = copy(a:rawLoclist)
let llist = filter(llist, 'v:val["valid"] == 1')
for e in llist
if empty(e['type'])
let e['type'] = 'E'
endif
endfor
let newObj._rawLoclist = llist
let newObj._hasErrorsOrWarningsToDisplay = -1
let newObj._name = ''
return newObj
endfunction
function! g:SyntasticLoclist.current()
if !exists("b:syntastic_loclist")
let b:syntastic_loclist = g:SyntasticLoclist.New([])
endif
return b:syntastic_loclist
endfunction
function! g:SyntasticLoclist.extend(other)
let list = self.toRaw()
call extend(list, a:other.toRaw())
return g:SyntasticLoclist.New(list)
endfunction
function! g:SyntasticLoclist.toRaw()
return copy(self._rawLoclist)
endfunction
function! g:SyntasticLoclist.filteredRaw()
return copy(self._quietWarnings ? self.errors() : self._rawLoclist)
endfunction
function! g:SyntasticLoclist.quietWarnings()
return self._quietWarnings
endfunction
function! g:SyntasticLoclist.isEmpty()
return empty(self._rawLoclist)
endfunction
function! g:SyntasticLoclist.getLength()
return len(self._rawLoclist)
endfunction
function! g:SyntasticLoclist.getName()
return len(self._name)
endfunction
function! g:SyntasticLoclist.setName(name)
let self._name = a:name
endfunction
function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay()
if self._hasErrorsOrWarningsToDisplay >= 0
return self._hasErrorsOrWarningsToDisplay
endif
let self._hasErrorsOrWarningsToDisplay = empty(self._rawLoclist) ? 0 : (!self._quietWarnings || len(self.errors()))
return self._hasErrorsOrWarningsToDisplay
endfunction
function! g:SyntasticLoclist.errors()
if !exists("self._cachedErrors")
let self._cachedErrors = self.filter({'type': "E"})
endif
return self._cachedErrors
endfunction
function! g:SyntasticLoclist.warnings()
if !exists("self._cachedWarnings")
let self._cachedWarnings = self.filter({'type': "W"})
endif
return self._cachedWarnings
endfunction
" cache used by EchoCurrentError()
function! g:SyntasticLoclist.messages(buf)
if !exists("self._cachedMessages")
let self._cachedMessages = {}
let errors = self.errors() + (self._quietWarnings ? [] : self.warnings())
for e in errors
let b = e['bufnr']
let l = e['lnum']
if !has_key(self._cachedMessages, b)
let self._cachedMessages[b] = {}
endif
if !has_key(self._cachedMessages[b], l)
let self._cachedMessages[b][l] = e['text']
endif
endfor
endif
return get(self._cachedMessages, a:buf, {})
endfunction
"Filter the list and return new native loclist
"e.g.
" .filter({'bufnr': 10, 'type': 'e'})
"
"would return all errors for buffer 10.
"
"Note that all comparisons are done with ==?
function! g:SyntasticLoclist.filter(filters)
let rv = []
for error in self._rawLoclist
let passes_filters = 1
for key in keys(a:filters)
if error[key] !=? a:filters[key]
let passes_filters = 0
break
endif
endfor
if passes_filters
call add(rv, error)
endif
endfor
return rv
endfunction
"display the cached errors for this buf in the location list
function! g:SyntasticLoclist.show()
call setloclist(0, self.filteredRaw())
if self.hasErrorsOrWarningsToDisplay()
let num = winnr()
exec "lopen " . g:syntastic_loc_list_height
if num != winnr()
wincmd p
endif
" try to find the loclist window and set w:quickfix_title
for buf in tabpagebuflist()
if buflisted(buf) && bufloaded(buf) && getbufvar(buf, '&buftype') ==# 'quickfix'
let win = bufwinnr(buf)
let title = getwinvar(win, 'quickfix_title')
if title ==# ':setloclist()' || strpart(title, 0, 16) ==# ':SyntasticCheck '
call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name)
endif
endif
endfor
endif
endfunction
" Non-method functions {{{1
function! g:SyntasticLoclistHide()
silent! lclose
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,72 @@
if exists("g:loaded_syntastic_makeprg_builder")
finish
endif
let g:loaded_syntastic_makeprg_builder = 1
let g:SyntasticMakeprgBuilder = {}
" Public methods {{{1
function! g:SyntasticMakeprgBuilder.New(exe, args, fname, post_args, tail, filetype, subchecker)
let newObj = copy(self)
let newObj._exe = a:exe
let newObj._args = a:args
let newObj._fname = a:fname
let newObj._post_args = a:post_args
let newObj._tail = a:tail
let newObj._filetype = empty(a:filetype) ? &filetype : a:filetype
let newObj._subchecker = a:subchecker
return newObj
endfunction
function! g:SyntasticMakeprgBuilder.makeprg()
return join([self.exe(), self.args(), self.fname(), self.post_args(), self.tail()])
endfunction
function! g:SyntasticMakeprgBuilder.exe()
return self._getOpt('exe')
endfunction
function! g:SyntasticMakeprgBuilder.args()
return self._getOpt('args')
endfunction
function! g:SyntasticMakeprgBuilder.fname()
if empty(self._fname)
return syntastic#util#shexpand('%')
else
return self._fname
endif
endfunction
function! g:SyntasticMakeprgBuilder.post_args()
return self._getOpt('post_args')
endfunction
function! g:SyntasticMakeprgBuilder.tail()
return self._getOpt('tail')
endfunction
" Private methods {{{1
function g:SyntasticMakeprgBuilder._getOpt(name)
if self._optExists(a:name)
return {self._optName(a:name)}
endif
return self['_' . a:name]
endfunction
function! g:SyntasticMakeprgBuilder._optExists(name)
return exists(self._optName(a:name))
endfunction
function! g:SyntasticMakeprgBuilder._optName(name)
let setting = "g:syntastic_" . self._filetype
if !empty(self._subchecker)
let setting .= '_' . self._subchecker
endif
return setting . '_' . a:name
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,67 @@
if exists("g:loaded_syntastic_modemap")
finish
endif
let g:loaded_syntastic_modemap = 1
let g:SyntasticModeMap = {}
" Public methods {{{1
function! g:SyntasticModeMap.Instance()
if !exists('s:SyntasticModeMapInstance')
let s:SyntasticModeMapInstance = copy(self)
call s:SyntasticModeMapInstance._initModeMapFromGlobalOpts()
endif
return s:SyntasticModeMapInstance
endfunction
function! g:SyntasticModeMap.allowsAutoChecking(filetype)
let fts = split(a:filetype, '\.')
if self.isPassive()
return self._isOneFiletypeActive(fts)
else
return self._noFiletypesArePassive(fts)
endif
endfunction
function! g:SyntasticModeMap.isPassive()
return self._mode == "passive"
endfunction
function! g:SyntasticModeMap.toggleMode()
if self._mode == "active"
let self._mode = "passive"
else
let self._mode = "active"
endif
endfunction
function! g:SyntasticModeMap.echoMode()
echo "Syntastic: " . self._mode . " mode enabled"
endfunction
" Private methods {{{1
function! g:SyntasticModeMap._initModeMapFromGlobalOpts()
let self._mode = "active"
let self._activeFiletypes = []
let self._passiveFiletypes = []
if exists("g:syntastic_mode_map")
let self._mode = get(g:syntastic_mode_map, 'mode', self._mode)
let self._activeFiletypes = get(g:syntastic_mode_map, 'active_filetypes', self._activeFiletypes)
let self._passiveFiletypes = get(g:syntastic_mode_map, 'passive_filetypes', self._passiveFiletypes)
endif
endfunction
function! g:SyntasticModeMap._isOneFiletypeActive(filetypes)
return !empty(filter(a:filetypes, 'index(self._activeFiletypes, v:val) != -1'))
endfunction
function! g:SyntasticModeMap._noFiletypesArePassive(filetypes)
return empty(filter(a:filetypes, 'index(self._passiveFiletypes, v:val) != -1'))
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,55 @@
if exists("g:loaded_syntastic_notifiers")
finish
endif
let g:loaded_syntastic_notifiers = 1
let g:SyntasticNotifiers = {}
let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist']
" Public methods {{{1
function! g:SyntasticNotifiers.Instance()
if !exists('s:SyntasticNotifiersInstance')
let s:SyntasticNotifiersInstance = copy(self)
call s:SyntasticNotifiersInstance._initNotifiers()
endif
return s:SyntasticNotifiersInstance
endfunction
function! g:SyntasticNotifiers.refresh(loclist)
for type in self._enabled_types
let class = substitute(type, '.*', 'Syntastic\u&Notifier', '')
if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled()
call self._notifier[type].refresh(a:loclist)
endif
endfor
endfunction
function! g:SyntasticNotifiers.reset(loclist)
for type in self._enabled_types
let class = substitute(type, '.*', 'Syntastic\u&Notifier', '')
" reset notifiers regardless if they are enabled or not, since
" the user might have disabled them since the last refresh();
" notifiers MUST be prepared to deal with reset() when disabled
if has_key(g:{class}, 'reset')
call self._notifier[type].reset(a:loclist)
endif
endfor
endfunction
" Private methods {{{1
function! g:SyntasticNotifiers._initNotifiers()
let self._notifier = {}
for type in s:notifier_types
let class = substitute(type, '.*', 'Syntastic\u&Notifier', '')
let self._notifier[type] = g:{class}.New()
endfor
let self._enabled_types = copy(s:notifier_types)
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,213 @@
if exists("g:loaded_syntastic_registry")
finish
endif
let g:loaded_syntastic_registry = 1
let s:defaultCheckers = {
\ 'c': ['gcc'],
\ 'coffee': ['coffee', 'coffeelint'],
\ 'cpp': ['gcc'],
\ 'css': ['csslint', 'phpcs'],
\ 'go': ['go'],
\ 'html': ['tidy'],
\ 'java': ['javac'],
\ 'javascript': ['jshint', 'jslint'],
\ 'json': ['jsonlint', 'jsonval'],
\ 'objc': ['gcc'],
\ 'objcpp': ['gcc'],
\ 'perl': ['perl', 'perlcritic'],
\ 'php': ['php', 'phpcs', 'phpmd'],
\ 'puppet': ['puppet', 'puppetlint'],
\ 'python': ['python', 'flake8', 'pylint'],
\ 'ruby': ['mri'],
\ 'sh': ['sh'],
\ 'tex': ['lacheck']
\ }
let s:defaultFiletypeMap = {
\ 'gentoo-metadata': 'xml',
\ 'lhaskell': 'haskell'
\ }
let g:SyntasticRegistry = {}
" TODO: Handling of filetype aliases: all public methods take aliases as
" parameters, all private methods take normalized filetypes. Public methods
" are thus supposed to normalize filetypes before calling private methods.
" Public methods {{{1
function! g:SyntasticRegistry.Instance()
if !exists('s:SyntasticRegistryInstance')
let s:SyntasticRegistryInstance = copy(self)
let s:SyntasticRegistryInstance._checkerMap = {}
endif
return s:SyntasticRegistryInstance
endfunction
function! g:SyntasticRegistry.CreateAndRegisterChecker(args)
let checker = g:SyntasticChecker.New(a:args)
let registry = g:SyntasticRegistry.Instance()
call registry.registerChecker(checker)
endfunction
function! g:SyntasticRegistry.registerChecker(checker) abort
let ft = a:checker.getFiletype()
if !has_key(self._checkerMap, ft)
let self._checkerMap[ft] = []
endif
call self._validateUniqueName(a:checker)
call add(self._checkerMap[ft], a:checker)
endfunction
function! g:SyntasticRegistry.checkable(ftalias)
return !empty(self.getActiveCheckers(a:ftalias))
endfunction
function! g:SyntasticRegistry.getActiveCheckers(ftalias)
let filetype = s:SyntasticRegistryNormaliseFiletype(a:ftalias)
let checkers = self.availableCheckersFor(a:ftalias)
if self._userHasFiletypeSettings(filetype)
return self._filterCheckersByUserSettings(checkers, filetype)
endif
if has_key(s:defaultCheckers, filetype)
return self._filterCheckersByDefaultSettings(checkers, filetype)
endif
let checkers = self.availableCheckersFor(filetype)
if !empty(checkers)
return [checkers[0]]
endif
return []
endfunction
function! g:SyntasticRegistry.getChecker(ftalias, name)
for checker in self.availableCheckersFor(a:ftalias)
if checker.getName() == a:name
return checker
endif
endfor
return {}
endfunction
function! g:SyntasticRegistry.availableCheckersFor(ftalias)
let filetype = s:SyntasticRegistryNormaliseFiletype(a:ftalias)
let checkers = copy(self._allCheckersFor(filetype))
return self._filterCheckersByAvailability(checkers)
endfunction
function! g:SyntasticRegistry.echoInfoFor(ftalias_list)
echomsg "Syntastic info for filetype: " . join(a:ftalias_list, '.')
let available = []
let active = []
for ftalias in a:ftalias_list
call extend(available, self.availableCheckersFor(ftalias))
call extend(active, self.getActiveCheckers(ftalias))
endfor
echomsg "Available checkers: " . join(syntastic#util#unique(map(available, "v:val.getName()")))
echomsg "Currently active checker(s): " . join(syntastic#util#unique(map(active, "v:val.getName()")))
endfunction
" Private methods {{{1
function! g:SyntasticRegistry._allCheckersFor(filetype)
call self._loadCheckers(a:filetype)
if empty(self._checkerMap[a:filetype])
return []
endif
return self._checkerMap[a:filetype]
endfunction
function! g:SyntasticRegistry._filterCheckersByDefaultSettings(checkers, filetype)
if has_key(s:defaultCheckers, a:filetype)
return self._filterCheckersByName(a:checkers, s:defaultCheckers[a:filetype])
endif
return a:checkers
endfunction
function! g:SyntasticRegistry._filterCheckersByUserSettings(checkers, filetype)
if exists("b:syntastic_checkers")
let whitelist = b:syntastic_checkers
else
let whitelist = g:syntastic_{a:filetype}_checkers
endif
return self._filterCheckersByName(a:checkers, whitelist)
endfunction
function! g:SyntasticRegistry._filterCheckersByName(checkers, list)
let checkers_by_name = {}
for c in a:checkers
let checkers_by_name[c.getName()] = c
endfor
let filtered = []
for name in a:list
if has_key(checkers_by_name, name)
call add(filtered, checkers_by_name[name])
endif
endfor
return filtered
endfunction
function! g:SyntasticRegistry._filterCheckersByAvailability(checkers)
return filter(copy(a:checkers), "v:val.isAvailable()")
endfunction
function! g:SyntasticRegistry._loadCheckers(filetype)
if self._haveLoadedCheckers(a:filetype)
return
endif
exec "runtime! syntax_checkers/" . a:filetype . "/*.vim"
if !has_key(self._checkerMap, a:filetype)
let self._checkerMap[a:filetype] = []
endif
endfunction
function! g:SyntasticRegistry._haveLoadedCheckers(filetype)
return has_key(self._checkerMap, a:filetype)
endfunction
function! g:SyntasticRegistry._userHasFiletypeSettings(filetype)
if exists("g:syntastic_" . a:filetype . "_checker") && !exists("g:syntastic_" . a:filetype . "_checkers")
let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker]
call syntastic#util#deprecationWarn("variable g:syntastic_" . a:filetype . "_checker is deprecated")
endif
return exists("b:syntastic_checkers") || exists("g:syntastic_" . a:filetype . "_checkers")
endfunction
function! g:SyntasticRegistry._validateUniqueName(checker) abort
for checker in self._allCheckersFor(a:checker.getFiletype())
if checker.getName() == a:checker.getName()
throw "Syntastic: Duplicate syntax checker name for: " . a:checker.getName()
endif
endfor
endfunction
" Private functions {{{1
"resolve filetype aliases, and replace - with _ otherwise we cant name
"syntax checker functions legally for filetypes like "gentoo-metadata"
function! s:SyntasticRegistryNormaliseFiletype(ftalias)
let ft = get(s:defaultFiletypeMap, a:ftalias, a:ftalias)
let ft = get(g:syntastic_filetype_map, ft, ft)
let ft = substitute(ft, '-', '_', 'g')
return ft
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,149 @@
if exists("g:loaded_syntastic_notifier_signs")
finish
endif
let g:loaded_syntastic_notifier_signs = 1
if !exists("g:syntastic_enable_signs")
let g:syntastic_enable_signs = 1
endif
if !exists("g:syntastic_error_symbol")
let g:syntastic_error_symbol = '>>'
endif
if !exists("g:syntastic_warning_symbol")
let g:syntastic_warning_symbol = '>>'
endif
if !exists("g:syntastic_style_error_symbol")
let g:syntastic_style_error_symbol = 'S>'
endif
if !exists("g:syntastic_style_warning_symbol")
let g:syntastic_style_warning_symbol = 'S>'
endif
" start counting sign ids at 5000, start here to hopefully avoid conflicting
" with any other code that places signs (not sure if this precaution is
" actually needed)
let s:first_sign_id = 5000
let s:next_sign_id = s:first_sign_id
let g:SyntasticSignsNotifier = {}
let s:setup_done = 0
" Public methods {{{1
function! g:SyntasticSignsNotifier.New()
let newObj = copy(self)
if !s:setup_done
call self._setup()
let s:setup_done = 1
endif
return newObj
endfunction
function! g:SyntasticSignsNotifier.enabled()
return
\ has('signs') &&
\ exists('b:syntastic_enable_signs') ? b:syntastic_enable_signs : g:syntastic_enable_signs
endfunction
function! g:SyntasticSignsNotifier.refresh(loclist)
let old_signs = copy(self._bufSignIds())
if self.enabled()
call self._signErrors(a:loclist)
endif
call self._removeSigns(old_signs)
let s:first_sign_id = s:next_sign_id
endfunction
" Private methods {{{1
" One time setup: define our own sign types and highlighting
function! g:SyntasticSignsNotifier._setup()
if has('signs')
if !hlexists('SyntasticErrorSign')
highlight link SyntasticErrorSign error
endif
if !hlexists('SyntasticWarningSign')
highlight link SyntasticWarningSign todo
endif
if !hlexists('SyntasticStyleErrorSign')
highlight link SyntasticStyleErrorSign SyntasticErrorSign
endif
if !hlexists('SyntasticStyleWarningSign')
highlight link SyntasticStyleWarningSign SyntasticWarningSign
endif
if !hlexists('SyntasticStyleErrorLine')
highlight link SyntasticStyleErrorLine SyntasticErrorLine
endif
if !hlexists('SyntasticStyleWarningLine')
highlight link SyntasticStyleWarningLine SyntasticWarningLine
endif
" define the signs used to display syntax and style errors/warns
exe 'sign define SyntasticError text=' . g:syntastic_error_symbol .
\ ' texthl=SyntasticErrorSign linehl=SyntasticErrorLine'
exe 'sign define SyntasticWarning text=' . g:syntastic_warning_symbol .
\ ' texthl=SyntasticWarningSign linehl=SyntasticWarningLine'
exe 'sign define SyntasticStyleError text=' . g:syntastic_style_error_symbol .
\ ' texthl=SyntasticStyleErrorSign linehl=SyntasticStyleErrorLine'
exe 'sign define SyntasticStyleWarning text=' . g:syntastic_style_warning_symbol .
\ ' texthl=SyntasticStyleWarningSign linehl=SyntasticStyleWarningLine'
endif
endfunction
" Place signs by all syntax errors in the buffer
function! g:SyntasticSignsNotifier._signErrors(loclist)
let loclist = a:loclist
if loclist.hasErrorsOrWarningsToDisplay()
" errors some first, so that they are not masked by warnings
let buf = bufnr('')
let issues = copy(loclist.errors())
if !loclist.quietWarnings()
call extend(issues, loclist.warnings())
endif
call filter(issues, 'v:val["bufnr"] == buf')
let seen = {}
for i in issues
if !has_key(seen, i['lnum'])
let seen[i['lnum']] = 1
let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error'
let sign_subtype = get(i, 'subtype', '')
let sign_type = 'Syntastic' . sign_subtype . sign_severity
exec "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr']
call add(self._bufSignIds(), s:next_sign_id)
let s:next_sign_id += 1
endif
endfor
endif
endfunction
" Remove the signs with the given ids from this buffer
function! g:SyntasticSignsNotifier._removeSigns(ids)
if has('signs')
for i in a:ids
exec "sign unplace " . i
call remove(self._bufSignIds(), index(self._bufSignIds(), i))
endfor
endif
endfunction
" Get all the ids of the SyntaxError signs in the buffer
function! g:SyntasticSignsNotifier._bufSignIds()
if !exists("b:syntastic_sign_ids")
let b:syntastic_sign_ids = []
endif
return b:syntastic_sign_ids
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,168 @@
"============================================================================
"File: ada.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Alfredo Di Napoli <alfredo.dinapoli@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law.
"
"============================================================================
" In order to also check header files add this to your .vimrc:
"
" let g:syntastic_ada_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_ada_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_ada_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_ada_includes. Then the header files are being re-checked
" on the next file write.
"
" let g:syntastic_ada_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_ada_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_ada_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_ada_include_dirs. This list can be used like this:
"
" let g:syntastic_ada_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_ada_compiler_options':
"
" let g:syntastic_ada_compiler_options = ' -std=c++0x'
"
" Additionally the setting 'g:syntastic_ada_config_file' allows you to define
" a file that contains additional compiler arguments like include directories
" or CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_ada_config':
"
" let g:syntastic_ada_config_file = '.config'
"
" Using the global variable 'g:syntastic_ada_remove_include_errors' you can
" specify whether errors of files included via the
" g:syntastic_ada_include_dirs' setting are removed from the result set:
"
" let g:syntastic_ada_remove_include_errors = 1
"
" Use the variable 'g:syntastic_ada_errorformat' to override the default error
" format:
"
" let g:syntastic_ada_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to gcc)
"
" let g:syntastic_ada_compiler = 'gcc'
if exists('g:loaded_syntastic_ada_gcc_checker')
finish
endif
let g:loaded_syntastic_ada_gcc_checker = 1
if !exists('g:syntastic_ada_compiler')
let g:syntastic_ada_compiler = 'gcc'
endif
function! SyntaxCheckers_ada_gcc_IsAvailable()
return executable(g:syntastic_ada_compiler)
endfunction
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_ada_compiler_options')
let g:syntastic_ada_compiler_options = ''
endif
if !exists('g:syntastic_ada_config_file')
let g:syntastic_ada_config_file = '.syntastic_ada_config'
endif
function! SyntaxCheckers_ada_gcc_GetLocList()
let makeprg = g:syntastic_ada_compiler . ' -c -x ada -fsyntax-only '
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
if exists('g:syntastic_c_errorformat')
let errorformat = g:syntastic_c_errorformat
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_ada_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('ada')
" determine whether to parse header files as well
if expand('%') =~? '\.ads$'
if exists('g:syntastic_ada_check_header')
let makeprg = g:syntastic_ada_compiler .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_ada_compiler_options .
\ ' ' . syntastic#c#GetIncludeDirs('ada')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_ada_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_ada_no_include_search') ||
\ g:syntastic_ada_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_ada_auto_refresh_includes') &&
\ g:syntastic_ada_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_ada_includes')
let b:syntastic_ada_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_ada_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_ada_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_ada_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_ada_remove_include_errors') &&
\ g:syntastic_ada_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'ada',
\ 'name': 'gcc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,50 @@
"==============================================================================
" FileName: applescript.vim
" Desc: Syntax checking plugin for syntastic.vim
" Author: Zhao Cai
" Email: caizhaoff@gmail.com
" Version: 0.2.1
" Date Created: Thu 09 Sep 2011 10:30:09 AM EST
" Last Modified: Fri 09 Dec 2011 01:10:24 PM EST
"
" History: 0.1.0 - working, but it will run the script everytime to check
" syntax. Should use osacompile but strangely it does not give
" errors.
"
" 0.2.0 - switch to osacompile, it gives less errors compared
" with osascript.
"
" 0.2.1 - remove g:syntastic_applescript_tempfile. use
" tempname() instead.
"
" License: This program is free software. It comes without any
" warranty, to the extent permitted by applicable law. You can
" redistribute it and/or modify it under the terms of the Do What The
" Fuck You Want To Public License, Version 2, as published by Sam
" Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_applescript_osacompile_checker")
finish
endif
let g:loaded_syntastic_applescript_osacompile_checker=1
function! SyntaxCheckers_applescript_osacompile_IsAvailable()
return executable('osacompile')
endfunction
function! SyntaxCheckers_applescript_osacompile_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'osacompile',
\ 'args': '-o ' . tempname() . '.scpt ',
\ 'filetype': 'applescript',
\ 'subchecker': 'osacompile' })
let errorformat = '%f:%l:%m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'applescript',
\ 'name': 'osacompile'})

View File

@ -0,0 +1,48 @@
"============================================================================
"File: checkpatch.vim
"Description: Syntax checking plugin for syntastic.vim using checkpatch.pl
"Maintainer: Daniel Walker <dwalker at fifo99 dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_c_checkpatch_checker")
finish
endif
let g:loaded_syntastic_c_checkpatch_checker = 1
" Bail if the user doesn't have `checkpatch.pl` or ./scripts/checkpatch.pl installed.
if executable("checkpatch.pl")
let g:syntastic_c_checker_checkpatch_location = 'checkpatch.pl'
elseif executable("./scripts/checkpatch.pl")
let g:syntastic_c_checker_checkpatch_location = './scripts/checkpatch.pl'
endif
function SyntaxCheckers_c_checkpatch_IsAvailable()
return exists("g:syntastic_c_checker_checkpatch_location")
endfunction
function! SyntaxCheckers_c_checkpatch_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': g:syntastic_c_checker_checkpatch_location,
\ 'args': '--no-summary --no-tree --terse --file',
\ 'filetype': 'c',
\ 'subchecker': 'checkpatch' })
let errorformat =
\ '%f:%l: %tARNING: %m,' .
\ '%f:%l: %tRROR: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0],
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'checkpatch'})

View File

@ -0,0 +1,183 @@
"============================================================================
"File: c.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" In order to also check header files add this to your .vimrc:
"
" let g:syntastic_c_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_c_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_c_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_c_includes. Then the header files are being re-checked on
" the next file write.
"
" let g:syntastic_c_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_c_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_c_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_c_include_dirs. This list can be used like this:
"
" let g:syntastic_c_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_c_compiler_options':
"
" let g:syntastic_c_compiler_options = ' -ansi'
"
" Additionally the setting 'g:syntastic_c_config_file' allows you to define a
" file that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_c_config':
"
" let g:syntastic_c_config_file = '.config'
"
" Using the global variable 'g:syntastic_c_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_c_include_dirs'
" setting are removed from the result set:
"
" let g:syntastic_c_remove_include_errors = 1
"
" Use the variable 'g:syntastic_c_errorformat' to override the default error
" format:
"
" let g:syntastic_c_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to gcc)
"
" let g:syntastic_c_compiler = 'clang'
if exists('g:loaded_syntastic_c_gcc_checker')
finish
endif
let g:loaded_syntastic_c_gcc_checker = 1
if !exists('g:syntastic_c_compiler')
let g:syntastic_c_compiler = 'gcc'
endif
function! SyntaxCheckers_c_gcc_IsAvailable()
return executable(g:syntastic_c_compiler)
endfunction
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_c_compiler_options')
let g:syntastic_c_compiler_options = '-std=gnu99'
endif
if !exists('g:syntastic_c_config_file')
let g:syntastic_c_config_file = '.syntastic_c_config'
endif
function! SyntaxCheckers_c_gcc_GetLocList()
let makeprg = g:syntastic_c_compiler . ' -x c -fsyntax-only '
let errorformat =
\ '%-G%f:%s:,' .
\ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
\ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
\ '%-GIn file included%.%#,' .
\ '%-G %#from %f:%l\,,' .
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,' .
\ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m,'.
\ '%f:%l: %m'
if exists('g:syntastic_c_errorformat')
let errorformat = g:syntastic_c_errorformat
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_c_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('c')
" determine whether to parse header files as well
if expand('%') =~? '\.h$'
if exists('g:syntastic_c_check_header')
let makeprg = g:syntastic_c_compiler .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_c_compiler_options .
\ ' ' . syntastic#c#GetNullDevice() .
\ ' ' . syntastic#c#GetIncludeDirs('c')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_c_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_c_no_include_search') ||
\ g:syntastic_c_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_c_auto_refresh_includes') &&
\ g:syntastic_c_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_c_includes')
let b:syntastic_c_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_c_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_c_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_c_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_c_remove_include_errors') &&
\ g:syntastic_c_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'gcc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,65 @@
"============================================================================
"File: make.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_c_make_checker')
finish
endif
let g:loaded_syntastic_c_make_checker = 1
function SyntaxCheckers_c_make_IsAvailable()
return executable('make')
endfunction
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_make_GetLocList()
let makeprg = 'make -sk'
let errorformat =
\ '%-G%f:%s:,' .
\ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
\ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
\ '%-GIn file included%.%#,' .
\ '%-G %#from %f:%l\,,' .
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,' .
\ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m,'.
\ '%f:%l: %m'
if exists('g:syntastic_c_errorformat')
let errorformat = g:syntastic_c_errorformat
endif
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_c_remove_include_errors') &&
\ g:syntastic_c_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'make'})
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@ -0,0 +1,58 @@
"============================================================================
"File: oclint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: "UnCO" Lin <undercooled aT lavabit com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" The setting 'g:syntastic_oclint_config_file' allows you to define a file
" that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_oclint_config':
"
" let g:syntastic_oclint_config_file = '.config'
if exists("g:loaded_syntastic_c_oclint_checker")
finish
endif
let g:loaded_syntastic_c_oclint_checker = 1
function! SyntaxCheckers_c_oclint_IsAvailable()
return executable("oclint")
endfunction
if !exists('g:syntastic_oclint_config_file')
let g:syntastic_oclint_config_file = '.syntastic_oclint_config'
endif
function! SyntaxCheckers_c_oclint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'oclint',
\ 'args': '-text',
\ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file),
\ 'filetype': 'c',
\ 'subchecker': 'oclint' })
let errorformat =
\ '%E%f:%l:%c: %m P1 ,' .
\ '%E%f:%l:%c: %m P2 ,' .
\ '%W%f:%l:%c: %m P3 ,' .
\ '%E%f:%l:%c: fatal error: %m,' .
\ '%E%f:%l:%c: error: %m,' .
\ '%W%f:%l:%c: warning: %m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'postprocess': ['compressWhitespace', 'sort'] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'oclint'})

View File

@ -0,0 +1,51 @@
"============================================================================
"File: sparse.vim
"Description: Syntax checking plugin for syntastic.vim using sparse.pl
"Maintainer: Daniel Walker <dwalker at fifo99 dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" The setting 'g:syntastic_sparse_config_file' allows you to define a file
" that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_sparse_config':
"
" let g:syntastic_sparse_config_file = '.config'
if exists("g:loaded_syntastic_c_sparse_checker")
finish
endif
let g:loaded_syntastic_c_sparse_checker = 1
function! SyntaxCheckers_c_sparse_IsAvailable()
return executable("sparse")
endfunction
if !exists('g:syntastic_sparse_config_file')
let g:syntastic_sparse_config_file = '.syntastic_sparse_config'
endif
function! SyntaxCheckers_c_sparse_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'sparse',
\ 'args': '-ftabstop=' . &ts . ' ' . syntastic#c#ReadConfig(g:syntastic_sparse_config_file),
\ 'filetype': 'c',
\ 'subchecker': 'sparse' })
let errorformat = '%f:%l:%v: %trror: %m,%f:%l:%v: %tarning: %m,'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'returns': [0] })
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'sparse'})

View File

@ -0,0 +1,57 @@
"============================================================================
"File: splint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" The setting 'g:syntastic_splint_config_file' allows you to define a file
" that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_splint_config':
"
" let g:syntastic_splint_config_file = '.config'
if exists("g:loaded_syntastic_c_splint_checker")
finish
endif
let g:loaded_syntastic_c_splint_checker = 1
function! SyntaxCheckers_c_splint_IsAvailable()
return executable("splint")
endfunction
if !exists('g:syntastic_splint_config_file')
let g:syntastic_splint_config_file = '.syntastic_splint_config'
endif
function! SyntaxCheckers_c_splint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'splint',
\ 'post_args': '-showfunc -hints +quiet ' . syntastic#c#ReadConfig(g:syntastic_splint_config_file),
\ 'filetype': 'c',
\ 'subchecker': 'splint' })
let errorformat =
\ '%-G%f:%l:%v: %[%#]%[%#]%[%#] Internal Bug %.%#,' .
\ '%W%f:%l:%v: %m,' .
\ '%W%f:%l: %m,' .
\ '%-C %\+In file included from %.%#,' .
\ '%-C %\+from %.%#,' .
\ '%+C %.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'postprocess': ['compressWhitespace'],
\ 'defaults': {'type': 'W'} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'splint'})

View File

@ -0,0 +1,32 @@
"============================================================================
"File: ycm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Val Markovic <val at markovic dot io>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_c_ycm_checker")
finish
endif
let g:loaded_syntastic_c_ycm_checker = 1
function! SyntaxCheckers_c_ycm_IsAvailable()
return exists('g:loaded_youcompleteme')
endfunction
if !exists('g:loaded_youcompleteme')
finish
endif
function! SyntaxCheckers_c_ycm_GetLocList()
return youcompleteme#CurrentFileDiagnostics()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'ycm'})

View File

@ -0,0 +1,44 @@
"============================================================================
"File: co.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Andrew Kelley <superjoe30@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_co_coco_checker")
finish
endif
let g:loaded_syntastic_co_coco_checker=1
"bail if the user doesnt have coco installed
if !executable("coco")
finish
endif
function! SyntaxCheckers_co_coco_GetLocList()
return executable('coco')
endfunction
function! SyntaxCheckers_co_coco_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'coco',
\ 'args': '-c -o /tmp',
\ 'filetype': 'co',
\ 'subchecker': 'coco' })
let errorformat =
\ '%EFailed at: %f,' .
\ '%ZSyntax%trror: %m on line %l,'.
\ '%EFailed at: %f,'.
\ '%Z%trror: Parse error on line %l: %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'co',
\ 'name': 'coco'})

View File

@ -0,0 +1,48 @@
"============================================================================
"File: coffee.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Lincoln Stoll <l@lds.li>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" Note: this script requires CoffeeScript version 1.6.2 or newer.
"
if exists("g:loaded_syntastic_coffee_coffee_checker")
finish
endif
let g:loaded_syntastic_coffee_coffee_checker=1
function! SyntaxCheckers_coffee_coffee_IsAvailable()
return executable("coffee") &&
\ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2])
endfunction
function! SyntaxCheckers_coffee_coffee_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'coffee',
\ 'args': '-cp',
\ 'filetype': 'coffee',
\ 'subchecker': 'coffee' })
let errorformat =
\ '%E%f:%l:%c: %trror: %m,' .
\ 'Syntax%trror: In %f\, %m on line %l,' .
\ '%EError: In %f\, Parse error on line %l: %m,' .
\ '%EError: In %f\, %m on line %l,' .
\ '%W%f(%l): lint warning: %m,' .
\ '%W%f(%l): warning: %m,' .
\ '%E%f(%l): SyntaxError: %m,' .
\ '%-Z%p^,' .
\ '%-G%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'coffee',
\ 'name': 'coffee'})

View File

@ -0,0 +1,38 @@
"============================================================================
"File: coffeelint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Lincoln Stoll <l@lds.li>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_coffee_coffeelint_checker")
finish
endif
let g:loaded_syntastic_coffee_coffeelint_checker=1
function! SyntaxCheckers_coffee_coffeelint_IsAvailable()
return executable('coffeelint')
endfunction
function! SyntaxCheckers_coffee_coffeelint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'coffeelint',
\ 'args': '--csv',
\ 'filetype': 'coffee',
\ 'subchecker': 'coffeelint' })
let errorformat = '%f\,%l\,%trror\,%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'coffee',
\ 'name': 'coffeelint'})

View File

@ -0,0 +1,40 @@
"============================================================================
"File: coqtop.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Matvey Aksenov <matvey.aksenov at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_coq_coqtop_checker")
finish
endif
let g:loaded_syntastic_coq_coqtop_checker=1
function! SyntaxCheckers_coq_coqtop_IsAvailable()
return executable('coqtop')
endfunction
function! SyntaxCheckers_coq_coqtop_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'coqtop',
\ 'args': '-noglob -batch -load-vernac-source',
\ 'filetype': 'coq',
\ 'subchecker': 'coqtop' })
let errorformat =
\ '%AFile \"%f\"\, line %l\, characters %c\-%.%#\:,'.
\ '%C%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'coq',
\ 'name': 'coqtop'})

View File

@ -0,0 +1,65 @@
"============================================================================
"File: cpplint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" For details about cpplint see:
" https://code.google.com/p/google-styleguide/
"
" Checker options:
"
" - g:syntastic_cpp_cpplint_thres (integer; default: 5)
" error threshold: policy violations with a severity above this
" value are highlighted as errors, the others are warnings
"
" - g:syntastic_cpp_cpplint_args (string; default: '--verbose=3')
" command line options to pass to cpplint
if exists("g:loaded_syntastic_cpp_cpplint_checker")
finish
endif
let g:loaded_syntastic_cpp_cpplint_checker = 1
if !exists('g:syntastic_cpp_cpplint_thres')
let g:syntastic_cpp_cpplint_thres = 5
endif
if ! exists('g:syntastic_cpp_cpplint_args')
let g:syntastic_cpp_cpplint_args = '--verbose=3'
endif
function! SyntaxCheckers_cpp_cpplint_IsAvailable()
return executable('cpplint.py')
endfunction
function! SyntaxCheckers_cpp_cpplint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'cpplint.py',
\ 'filetype': 'cpp',
\ 'subchecker': 'cpplint' })
let errorformat = '%A%f:%l: %m [%t],%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style' })
" change error types according to the prescribed threshold
for n in range(len(loclist))
let loclist[n]['type'] = loclist[n]['type'] < g:syntastic_cpp_cpplint_thres ? 'W' : 'E'
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'cpplint'})

View File

@ -0,0 +1,179 @@
"============================================================================
"File: cpp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" In order to also check header files add this to your .vimrc:
"
" let g:syntastic_cpp_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_cpp_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_cpp_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_cpp_includes. Then the header files are being re-checked
" on the next file write.
"
" let g:syntastic_cpp_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_cpp_include_dirs. This list can be used like this:
"
" let g:syntastic_cpp_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_cpp_compiler_options':
"
" let g:syntastic_cpp_compiler_options = ' -std=c++0x'
"
" Additionally the setting 'g:syntastic_cpp_config_file' allows you to define
" a file that contains additional compiler arguments like include directories
" or CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_cpp_config':
"
" let g:syntastic_cpp_config_file = '.config'
"
" Using the global variable 'g:syntastic_cpp_remove_include_errors' you can
" specify whether errors of files included via the
" g:syntastic_cpp_include_dirs' setting are removed from the result set:
"
" let g:syntastic_cpp_remove_include_errors = 1
"
" Use the variable 'g:syntastic_cpp_errorformat' to override the default error
" format:
"
" let g:syntastic_cpp_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to g++)
"
" let g:syntastic_cpp_compiler = 'clang++'
if exists('g:loaded_syntastic_cpp_gcc_checker')
finish
endif
let g:loaded_syntastic_cpp_gcc_checker = 1
if !exists('g:syntastic_cpp_compiler')
let g:syntastic_cpp_compiler = 'g++'
endif
function! SyntaxCheckers_cpp_gcc_IsAvailable()
return executable(g:syntastic_cpp_compiler)
endfunction
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_cpp_compiler_options')
let g:syntastic_cpp_compiler_options = ''
endif
if !exists('g:syntastic_cpp_config_file')
let g:syntastic_cpp_config_file = '.syntastic_cpp_config'
endif
function! SyntaxCheckers_cpp_gcc_GetLocList()
let makeprg = g:syntastic_cpp_compiler . ' -x c++ -fsyntax-only '
let errorformat =
\ '%-G%f:%s:,' .
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,'.
\ '%f:%l: %trror: %m,'.
\ '%f:%l: %tarning: %m,'.
\ '%f:%l: %m'
if exists('g:syntastic_cpp_errorformat')
let errorformat = g:syntastic_cpp_errorformat
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_cpp_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
" determine whether to parse header files as well
if expand('%') =~? '\.\(h\|hpp\|hh\)$'
if exists('g:syntastic_cpp_check_header')
let makeprg = g:syntastic_cpp_compiler .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_cpp_compiler_options .
\ ' ' . syntastic#c#GetNullDevice() .
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_cpp_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_cpp_no_include_search') ||
\ g:syntastic_cpp_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_cpp_auto_refresh_includes') &&
\ g:syntastic_cpp_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_cpp_includes')
let b:syntastic_cpp_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_cpp_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_cpp_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_cpp_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_cpp_remove_include_errors') &&
\ g:syntastic_cpp_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'gcc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,36 @@
"============================================================================
"File: oclint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: "UnCO" Lin <undercooled aT lavabit com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" The setting 'g:syntastic_oclint_config_file' allows you to define a file
" that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_oclint_config':
"
" let g:syntastic_oclint_config_file = '.config'
if exists("g:loaded_syntastic_cpp_oclint_checker")
finish
endif
let g:loaded_syntastic_cpp_oclint_checker = 1
function! SyntaxCheckers_cpp_oclint_IsAvailable()
return SyntaxCheckers_c_oclint_IsAvailable()
endfunction
function! SyntaxCheckers_cpp_oclint_GetLocList()
return SyntaxCheckers_c_oclint_GetLocList()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'oclint'})
runtime! syntax_checkers/c/*.vim

View File

@ -0,0 +1,34 @@
"============================================================================
"File: ycm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Val Markovic <val at markovic dot io>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_cpp_ycm_checker")
finish
endif
let g:loaded_syntastic_cpp_ycm_checker = 1
function! SyntaxCheckers_cpp_ycm_IsAvailable()
return SyntaxCheckers_c_ycm_IsAvailable()
endfunction
if !exists('g:loaded_youcompleteme')
finish
endif
function! SyntaxCheckers_cpp_ycm_GetLocList()
return SyntaxCheckers_c_ycm_GetLocList()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'ycm'})
runtime! syntax_checkers/c/*.vim

View File

@ -0,0 +1,39 @@
"============================================================================
"File: cs.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Daniel Walker <dwalker@fifo99.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_cs_mcs_checker")
finish
endif
let g:loaded_syntastic_cs_mcs_checker=1
function! SyntaxCheckers_cs_mcs_IsAvailable()
return executable('mcs')
endfunction
function! SyntaxCheckers_cs_mcs_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'mcs',
\ 'args': '--parse',
\ 'filetype': 'cs',
\ 'subchecker': 'mcs' })
let errorformat = '%f(%l\,%c): %trror %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cs',
\ 'name': 'mcs'})

View File

@ -0,0 +1,54 @@
"============================================================================
"File: css.vim
"Description: Syntax checking plugin for syntastic.vim using `csslint` CLI tool (http://csslint.net).
"Maintainer: Ory Band <oryband at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" Specify additional options to csslint with this option. e.g. to disable
" warnings:
"
" let g:syntastic_csslint_options = "--warnings=none"
if exists("g:loaded_syntastic_css_csslint_checker")
finish
endif
let g:loaded_syntastic_css_csslint_checker=1
if !exists('g:syntastic_csslint_options')
let g:syntastic_csslint_options = ""
endif
function! SyntaxCheckers_css_csslint_IsAvailable()
return executable('csslint')
endfunction
function! SyntaxCheckers_css_csslint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'csslint',
\ 'args': '--format=compact ' . g:syntastic_csslint_options,
\ 'filetype': 'css',
\ 'subchecker': 'csslint' })
" Print CSS Lint's error/warning messages from compact format. Ignores blank lines.
let errorformat =
\ '%-G,' .
\ '%-G%f: lint free!,' .
\ '%f: line %l\, col %c\, %trror - %m,' .
\ '%f: line %l\, col %c\, %tarning - %m,'.
\ '%f: line %l\, col %c\, %m,'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'csslint'})

View File

@ -0,0 +1,33 @@
"============================================================================
"File: phpcs.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" See here for details of phpcs
" - phpcs (see http://pear.php.net/package/PHP_CodeSniffer)
"
if exists("g:loaded_syntastic_css_phpcs_checker")
finish
endif
let g:loaded_syntastic_css_phpcs_checker=1
function! SyntaxCheckers_css_phpcs_IsAvailable()
return SyntaxCheckers_php_phpcs_IsAvailable()
endfunction
function! SyntaxCheckers_css_phpcs_GetLocList()
return SyntaxCheckers_php_phpcs_GetLocList()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'phpcs'})
runtime! syntax_checkers/php/*.vim

View File

@ -0,0 +1,62 @@
"============================================================================
"File: prettycss.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" For details about PrettyCSS see:
"
" - http://fidian.github.io/PrettyCSS/
" - https://github.com/fidian/PrettyCSS
if exists("g:loaded_syntastic_css_prettycss_checker")
finish
endif
let g:loaded_syntastic_css_prettycss_checker=1
function! SyntaxCheckers_css_prettycss_IsAvailable()
return executable('prettycss')
endfunction
function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item)
let term = matchstr(a:item["text"], ' (\zs[^)]\+\ze)$')
if term != ''
let term = '\V' . term
endif
return term
endfunction
function! SyntaxCheckers_css_prettycss_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'prettycss',
\ 'filetype': 'css',
\ 'subchecker': 'prettycss' })
" Print CSS Lint's error/warning messages from compact format. Ignores blank lines.
let errorformat =
\ '%EError: %m\, line %l\, char %c),' .
\ '%WWarning: %m\, line %l\, char %c),' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'postprocess': ['sort'] })
for n in range(len(loclist))
let loclist[n]["text"] .= ')'
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'prettycss'})

View File

@ -0,0 +1,42 @@
"============================================================================
"File: cucumber.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_cucumber_cucumber_checker")
finish
endif
let g:loaded_syntastic_cucumber_cucumber_checker=1
function! SyntaxCheckers_cucumber_cucumber_IsAvailable()
return executable('cucumber')
endfunction
function! SyntaxCheckers_cucumber_cucumber_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'cucumber',
\ 'args': '--dry-run --quiet --strict --format pretty',
\ 'filetype': 'cucumber',
\ 'subchecker': 'cucumber' })
let errorformat =
\ '%f:%l:%c:%m,' .
\ '%W %.%# (%m),' .
\ '%-Z%f:%l:%.%#,'.
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cucumber',
\ 'name': 'cucumber'})

View File

@ -0,0 +1,72 @@
"============================================================================
"File: cuda.vim
"Description: Syntax checking plugin for syntastic.vim
"
"Author: Hannes Schulz <schulz at ais dot uni-bonn dot de>
"
"============================================================================
" in order to also check header files add this to your .vimrc:
" (this creates an empty .syntastic_dummy.cu file in your source directory)
"
" let g:syntastic_cuda_check_header = 1
" By default, nvcc and thus syntastic, defaults to the most basic architecture.
" This can produce false errors if the developer intends to compile for newer
" hardware and use newer features, eg. double precision numbers. To pass a
" specific target arch to nvcc, e.g. add the following to your .vimrc:
"
" let g:syntastic_cuda_arch = "sm_20"
if exists("g:loaded_syntastic_cuda_nvcc_checker")
finish
endif
let g:loaded_syntastic_cuda_nvcc_checker=1
function! SyntaxCheckers_cuda_nvcc_IsAvailable()
return executable('nvcc')
endfunction
function! SyntaxCheckers_cuda_nvcc_GetLocList()
if exists('g:syntastic_cuda_arch')
let arch_flag = '-arch=' . g:syntastic_cuda_arch
else
let arch_flag = ''
endif
let makeprg =
\ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' .
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#GetNullDevice()
let errorformat =
\ '%*[^"]"%f"%*\D%l: %m,'.
\ '"%f"%*\D%l: %m,'.
\ '%-G%f:%l: (Each undeclared identifier is reported only once,'.
\ '%-G%f:%l: for each function it appears in.),'.
\ '%f:%l:%c:%m,'.
\ '%f(%l):%m,'.
\ '%f:%l:%m,'.
\ '"%f"\, line %l%*\D%c%*[^ ] %m,'.
\ '%D%*\a[%*\d]: Entering directory `%f'','.
\ '%X%*\a[%*\d]: Leaving directory `%f'','.
\ '%D%*\a: Entering directory `%f'','.
\ '%X%*\a: Leaving directory `%f'','.
\ '%DMaking %*\a in %f,'.
\ '%f|%l| %m'
if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$'
if exists('g:syntastic_cuda_check_header')
let makeprg =
\ 'echo > .syntastic_dummy.cu ; ' .
\ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' .
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#GetNullDevice()
else
return []
endif
endif
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cuda',
\ 'name': 'nvcc'})

View File

@ -0,0 +1,177 @@
"============================================================================
"File: d.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Alfredo Di Napoli <alfredo dot dinapoli at gmail dot com>
"License: Based on the original work of Gregor Uhlenheuer and his
" cpp.vim checker so credits are dued.
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
" HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
" OTHER DEALINGS IN THE SOFTWARE.
"
"============================================================================
" In order to also check header files add this to your .vimrc:
"
" let g:syntastic_d_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_d_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_d_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_d_includes. Then the header files are being re-checked
" on the next file write.
"
" let g:syntastic_d_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_d_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_d_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" dmd command line you can add those to the global variable
" g:syntastic_d_include_dirs. This list can be used like this:
"
" let g:syntastic_d_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_d_compiler_options':
"
" let g:syntastic_d_compiler_options = ' -std=c++0x'
"
" Additionally the setting 'g:syntastic_d_config_file' allows you to define
" a file that contains additional compiler arguments like include directories
" or CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_d_config':
"
" let g:syntastic_d_config_file = '.config'
"
" Using the global variable 'g:syntastic_d_remove_include_errors' you can
" specify whether errors of files included via the
" g:syntastic_d_include_dirs' setting are removed from the result set:
"
" let g:syntastic_d_remove_include_errors = 1
"
" Use the variable 'g:syntastic_d_errorformat' to override the default error
" format:
"
" let g:syntastic_d_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to dmd)
"
" let g:syntastic_d_compiler = 'clang++'
if exists('g:loaded_syntastic_d_dmd_checker')
finish
endif
let g:loaded_syntastic_d_dmd_checker = 1
if !exists('g:syntastic_d_compiler')
let g:syntastic_d_compiler = 'dmd'
endif
function! SyntaxCheckers_d_dmd_IsAvailable()
return executable(g:syntastic_d_compiler)
endfunction
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_d_compiler_options')
let g:syntastic_d_compiler_options = ''
endif
if !exists('g:syntastic_d_config_file')
let g:syntastic_d_config_file = '.syntastic_d_config'
endif
function! SyntaxCheckers_d_dmd_GetLocList()
let makeprg = g:syntastic_d_compiler . ' -c -of' . syntastic#util#DevNull() . ' '
let errorformat = '%-G%f:%s:,%f(%l): %m,%f:%l: %m'
if exists('g:syntastic_d_errorformat')
let errorformat = g:syntastic_d_errorformat
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_d_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('d')
" determine whether to parse header files as well
if expand('%') =~? '\.di$'
if exists('g:syntastic_d_check_header')
let makeprg = g:syntastic_d_compiler .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' -of' . syntastic#util#DevNull() .
\ ' ' . g:syntastic_d_compiler_options .
\ ' ' . syntastic#c#GetIncludeDirs('d')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_d_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_d_no_include_search') ||
\ g:syntastic_d_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_d_auto_refresh_includes') &&
\ g:syntastic_d_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_d_includes')
let b:syntastic_d_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_d_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_d_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_d_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_d_remove_include_errors') &&
\ g:syntastic_d_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'd',
\ 'name': 'dmd'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,66 @@
"============================================================================
"File: dart_analyzer.vim
"Description: Dart syntax checker - using dart_analyzer
"Maintainer: Maksim Ryzhikov <rv.maksim at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_dart_dart_analyzer_checker")
finish
endif
let g:loaded_syntastic_dart_dart_analyzer_checker=1
if !exists("g:syntastic_dart_analyzer_conf")
let g:syntastic_dart_analyzer_conf = ''
endif
function! SyntaxCheckers_dart_dart_analyzer_IsAvailable()
return executable("dart_analyzer")
endfunction
function! SyntaxCheckers_dart_dart_analyzer_GetHighlightRegex(error)
let lcol = a:error['col'] - 1
let rcol = a:error['nr'] + lcol + 1
return '\%>'.lcol.'c\%<'.rcol.'c'
endfunction
function! SyntaxCheckers_dart_dart_analyzer_GetLocList()
let args = !empty(g:syntastic_dart_analyzer_conf) ? ' ' . g:syntastic_dart_analyzer_conf : ''
let makeprg = syntastic#makeprg#build({
\ 'exe': 'dart_analyzer',
\ 'args': '--error_format machine',
\ 'post_args': args,
\ 'filetype': 'dart',
\ 'subchecker': 'dart_analyzer' })
" Machine readable format looks like:
" SEVERITY|TYPE|ERROR_CODE|file:FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE
" SEVERITY: (WARNING|ERROR)
" TYPE: (RESOLVER|STATIC_TYPE|...)
" ERROR_CODE: (NO_SUCH_TYPE|...)
" FILENAME: String
" LINE_NUMBER: int
" COLUMN: int
" LENGHT: int
" MESSAGE: String
" We use %n to grab the error length to be able to access it in the matcher.
let commonformat = '|%.%#|%.%#|file:%f|%l|%c|%n|%m'
" TODO(amouravski): simply take everything after ERROR|WARNING as a message
" and then parse it by hand later.
let errorformat = '%EERROR'.l:commonformat.','.
\'%WWARNING'.l:commonformat
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'dart',
\ 'name': 'dart_analyzer'})

View File

@ -0,0 +1,30 @@
"============================================================================
"File: docbk.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_docbk_xmllint_checker")
finish
endif
let g:loaded_syntastic_docbk_xmllint_checker=1
function! SyntaxCheckers_docbk_xmllint_IsAvailable()
return SyntaxCheckers_xml_xmllint_IsAvailable()
endfunction
function! SyntaxCheckers_docbk_xmllint_GetLocList()
return SyntaxCheckers_xml_xmllint_GetLocList()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'docbk',
\ 'name': 'xmllint'})
runtime! syntax_checkers/xml/*.vim

View File

@ -0,0 +1,45 @@
"============================================================================
"File: elixir.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Richard Ramsden <rramsden at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_elixir_elixir_checker")
finish
endif
let g:loaded_syntastic_elixir_elixir_checker=1
" TODO: we should probably split this into separate checkers
function! SyntaxCheckers_elixir_elixir_IsAvailable()
return executable('elixir') && executable('mix')
endfunction
function! SyntaxCheckers_elixir_elixir_GetLocList()
let make_options = {}
let compile_command = 'elixir'
let mix_file = syntastic#util#findInParent('mix.exs', expand('%:p:h'))
if filereadable(mix_file)
let compile_command = 'mix compile'
let make_options['cwd'] = fnamemodify(mix_file, ':p:h')
endif
let make_options['makeprg'] = syntastic#makeprg#build({
\ 'exe': compile_command,
\ 'filetype': 'elixir',
\ 'subchecker': 'elixir' })
let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m'
return SyntasticMake(make_options)
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'elixir',
\ 'name': 'elixir'})

View File

@ -0,0 +1,51 @@
"============================================================================
"File: erlang.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Pawel Salata <rockplayer.pl at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_erlang_erlang_checker")
finish
endif
let g:loaded_syntastic_erlang_erlang_checker=1
let s:check_file = expand('<sfile>:p:h') . '/erlang_check_file.erl'
if !exists("g:syntastic_erlc_include_path")
let g:syntastic_erlc_include_path=""
endif
function! SyntaxCheckers_erlang_escript_IsAvailable()
return executable('escript')
endfunction
function! SyntaxCheckers_erlang_escript_GetLocList()
let extension = expand('%:e')
if match(extension, 'hrl') >= 0
return []
endif
let shebang = getbufline(bufnr('%'), 1)[0]
if len(shebang) > 0
if match(shebang, 'escript') >= 0
let makeprg = 'escript -s ' . syntastic#util#shexpand('%:p')
else
let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' ' . g:syntastic_erlc_include_path
endif
else
let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' '. g:syntastic_erlc_include_path
endif
let errorformat =
\ '%f:%l:\ %tarning:\ %m,'.
\ '%E%f:%l:\ %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'erlang',
\ 'name': 'escript'})

View File

@ -0,0 +1,34 @@
#!/usr/bin/env escript
-export([main/1]).
main([FileName]) ->
LibDirs = filelib:wildcard("{lib,deps}/*/ebin"),
compile(FileName, LibDirs);
main([FileName | LibDirs]) ->
compile(FileName, LibDirs).
compile(FileName, LibDirs) ->
Root = get_root(filename:dirname(FileName)),
ok = code:add_pathsa(LibDirs),
compile:file(FileName, [warn_obsolete_guard,
warn_unused_import,
warn_shadow_vars,
warn_export_vars,
strong_validation,
report,
{i, filename:join(Root, "include")},
{i, filename:join(Root, "deps")},
{i, filename:join(Root, "apps")},
{i, filename:join(Root, "lib")}
]).
get_root(Dir) ->
Path = filename:split(filename:absname(Dir)),
filename:join(get_root(lists:reverse(Path), Path)).
get_root([], Path) ->
Path;
get_root(["src" | Tail], _Path) ->
lists:reverse(Tail);
get_root([_ | Tail], Path) ->
get_root(Tail, Path).

View File

@ -0,0 +1,65 @@
"============================================================================
"File: ruby.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_eruby_ruby_checker")
finish
endif
let g:loaded_syntastic_eruby_ruby_checker=1
if !exists("g:syntastic_ruby_exec")
let g:syntastic_ruby_exec = "ruby"
endif
function! SyntaxCheckers_eruby_ruby_IsAvailable()
return executable(expand(g:syntastic_ruby_exec))
endfunction
function! SyntaxCheckers_eruby_ruby_GetLocList()
let exe = expand(g:syntastic_ruby_exec)
if !has('win32')
let exe = 'RUBYOPT= ' . exe
endif
let fname = "'" . escape(expand('%'), "\\'") . "'"
" TODO: encodings became useful in ruby 1.9 :)
if syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('ruby --version'), [1, 9])
let enc = &fileencoding != '' ? &fileencoding : &encoding
let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"'
else
let encoding_spec = ''
endif
"gsub fixes issue #7, rails has it's own eruby syntax
let makeprg =
\ exe . ' -rerb -e ' .
\ syntastic#util#shescape('puts ERB.new(File.read(' .
\ fname . encoding_spec .
\ ').gsub(''<\%='',''<\%''), nil, ''-'').src') .
\ ' \| ' . exe . ' -c'
let errorformat =
\ '%-GSyntax OK,'.
\ '%E-:%l: syntax error\, %m,%Z%p^,'.
\ '%W-:%l: warning: %m,'.
\ '%Z%p^,'.
\ '%-C%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'eruby',
\ 'name': 'ruby'})

View File

@ -0,0 +1,63 @@
"============================================================================
"File: fortran.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Karl Yngve Lervåg <karl.yngve@lervag.net>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"Note: This syntax checker uses gfortran with the option -fsyntax-only
" to check for errors and warnings. Additional flags may be
" supplied through both local and global variables,
" b:syntastic_fortran_flags,
" g:syntastic_fortran_flags.
" This is particularly useful when the source requires module files
" in order to compile (that is when it needs modules defined in
" separate files).
"
"============================================================================
if exists("g:loaded_syntastic_fortran_gfortran_checker")
finish
endif
let g:loaded_syntastic_fortran_gfortran_checker=1
if !exists('g:syntastic_fortran_flags')
let g:syntastic_fortran_flags = ''
endif
function! SyntaxCheckers_fortran_gfortran_IsAvailable()
return executable('gfortran')
endfunction
function! SyntaxCheckers_fortran_gfortran_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'gfortran',
\ 'args': s:args(),
\ 'filetype': 'fortran',
\ 'subchecker': 'gfortran' })
let errorformat =
\ '%-C %#,'.
\ '%-C %#%.%#,'.
\ '%A%f:%l.%c:,'.
\ '%Z%m,'.
\ '%G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
function s:args()
let rv = '-fsyntax-only ' . g:syntastic_fortran_flags
if exists('b:syntastic_fortran_flags')
let rv .= " " . b:syntastic_fortran_flags
endif
return rv
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'fortran',
\ 'name': 'gfortran'})

View File

@ -0,0 +1,75 @@
"============================================================================
"File: go.vim
"Description: Check go syntax using 'gofmt -l' followed by 'go [build|test]'
"Maintainer: Kamil Kisiel <kamil@kamilkisiel.net>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" This syntax checker does not reformat your source code.
" Use a BufWritePre autocommand to that end:
" autocmd FileType go autocmd BufWritePre <buffer> Fmt
"============================================================================
if exists("g:loaded_syntastic_go_go_checker")
finish
endif
let g:loaded_syntastic_go_go_checker=1
function! SyntaxCheckers_go_go_IsAvailable()
return executable('go')
endfunction
function! SyntaxCheckers_go_go_GetLocList()
" Check with gofmt first, since `go build` and `go test` might not report
" syntax errors in the current file if another file with syntax error is
" compiled first.
let makeprg = syntastic#makeprg#build({
\ 'exe': 'gofmt',
\ 'args': '-l',
\ 'tail': '1>' . syntastic#util#DevNull(),
\ 'filetype': 'go',
\ 'subchecker': 'go' })
let errorformat =
\ '%f:%l:%c: %m,' .
\ '%-G%.%#'
let errors = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
if !empty(errors)
return errors
endif
" Test files, i.e. files with a name ending in `_test.go`, are not
" compiled by `go build`, therefore `go test` must be called for those.
if match(expand('%'), '_test.go$') == -1
let makeprg = 'go build ' . syntastic#c#GetNullDevice()
else
let makeprg = 'go test -c ' . syntastic#c#GetNullDevice()
endif
let errorformat =
\ '%f:%l:%c:%m,' .
\ '%f:%l%m,' .
\ '%-G#%.%#'
" The go compiler needs to either be run with an import path as an
" argument or directly from the package directory. Since figuring out
" the proper import path is fickle, just cwd to the package.
let errors = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'cwd': expand('%:p:h'),
\ 'defaults': {'type': 'e'} })
return errors
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'go',
\ 'name': 'go'})

View File

@ -0,0 +1,42 @@
"============================================================================
"File: gofmt.vim
"Description: Check go syntax using 'gofmt -l'
"Maintainer: Brandon Thomson <bt@brandonthomson.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" This syntax checker does not reformat your source code.
" Use a BufWritePre autocommand to that end:
" autocmd FileType go autocmd BufWritePre <buffer> Fmt
"============================================================================
if exists("g:loaded_syntastic_go_gofmt_checker")
finish
endif
let g:loaded_syntastic_go_gofmt_checker=1
function! SyntaxCheckers_go_gofmt_IsAvailable()
return executable('gofmt')
endfunction
function! SyntaxCheckers_go_gofmt_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'gofmt',
\ 'args': '-l',
\ 'tail': '1>' . syntastic#util#DevNull(),
\ 'filetype': 'go',
\ 'subchecker': 'gofmt' })
let errorformat = '%f:%l:%c: %m,%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'go',
\ 'name': 'gofmt'})

View File

@ -0,0 +1,37 @@
"============================================================================
"File: golint.vim
"Description: Check go syntax using 'golint'
"Maintainer: Hiroshi Ioka <hirochachacha@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_go_golint_checker")
finish
endif
let g:loaded_syntastic_go_golint_checker=1
function! SyntaxCheckers_go_golint_IsAvailable()
return executable('golint')
endfunction
function! SyntaxCheckers_go_golint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'golint',
\ 'filetype': 'go',
\ 'subchecker': 'golint' })
let errorformat = '%f:%l:%c: %m,%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'go',
\ 'name': 'golint'})

View File

@ -0,0 +1,40 @@
"============================================================================
"File: govet.vim
"Description: Perform static analysis of Go code with the vet tool
"Maintainer: Kamil Kisiel <kamil@kamilkisiel.net>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_go_govet_checker")
finish
endif
let g:loaded_syntastic_go_govet_checker=1
function! SyntaxCheckers_go_govet_IsAvailable()
return executable('go')
endfunction
function! SyntaxCheckers_go_govet_GetLocList()
let makeprg = 'go vet'
let errorformat = '%Evet: %.%\+: %f:%l:%c: %m,%W%f:%l: %m,%-G%.%#'
" The go compiler needs to either be run with an import path as an
" argument or directly from the package directory. Since figuring out
" the proper import path is fickle, just cwd to the package.
let errors = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'cwd': expand('%:p:h'),
\ 'defaults': {'type': 'w'} })
return errors
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'go',
\ 'name': 'govet'})

View File

@ -0,0 +1,45 @@
"============================================================================
"File: haml.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_haml_haml_checker")
finish
endif
let g:loaded_syntastic_haml_haml_checker=1
if !exists("g:syntastic_haml_interpreter")
let g:syntastic_haml_interpreter = "haml"
endif
function! SyntaxCheckers_haml_haml_IsAvailable()
return executable(g:syntastic_haml_interpreter)
endfunction
function! SyntaxCheckers_haml_haml_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': g:syntastic_haml_interpreter,
\ 'args': '-c',
\ 'filetype': 'haml',
\ 'subchecker': 'haml' })
let errorformat =
\ 'Haml error on line %l: %m,' .
\ 'Syntax error on line %l: %m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'haml',
\ 'name': 'haml'})

View File

@ -0,0 +1,47 @@
"============================================================================
"File: ghc-mod.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_haskell_ghc_mod_checker")
finish
endif
let g:loaded_syntastic_haskell_ghc_mod_checker=1
function! SyntaxCheckers_haskell_ghc_mod_IsAvailable()
return executable('ghc-mod')
endfunction
function! SyntaxCheckers_haskell_ghc_mod_GetLocList()
let errorformat =
\ '%-G%\s%#,' .
\ '%f:%l:%c:%trror: %m,' .
\ '%f:%l:%c:%tarning: %m,'.
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c:%m,' .
\ '%E%f:%l:%c:,' .
\ '%Z%m'
let makeprg = syntastic#makeprg#build({
\ 'exe': 'ghc-mod check',
\ 'filetype': 'haskell',
\ 'subchecker': 'ghc_mod' })
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'haskell',
\ 'name': 'ghc_mod'})

View File

@ -0,0 +1,46 @@
"============================================================================
"File: hdevtools.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_haskell_hdevtools_checker")
finish
endif
let g:loaded_syntastic_haskell_hdevtools_checker=1
function! SyntaxCheckers_haskell_hdevtools_IsAvailable()
return executable('hdevtools')
endfunction
function! SyntaxCheckers_haskell_hdevtools_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'hdevtools check',
\ 'args': get(g:, 'hdevtools_options', ''),
\ 'filetype': 'haskell',
\ 'subchecker': 'hdevtools' })
let errorformat= '\%-Z\ %#,'.
\ '%W%f:%l:%c:\ Warning:\ %m,'.
\ '%E%f:%l:%c:\ %m,'.
\ '%E%>%f:%l:%c:,'.
\ '%+C\ \ %#%m,'.
\ '%W%>%f:%l:%c:,'.
\ '%+C\ \ %#%tarning:\ %m,'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['compressWhitespace'] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'haskell',
\ 'name': 'hdevtools'})

View File

@ -0,0 +1,38 @@
"============================================================================
"File: hlint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Nicolas Wu <nicolas.wu at gmail dot com>
"License: BSD
"============================================================================
if exists("g:loaded_syntastic_haskell_hlint_checker")
finish
endif
let g:loaded_syntastic_haskell_hlint_checker=1
function! SyntaxCheckers_haskell_hlint_IsAvailable()
return executable('hlint')
endfunction
function! SyntaxCheckers_haskell_hlint_GetLocList()
let errorformat =
\ '%E%f:%l:%c: Error: %m,' .
\ '%W%f:%l:%c: Warning: %m,' .
\ '%C%m'
let makeprg = syntastic#makeprg#build({
\ 'exe': 'hlint',
\ 'filetype': 'haskell',
\ 'subchecker': 'hlint' })
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['compressWhitespace'] })
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'haskell',
\ 'name': 'hlint'})

View File

@ -0,0 +1,52 @@
"============================================================================
"File: haxe.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: David Bernard <david.bernard.31 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_haxe_haxe_checker")
finish
endif
let g:loaded_syntastic_haxe_haxe_checker=1
function! SyntaxCheckers_haxe_haxe_IsAvailable()
return executable('haxe')
endfunction
function! SyntaxCheckers_haxe_haxe_GetLocList()
if exists('b:vaxe_hxml')
let hxml = b:vaxe_hxml
elseif exists('g:vaxe_hxml')
let hxml = g:vaxe_hxml
else
let hxml = syntastic#util#findInParent('*.hxml', expand('%:p:h'))
endif
let hxml = fnamemodify(hxml, ':p')
if !empty(hxml)
let makeprg = syntastic#makeprg#build({
\ 'exe': 'haxe',
\ 'fname': syntastic#util#shescape(fnameescape(fnamemodify(hxml, ':t'))),
\ 'filetype': 'haxe',
\ 'subchecker': 'haxe' })
let errorformat = '%E%f:%l: characters %c-%*[0-9] : %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'cwd': fnamemodify(hxml, ':h') })
endif
return []
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'haxe',
\ 'name': 'haxe'})

View File

@ -0,0 +1,38 @@
"============================================================================
"File: hss.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Justin Donaldson (jdonaldson@gmail.com)
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_hss_hss_checker")
finish
endif
let g:loaded_syntastic_hss_hss_checker=1
function! SyntaxCheckers_hss_hss_IsAvailable()
return executable('hss')
endfunction
function! SyntaxCheckers_hss_hss_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'hss',
\ 'args' : '-output ' . syntastic#util#DevNull(),
\ 'filetype': 'hss',
\ 'subchecker': 'hss' })
let errorformat = '%E%f:%l: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'hss',
\ 'name': 'hss'})

View File

@ -0,0 +1,174 @@
"============================================================================
"File: tidy.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" Checker option:
"
" - g:syntastic_html_tidy_ignore_errors (list; default: [])
" list of errors to ignore
" - g:syntastic_html_tidy_blocklevel_tags (list; default: [])
" list of additional blocklevel tags, to be added to "--new-blocklevel-tags"
" - g:syntastic_html_tidy_inline_tags (list; default: [])
" list of additional inline tags, to be added to "--new-inline-tags"
" - g:syntastic_html_tidy_empty_tags (list; default: [])
" list of additional empty tags, to be added to "--new-empty-tags"
if exists("g:loaded_syntastic_html_tidy_checker")
finish
endif
let g:loaded_syntastic_html_tidy_checker = 1
if !exists('g:syntastic_html_tidy_ignore_errors')
let g:syntastic_html_tidy_ignore_errors = []
endif
if !exists('g:syntastic_html_tidy_blocklevel_tags')
let g:syntastic_html_tidy_blocklevel_tags = []
endif
if !exists('g:syntastic_html_tidy_inline_tags')
let g:syntastic_html_tidy_inline_tags = []
endif
if !exists('g:syntastic_html_tidy_empty_tags')
let g:syntastic_html_tidy_empty_tags = []
endif
function! SyntaxCheckers_html_tidy_IsAvailable()
return executable('tidy')
endfunction
" TODO: join this with xhtml.vim for DRY's sake?
function! s:TidyEncOptByFenc()
let tidy_opts = {
\'utf-8' : '-utf8',
\'ascii' : '-ascii',
\'latin1' : '-latin1',
\'iso-2022-jp' : '-iso-2022',
\'cp1252' : '-win1252',
\'macroman' : '-mac',
\'utf-16le' : '-utf16le',
\'utf-16' : '-utf16',
\'big5' : '-big5',
\'cp932' : '-shiftjis',
\'sjis' : '-shiftjis',
\'cp850' : '-ibm858',
\}
return get(tidy_opts, &fileencoding, '-utf8')
endfunction
let s:ignore_errors = [
\ "<table> lacks \"summary\" attribute",
\ "not approved by W3C",
\ "attribute \"placeholder\"",
\ "<meta> proprietary attribute \"charset\"",
\ "<meta> lacks \"content\" attribute",
\ "inserting \"type\" attribute",
\ "proprietary attribute \"data-",
\ "missing <!DOCTYPE> declaration",
\ "inserting implicit <body>",
\ "inserting missing 'title' element",
\ "attribute \"[+",
\ "unescaped & or unknown entity",
\ "<input> attribute \"type\" has invalid value \"search\""
\ ]
let s:blocklevel_tags = [
\ "main",
\ "section",
\ "article",
\ "aside",
\ "hgroup",
\ "header",
\ "footer",
\ "nav",
\ "figure",
\ "figcaption"
\ ]
let s:inline_tags = [
\ "video",
\ "audio",
\ "source",
\ "embed",
\ "mark",
\ "progress",
\ "meter",
\ "time",
\ "ruby",
\ "rt",
\ "rp",
\ "canvas",
\ "command",
\ "details",
\ "datalist"
\ ]
let s:empty_tags = [
\ "wbr",
\ "keygen"
\ ]
function! s:IgnoreError(text)
for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors
if stridx(a:text, i) != -1
return 1
endif
endfor
return 0
endfunction
function! s:NewTags(name)
return syntastic#util#shescape(join( s:{a:name} + g:syntastic_html_tidy_{a:name}, ',' ))
endfunction
function s:Args()
let args = s:TidyEncOptByFenc() .
\ ' --new-blocklevel-tags ' . s:NewTags('blocklevel_tags') .
\ ' --new-inline-tags ' . s:NewTags('inline_tags') .
\ ' --new-empty-tags ' . s:NewTags('empty_tags') .
\ ' -e'
return args
endfunction
function! SyntaxCheckers_html_tidy_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'tidy',
\ 'args': s:Args(),
\ 'tail': '2>&1',
\ 'filetype': 'html',
\ 'subchecker': 'tidy' })
let errorformat =
\ '%Wline %l column %v - Warning: %m,' .
\ '%Eline %l column %v - Error: %m,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'returns': [0, 1, 2] })
" filter out valid HTML5 from the errors
for n in range(len(loclist))
if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1
let loclist[n]['valid'] = 0
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'html',
\ 'name': 'tidy'})

View File

@ -0,0 +1,78 @@
"============================================================================
"File: validator.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" For detail;s about validator see: http://about.validator.nu/
"
" Checker options:
"
" - g:syntastic_html_validator_api (string; default: 'http://validator.nu/')
" URL of the service to use for checking; leave it to the default to run the
" checks against http://validator.nu/, or set it to 'http://localhost:8888/'
" if you're running a local service as per http://about.validator.nu/#src
"
" - g:syntastic_html_validator_parser (string; default: empty)
" parser to use; legal values are: xml, xmldtd, html, html5, html4, html4tr;
" set it to 'html5' to check HTML5 files; see the wiki for reference:
" http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#parser
"
" - g:syntastic_html_validator_nsfilter (string; default: empty)
" sets the nsfilter for the parser; see the wiki for details:
" http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#nsfilter
if exists("g:loaded_syntastic_html_validator_checker")
finish
endif
let g:loaded_syntastic_html_validator_checker=1
if !exists('g:syntastic_html_validator_api')
let g:syntastic_html_validator_api = 'http://validator.nu/'
endif
if !exists('g:syntastic_html_validator_parser')
let g:syntastic_html_validator_parser = ''
endif
if !exists('g:syntastic_html_validator_nsfilter')
let g:syntastic_html_validator_nsfilter = ''
endif
let s:decoder = 'awk -f ' . syntastic#util#shescape(expand('<sfile>:p:h') . '/validator_decode.awk')
function! SyntaxCheckers_html_validator_IsAvailable()
return executable('curl') && executable('awk')
endfunction
function! SyntaxCheckers_html_validator_GetLocList()
let makeprg = 'curl -s --compressed -F out=gnu -F asciiquotes=yes' .
\ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
\ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
\ ' -F doc=@' . syntastic#util#shexpand('%') . '\;type=text/html\;filename=' . syntastic#util#shexpand('%') . ' ' .
\ g:syntastic_html_validator_api . ' \| ' . s:decoder
let errorformat =
\ '%E"%f":%l: %trror: %m,' .
\ '%E"%f":%l-%\d%\+: %trror: %m,' .
\ '%E"%f":%l%\%.%c: %trror: %m,' .
\ '%E"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: %trror: %m,' .
\ '%E"%f":%l: %trror fatal: %m,' .
\ '%E"%f":%l-%\d%\+: %trror fatal: %m,' .
\ '%E"%f":%l%\%.%c: %trror fatal: %m,' .
\ '%E"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: %trror fatal: %m,' .
\ '%W"%f":%l: info %tarning: %m,' .
\ '%W"%f":%l-%\d%\+: info %tarning: %m,' .
\ '%W"%f":%l%\%.%c: info %tarning: %m,' .
\ '%W"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: info %tarning: %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'html',
\ 'name': 'validator'})

View File

@ -0,0 +1,61 @@
#!/usr/bin/awk -f
#============================================================================
#File: validator_decode.awk
#Description: Helper script for validator.vim
#Maintainer: LCD 47 <lcd047 at gmail dot com>
#License: This program is free software. It comes without any warranty,
# to the extent permitted by applicable law. You can redistribute
# it and/or modify it under the terms of the Do What The Fuck You
# Want To Public License, Version 2, as published by Sam Hocevar.
# See http://sam.zoy.org/wtfpl/COPYING for more details.
#
#============================================================================
BEGIN {
FS = OFS = "\""
hextab ["0"] = 0; hextab ["8"] = 8;
hextab ["1"] = 1; hextab ["9"] = 9;
hextab ["2"] = 2; hextab ["A"] = hextab ["a"] = 10
hextab ["3"] = 3; hextab ["B"] = hextab ["b"] = 11;
hextab ["4"] = 4; hextab ["C"] = hextab ["c"] = 12;
hextab ["5"] = 5; hextab ["D"] = hextab ["d"] = 13;
hextab ["6"] = 6; hextab ["E"] = hextab ["e"] = 14;
hextab ["7"] = 7; hextab ["F"] = hextab ["f"] = 15;
}
function urldecode (url) {
decoded = ""
i = 1
len = length (url)
while ( i <= len ) {
c = substr (url, i, 1)
if ( c == "%" ) {
if ( i + 2 <= len ) {
c1 = substr (url, i + 1, 1)
c2 = substr (url, i + 2, 1)
if ( hextab [c1] != "" && hextab [c2] != "" ) {
code = 0 + hextab [c1] * 16 + hextab [c2] + 0
c = sprintf ("%c", code)
}
else
c = c c1 c2
i += 2
}
else if ( i + 1 <= len ) {
c = substr (url, i, 2)
i++
}
}
else if ( c == "+" )
c = " "
decoded = decoded c
i++
}
return decoded
}
{
$2 = urldecode($2)
gsub ("\\\\\"", "\"", $2)
print
}

View File

@ -0,0 +1,65 @@
"============================================================================
"File: w3.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" Checker option:
"
" - g:syntastic_html_w3_api (string; default: 'http://validator.w3.org/check')
" URL of the service to use for checking; leave it to the default to run the
" checks against http://validator.w3.org/, or set it to
" 'http://localhost/w3c-validator/check' if you're running a local service
if exists("g:loaded_syntastic_html_w3_checker")
finish
endif
let g:loaded_syntastic_html_w3_checker = 1
if !exists('g:syntastic_html_w3_api')
let g:syntastic_html_w3_api = 'http://validator.w3.org/check'
endif
function! SyntaxCheckers_html_w3_IsAvailable()
return executable('curl')
endfunction
function! SyntaxCheckers_html_w3_GetLocList()
let makeprg = 'curl -s -F output=json ' .
\ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' .
\ g:syntastic_html_w3_api
let errorformat =
\ '%A %\+{,' .
\ '%C %\+"lastLine": %l\,%\?,' .
\ '%C %\+"lastColumn": %c\,%\?,' .
\ '%C %\+"message": "%m"\,%\?,' .
\ '%C %\+"type": "%trror"\,%\?,' .
\ '%-G %\+"type": "%tnfo"\,%\?,' .
\ '%C %\+"subtype": "%tarning"\,%\?,' .
\ '%Z %\+}\,,' .
\ '%-G%.%#'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")},
\ 'returns': [0] })
for n in range(len(loclist))
let loclist[n]['text'] = substitute(loclist[n]['text'], '\\\([\"]\)', '\1', 'g')
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'html',
\ 'name': 'w3'})

View File

@ -0,0 +1,60 @@
"============================================================================
"File: checkstyle.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Dmitry Geurkov <d.geurkov at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" Tested with checkstyle 5.5
"============================================================================
if exists("g:loaded_syntastic_java_checkstyle_checker")
finish
endif
let g:loaded_syntastic_java_checkstyle_checker=1
if !exists("g:syntastic_java_checkstyle_classpath")
let g:syntastic_java_checkstyle_classpath = 'checkstyle-5.5-all.jar'
endif
if !exists("g:syntastic_java_checkstyle_conf_file")
let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml'
endif
function! SyntaxCheckers_java_checkstyle_IsAvailable()
return executable('java')
endfunction
function! SyntaxCheckers_java_checkstyle_GetLocList()
let fname = fnameescape( expand('%:p:h') . '/' . expand('%:t') )
if has('win32unix')
let fname = substitute(system('cygpath -m ' . fname), '\%x00', '', 'g')
endif
let makeprg = syntastic#makeprg#build({
\ 'exe': 'java',
\ 'args': '-cp ' . g:syntastic_java_checkstyle_classpath .
\ ' com.puppycrawl.tools.checkstyle.Main -c ' . g:syntastic_java_checkstyle_conf_file,
\ 'fname': fname,
\ 'filetype': 'java',
\ 'subchecker': 'checkstyle' })
let errorformat =
\ '%f:%l:%c:\ %m,' .
\ '%f:%l:\ %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'postprocess': ['cygwinRemoveCR'] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'java',
\ 'name': 'checkstyle'})

View File

@ -0,0 +1,366 @@
"============================================================================
"File: javac.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Jochen Keil <jochen.keil at gmail dot com>
" Dmitry Geurkov <d.geurkov at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_java_javac_checker")
finish
endif
let g:loaded_syntastic_java_javac_checker=1
let g:syntastic_java_javac_maven_pom_tags = ["build", "properties"]
let g:syntastic_java_javac_maven_pom_properties = {}
" Global Options
if !exists("g:syntastic_java_javac_executable")
let g:syntastic_java_javac_executable = 'javac'
endif
if !exists("g:syntastic_java_maven_executable")
let g:syntastic_java_maven_executable = 'mvn'
endif
if !exists("g:syntastic_java_javac_options")
let g:syntastic_java_javac_options = '-Xlint'
endif
if !exists("g:syntastic_java_javac_classpath")
let g:syntastic_java_javac_classpath = ''
endif
if !exists("g:syntastic_java_javac_delete_output")
let g:syntastic_java_javac_delete_output = 1
endif
function! s:CygwinPath(path)
return substitute(system("cygpath -m ".a:path), '\%x00', '', 'g')
endfunction
if !exists("g:syntastic_java_javac_temp_dir")
if has('win32') || has('win64')
let g:syntastic_java_javac_temp_dir = $TEMP."\\vim-syntastic-javac"
elseif has('win32unix')
let g:syntastic_java_javac_temp_dir = s:CygwinPath('/tmp/vim-syntastic-javac')
else
let g:syntastic_java_javac_temp_dir = '/tmp/vim-syntastic-javac'
endif
endif
if !exists("g:syntastic_java_javac_autoload_maven_classpath")
let g:syntastic_java_javac_autoload_maven_classpath = 1
endif
if !exists('g:syntastic_java_javac_config_file_enabled')
let g:syntastic_java_javac_config_file_enabled = 0
endif
if !exists('g:syntastic_java_javac_config_file')
let g:syntastic_java_javac_config_file = '.syntastic_javac_config'
endif
if !exists("g:syntastic_java_javac_maven_pom_ftime")
let g:syntastic_java_javac_maven_pom_ftime = {}
endif
if !exists("g:syntastic_java_javac_maven_pom_classpath")
let g:syntastic_java_javac_maven_pom_classpath = {}
endif
function! s:RemoveCarriageReturn(line)
return substitute(a:line, '\r', '', 'g')
endfunction
" recursively remove directory and all it's sub-directories
function! s:RemoveDir(dir)
if isdirectory(a:dir)
for f in split(globpath(a:dir, '*'), "\n")
call s:RemoveDir(f)
endfor
silent! call system('rmdir ' . a:dir)
else
silent! call delete(a:dir)
endif
endfunction
function! s:AddToClasspath(classpath,path)
if a:path == ''
return a:classpath
endif
if a:classpath != '' && a:path != ''
if has('win32') || has('win32unix') || has('win64')
return a:classpath . ";" . a:path
else
return a:classpath . ":" . a:path
endif
else
return a:path
endif
endfunction
function! s:LoadClasspathFromConfigFile()
if filereadable(g:syntastic_java_javac_config_file)
let path = ''
let lines = readfile(g:syntastic_java_javac_config_file)
for l in lines
if l != ''
let path .= l . "\n"
endif
endfor
return path
else
return ''
endif
endfunction
function! s:SaveClasspath()
let path = ''
let lines = getline(1, line('$'))
" save classpath to config file
if g:syntastic_java_javac_config_file_enabled
call writefile(lines,g:syntastic_java_javac_config_file)
endif
for l in lines
if l != ''
let path .= l . "\n"
endif
endfor
let g:syntastic_java_javac_classpath = path
let &modified = 0
endfunction
function! s:EditClasspath()
let command = 'syntastic javac classpath'
let winnr = bufwinnr('^' . command . '$')
if winnr < 0
let pathlist = split(g:syntastic_java_javac_classpath,"\n")
execute (len(pathlist) + 5) . 'sp ' . fnameescape(command)
augroup syntastic
autocmd BufWriteCmd <buffer> call s:SaveClasspath() | bwipeout
augroup END
setlocal buftype=acwrite bufhidden=wipe nobuflisted noswapfile nowrap number
for p in pathlist
call append(line('$') - 1, p)
endfor
else
execute winnr . 'wincmd w'
endif
endfunction
function! s:GetMavenProperties()
let mvn_properties = {}
let pom = findfile("pom.xml", ".;")
if filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_properties, pom)
let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom
let mvn_is_managed_tag = 1
let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n")
let current_path = 'project'
for line in mvn_settings_output
let matches = matchlist(line, '^\s*<\([a-zA-Z0-9\-\.]\+\)>\s*$')
if mvn_is_managed_tag && !empty(matches)
let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) >= 0
let current_path .= '.' . matches[1]
else
let matches = matchlist(line, '^\s*</\([a-zA-Z0-9\-\.]\+\)>\s*$')
if !empty(matches)
let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) < 0
let current_path = substitute(current_path, '\.' . matches[1] . "$", '', '')
else
let matches = matchlist(line, '^\s*<\([a-zA-Z0-9\-\.]\+\)>\(.\+\)</[a-zA-Z0-9\-\.]\+>\s*$')
if mvn_is_managed_tag && !empty(matches)
let mvn_properties[current_path . '.' . matches[1]] = matches[2]
endif
endif
endif
endfor
let g:syntastic_java_javac_maven_pom_properties[pom] = mvn_properties
endif
return g:syntastic_java_javac_maven_pom_properties[pom]
endif
return mvn_properties
endfunction
command! SyntasticJavacEditClasspath call s:EditClasspath()
function! s:GetMavenClasspath()
let pom = findfile("pom.xml", ".;")
if filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom)
let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom
let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n")
let class_path_next = 0
for line in mvn_classpath_output
if class_path_next == 1
let mvn_classpath = s:RemoveCarriageReturn(line)
break
endif
if match(line,'Dependencies classpath:') >= 0
let class_path_next = 1
endif
endfor
let mvn_properties = s:GetMavenProperties()
let output_dir = 'target/classes'
if has_key(mvn_properties, 'project.build.outputDirectory')
let output_dir = mvn_properties['project.build.outputDirectory']
endif
let mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir)
let test_output_dir = 'target/test-classes'
if has_key(mvn_properties, 'project.build.testOutputDirectory')
let test_output_dir = mvn_properties['project.build.testOutputDirectory']
endif
let mvn_classpath = s:AddToClasspath(mvn_classpath, test_output_dir)
let g:syntastic_java_javac_maven_pom_ftime[pom] = getftime(pom)
let g:syntastic_java_javac_maven_pom_classpath[pom] = mvn_classpath
endif
return g:syntastic_java_javac_maven_pom_classpath[pom]
endif
return ''
endfunction
function! SyntaxCheckers_java_javac_IsAvailable()
return executable(g:syntastic_java_javac_executable)
endfunction
function! s:MavenOutputDirectory()
let pom = findfile("pom.xml", ".;")
if filereadable(pom)
let mvn_properties = s:GetMavenProperties()
let output_dir = getcwd()
if has_key(mvn_properties, 'project.properties.build.dir')
let output_dir = mvn_properties['project.properties.build.dir']
endif
if match(expand( '%:p:h' ), "src.main.java") >= 0
let output_dir .= '/target/classes'
if has_key(mvn_properties, 'project.build.outputDirectory')
let output_dir = mvn_properties['project.build.outputDirectory']
endif
endif
if match(expand( '%:p:h' ), "src.test.java") >= 0
let output_dir .= '/target/test-classes'
if has_key(mvn_properties, 'project.build.testOutputDirectory')
let output_dir = mvn_properties['project.build.testOutputDirectory']
endif
endif
if has('win32unix')
let output_dir=s:CygwinPath(output_dir)
endif
return output_dir
endif
endfunction
function! SyntaxCheckers_java_javac_GetLocList()
let javac_opts = g:syntastic_java_javac_options
if g:syntastic_java_javac_delete_output
let output_dir = g:syntastic_java_javac_temp_dir
let javac_opts .= ' -d ' . output_dir
endif
" load classpath from config file
if g:syntastic_java_javac_config_file_enabled
let loaded_classpath = s:LoadClasspathFromConfigFile()
if loaded_classpath != ''
let g:syntastic_java_javac_classpath = loaded_classpath
endif
endif
let javac_classpath = ''
" add classpathes to javac_classpath
for path in split(g:syntastic_java_javac_classpath,"\n")
if path != ''
try
let ps = glob(path,0,1)
catch
let ps = split(glob(path,0),"\n")
endtry
if type(ps) == type([])
for p in ps
if p != ''
let javac_classpath = s:AddToClasspath(javac_classpath,p)
endif
endfor
else
let javac_classpath = s:AddToClasspath(javac_classpath,ps)
endif
endif
endfor
if g:syntastic_java_javac_autoload_maven_classpath
if !g:syntastic_java_javac_delete_output
let maven_output_dir = s:MavenOutputDirectory()
let javac_opts .= ' -d ' . maven_output_dir
endif
let maven_classpath = s:GetMavenClasspath()
let javac_classpath = s:AddToClasspath(javac_classpath,maven_classpath)
endif
if javac_classpath != ''
let javac_opts .= ' -cp "' . fnameescape(javac_classpath) . '"'
endif
" path seperator
if has('win32') || has('win32unix') || has('win64')
let sep = "\\"
else
let sep = '/'
endif
let fname = fnameescape(expand ( '%:p:h' ) . sep . expand ( '%:t' ))
if has('win32unix')
let fname = s:CygwinPath(fname)
endif
let makeprg = syntastic#makeprg#build({
\ 'exe': g:syntastic_java_javac_executable,
\ 'args': javac_opts,
\ 'fname': fname,
\ 'tail': '2>&1',
\ 'filetype': 'java',
\ 'subchecker': 'javac' })
" unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types
let errorformat =
\ '%E%f:%l:\ error:\ %m,'.
\ '%W%f:%l:\ warning:\ %m,'.
\ '%A%f:%l:\ %m,'.
\ '%+Z%p^,'.
\ '%+C%.%#,'.
\ '%-G%.%#'
if g:syntastic_java_javac_delete_output
silent! call mkdir(output_dir,'p')
endif
let errors = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['cygwinRemoveCR'] })
if g:syntastic_java_javac_delete_output
call s:RemoveDir(output_dir)
endif
return errors
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'java',
\ 'name': 'javac'})

View File

@ -0,0 +1,66 @@
"============================================================================
"File: closurecompiler.vim
"Description: Javascript syntax checker - using Google Closure Compiler
"Maintainer: Motohiro Takayama <mootoh at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" To enable this plugin, edit the .vimrc like this:
"
" let g:syntastic_javascript_checker = "closurecompiler"
"
" and set the path to the Google Closure Compiler:
"
" let g:syntastic_javascript_closure_compiler_path = '/path/to/google-closure-compiler.jar'
"
" It takes additional options for Google Closure Compiler with the variable
" g:syntastic_javascript_closure_compiler_options.
"
if exists("g:loaded_syntastic_javascript_closurecompiler_checker")
finish
endif
let g:loaded_syntastic_javascript_closurecompiler_checker=1
if !exists("g:syntastic_javascript_closure_compiler_options")
let g:syntastic_javascript_closure_compiler_options = ""
endif
function! SyntaxCheckers_javascript_closurecompiler_IsAvailable()
return exists("g:syntastic_javascript_closure_compiler_path")
endfunction
function! SyntaxCheckers_javascript_closurecompiler_GetLocList()
if exists("g:syntastic_javascript_closure_compiler_file_list")
let file_list = join(readfile(g:syntastic_javascript_closure_compiler_file_list), ' ')
else
let file_list = syntastic#util#shexpand('%')
endif
let makeprg = syntastic#makeprg#build({
\ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path,
\ 'args': g:syntastic_javascript_closure_compiler_options . ' --js' ,
\ 'fname': file_list,
\ 'filetype': 'javascript',
\ 'subchecker': 'closurecompiler' })
let errorformat =
\ '%-GOK,'.
\ '%E%f:%l: ERROR - %m,'.
\ '%Z%p^,'.
\ '%W%f:%l: WARNING - %m,'.
\ '%Z%p^'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'closurecompiler'})

View File

@ -0,0 +1,46 @@
"============================================================================
"File: gjslint.vim
"Description: Javascript syntax checker - using gjslint
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_gjslint_checker")
finish
endif
let g:loaded_syntastic_javascript_gjslint_checker=1
if !exists("g:syntastic_javascript_gjslint_conf")
let g:syntastic_javascript_gjslint_conf = ""
endif
function! SyntaxCheckers_javascript_gjslint_IsAvailable()
return executable('gjslint')
endfunction
function! SyntaxCheckers_javascript_gjslint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'gjslint',
\ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep",
\ 'filetype': 'javascript',
\ 'subchecker': 'gjslint' })
let errorformat =
\ "%f:%l:(New Error -%\\?\%n) %m," .
\ "%f:%l:(-%\\?%n) %m," .
\ "%-G1 files checked," .
\ " no errors found.," .
\ "%-G%.%#"
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'gjslint'})

View File

@ -0,0 +1,55 @@
"============================================================================
"File: jshint.vim
"Description: Javascript syntax checker - using jshint
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_jshint_checker")
finish
endif
let g:loaded_syntastic_javascript_jshint_checker=1
if !exists("g:syntastic_javascript_jshint_conf")
let g:syntastic_javascript_jshint_conf = ""
endif
function! SyntaxCheckers_javascript_jshint_IsAvailable()
return executable('jshint')
endfunction
function! SyntaxCheckers_javascript_jshint_GetLocList()
let jshint_new = s:JshintNew()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'jshint',
\ 'post_args': (jshint_new ? ' --verbose ' : '') . s:Args(),
\ 'filetype': 'javascript',
\ 'subchecker': 'jshint' })
let errorformat = jshint_new ?
\ '%f: line %l\, col %c\, %m \(%t%*\d\)' :
\ '%E%f: line %l\, col %c\, %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
function s:JshintNew()
return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('jshint --version'), [1, 1])
endfunction
function s:Args()
" node-jshint uses .jshintrc as config unless --config arg is present
return !empty(g:syntastic_javascript_jshint_conf) ? ' --config ' . g:syntastic_javascript_jshint_conf : ''
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'jshint'})

View File

@ -0,0 +1,56 @@
"============================================================================
"File: jsl.vim
"Description: Javascript syntax checker - using jsl
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_javascript_jsl_checker")
finish
endif
let g:loaded_syntastic_javascript_jsl_checker=1
if !exists("g:syntastic_javascript_jsl_conf")
let g:syntastic_javascript_jsl_conf = ""
endif
function s:ConfFlag()
if !empty(g:syntastic_javascript_jsl_conf)
return "-conf " . g:syntastic_javascript_jsl_conf
endif
return ""
endfunction
function! SyntaxCheckers_javascript_jsl_IsAvailable()
return executable('jsl')
endfunction
function! SyntaxCheckers_javascript_jsl_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'jsl',
\ 'args': s:ConfFlag() . " -nologo -nofilelisting -nosummary -nocontext -process",
\ 'filetype': 'javascript',
\ 'subchecker': 'jsl' })
let errorformat =
\ '%W%f(%l): lint warning: %m,'.
\ '%-Z%p^,'.
\ '%W%f(%l): warning: %m,'.
\ '%-Z%p^,'.
\ '%E%f(%l): SyntaxError: %m,'.
\ '%-Z%p^,'.
\ '%-G'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'jsl'})

View File

@ -0,0 +1,53 @@
"============================================================================
"File: jslint.vim
"Description: Javascript syntax checker - using jslint
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"Tested with jslint 0.1.4.
"============================================================================
if exists("g:loaded_syntastic_javascript_jslint_checker")
finish
endif
let g:loaded_syntastic_javascript_jslint_checker=1
if !exists("g:syntastic_javascript_jslint_conf")
let g:syntastic_javascript_jslint_conf = "--white --undef --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars"
endif
function! SyntaxCheckers_javascript_jslint_IsAvailable()
return executable('jslint')
endfunction
function! SyntaxCheckers_javascript_jslint_HighlightTerm(error)
let unexpected = matchstr(a:error['text'], 'Expected.*and instead saw \'\zs.*\ze\'')
if len(unexpected) < 1 | return '' | end
return '\V'.split(unexpected, "'")[1]
endfunction
function! SyntaxCheckers_javascript_jslint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'jslint',
\ 'args': g:syntastic_javascript_jslint_conf,
\ 'filetype': 'javascript',
\ 'subchecker': 'jslint' })
let errorformat =
\ '%E %##%n %m,'.
\ '%-Z%.%#Line %l\, Pos %c,'.
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'jslint'})

View File

@ -0,0 +1,43 @@
"============================================================================
"File: jsonlint.vim
"Description: JSON syntax checker - using jsonlint
"Maintainer: Miller Medeiros <contact at millermedeiros dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_json_jsonlint_checker")
finish
endif
let g:loaded_syntastic_json_jsonlint_checker=1
function! SyntaxCheckers_json_jsonlint_IsAvailable()
return executable('jsonlint')
endfunction
function! SyntaxCheckers_json_jsonlint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'jsonlint',
\ 'post_args': '--compact',
\ 'filetype': 'json',
\ 'subchecker': 'jsonlint' })
let errorformat =
\ '%ELine %l:%c,'.
\ '%Z\\s%#Reason: %m,'.
\ '%C%.%#,'.
\ '%f: line %l\, col %c\, %m,'.
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'json',
\ 'name': 'jsonlint'})

View File

@ -0,0 +1,40 @@
"============================================================================
"File: jsonval.vim
"Description: JSON syntax checker - using jsonval
"Maintainer: Miller Medeiros <contact at millermedeiros dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_json_jsonval_checker")
finish
endif
let g:loaded_syntastic_json_jsonval_checker=1
function! SyntaxCheckers_json_jsonval_IsAvailable()
return executable('jsonval')
endfunction
function! SyntaxCheckers_json_jsonval_GetLocList()
" based on https://gist.github.com/1196345
let makeprg = syntastic#makeprg#build({
\ 'exe': 'jsonval',
\ 'filetype': 'json',
\ 'subchecker': 'jsonval' })
let errorformat =
\ '%E%f:\ %m\ at\ line\ %l,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'json',
\ 'name': 'jsonval'})

View File

@ -0,0 +1,41 @@
#!/usr/bin/env node
fs = require 'fs'
less = require 'less'
args = process.argv.slice(1)
options = {}
args = args.filter (arg) ->
match = arg.match(/^-I(.+)$/)
if match
options.paths.push(match[1]);
return false
match = arg.match(/^--?([a-z][\-0-9a-z]*)(?:=([^\s]+))?$/i)
if match
arg = match[1]
else
return arg
switch arg
when 'strict-imports' then options.strictImports = true
when 'include-path'
options.paths = match[2].split(if os.type().match(/Windows/) then ';' else ':')
.map (p) ->
if p
return path.resolve(process.cwd(), p)
when 'O0' then options.optimization = 0
when 'O1' then options.optimization = 1
when 'O2' then options.optimization = 2
options.filename = args[1]
parser = new(less.Parser) options
fs.readFile(options.filename, 'utf-8', (err,data) ->
parser.parse(data, (err, tree) ->
if err
less.writeError err
process.exit(1)
)
)

View File

@ -0,0 +1,57 @@
// Generated by CoffeeScript 1.3.3
(function() {
var args, fs, less, options, parser;
fs = require('fs');
less = require('less');
args = process.argv.slice(1);
options = {};
args = args.filter(function(arg) {
var match;
match = arg.match(/^-I(.+)$/);
if (match) {
options.paths.push(match[1]);
return false;
}
match = arg.match(/^--?([a-z][\-0-9a-z]*)(?:=([^\s]+))?$/i);
if (match) {
arg = match[1];
} else {
return arg;
}
switch (arg) {
case 'strict-imports':
return options.strictImports = true;
case 'include-path':
return options.paths = match[2].split(os.type().match(/Windows/) ? ';' : ':').map(function(p) {
if (p) {
return path.resolve(process.cwd(), p);
}
});
case 'O0':
return options.optimization = 0;
case 'O1':
return options.optimization = 1;
case 'O2':
return options.optimization = 2;
}
});
options.filename = args[1];
parser = new less.Parser(options);
fs.readFile(options.filename, 'utf-8', function(err, data) {
return parser.parse(data, function(err, tree) {
if (err) {
less.writeError(err);
return process.exit(1);
}
});
});
}).call(this);

View File

@ -0,0 +1,61 @@
"============================================================================
"File: less.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Julien Blanchard <julien at sideburns dot eu>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" To send additional options to less use the variable g:syntastic_less_options.
" The default is
" let g:syntastic_less_options = "--no-color"
"
" To use less-lint instead of less set the variable
" g:syntastic_less_use_less_lint.
if exists("g:loaded_syntastic_less_lessc_checker")
finish
endif
let g:loaded_syntastic_less_lessc_checker=1
if !exists("g:syntastic_less_options")
let g:syntastic_less_options = "--no-color"
endif
if !exists("g:syntastic_less_use_less_lint")
let g:syntastic_less_use_less_lint = 0
endif
if g:syntastic_less_use_less_lint
let s:check_file = 'node ' . expand('<sfile>:p:h') . '/less-lint.js'
else
let s:check_file = 'lessc'
end
function! SyntaxCheckers_less_lessc_IsAvailable()
return executable('lessc')
endfunction
function! SyntaxCheckers_less_lessc_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': s:check_file,
\ 'args': g:syntastic_less_options,
\ 'tail': syntastic#util#DevNull(),
\ 'filetype': 'less',
\ 'subchecker': 'lessc' })
let errorformat = '%m in %f:%l:%c'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'less',
\ 'name': 'lessc'})

View File

@ -0,0 +1,47 @@
"============================================================================
"File: lisp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Karl Yngve Lervåg <karl.yngve@lervag.net>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_lisp_clisp_checker")
finish
endif
let g:loaded_syntastic_lisp_clisp_checker=1
function! SyntaxCheckers_lisp_clisp_IsAvailable()
return executable("clisp")
endfunction
function! SyntaxCheckers_lisp_clisp_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'clisp',
\ 'args': '-q -c',
\ 'tail': '-o /tmp/clisp-vim-compiled-file',
\ 'filetype': 'lisp',
\ 'subchecker': 'clisp' })
let errorformat =
\ '%-G;%.%#,' .
\ '%W%>WARNING:%.%#line %l : %m,' .
\ '%Z %#%m,' .
\ '%W%>WARNING:%.%#lines %l..%\d\# : %m,' .
\ '%Z %#%m,' .
\ '%E%>The following functions were %m,' .
\ '%Z %m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'lisp',
\ 'name': 'clisp'})

View File

@ -0,0 +1,38 @@
"============================================================================
"File: llvm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Andrew Kelley <superjoe30@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_llvm_llvm_checker")
finish
endif
let g:loaded_syntastic_llvm_llvm_checker=1
function! SyntaxCheckers_llvm_llvm_IsAvailable()
return executable("llc")
endfunction
function! SyntaxCheckers_llvm_llvm_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'llc',
\ 'args': syntastic#c#GetNullDevice(),
\ 'filetype': 'llvm',
\ 'subchecker': 'llvm' })
let errorformat = 'llc: %f:%l:%c: %trror: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'llvm',
\ 'name': 'llvm'})

View File

@ -0,0 +1,64 @@
"============================================================================
"File: lua.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_lua_luac_checker")
finish
endif
let g:loaded_syntastic_lua_luac_checker=1
function! SyntaxCheckers_lua_luac_IsAvailable()
return executable('luac')
endfunction
function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
let near = matchstr(a:pos['text'], "near '[^']\\+'")
let result = ''
if len(near) > 0
let near = split(near, "'")[1]
if near == '<eof>'
let p = getpos('$')
let a:pos['lnum'] = p[1]
let a:pos['col'] = p[2]
let result = '\%'.p[2].'c'
else
let result = '\V'.near
endif
let open = matchstr(a:pos['text'], "(to close '[^']\\+' at line [0-9]\\+)")
if len(open) > 0
let oline = split(open, "'")[1:2]
let line = 0+strpart(oline[1], 9)
call matchadd('SpellCap', '\%'.line.'l\V'.oline[0])
endif
endif
return result
endfunction
function! SyntaxCheckers_lua_luac_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'luac',
\ 'args': '-p',
\ 'filetype': 'lua',
\ 'subchecker': 'luac' })
let errorformat = 'luac: %#%f:%l: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'lua',
\ 'name': 'luac'})

View File

@ -0,0 +1,41 @@
"============================================================================
"File: matlab.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Jason Graham <jason at the-graham dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_matlab_mlint_checker")
finish
endif
let g:loaded_syntastic_matlab_mlint_checker=1
function! SyntaxCheckers_matlab_mlint_IsAvailable()
return executable("mlint")
endfunction
function! SyntaxCheckers_matlab_mlint_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'mlint',
\ 'args': '-id $*',
\ 'filetype': 'matlab',
\ 'subchecker': 'mlint' })
let errorformat =
\ 'L %l (C %c): %*[a-zA-Z0-9]: %m,'.
\ 'L %l (C %c-%*[0-9]): %*[a-zA-Z0-9]: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr("")} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'matlab',
\ 'name': 'mlint'})

View File

@ -0,0 +1,38 @@
"============================================================================
"File: nasm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Håvard Pettersson <haavard.pettersson at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_nasm_nasm_checker")
finish
endif
let g:loaded_syntastic_nasm_nasm_checker=1
function! SyntaxCheckers_nasm_nasm_IsAvailable()
return executable("nasm")
endfunction
function! SyntaxCheckers_nasm_nasm_GetLocList()
let wd = syntastic#util#shescape(expand("%:p:h") . "/")
let makeprg = syntastic#makeprg#build({
\ 'exe': 'nasm',
\ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#GetNullDevice()
\ 'filetype': 'nasm',
\ 'subchecker': 'nasm' })
let errorformat = '%f:%l: %t%*[^:]: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'nasm',
\ 'name': 'nasm'})

View File

@ -0,0 +1,41 @@
"============================================================================
"File: mandoc.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_nroff_mandoc_checker")
finish
endif
let g:loaded_syntastic_nroff_mandoc_checker=1
function! SyntaxCheckers_nroff_mandoc_IsAvailable()
return executable("mandoc")
endfunction
function! SyntaxCheckers_nroff_mandoc_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'mandoc',
\ 'args': '-Tlint',
\ 'filetype': 'nroff',
\ 'subchecker': 'mandoc' })
let errorformat =
\ '%E%f:%l:%c: %tRROR: %m,' .
\ '%W%f:%l:%c: %tARNING: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 2, 3, 4] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'nroff',
\ 'name': 'mandoc'})

View File

@ -0,0 +1,184 @@
"============================================================================
"File: objc.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" In order to also check header files add this to your .vimrc:
" (this usually creates a .gch file in your source directory)
"
" let g:syntastic_objc_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_objc_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_objc_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_objc_includes. Then the header files are being re-checked on
" the next file write.
"
" let g:syntastic_objc_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_objc_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_objc_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_objc_include_dirs. This list can be used like this:
"
" let g:syntastic_objc_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_objc_compiler_options':
"
" let g:syntastic_objc_compiler_options = ' -ansi'
"
" Additionally the setting 'g:syntastic_objc_config_file' allows you to define a
" file that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_objc_config':
"
" let g:syntastic_objc_config_file = '.config'
"
" Using the global variable 'g:syntastic_objc_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_objc_include_dirs'
" setting are removed from the result set:
"
" let g:syntastic_objc_remove_include_errors = 1
"
" Use the variable 'g:syntastic_objc_errorformat' to override the default error
" format:
"
" let g:syntastic_objc_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to gcc)
"
" let g:syntastic_objc_compiler = 'clang'
if exists('g:loaded_syntastic_objc_gcc_checker')
finish
endif
let g:loaded_syntastic_objc_gcc_checker = 1
if !exists('g:syntastic_objc_compiler')
let g:syntastic_objc_compiler = 'gcc'
endif
function! SyntaxCheckers_objc_gcc_IsAvailable()
return executable(g:syntastic_objc_compiler)
endfunction
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_objc_compiler_options')
let g:syntastic_objc_compiler_options = '-std=gnu99'
endif
if !exists('g:syntastic_objc_config_file')
let g:syntastic_objc_config_file = '.syntastic_objc_config'
endif
function! SyntaxCheckers_objc_gcc_GetLocList()
let makeprg = g:syntastic_objc_compiler . ' -x objective-c -fsyntax-only -lobjc'
let errorformat =
\ '%-G%f:%s:,' .
\ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
\ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
\ '%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,' .
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,' .
\ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m,' .
\ '%f:%l: %m'
if exists('g:syntastic_objc_errorformat')
let errorformat = g:syntastic_objc_errorformat
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_objc_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('objc')
" determine whether to parse header files as well
if expand('%') =~? '\.h$'
if exists('g:syntastic_objc_check_header')
let makeprg = g:syntastic_objc_compiler .
\ ' -x objective-c-header ' .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_objc_compiler_options .
\ ' ' . syntastic#c#GetIncludeDirs('objc')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_objc_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_objc_no_include_search') ||
\ g:syntastic_objc_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_objc_auto_refresh_includes') &&
\ g:syntastic_objc_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_objc_includes')
let b:syntastic_objc_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_objc_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_objc_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_objc_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_objc_remove_include_errors') &&
\ g:syntastic_objc_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objc',
\ 'name': 'gcc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,36 @@
"============================================================================
"File: oclint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: "UnCO" Lin <undercooled aT lavabit com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" The setting 'g:syntastic_oclint_config_file' allows you to define a file
" that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_oclint_config':
"
" let g:syntastic_oclint_config_file = '.config'
if exists("g:loaded_syntastic_objc_oclint_checker")
finish
endif
let g:loaded_syntastic_objc_oclint_checker = 1
function! SyntaxCheckers_objc_oclint_IsAvailable()
return SyntaxCheckers_c_oclint_IsAvailable()
endfunction
function! SyntaxCheckers_objc_oclint_GetLocList()
return SyntaxCheckers_c_oclint_GetLocList()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objc',
\ 'name': 'oclint'})
runtime! syntax_checkers/c/*.vim

View File

@ -0,0 +1,34 @@
"============================================================================
"File: ycm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Val Markovic <val at markovic dot io>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_objc_ycm_checker")
finish
endif
let g:loaded_syntastic_objc_ycm_checker = 1
runtime! syntax_checkers/c/*.vim
function! SyntaxCheckers_objc_ycm_IsAvailable()
return SyntaxCheckers_c_ycm_IsAvailable()
endfunction
if !exists('g:loaded_youcompleteme')
finish
endif
function! SyntaxCheckers_objc_ycm_GetLocList()
return SyntaxCheckers_c_ycm_GetLocList()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objc',
\ 'name': 'ycm'})

View File

@ -0,0 +1,184 @@
"============================================================================
"File: objcpp.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
" In order to also check header files add this to your .vimrc:
" (this usually creates a .gch file in your source directory)
"
" let g:syntastic_objcpp_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_objcpp_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_objcpp_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_objcpp_includes. Then the header files are being re-checked on
" the next file write.
"
" let g:syntastic_objcpp_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_objcpp_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_objcpp_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_objcpp_include_dirs. This list can be used like this:
"
" let g:syntastic_objcpp_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_objcpp_compiler_options':
"
" let g:syntastic_objcpp_compiler_options = ' -ansi'
"
" Additionally the setting 'g:syntastic_objcpp_config_file' allows you to define a
" file that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_objcpp_config':
"
" let g:syntastic_objcpp_config_file = '.config'
"
" Using the global variable 'g:syntastic_objcpp_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_objcpp_include_dirs'
" setting are removed from the result set:
"
" let g:syntastic_objcpp_remove_include_errors = 1
"
" Use the variable 'g:syntastic_objcpp_errorformat' to override the default error
" format:
"
" let g:syntastic_objcpp_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to gcc)
"
" let g:syntastic_objcpp_compiler = 'clang'
if exists('g:loaded_syntastic_objcpp_gcc_checker')
finish
endif
let g:loaded_syntastic_objcpp_gcc_checker = 1
if !exists('g:syntastic_objcpp_compiler')
let g:syntastic_objcpp_compiler = 'gcc'
endif
function! SyntaxCheckers_objcpp_gcc_IsAvailable()
return executable(g:syntastic_objcpp_compiler)
endfunction
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_objcpp_compiler_options')
let g:syntastic_objcpp_compiler_options = '-std=gnu99'
endif
if !exists('g:syntastic_objcpp_config_file')
let g:syntastic_objcpp_config_file = '.syntastic_objcpp_config'
endif
function! SyntaxCheckers_objcpp_gcc_GetLocList()
let makeprg = g:syntastic_objcpp_compiler . ' -x objective-c++ -fsyntax-only -lobjc'
let errorformat =
\ '%-G%f:%s:,' .
\ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
\ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
\ '%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,' .
\ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,' .
\ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m,' .
\ '%f:%l: %m'
if exists('g:syntastic_objcpp_errorformat')
let errorformat = g:syntastic_objcpp_errorformat
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_objcpp_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('objcpp')
" determine whether to parse header files as well
if expand('%') =~? '\.h$'
if exists('g:syntastic_objcpp_check_header')
let makeprg = g:syntastic_objcpp_compiler .
\ ' -x objective-c++-header ' .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_objcpp_compiler_options .
\ ' ' . syntastic#c#GetIncludeDirs('objcpp')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_objcpp_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_objcpp_no_include_search') ||
\ g:syntastic_objcpp_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_objcpp_auto_refresh_includes') &&
\ g:syntastic_objcpp_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_objcpp_includes')
let b:syntastic_objcpp_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_objcpp_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_objcpp_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_objcpp_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_objcpp_remove_include_errors') &&
\ g:syntastic_objcpp_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objcpp',
\ 'name': 'gcc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -0,0 +1,36 @@
"============================================================================
"File: oclint.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: "UnCO" Lin <undercooled aT lavabit com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" The setting 'g:syntastic_oclint_config_file' allows you to define a file
" that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_oclint_config':
"
" let g:syntastic_oclint_config_file = '.config'
if exists("g:loaded_syntastic_objcpp_oclint_checker")
finish
endif
let g:loaded_syntastic_objcpp_oclint_checker = 1
function! SyntaxCheckers_objcpp_oclint_IsAvailable()
return SyntaxCheckers_c_oclint_IsAvailable()
endfunction
function! SyntaxCheckers_objcpp_oclint_GetLocList()
return SyntaxCheckers_c_oclint_GetLocList()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objcpp',
\ 'name': 'oclint'})
runtime! syntax_checkers/c/*.vim

View File

@ -0,0 +1,34 @@
"============================================================================
"File: ycm.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Val Markovic <val at markovic dot io>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_objcpp_ycm_checker")
finish
endif
let g:loaded_syntastic_objcpp_ycm_checker = 1
runtime! syntax_checkers/c/*.vim
function! SyntaxCheckers_objcpp_ycm_IsAvailable()
return SyntaxCheckers_c_ycm_IsAvailable()
endfunction
if !exists('g:loaded_youcompleteme')
finish
endif
function! SyntaxCheckers_objcpp_ycm_GetLocList()
return SyntaxCheckers_c_ycm_GetLocList()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'objcpp',
\ 'name': 'ycm'})

View File

@ -0,0 +1,149 @@
"============================================================================
"File: ocaml.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Török Edwin <edwintorok at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" The more reliable way to check for a single .ml file is to use ocamlc.
" You can do that setting this in your .vimrc:
"
" let g:syntastic_ocaml_use_ocamlc = 1
" It's possible to use ocamlc in conjuction with Jane Street's Core. In order
" to do that, you have to specify this in your .vimrc:
"
" let g:syntastic_ocaml_use_janestreet_core = 1
" let g:syntastic_ocaml_janestreet_core_dir = <path>
"
" Where path is the path to your core installation (usually a collection of
" .cmx and .cmxa files).
"
"
" By default the camlp4o preprocessor is used to check the syntax of .ml, and .mli files,
" ocamllex is used to check .mll files and menhir is used to check .mly files.
" The output is all redirected to /dev/null, nothing is written to the disk.
"
" If your source code needs camlp4r then you can define this in your .vimrc:
"
" let g:syntastic_ocaml_camlp4r = 1
"
" If you used some syntax extensions, or you want to also typecheck the source
" code, then you can define this:
"
" let g:syntastic_ocaml_use_ocamlbuild = 1
"
" This will run ocamlbuild <name>.inferred.mli, so it will write to your _build
" directory (and possibly rebuild your myocamlbuild.ml plugin), only enable this
" if you are ok with that.
"
" If you are using syntax extensions / external libraries and have a properly
" set up _tags (and myocamlbuild.ml file) then it should just work
" to enable this flag and get syntax / type checks through syntastic.
"
" For best results your current directory should be the project root
" (same situation if you want useful output from :make).
if exists("g:loaded_syntastic_ocaml_camlp4o_checker")
finish
endif
let g:loaded_syntastic_ocaml_camlp4o_checker=1
if exists('g:syntastic_ocaml_camlp4r') &&
\ g:syntastic_ocaml_camlp4r != 0
let s:ocamlpp="camlp4r"
else
let s:ocamlpp="camlp4o"
endif
function! SyntaxCheckers_ocaml_camlp4o_IsAvailable()
return executable(s:ocamlpp)
endfunction
if !exists('g:syntastic_ocaml_use_ocamlc') || !executable('ocamlc')
let g:syntastic_ocaml_use_ocamlc = 0
endif
if !exists('g:syntastic_ocaml_use_janestreet_core')
let g:syntastic_ocaml_use_ocamlc = 0
endif
if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable("ocamlbuild")
let g:syntastic_ocaml_use_ocamlbuild = 0
endif
function! SyntaxCheckers_ocaml_camlp4o_GetLocList()
let makeprg = s:GetMakeprg()
if makeprg == ""
return []
endif
let errorformat =
\ '%AFile "%f"\, line %l\, characters %c-%*\d:,'.
\ '%AFile "%f"\, line %l\, characters %c-%*\d (end at line %*\d\, character %*\d):,'.
\ '%AFile "%f"\, line %l\, character %c:,'.
\ '%AFile "%f"\, line %l\, character %c:%m,'.
\ '%-GPreprocessing error %.%#,'.
\ '%-GCommand exited %.%#,'.
\ '%C%tarning %n: %m,'.
\ '%C%m,'.
\ '%-G+%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
function s:GetMakeprg()
if g:syntastic_ocaml_use_ocamlc
return s:GetOcamlcMakeprg()
endif
if g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')
return s:GetOcamlBuildMakeprg()
endif
return s:GetOtherMakeprg()
endfunction
function s:GetOcamlcMakeprg()
if g:syntastic_ocaml_use_janestreet_core
let build_cmd = "ocamlc -I "
let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir)
let build_cmd .= " -c " . syntastic#util#shexpand('%')
return build_cmd
else
return "ocamlc -c " . syntastic#util#shexpand('%')
endif
endfunction
function s:GetOcamlBuildMakeprg()
return "ocamlbuild -quiet -no-log -tag annot," . s:ocamlpp . " -no-links -no-hygiene -no-sanitize " .
\ syntastic#util#shexpand('%:r') . ".cmi"
endfunction
function s:GetOtherMakeprg()
"TODO: give this function a better name?
"
"TODO: should use throw/catch instead of returning an empty makeprg
let extension = expand('%:e')
let makeprg = ""
if match(extension, 'mly') >= 0 && executable("menhir")
" ocamlyacc output can't be redirected, so use menhir
let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull()
elseif match(extension,'mll') >= 0 && executable("ocamllex")
let makeprg = "ocamllex -q " . syntastic#c#GetNullDevice() . " " . syntastic#util#shexpand('%')
else
let makeprg = "camlp4o " . syntastic#c#GetNullDevice() . " " . syntastic#util#shexpand('%')
endif
return makeprg
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'ocaml',
\ 'name': 'camlp4o'})

View File

@ -0,0 +1,186 @@
#!/usr/bin/env perl
# vimparse.pl - Reformats the error messages of the Perl interpreter for use
# with the quickfix mode of Vim
#
# Copyright (c) 2001 by Jörg Ziefle <joerg.ziefle@gmx.de>
# Copyright (c) 2012 Eric Harmon <http://eharmon.net>
# You may use and distribute this software under the same terms as Perl itself.
#
# Usage: put one of the two configurations below in your ~/.vimrc (without the
# description and '# ') and enjoy (be sure to adjust the paths to vimparse.pl
# before):
#
# Program is run interactively with 'perl -w':
#
# set makeprg=$HOME/bin/vimparse.pl\ %\ $*
# set errorformat=%t:%f:%l:%m
#
# Program is only compiled with 'perl -wc':
#
# set makeprg=$HOME/bin/vimparse.pl\ -c\ %\ $*
# set errorformat=%t:%f:%l:%m
#
# Usage:
# vimparse.pl [-c] [-w] [-f <errorfile>] <programfile> [programargs]
#
# -c compile only, don't run (perl -wc)
# -w output warnings as warnings instead of errors (slightly slower)
# -f write errors to <errorfile>
#
# Example usages:
# * From the command line:
# vimparse.pl program.pl
#
# vimparse.pl -c -w -f errorfile program.pl
# Then run vim -q errorfile to edit the errors with Vim.
# This uses the custom errorformat: %t:%f:%l:%m.
#
# * From Vim:
# Edit in Vim (and save, if you don't have autowrite on), then
# type ':mak' or ':mak args' (args being the program arguments)
# to error check.
#
# Version history:
# 0.3 (05/31/2012):
# * Added support for the seperate display of warnings
# * Switched output format to %t:%f:%l:%m to support error levels
# 0.2 (04/12/2001):
# * First public version (sent to Bram)
# * -c command line option for compiling only
# * grammatical fix: 'There was 1 error.'
# * bug fix for multiple arguments
# * more error checks
# * documentation (top of file, &usage)
# * minor code clean ups
# 0.1 (02/02/2001):
# * Initial version
# * Basic functionality
#
# Todo:
# * test on more systems
# * use portable way to determine the location of perl ('use Config')
# * include option that shows perldiag messages for each error
# * allow to pass in program by STDIN
# * more intuitive behaviour if no error is found (show message)
#
# Tested under SunOS 5.7 with Perl 5.6.0. Let me know if it's not working for
# you.
use warnings;
use strict;
use Getopt::Std;
use File::Temp qw( tempfile );
use vars qw/$opt_I $opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars'
use constant VERSION => 0.2;
getopts('cwf:hI:');
&usage if $opt_h; # not necessarily needed, but good for further extension
if (defined $opt_f) {
open FILE, "> $opt_f" or do {
warn "Couldn't open $opt_f: $!. Using STDOUT instead.\n";
undef $opt_f;
};
};
my $handle = (defined $opt_f ? \*FILE : \*STDOUT);
(my $file = shift) or &usage; # display usage if no filename is supplied
my $args = (@ARGV ? ' ' . join ' ', @ARGV : '');
if ($file eq '-') { # make STDIN seek-able, so it can be read twice
my $fh = tempfile();
print {$fh} <STDIN>;
open \*STDIN, '<&', $fh or die "open: $!";
seek \*STDIN, 0, 0 or die "seek: $!";
}
my $libs = join ' ', map {"-I$_"} split ',', $opt_I || '';
my @error_lines = `$^X $libs @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-Mwarnings ']} "$file$args" 2>&1`;
my @lines = map { "E:$_" } @error_lines;
my @warn_lines;
if(defined($opt_w)) {
if ($file eq '-') {
seek \*STDIN, 0, 0 or die "seek: $!";
}
@warn_lines = `$^X $libs @{[defined $opt_c ? '-c ' : '' ]} -Mwarnings "$file$args" 2>&1`;
}
# Any new errors must be warnings
foreach my $line (@warn_lines) {
if(!grep { $_ eq $line } @error_lines) {
push(@lines, "W:$line");
}
}
my $errors = 0;
foreach my $line (@lines) {
chomp($line);
my ($file, $lineno, $message, $rest, $severity);
if ($line =~ /^([EW]):(.*)\sat\s(.*)\sline\s(\d+)(.*)$/) {
($severity, $message, $file, $lineno, $rest) = ($1, $2, $3, $4, $5);
$errors++;
$message .= $rest if ($rest =~ s/^,//);
print $handle "$severity:$file:$lineno:$message\n";
} else { next };
}
if (defined $opt_f) {
my $msg;
if ($errors == 1) {
$msg = "There was 1 error.\n";
} else {
$msg = "There were $errors errors.\n";
};
print STDOUT $msg;
close FILE;
unlink $opt_f unless $errors;
};
sub usage {
(local $0 = $0) =~ s/^.*\/([^\/]+)$/$1/; # remove path from name of program
print<<EOT;
Usage:
$0 [-c] [-w] [-f <errorfile>] <programfile> [programargs]
-c compile only, don't run (executes 'perl -c')
-w output warnings as warnings instead of errors (slightly slower)
-f write errors to <errorfile>
-I specify \@INC/#include directory <perl_lib_path>
Examples:
* At the command line:
$0 program.pl
Displays output on STDOUT.
$0 -c -w -f errorfile program.pl
Then run 'vim -q errorfile' to edit the errors with Vim.
This uses the custom errorformat: %t:%f:%l:%m.
* In Vim:
Edit in Vim (and save, if you don't have autowrite on), then
type ':mak' or ':mak args' (args being the program arguments)
to error check.
EOT
exit 0;
};

View File

@ -0,0 +1,71 @@
"============================================================================
"File: perl.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Anthony Carapetis <anthony.carapetis at gmail dot com>,
" Eric Harmon <http://eharmon.net>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" In order to add some custom lib directories that should be added to the
" perl command line you can add those as a comma-separated list to the variable
" g:syntastic_perl_lib_path.
"
" let g:syntastic_perl_lib_path = './lib,./lib/auto'
"
" To use your own perl error output munger script, use the
" g:syntastic_perl_efm_program option. Any command line parameters should be
" included in the variable declaration. The program should expect a single
" parameter; the fully qualified filename of the file to be checked.
"
" let g:syntastic_perl_efm_program = "foo.pl -o -m -g"
"
if exists("g:loaded_syntastic_perl_perl_checker")
finish
endif
let g:loaded_syntastic_perl_perl_checker=1
if !exists("g:syntastic_perl_interpreter")
let g:syntastic_perl_interpreter = "perl"
endif
function! SyntaxCheckers_perl_perl_IsAvailable()
return executable(g:syntastic_perl_interpreter)
endfunction
if !exists("g:syntastic_perl_efm_program")
let g:syntastic_perl_efm_program =
\ g:syntastic_perl_interpreter . ' ' .
\ syntastic#util#shescape(expand('<sfile>:p:h') . '/efm_perl.pl') .
\ ' -c -w'
endif
function! SyntaxCheckers_perl_perl_GetLocList()
let makeprg = exists("b:syntastic_perl_efm_program") ? b:syntastic_perl_efm_program : g:syntastic_perl_efm_program
if exists("g:syntastic_perl_lib_path")
let makeprg .= ' -I' . g:syntastic_perl_lib_path
endif
let makeprg .= ' ' . syntastic#util#shexpand('%') . s:ExtraMakeprgArgs()
let errorformat = '%t:%f:%l:%m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
function! s:ExtraMakeprgArgs()
let shebang = syntastic#util#parseShebang()
if index(shebang['args'], '-T') != -1
return ' -Tc'
endif
return ''
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'perl',
\ 'name': 'perl'})

View File

@ -0,0 +1,65 @@
"============================================================================
"File: perlcritic.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" For details about perlcritic see:
"
" - http://perlcritic.tigris.org/
" - https://metacpan.org/module/Perl::Critic
"
" Checker options:
"
" - g:syntastic_perl_perlcritic_thres (integer; default: 5)
" error threshold: policy violations with a severity above this
" value are highlighted as errors, the others are warnings
"
" - g:syntastic_perl_perlcritic_args (string; default: empty)
" command line options to pass to perlcritic
if exists("g:loaded_syntastic_perl_perlcritic_checker")
finish
endif
let g:loaded_syntastic_perl_perlcritic_checker=1
if !exists('g:syntastic_perl_perlcritic_thres')
let g:syntastic_perl_perlcritic_thres = 5
endif
function! SyntaxCheckers_perl_perlcritic_IsAvailable()
return executable('perlcritic')
endfunction
function! SyntaxCheckers_perl_perlcritic_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'perlcritic',
\ 'post_args': '--quiet --nocolor --verbose "\%s:\%f:\%l:\%c:(\%s) \%m (\%e)\n"',
\ 'filetype': 'perl',
\ 'subchecker': 'perlcritic' })
let errorformat = '%t:%f:%l:%c:%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 2],
\ 'subtype': 'Style' })
" change error types according to the prescribed threshold
for n in range(len(loclist))
let loclist[n]['type'] = loclist[n]['type'] < g:syntastic_perl_perlcritic_thres ? 'W' : 'E'
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'perl',
\ 'name': 'perlcritic'})

View File

@ -0,0 +1,30 @@
"============================================================================
"File: podchecker.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_perl_podchecker_checker")
finish
endif
let g:loaded_syntastic_perl_podchecker_checker=1
function! SyntaxCheckers_perl_podchecker_IsAvailable()
return SyntaxCheckers_pod_podchecker_IsAvailable()
endfunction
function! SyntaxCheckers_perl_podchecker_GetLocList()
return SyntaxCheckers_pod_podchecker_GetLocList()
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'perl',
\ 'name': 'podchecker'})
runtime! syntax_checkers/pod/*.vim

View File

@ -0,0 +1,52 @@
"============================================================================
"File: php.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_php_php_checker")
finish
endif
let g:loaded_syntastic_php_php_checker=1
function! SyntaxCheckers_php_php_IsAvailable()
return executable("php")
endfunction
function! SyntaxCheckers_php_php_GetHighlightRegex(item)
let unexpected = matchstr(a:item['text'], "unexpected '[^']\\+'")
if len(unexpected) < 1
return ''
endif
return '\V'.split(unexpected, "'")[1]
endfunction
function! SyntaxCheckers_php_php_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'php',
\ 'args': '-l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0',
\ 'filetype': 'php',
\ 'subchecker': 'php' })
let errorformat =
\ '%-GNo syntax errors detected in%.%#,'.
\ 'Parse error: %#syntax %trror\, %m in %f on line %l,'.
\ 'Parse %trror: %m in %f on line %l,'.
\ 'Fatal %trror: %m in %f on line %l,'.
\ '%-G\s%#,'.
\ '%-GErrors parsing %.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'php',
\ 'name': 'php'})

View File

@ -0,0 +1,44 @@
"============================================================================
"File: phpcs.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
"
" See here for details of phpcs
" - phpcs (see http://pear.php.net/package/PHP_CodeSniffer)
"
if exists("g:loaded_syntastic_php_phpcs_checker")
finish
endif
let g:loaded_syntastic_php_phpcs_checker=1
function! SyntaxCheckers_php_phpcs_IsAvailable()
return executable('phpcs')
endfunction
function! SyntaxCheckers_php_phpcs_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': 'phpcs',
\ 'args': '--report=csv',
\ 'filetype': 'php',
\ 'subchecker': 'phpcs' })
let errorformat =
\ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'.
\ '"%f"\,%l\,%c\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'php',
\ 'name': 'phpcs'})

Some files were not shown because too many files have changed in this diff Show More