1
0
Fork 0
mirror of synced 2024-11-22 16:55:34 -05:00

Updated plugins

This commit is contained in:
amix 2016-06-26 13:12:36 +02:00
parent 0228ad0e9e
commit 0cb4702c1e
74 changed files with 10264 additions and 3014 deletions

View file

@ -1,3 +1,7 @@
if exists('g:autoloaded_ack') || &cp
finish
endif
if exists('g:ack_use_dispatch') if exists('g:ack_use_dispatch')
if g:ack_use_dispatch && !exists(':Dispatch') if g:ack_use_dispatch && !exists(':Dispatch')
call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.') call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.')
@ -238,4 +242,5 @@ function! s:Warn(msg) "{{{
echohl WarningMsg | echomsg 'Ack: ' . a:msg | echohl None echohl WarningMsg | echomsg 'Ack: ' . a:msg | echohl None
endf "}}} endf "}}}
let g:autoloaded_ack = 1
" vim:set et sw=2 ts=2 tw=78 fdm=marker " vim:set et sw=2 ts=2 tw=78 fdm=marker

View file

@ -4,6 +4,10 @@
Author: Antoine Imbert <antoine.imbert+ackvim@gmail.com> *ack-author* Author: Antoine Imbert <antoine.imbert+ackvim@gmail.com> *ack-author*
License: Same terms as Vim itself (see |license|) License: Same terms as Vim itself (see |license|)
This plugin is only available if 'compatible' is not set.
{Vi does not have any of this}
============================================================================== ==============================================================================
INTRODUCTION *ack* INTRODUCTION *ack*
@ -16,7 +20,7 @@ shows the results in a split window.
Search recursively in {directory} (which defaults to the current Search recursively in {directory} (which defaults to the current
directory) for the {pattern}. Behaves just like the |:grep| command, but directory) for the {pattern}. Behaves just like the |:grep| command, but
will open the |Quickfix| window for you. If [!] is not given the first will open the |Quickfix| window for you. If [!] is not given the first
occurence is jumped to. occurrence is jumped to.
:AckAdd [options] {pattern} [{directory}] *:AckAdd* :AckAdd [options] {pattern} [{directory}] *:AckAdd*
@ -90,7 +94,6 @@ Example:
> >
let g:ackprg = "ag --vimgrep" let g:ackprg = "ag --vimgrep"
< <
*g:ack_default_options* *g:ack_default_options*
g:ack_default_options g:ack_default_options
Default: " -s -H --nocolor --nogroup --column" Default: " -s -H --nocolor --nogroup --column"
@ -107,18 +110,17 @@ Example:
let g:ack_default_options = let g:ack_default_options =
\ " -s -H --nocolor --nogroup --column --smart-case --follow" \ " -s -H --nocolor --nogroup --column --smart-case --follow"
< <
*g:ack_apply_qmappings* *g:ack_apply_qmappings*
g:ack_apply_qmappings g:ack_apply_qmappings
Default: 1 Default: 1
This option enable mappings on quickview window. This option enables mappings on the |quickfix| window.
*g:ack_apply_lmappings* *g:ack_apply_lmappings*
g:ack_apply_lmappings g:ack_apply_lmappings
Default: 1 Default: 1
This option enable mappings on Location list window. This option enables mappings on |location-list| windows.
*g:ack_mappings* *g:ack_mappings*
g:ack_mappings g:ack_mappings
@ -139,7 +141,6 @@ Example, if you want to open the result in the middle of the screen:
> >
let g:ack_mappings = { "o": "<CR>zz" } let g:ack_mappings = { "o": "<CR>zz" }
< <
*g:ack_qhandler* *g:ack_qhandler*
g:ack_qhandler g:ack_qhandler
Default: "botright copen" Default: "botright copen"
@ -150,7 +151,6 @@ If you want to open a quickview window with 30 lines you can do:
> >
let g:ack_qhandler = "botright copen 30" let g:ack_qhandler = "botright copen 30"
< <
*g:ack_lhandler* *g:ack_lhandler*
g:ack_lhandler g:ack_lhandler
Default: "botright lopen" Default: "botright lopen"
@ -161,9 +161,7 @@ If you want to open a Location list window with 30 lines you can do:
> >
let g:ack_lhandler = "botright lopen 30" let g:ack_lhandler = "botright lopen 30"
< <
*g:ackhighlight* *g:ackhighlight*
g:ackhighlight g:ackhighlight
Default: 0 Default: 0
@ -173,7 +171,6 @@ Example:
> >
let g:ackhighlight = 1 let g:ackhighlight = 1
< <
*g:ack_autoclose* *g:ack_autoclose*
g:ack_autoclose g:ack_autoclose
Default: 0 Default: 0
@ -185,9 +182,7 @@ Example:
> >
let g:ack_autoclose = 1 let g:ack_autoclose = 1
< <
*g:ack_autofold_results* *g:ack_autofold_results*
g:ack_autofold_results g:ack_autofold_results
Default: 0 Default: 0
@ -200,9 +195,7 @@ Example:
> >
let g:ack_autofold_results = 1 let g:ack_autofold_results = 1
< <
*g:ackpreview* *g:ackpreview*
g:ackpreview g:ackpreview
Default: 0 Default: 0
@ -212,9 +205,7 @@ Example:
> >
let g:ackpreview = 1 let g:ackpreview = 1
< <
*g:ack_use_dispatch* *g:ack_use_dispatch*
g:ack_use_dispatch g:ack_use_dispatch
Default: 0 Default: 0
@ -229,9 +220,7 @@ Example:
> >
let g:ack_use_dispatch = 1 let g:ack_use_dispatch = 1
< <
*g:ack_use_cword_for_empty_search* *g:ack_use_cword_for_empty_search*
g:ack_use_cword_for_empty_search g:ack_use_cword_for_empty_search
Default: 1 Default: 1
@ -239,34 +228,76 @@ Use this option to enable blank searches to run against the word under the
cursor. When this option is not set, blank searches will only output an error cursor. When this option is not set, blank searches will only output an error
message. message.
Example: Example:
> >
let g:ack_use_cword_for_empty_search = 0 let g:ack_use_cword_for_empty_search = 0
< <
============================================================================== ==============================================================================
MAPPINGS *ack-mappings* MAPPINGS *ack-mappings*
The following keyboard shortcuts are available in the quickfix window: The following keyboard shortcuts are available in the |quickfix| and
|location-list| windows:
o open file (same as enter). ? display a quick summary of these mappings.
O open file and close quickfix window. o open file (same as Enter).
O open file and close the quickfix window.
go preview file (open but maintain focus on ack.vim results). go preview file (open but maintain focus on ack.vim results).
t open in a new tab. t open in a new tab.
T open in new tab silently. T open in new tab without moving to it.
h open in horizontal split. h open in horizontal split.
H open in horizontal split silently. H open in horizontal split, keeping focus on the results.
v open in vertical split. v open in vertical split.
gv open in vertical split silently. gv open in vertical split, keeping focus on the results.
q close the quickfix window. q close the quickfix window.
To adjust these, see |g:ack_mappings|.
==============================================================================
Ignoring files *ack-ignore*
If you're using this plugin with ag, The Silver Searcher, bear in mind that:
- It ignores file patterns from your .gitignore and .hgignore.
- If there are other files in your source repository you don't wish to
search, you can add their patterns to an .agignore file.
==============================================================================
ISSUES AND FAQ *ack-issues-and-faq*
I use NERDTree and opening ack.vim results in a vertical split displaces it.~
You are probably using NERDTree with its default alignment at the left
side of the window. Set these custom mappings in your vimrc to work around
this:
>
let g:ack_mappings = {
\ 'v': '<C-W><CR><C-W>L<C-W>p<C-W>J<C-W>p',
\ 'gv': '<C-W><CR><C-W>L<C-W>p<C-W>J' }
<
This solution will be improved in the future.
Results show a mix of relative and absolute paths, making them hard to read.~
This is a quirk of Vim that can happen with plain |:vimgrep| too. You can
try this in your vimrc to work around it:
>
autocmd BufAdd * exe "cd" fnameescape(getcwd())
<
but for some users this may be disruptive to their Vim workflow. For more
details, see:
http://vi.stackexchange.com/a/4816/7174
https://github.com/mileszs/ack.vim/issues/143
vim:set et sw=4 ts=4 tw=78:

View file

@ -1,4 +1,4 @@
if exists('g:loaded_ack') if exists('g:loaded_ack') || &cp
finish finish
endif endif

View file

@ -1,5 +1,7 @@
# ag.vim # # ag.vim #
## Deprecated: See [this comment](https://github.com/rking/ag.vim/issues/124#issuecomment-227038003) for more info. Maybe try [ack.vim](https://github.com/mileszs/ack.vim#can-i-use-ag-the-silver-searcher-with-this) as an alternative. ##
This plugin is a front for ag, A.K.A. This plugin is a front for ag, A.K.A.
[the_silver_searcher](https://github.com/ggreer/the_silver_searcher). Ag can [the_silver_searcher](https://github.com/ggreer/the_silver_searcher). Ag can
be used as a replacement for 153% of the uses of `ack`. This plugin will allow be used as a replacement for 153% of the uses of `ack`. This plugin will allow

View file

@ -93,6 +93,7 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] =
\ 'open_single_match': ['s:opensingle', []], \ 'open_single_match': ['s:opensingle', []],
\ 'brief_prompt': ['s:brfprt', 0], \ 'brief_prompt': ['s:brfprt', 0],
\ 'match_current_file': ['s:matchcrfile', 0], \ 'match_current_file': ['s:matchcrfile', 0],
\ 'match_natural_name': ['s:matchnatural', 0],
\ 'compare_lim': ['s:compare_lim', 3000], \ 'compare_lim': ['s:compare_lim', 3000],
\ 'bufname_mod': ['s:bufname_mod', ':t'], \ 'bufname_mod': ['s:bufname_mod', ':t'],
\ 'bufpath_mod': ['s:bufpath_mod', ':~:.:h'], \ 'bufpath_mod': ['s:bufpath_mod', ':~:.:h'],
@ -425,7 +426,7 @@ fu! s:UserCmd(lscmd)
let do_ign = let do_ign =
\ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore'] \ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore']
if do_ign && ctrlp#igncwd(s:cwd) | retu | en if do_ign && ctrlp#igncwd(s:cwd) | retu | en
if exists('+ssl') && &ssl if exists('+ssl') && &ssl && &shell !~ 'sh'
let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')]
en en
if (has('win32') || has('win64')) && match(&shellcmdflag, "/") != -1 if (has('win32') || has('win64')) && match(&shellcmdflag, "/") != -1
@ -653,9 +654,9 @@ fu! s:Update(str)
endf endf
fu! s:ForceUpdate() fu! s:ForceUpdate()
let wv = winsaveview() let pos = exists('*getcurpos') ? getcurpos() : getpos('.')
sil! cal s:Update(escape(s:getinput(), '\')) sil! cal s:Update(escape(s:getinput(), '\'))
cal winrestview(wv) cal setpos('.', pos)
endf endf
fu! s:BuildPrompt(upd) fu! s:BuildPrompt(upd)
@ -839,9 +840,9 @@ fu! s:PrtSelectMove(dir)
let wht = winheight(0) let wht = winheight(0)
let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'} let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'}
exe 'keepj norm!' dirs[a:dir] exe 'keepj norm!' dirs[a:dir]
let wv = winsaveview() let pos = exists('*getcurpos') ? getcurpos() : getpos('.')
cal s:BuildPrompt(0) cal s:BuildPrompt(0)
cal winrestview(wv) cal setpos('.', pos)
endf endf
fu! s:PrtSelectJump(char) fu! s:PrtSelectJump(char)
@ -864,9 +865,9 @@ fu! s:PrtSelectJump(char)
let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]] let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]]
en en
exe 'keepj norm!' ( jmpln + 1 ).'G' exe 'keepj norm!' ( jmpln + 1 ).'G'
let wv = winsaveview() let pos = exists('*getcurpos') ? getcurpos() : getpos('.')
cal s:BuildPrompt(0) cal s:BuildPrompt(0)
cal winrestview(wv) cal setpos('.', pos)
en en
endf endf
" Misc {{{2 " Misc {{{2
@ -907,6 +908,7 @@ fu! s:PrtDeleteMRU()
endf endf
fu! s:PrtExit() fu! s:PrtExit()
exe bufwinnr(s:bufnr).'winc w'
if bufnr('%') == s:bufnr && bufname('%') == 'ControlP' if bufnr('%') == s:bufnr && bufname('%') == 'ControlP'
noa cal s:Close(1) noa cal s:Close(1)
noa winc p noa winc p
@ -1822,7 +1824,7 @@ fu! s:highlight(pat, grp)
" occurrence of our letters. We also ensure that our matcher is case " occurrence of our letters. We also ensure that our matcher is case
" insensitive or sensitive depending. " insensitive or sensitive depending.
cal matchadd(a:grp, beginning.middle.ending) cal matchadd(a:grp, beginning.middle.ending)
endfor endfo
en en
cal matchadd('CtrlPLinePre', '^>') cal matchadd('CtrlPLinePre', '^>')
@ -2346,9 +2348,16 @@ endf
fu! s:buildpat(lst) fu! s:buildpat(lst)
let pat = a:lst[0] let pat = a:lst[0]
if s:matchnatural == 1
for item in range(1, len(a:lst) - 1)
let c = a:lst[item - 1]
let pat .= (c == '/' ? '[^/]\{-}' : '[^'.c.'/]\{-}').a:lst[item]
endfo
else
for item in range(1, len(a:lst) - 1) for item in range(1, len(a:lst) - 1)
let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item] let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item]
endfo endfo
en
retu pat retu pat
endf endf

View file

@ -2,7 +2,7 @@
" Filename: autoload/lightline.vim " Filename: autoload/lightline.vim
" Author: itchyny " Author: itchyny
" License: MIT License " License: MIT License
" Last Change: 2016/06/11 14:05:27. " Last Change: 2016/06/12 22:40:00.
" ============================================================================= " =============================================================================
let s:save_cpo = &cpo let s:save_cpo = &cpo

View file

@ -187,17 +187,17 @@ endfunction
" closes the parent dir of the current node " closes the parent dir of the current node
function! s:closeCurrentDir(node) function! s:closeCurrentDir(node)
let parent = a:node.parent let parent = a:node.parent
if parent ==# {} || parent.isRoot() while g:NERDTreeCascadeOpenSingleChildDir && !parent.isRoot()
call nerdtree#echo("cannot close tree root") let childNodes = parent.getVisibleChildren()
else if len(childNodes) == 1 && childNodes[0].path.isDirectory
while g:NERDTreeCascadeOpenSingleChildDir && !parent.parent.isRoot()
if parent.parent.getVisibleChildCount() == 1
call parent.close()
let parent = parent.parent let parent = parent.parent
else else
break break
endif endif
endwhile endwhile
if parent ==# {} || parent.isRoot()
call nerdtree#echo("cannot close tree root")
else
call parent.close() call parent.close()
call b:NERDTree.render() call b:NERDTree.render()
call parent.putCursorHere(0, 0) call parent.putCursorHere(0, 0)

View file

@ -11,7 +11,7 @@
## 1. Bug reports / GitHub issues ## 1. Bug reports / GitHub issues
Please note that the preferred channel for posting bug reports is the Please note that the preferred channel for posting bug reports is the
[issue tracker at GitHub][0]. Reports posted elsewhere are less likely [issue tracker at GitHub][bug_tracker]. Reports posted elsewhere are less likely
to be seen by the core team. to be seen by the core team.
When reporting a bug make sure you search the existing GitHub issues When reporting a bug make sure you search the existing GitHub issues
@ -39,14 +39,14 @@ too:
## 2. Submitting a patch ## 2. Submitting a patch
Before you consider adding features to syntastic, _please_ spend a few minutes Before you consider adding features to syntastic, _please_ spend a few minutes
(re-)reading the latest version of the [manual][1]. Syntastic is changing (re-)reading the latest version of the [manual][manual]. Syntastic is changing
rapidly at times, and it's possible that some features you want to add exist rapidly at times, and it's possible that some features you want to add exist
already. already.
To submit a patch: To submit a patch:
* fork the [repo][2] on GitHub; * fork the [repo][github] on GitHub;
* make a [topic branch][3] and start hacking; * make a [topic branch][branches] and start hacking;
* submit a pull request based off your topic branch. * submit a pull request based off your topic branch.
Small, focused patches are preferred. Small, focused patches are preferred.
@ -69,14 +69,14 @@ Follow the coding conventions/styles used in the syntastic core:
* don't use `l:` prefixes for variables unless actually required (i.e. * don't use `l:` prefixes for variables unless actually required (i.e.
almost never); almost never);
* code for maintainability; we would rather a function be a couple of * code for maintainability; we would rather a function be a couple of
lines longer and have (for example) some [explaining variables][4] to lines longer and have (for example) some [explaining variables][variables] to
aid readability. aid readability.
<a name="checkerstyle"></a> <a name="checkerstyle"></a>
## 4. Syntax checker notes ## 4. Syntax checker notes
Make sure to read the [guide][5] if you plan to add new syntax checkers. Make sure to read the [guide][guide] if you plan to add new syntax checkers.
Use the existing checkers as templates, rather than writing everything Use the existing checkers as templates, rather than writing everything
from scratch. from scratch.
@ -97,9 +97,9 @@ let errorformat =
\ '%-G%.%#' \ '%-G%.%#'
``` ```
[0]: https://github.com/scrooloose/syntastic/issues [bug_tracker]: https://github.com/scrooloose/syntastic/issues
[1]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt [manual]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt
[2]: https://github.com/scrooloose/syntastic [github]: https://github.com/scrooloose/syntastic
[3]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches [branches]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches
[4]: http://www.refactoring.com/catalog/extractVariable.html [variables]: http://www.refactoring.com/catalog/extractVariable.html
[5]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide [guide]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide

View file

@ -46,37 +46,38 @@
## 1\. Introduction ## 1\. Introduction
Syntastic is a syntax checking plugin for [Vim][13] that runs files through Syntastic is a syntax checking plugin for [Vim][vim] that runs files through
external syntax checkers and displays any resulting errors to the user. This 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 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 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. compile their code or execute their script to find them.
At the time of this writing, syntastic has checking plugins for ActionScript, At the time of this writing, syntastic has checking plugins for ActionScript,
Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, ASM, Ada, Ansible configurations, API Blueprint, AppleScript, AsciiDoc, Assembly
BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco, languages, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript,
Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dockerfile, Dust, Elixir,
Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe,
Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP,
LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix,
Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
Object, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML, Object, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python,
R, Racket, RDF TriG, RDF Turtle, Relax NG, reStructuredText, RPM spec, Ruby, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG, reStructuredText, RPM spec,
SASS/SCSS, Scala, Slim, SML, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, Ruby, SASS/SCSS, Scala, Slim, SML, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo,
TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, XQuery,
YANG data models, z80, Zope page templates, and zsh. See the [wiki][3] for YACC, YAML, YANG data models, z80, Zope page templates, and Zsh. See the
details about the corresponding supported checkers. [manual][checkers] for details about the corresponding supported checkers
(`:help syntastic-checkers` in Vim).
A number of third-party Vim plugins also provide checkers for syntastic, A number of third-party Vim plugins also provide checkers for syntastic,
for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12], for example: [merlin][merlin], [omnisharp-vim][omnisharp], [rust.vim][rust],
[syntastic-extras][26], [syntastic-more][27], [vim-crystal][29], [syntastic-extras][myint], [syntastic-more][roktas], [vim-crystal][crystal],
[vim-eastwood][28], and [vim-swift][24]. [vim-eastwood][eastwood], and [vim-swift][swift].
Below is a screenshot showing the methods that Syntastic uses to display syntax 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 errors. Note that, in practise, you will only have a subset of these methods
enabled. enabled.
![Screenshot 1][0] ![Screenshot 1][screenshot]
1. Errors are loaded into the location list for the corresponding window. 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. 2. When the cursor is on a line containing an error, the error message is echoed in the command window.
@ -94,7 +95,7 @@ enabled.
### 2.1\. Requirements ### 2.1\. Requirements
Syntastic itself has rather relaxed requirements: it doesn't have any external Syntastic itself has rather relaxed requirements: it doesn't have any external
dependencies, and it needs a version of [Vim][13] compiled with a few common dependencies, and it needs a version of [Vim][vim] compiled with a few common
features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`, features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`,
`reltime`, and `user_commands`. Not all possible combinations of features that `reltime`, and `user_commands`. Not all possible combinations of features that
include the ones above make equal sense on all operating systems, but Vim include the ones above make equal sense on all operating systems, but Vim
@ -102,8 +103,8 @@ version 7 or later with the "normal", "big", or "huge" feature sets should be
fine. fine.
Syntastic should work with any modern plugin managers for Vim, such as Syntastic should work with any modern plugin managers for Vim, such as
[NeoBundle][14], [Pathogen][1], [Vim-Addon-Manager][15], [Vim-Plug][16], or [NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam], [Vim-Plug][plug], or
[Vundle][17]. Instructions for installing syntastic with [Pathogen][1] are [Vundle][vundle]. Instructions for installing syntastic with [Pathogen][pathogen] are
included below for completeness. included below for completeness.
Starting with Vim version 7.4.1486 you can also load syntastic using the Starting with Vim version 7.4.1486 you can also load syntastic using the
@ -115,20 +116,21 @@ syntastic is present only in versions 7.4.1486 and later.
Last but not least: syntastic doesn't know how to do any syntax checks by Last but not least: syntastic doesn't know how to do any syntax checks by
itself. In order to get meaningful results you need to install external itself. In order to get meaningful results you need to install external
checkers corresponding to the types of files you use. Please consult the checkers corresponding to the types of files you use. Please consult the
[wiki][3] for a list of supported checkers. [manual][checkers] (`:help syntastic-checkers` in Vim) for a list of supported
checkers.
<a name="installpathogen"></a> <a name="installpathogen"></a>
### 2.2\. Installing syntastic with Pathogen ### 2.2\. Installing syntastic with Pathogen
If you already have [Pathogen][1] working then skip [Step 1](#step1) and go to If you already have [Pathogen][pathogen] working then skip [Step 1](#step1) and go to
[Step 2](#step2). [Step 2](#step2).
<a name="step1"></a> <a name="step1"></a>
#### 2.2.1\. Step 1: Install pathogen.vim #### 2.2.1\. Step 1: Install pathogen.vim
First I'll show you how to install Tim Pope's [Pathogen][1] so that it's easy to First I'll show you how to install Tim Pope's [Pathogen][pathogen] so that it's easy to
install syntastic. Do this in your terminal so that you get the `pathogen.vim` install syntastic. Do this in your terminal so that you get the `pathogen.vim`
file and the directories it needs: file and the directories it needs:
```sh ```sh
@ -155,7 +157,7 @@ Quit vim and start it back up to reload it, then type:
:Helptags :Helptags
``` ```
If you get an error when you do this, then you probably didn't install If you get an error when you do this, then you probably didn't install
[Pathogen][1] right. Go back to [Step 1](#step1) and make sure you did the [Pathogen][pathogen] right. Go back to [Step 1](#step1) and make sure you did the
following: following:
1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories. 1. Created both the `~/.vim/autoload` and `~/.vim/bundle` directories.
@ -192,10 +194,11 @@ __4.1. 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 A. The most likely reason is that none of the syntax checkers that it requires
are installed. For example: by default, python requires either `flake8` or are installed. For example: by default, python requires either `flake8` or
`pylint` to be installed and in your `$PATH`. To see which executables are `pylint` to be installed and in your `$PATH`. Read the [manual][checkers]
supported, look at the [wiki][3]. Note that aliases do not work; the actual (`:help syntastic-checkers` in Vim) to find out what executables are
executables must be available in your `$PATH`. Symbolic links are okay though. supported. Note that aliases do not work; the actual executables must be
You can see syntastic's idea of available checkers by running `:SyntasticInfo`. available in your `$PATH`. Symbolic links are okay though. You can see
syntastic's idea of available checkers by running `:SyntasticInfo`.
A second probable reason is that none of the available checkers are A second probable reason is that none of the available checkers are
enabled. Syntastic comes preconfigured with a default list of enabled checkers enabled. Syntastic comes preconfigured with a default list of enabled checkers
@ -222,7 +225,7 @@ on Windows.
Finally, another reason it could fail is that either the command line options Finally, 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 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 sure you have the latest version of the syntax checker installed. If it still
fails then post an [issue][4] - or better yet, create a pull request. fails then post an [issue][bug_tracker] - or better yet, create a pull request.
<a name="faqpython3"></a> <a name="faqpython3"></a>
@ -238,18 +241,18 @@ let g:syntastic_python_python_exec = '/path/to/python3'
__4.3. Q. Are there any local checkers for HTML5 that I can use with syntastic?__ __4.3. Q. Are there any local checkers for HTML5 that I can use with syntastic?__
[HTML Tidy][18] has a fork named [HTML Tidy for HTML5][19]. It's a drop [HTML Tidy][tidy_old] has a fork named [HTML Tidy for HTML5][tidy]. It's a drop
in replacement, and syntastic can use it without changes. Just install it in replacement, and syntastic can use it without changes. Just install it
somewhere and point `g:syntastic_html_tidy_exec` to its executable: somewhere and point `g:syntastic_html_tidy_exec` to its executable:
```vim ```vim
let g:syntastic_html_tidy_exec = 'tidy5' let g:syntastic_html_tidy_exec = 'tidy5'
``` ```
Alternatively, you can install [vnu.jar][21] from the [validator.nu][20] Alternatively, you can install [vnu.jar][vnu_jar] from the [validator.nu][vnu]
project and run it as a [HTTP server][23]: project and run it as a [HTTP server][vnu_server]:
```sh ```sh
$ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888 $ java -Xss512k -cp /path/to/vnu.jar nu.validator.servlet.Main 8888
``` ```
Then you can [configure][22] syntastic to use it: Then you can configure syntastic to use it:
```vim ```vim
let g:syntastic_html_validator_api = 'http://localhost:8888/' let g:syntastic_html_validator_api = 'http://localhost:8888/'
``` ```
@ -260,7 +263,7 @@ __4.4. Q. The `perl` checker has stopped working...__
A. The `perl` checker runs `perl -c` against your file, which in turn A. The `perl` checker runs `perl -c` against your file, which in turn
__executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use` __executes__ any `BEGIN`, `UNITCHECK`, and `CHECK` blocks, and any `use`
statements in your file (cf. [perlrun][10]). This is probably fine if you statements in your file (cf. [perlrun][perlrun]). This is probably fine if you
wrote the file yourself, but it's a security problem if you're checking wrote the file yourself, but it's a security problem if you're checking
third-party files. Since there is currently no way to disable this behaviour third-party files. Since there is currently no way to disable this behaviour
while still producing useful results, the checker is now disabled by default. while still producing useful results, the checker is now disabled by default.
@ -274,7 +277,7 @@ let g:syntastic_enable_perl_checker = 1
__4.5. Q. What happened to the `rustc` checker?__ __4.5. Q. What happened to the `rustc` checker?__
A. It is now part of the [rust.vim][12] plugin. If you install this plugin the A. It is now part of the [rust.vim][rust] plugin. If you install this plugin the
checker should be picked up automatically by syntastic. checker should be picked up automatically by syntastic.
<a name="faqxcrun"></a> <a name="faqxcrun"></a>
@ -282,7 +285,7 @@ checker should be picked up automatically by syntastic.
__4.6. Q. What happened to the `xcrun` checker?__ __4.6. Q. What happened to the `xcrun` checker?__
A. The `xcrun` checker used to have a security problem and it has been removed. A. The `xcrun` checker used to have a security problem and it has been removed.
A better checker for __Swift__ is part of the [vim-swift][24] plugin. If you A better checker for __Swift__ is part of the [vim-swift][swift] plugin. If you
install this plugin the checker should be picked up automatically by syntastic. install this plugin the checker should be picked up automatically by syntastic.
<a name="faqloclist"></a> <a name="faqloclist"></a>
@ -324,8 +327,8 @@ A. Stick a line like this in your `vimrc`:
let g:syntastic_<filetype>_checkers = ['<checker-name>'] let g:syntastic_<filetype>_checkers = ['<checker-name>']
``` ```
To see the list of supported checkers for your filetype look at the To see the list of supported checkers for your filetype read the
[wiki][3]. [manual][checkers] (`:help syntastic-checkers` in Vim).
e.g. Python has the following checkers, among others: `flake8`, `pyflakes`, e.g. Python has the following checkers, among others: `flake8`, `pyflakes`,
`pylint` and a native `python` checker. `pylint` and a native `python` checker.
@ -406,7 +409,7 @@ A. Vim provides several built-in commands for this. See `:help :lnext` and
`:help :lprevious`. `:help :lprevious`.
If you use these commands a lot then you may want to add shortcut mappings to If you use these commands a lot then you may want to add shortcut mappings to
your `vimrc`, or install something like [unimpaired][2], which provides such your `vimrc`, or install something like [unimpaired][unimpaired], which provides such
mappings (among other things). mappings (among other things).
<a name="faqbdelete"></a> <a name="faqbdelete"></a>
@ -427,50 +430,50 @@ cabbrev <silent> bd <C-r>=(getcmdtype()==#':' && getcmdpos()==1 ? 'lclose\|bdele
## 5\. Resources ## 5\. Resources
The preferred place for posting suggestions, reporting bugs, and general The preferred place for posting suggestions, reporting bugs, and general
discussions related to syntastic is the [issue tracker at GitHub][4]. discussions related to syntastic is the [issue tracker at GitHub][bug_tracker].
A guide for writing syntax checkers can be found in the [wiki][11]. A guide for writing syntax checkers can be found in the [wiki][guide].
There are also a dedicated [google group][5], and a There are also a dedicated [google group][google_group], and a
[syntastic tag at StackOverflow][6]. [syntastic tag at StackOverflow][stack_overflow].
Syntastic aims to provide a common interface to syntax checkers for as many Syntastic aims to provide a common interface to syntax checkers for as many
languages as possible. For particular languages, there are, of course, other languages as possible. For particular languages, there are, of course, other
plugins that provide more functionality than syntastic. You might want to take plugins that provide more functionality than syntastic. You might want to take
a look at [ghcmod-vim][31], [jedi-vim][7], [python-mode][8], [vim-go][32], or a look at [ghcmod-vim][ghcmod], [jedi-vim][jedi], [python-mode][python_mode], [vim-go][vimgo], or
[YouCompleteMe][9]. [YouCompleteMe][ycm].
[0]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png [screenshot]: https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png
[1]: https://github.com/tpope/vim-pathogen
[2]: https://github.com/tpope/vim-unimpaired [bug_tracker]: https://github.com/scrooloose/syntastic/issues
[3]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers [checkers]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic-checkers.txt
[4]: https://github.com/scrooloose/syntastic/issues [crystal]: https://github.com/rhysd/vim-crystal
[5]: https://groups.google.com/group/vim-syntastic [eastwood]: https://github.com/venantius/vim-eastwood
[6]: http://stackoverflow.com/questions/tagged/syntastic [ghcmod]: https://github.com/eagletmt/ghcmod-vim
[7]: https://github.com/davidhalter/jedi-vim [google_group]: https://groups.google.com/group/vim-syntastic
[8]: https://github.com/klen/python-mode [guide]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
[9]: http://valloric.github.io/YouCompleteMe/ [jedi]: https://github.com/davidhalter/jedi-vim
[10]: http://perldoc.perl.org/perlrun.html#*-c* [merlin]: https://github.com/the-lambda-church/merlin
[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide [myint]: https://github.com/myint/syntastic-extras
[12]: https://github.com/rust-lang/rust.vim [neobundle]: https://github.com/Shougo/neobundle.vim
[13]: http://www.vim.org/ [omnisharp]: https://github.com/OmniSharp/omnisharp-vim
[14]: https://github.com/Shougo/neobundle.vim [pathogen]: https://github.com/tpope/vim-pathogen
[15]: https://github.com/MarcWeber/vim-addon-manager [perlrun]: http://perldoc.perl.org/perlrun.html#*-c*
[16]: https://github.com/junegunn/vim-plug/ [plug]: https://github.com/junegunn/vim-plug/
[17]: https://github.com/gmarik/Vundle.vim [python_mode]: https://github.com/klen/python-mode
[18]: http://tidy.sourceforge.net/ [roktas]: https://github.com/roktas/syntastic-more
[19]: http://www.htacg.org/tidy-html5/ [rust]: https://github.com/rust-lang/rust.vim
[20]: http://about.validator.nu/ [stack_overflow]: http://stackoverflow.com/questions/tagged/syntastic
[21]: https://github.com/validator/validator/releases/latest [swift]: https://github.com/kballard/vim-swift
[22]: https://github.com/scrooloose/syntastic/wiki/HTML%3A---validator [tidy]: http://www.htacg.org/tidy-html5/
[23]: http://validator.github.io/validator/#standalone [tidy_old]: http://tidy.sourceforge.net/
[24]: https://github.com/kballard/vim-swift [unimpaired]: https://github.com/tpope/vim-unimpaired
[25]: https://github.com/OmniSharp/omnisharp-vim [vam]: https://github.com/MarcWeber/vim-addon-manager
[26]: https://github.com/myint/syntastic-extras [vim]: http://www.vim.org/
[27]: https://github.com/roktas/syntastic-more [vimgo]: https://github.com/fatih/vim-go
[28]: https://github.com/venantius/vim-eastwood [vnu]: http://about.validator.nu/
[29]: https://github.com/rhysd/vim-crystal [vnu_jar]: https://github.com/validator/validator/releases/latest
[30]: https://github.com/the-lambda-church/merlin [vnu_server]: http://validator.github.io/validator/#standalone
[31]: https://github.com/eagletmt/ghcmod-vim [vundle]: https://github.com/gmarik/Vundle.vim
[32]: https://github.com/fatih/vim-go [ycm]: http://valloric.github.io/YouCompleteMe/
<!-- <!--
vim:tw=79:sw=4: vim:tw=79:sw=4:

View file

@ -357,6 +357,54 @@ function! syntastic#preprocess#stylelint(errors) abort " {{{2
return out return out
endfunction " }}}2 endfunction " }}}2
function! syntastic#preprocess#tern_lint(errors) abort " {{{2
let errs = join(a:errors, '')
let json = s:_decode_JSON(errs)
echomsg string(json)
let out = []
if type(json) == type({}) && has_key(json, 'messages') && type(json['messages']) == type([])
for e in json['messages']
try
let line_from = byte2line(e['from'] + 1)
if line_from > 0
let line = line_from
let column = e['from'] - line2byte(line_from) + 2
let line_to = byte2line(e['from'] + 1)
let hl = line_to == line ? e['to'] - line2byte(line_to) + 1 : 0
else
let line = 0
let column = 0
let hl = 0
endif
if column < 0
let column = 0
endif
if hl < 0
let hl = 0
endif
call add(out,
\ e['file'] . ':' .
\ e['severity'][0] . ':' .
\ line . ':' .
\ column . ':' .
\ hl . ':' .
\ e['message'])
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker javascript/tern_lint: unrecognized error item ' . string(e))
let out = []
endtry
endfor
else
call syntastic#log#warn('checker javascript/tern_lint: unrecognized error format')
endif
echomsg string(out)
return out
endfunction " }}}2
function! syntastic#preprocess#tslint(errors) abort " {{{2 function! syntastic#preprocess#tslint(errors) abort " {{{2
return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")') return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")')
endfunction " }}}2 endfunction " }}}2

File diff suppressed because it is too large Load diff

View file

@ -76,9 +76,7 @@ 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 up an external syntax checking program. The core script delegates off to these
plugins and uses their output to provide the syntastic functionality. plugins and uses their output to provide the syntastic functionality.
Take a look at the wiki for a list of supported filetypes and checkers: Take a look at the list of supported filetypes and checkers: |syntastic-checkers|.
https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
Note: This doc only deals with using syntastic. To learn how to write syntax Note: This doc only deals with using syntastic. To learn how to write syntax
checker integrations, see the guide on the GitHub wiki: checker integrations, see the guide on the GitHub wiki:
@ -563,7 +561,7 @@ option should be set to something like: >
\ "file:p": ['\m^/usr/include/', '\m\c\.h$'] } \ "file:p": ['\m^/usr/include/', '\m\c\.h$'] }
< <
Each element turns off messages matching the patterns specified by the Each element turns off messages matching the patterns specified by the
corresponding value. Values are lists, but if a list consist of a single corresponding value. Values are lists, but if a list consists of a single
element you may omit the brackets (e.g. you may write "style" instead of element you may omit the brackets (e.g. you may write "style" instead of
["style"]). Elements with values [] or "" are ignored (this is useful for ["style"]). Elements with values [] or "" are ignored (this is useful for
overriding filters, cf. |filter-overrides|). overriding filters, cf. |filter-overrides|).
@ -751,10 +749,8 @@ If neither |'g:syntastic_<filetype>_checkers'| nor |'b:syntastic_checkers'|
is set, a default list of checker is used. Beware however that this list is set, a default list of checker is used. Beware however that this list
deliberately kept minimal, for performance reasons. deliberately kept minimal, for performance reasons.
Take a look at the wiki to find out what checkers and filetypes are supported Take a look elsewhere in this manual to find out what checkers and filetypes
by syntastic: are supported by syntastic: |syntastic-checkers|.
https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
Use `:SyntasticInfo` to see which checkers are available for a given filetype. Use `:SyntasticInfo` to see which checkers are available for a given filetype.
@ -848,9 +844,8 @@ omitting the filename from the command line: >
*syntastic-config-no-makeprgbuild* *syntastic-config-no-makeprgbuild*
For checkers that do not use the "makeprgBuild()" function you will have to For checkers that do not use the "makeprgBuild()" function you will have to
look at the source code of the checker in question. If there are specific look at the source code of the checker in question. If there are specific
options that can be set, they are normally documented in the wiki: options that can be set they are normally documented in this manual (see
|syntastic-checkers|).
https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
5.4 Sorting errors *syntastic-config-sort* 5.4 Sorting errors *syntastic-config-sort*

View file

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.7.0-144' let g:_SYNTASTIC_VERSION = '3.7.0-153'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1

View file

@ -17,7 +17,6 @@ let g:loaded_syntastic_cpp_clang_check_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp', \ 'filetype': 'cpp',
\ 'name': 'clang_check', \ 'name': 'clang_check',
\ 'exec': 'clang-check',
\ 'redirect': 'c/clang_check'}) \ 'redirect': 'c/clang_check'})
" vim: set sw=4 sts=4 et fdm=marker: " vim: set sw=4 sts=4 et fdm=marker:

View file

@ -17,7 +17,6 @@ let g:loaded_syntastic_cpp_clang_tidy_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp', \ 'filetype': 'cpp',
\ 'name': 'clang_tidy', \ 'name': 'clang_tidy',
\ 'exec': 'clang-tidy',
\ 'redirect': 'c/clang_tidy'}) \ 'redirect': 'c/clang_tidy'})
" vim: set sw=4 sts=4 et fdm=marker: " vim: set sw=4 sts=4 et fdm=marker:

View file

@ -18,7 +18,6 @@ let g:loaded_syntastic_cpp_pc_lint_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp', \ 'filetype': 'cpp',
\ 'name': 'pc_lint', \ 'name': 'pc_lint',
\ 'exec': 'lint-nt',
\ 'redirect': 'c/pc_lint'}) \ 'redirect': 'c/pc_lint'})
" vim: set sw=4 sts=4 et fdm=marker: " vim: set sw=4 sts=4 et fdm=marker:

View file

@ -0,0 +1,53 @@
"============================================================================
"File: tern_lint.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047@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_javascript_tern_lint_checker')
finish
endif
let g:loaded_syntastic_javascript_tern_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_tern_lint_IsAvailable() dict
return has('byte_offset') && executable(self.getExec())
endfunction
function! SyntaxCheckers_javascript_tern_lint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%t:%l:%c:%n:%m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'tern_lint',
\ 'returns': [0] })
for e in loclist
if get(e, 'col', 0) && get(e, 'nr', 0)
let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . (e['nr'] + 1) . 'c'
endif
let e['nr'] = 0
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript',
\ 'name': 'tern_lint',
\ 'exec': 'tern-lint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -0,0 +1,51 @@
"============================================================================
"File: sass_lint.vim
"Description: Syntax checking plugin for syntastic
"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_sass_sass_lint_checker')
finish
endif
let g:loaded_syntastic_sass_sass_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_sass_sass_lint_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [1, 5])
endfunction
function! SyntaxCheckers_sass_sass_lint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': '-v',
\ 'args_after': '-q -f compact' })
let errorformat =
\ '%f: line %l\, col %c\, %trror - %m,' .
\ '%f: line %l\, col %c\, %tarning - %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'sass',
\ 'name': 'sass_lint',
\ 'exec': 'sass-lint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -0,0 +1,23 @@
"============================================================================
"File: sass_lint.vim
"Description: Syntax checking plugin for syntastic
"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_scss_sass_lint_checker')
finish
endif
let g:loaded_syntastic_scss_sass_lint_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'scss',
\ 'name': 'sass_lint',
\ 'redirect': 'sass/sass_lint'})
" vim: set sw=4 sts=4 et fdm=marker:

View file

@ -41,35 +41,37 @@ endfunction " }}}1
" Utilities {{{1 " Utilities {{{1
function! s:GetValaModules() " {{{2 function! s:GetValaModules() " {{{2
if exists('g:syntastic_vala_modules') if exists('g:syntastic_vala_modules') || exists('b:syntastic_vala_modules')
if type(g:syntastic_vala_modules) == type('') let modules = syntastic#util#var('vala_modules')
return split(g:syntastic_vala_modules, '\s\+') if type(modules) == type('')
elseif type(g:syntastic_vala_modules) == type([]) return split(modules, '\m\s\+')
return copy(g:syntastic_vala_modules) elseif type(modules) == type([])
return copy(modules)
else else
echoerr 'g:syntastic_vala_modules must be either list or string: fallback to in file modules string' echoerr 'syntastic_vala_modules must be either list or string: fallback to in file modules string'
endif endif
endif endif
let modules_line = search('^// modules: ', 'n') let modules_line = search('^// modules: ', 'n')
let modules_str = getline(modules_line) let modules_str = getline(modules_line)
return split(strpart(modules_str, 12), '\s\+') return split(strpart(modules_str, 12), '\m\s\+')
endfunction " }}}2 endfunction " }}}2
function! s:GetValaVapiDirs() " {{{2 function! s:GetValaVapiDirs() " {{{2
if exists('g:syntastic_vala_vapi_dirs') if exists('g:syntastic_vala_vapi_dirs') || exists('b:syntastic_vala_vapi_dirs')
if type(g:syntastic_vala_vapi_dirs) == type('') let vapi_dirs = syntastic#util#var('vala_vapi_dirs')
return split(g:syntastic_vala_vapi_dirs, '\s\+') if type(vapi_dirs) == type('')
elseif type(g:syntastic_vala_vapi_dirs) == type([]) return split(vapi_dirs, '\m\s\+')
return copy(g:syntastic_vala_vapi_dirs) elseif type(vapi_dirs) == type([])
return copy(vapi_dirs)
else else
echoerr 'g:syntastic_vala_vapi_dirs must be either a list, or a string: fallback to in-file modules string' echoerr 'syntastic_vala_vapi_dirs must be either a list, or a string: fallback to in-file modules string'
endif endif
endif endif
let vapi_line = search('^//\s*vapidirs:\s*','n') let vapi_line = search('^//\s*vapidirs:\s*','n')
let vapi_str = getline(vapi_line) let vapi_str = getline(vapi_line)
return split( substitute( vapi_str, '^//\s*vapidirs:\s*', '', 'g' ), '\s\+' ) return split( substitute( vapi_str, '\m^//\s*vapidirs:\s*', '', 'g' ), '\m\s\+' )
endfunction " }}}2 endfunction " }}}2
" }}}1 " }}}1

View file

@ -67,9 +67,10 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1
\ 'EVL204': 3, \ 'EVL204': 3,
\ 'EVL205': 3 } \ 'EVL205': 3 }
if exists('g:syntastic_vimlint_options') if exists('g:syntastic_vimlint_options') || exists('b:syntastic_vimlint_options')
if type(g:syntastic_vimlint_options) == type({}) let opts = syntastic#util#var('vimlint_options')
let options = filter(copy(g:syntastic_vimlint_options), 'v:key =~# "\\m^EVL"') if type(opts) == type({})
let options = filter(copy(opts), 'v:key =~# "\\m^EVL"')
call extend(param, options, 'force') call extend(param, options, 'force')
endif endif
endif endif

View file

@ -1116,7 +1116,7 @@ endfunction
function! s:CommitComplete(A,L,P) abort function! s:CommitComplete(A,L,P) abort
if a:A =~ '^-' || type(a:A) == type(0) " a:A is 0 on :Gcommit -<Tab> if a:A =~ '^-' || type(a:A) == type(0) " a:A is 0 on :Gcommit -<Tab>
let args = ['-C', '-F', '-a', '-c', '-e', '-i', '-m', '-n', '-o', '-q', '-s', '-t', '-u', '-v', '--all', '--allow-empty', '--amend', '--author=', '--cleanup=', '--dry-run', '--edit', '--file=', '--include', '--interactive', '--message=', '--no-verify', '--only', '--quiet', '--reedit-message=', '--reuse-message=', '--signoff', '--template=', '--untracked-files', '--verbose'] let args = ['-C', '-F', '-a', '-c', '-e', '-i', '-m', '-n', '-o', '-q', '-s', '-t', '-u', '-v', '--all', '--allow-empty', '--amend', '--author=', '--cleanup=', '--dry-run', '--edit', '--file=', '--fixup=', '--include', '--interactive', '--message=', '--no-verify', '--only', '--quiet', '--reedit-message=', '--reuse-message=', '--signoff', '--squash=', '--template=', '--untracked-files', '--verbose']
return filter(args,'v:val[0 : strlen(a:A)-1] ==# a:A') return filter(args,'v:val[0 : strlen(a:A)-1] ==# a:A')
else else
return s:repo().superglob(a:A) return s:repo().superglob(a:A)
@ -2840,7 +2840,7 @@ function! s:cfile() abort
elseif getline('.') =~# '^#\trenamed:.* -> ' elseif getline('.') =~# '^#\trenamed:.* -> '
let file = '/'.matchstr(getline('.'),' -> \zs.*') let file = '/'.matchstr(getline('.'),' -> \zs.*')
return [file] return [file]
elseif getline('.') =~# '^#\t[[:alpha:] ]\+: *.' elseif getline('.') =~# '^#\t\(\k\| \)\+: *.'
let file = '/'.matchstr(getline('.'),': *\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$') let file = '/'.matchstr(getline('.'),': *\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$')
return [file] return [file]
elseif getline('.') =~# '^#\t.' elseif getline('.') =~# '^#\t.'

View file

@ -3,12 +3,16 @@
IMPROVEMENTS: IMPROVEMENTS:
* `:GoDoc` accepts arguments now which are passed directly to `godoc`. So usages like `:GoDoc flag` works again (it was changed in previous versions [gh-894] * `:GoDoc` accepts arguments now which are passed directly to `godoc`. So usages like `:GoDoc flag` works again (it was changed in previous versions [gh-894]
* `:GoDef` works now for modified files as well [gh-910]
* Internal: fix indentations on all files to **2-spaces/no tabs**. This is now the default vim-go style across all VimL files [gh-915]
BUG FIXES: BUG FIXES:
* Escape `#` characters when opening URL's, as it's handled as alternative file in vim [gh-895] * Escape `#` characters when opening URL's, as it's handled as alternative file in vim [gh-895]
* Fix typos in `doc/vim-go.txt` about usages of syntax highglightings [gh-897] * Fix typos in `doc/vim-go.txt` about usages of syntax highglightings [gh-897]
* Fix `:GoCoverage` not running for Neovim [gh-899]
* Fix `:GoFmt` not picking up `-srcdir` if the command was set to use `goimports` [gh-904]
* Fix `:GoTestCompile` to not leave behind artifacts if the cwd and the test files's directory do not match [gh-909]
## 1.7.1 (June 7, 2016) ## 1.7.1 (June 7, 2016)

View file

@ -156,3 +156,4 @@ function! ctrlp#decls#cmd(mode, ...)
return s:id return s:id
endfunction endfunction
" vim: sw=2 ts=2 et

View file

@ -28,3 +28,5 @@ function! go#alternate#Switch(bang, cmd)
execute ":" . a:cmd . " " . alt_file execute ":" . a:cmd . " " . alt_file
endif endif
endfunction endfunction
" vim: sw=2 ts=2 et

View file

@ -50,3 +50,5 @@ function! go#asmfmt#Format()
" Restore the cursor/window positions. " Restore the cursor/window positions.
call winrestview(l:curw) call winrestview(l:curw)
endfunction endfunction
" vim: sw=2 ts=2 et

View file

@ -188,8 +188,7 @@ endfunction
function! go#cmd#Test(bang, compile, ...) function! go#cmd#Test(bang, compile, ...)
let args = ["test"] let args = ["test"]
" don't run the test, only compile it. Useful to capture and fix errors or " don't run the test, only compile it. Useful to capture and fix errors.
" to create a test binary.
if a:compile if a:compile
let compile_file = "vim-go-test-compile" let compile_file = "vim-go-test-compile"
call extend(args, ["-c", "-o", compile_file]) call extend(args, ["-c", "-o", compile_file])
@ -198,7 +197,9 @@ function! go#cmd#Test(bang, compile, ...)
if a:0 if a:0
" expand all wildcards(i.e: '%' to the current file name) " expand all wildcards(i.e: '%' to the current file name)
let goargs = map(copy(a:000), "expand(v:val)") let goargs = map(copy(a:000), "expand(v:val)")
if !has('nvim')
let goargs = go#util#Shelllist(goargs, 1) let goargs = go#util#Shelllist(goargs, 1)
endif
call extend(args, goargs, 1) call extend(args, goargs, 1)
else else
@ -231,25 +232,21 @@ function! go#cmd#Test(bang, compile, ...)
redraw redraw
let command = "go " . join(args, ' ') let command = "go " . join(args, ' ')
let out = go#tool#ExecuteInDir(command) let out = go#tool#ExecuteInDir(command)
let l:listtype = "quickfix" let l:listtype = "quickfix"
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
execute cd fnameescape(expand("%:p:h"))
if a:compile if a:compile
call delete(compile_file) call delete(compile_file)
endif endif
if go#util#ShellError() != 0 if go#util#ShellError() != 0
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
try
execute cd fnameescape(expand("%:p:h"))
let errors = go#tool#ParseErrors(split(out, '\n')) let errors = go#tool#ParseErrors(split(out, '\n'))
let errors = go#tool#FilterValids(errors) let errors = go#tool#FilterValids(errors)
finally
execute cd . fnameescape(dir)
endtry
call go#list#Populate(l:listtype, errors) call go#list#Populate(l:listtype, errors)
call go#list#Window(l:listtype, len(errors)) call go#list#Window(l:listtype, len(errors))
@ -270,6 +267,7 @@ function! go#cmd#Test(bang, compile, ...)
echon "vim-go: " | echohl Function | echon "[test] PASS" | echohl None echon "vim-go: " | echohl Function | echon "[test] PASS" | echohl None
endif endif
endif endif
execute cd . fnameescape(dir)
endfunction endfunction
" Testfunc runs a single test that surrounds the current cursor position. " Testfunc runs a single test that surrounds the current cursor position.
@ -358,4 +356,4 @@ function! s:test_compile_handler(job, exit_status, data)
unlet s:test_compile_handlers[a:job.id] unlet s:test_compile_handlers[a:job.id]
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -153,4 +153,4 @@ function! go#complete#Complete(findstart, base)
endif endif
endf endf
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -282,5 +282,4 @@ function! s:coverage_browser_handler(job, exit_status, data)
unlet s:coverage_browser_handler_jobs[a:job.id] unlet s:coverage_browser_handler_jobs[a:job.id]
endfunction endfunction
" vim: sw=2 ts=2 et
" vim:ts=4:sw=4:et

View file

@ -6,6 +6,12 @@ function! go#def#Jump(mode)
let $GOPATH = go#path#Detect() let $GOPATH = go#path#Detect()
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
if &modified
" Write current unsaved buffer to a temp file and use the modified content
let l:tmpname = tempname()
call writefile(getline(1, '$'), l:tmpname)
let fname = l:tmpname
endif
" so guru right now is slow for some people. previously we were using " so guru right now is slow for some people. previously we were using
" godef which also has it's own quirks. But this issue come up so many " godef which also has it's own quirks. But this issue come up so many
@ -46,6 +52,10 @@ function! go#def#Jump(mode)
return return
endif endif
if exists("l:tmpname")
call delete(l:tmpname)
endif
if go#util#ShellError() != 0 if go#util#ShellError() != 0
call go#util#EchoError(out) call go#util#EchoError(out)
return return
@ -226,3 +236,4 @@ function! go#def#Stack(...)
endif endif
endfunction endfunction
" vim: sw=2 ts=2 et

View file

@ -152,4 +152,4 @@ function! s:GodocView(newposition, position, content)
noremap <buffer> <silent> <Esc> :<C-U>close<CR> noremap <buffer> <silent> <Esc> :<C-U>close<CR>
endfunction endfunction
" vim:ts=2:sw=2:et " vim: sw=2 ts=2 et

View file

@ -86,34 +86,32 @@ function! go#fmt#Format(withGoimport)
endif endif
" get the command first so we can test it " get the command first so we can test it
let fmt_command = g:go_fmt_command let bin_name = g:go_fmt_command
if a:withGoimport == 1 if a:withGoimport == 1
let fmt_command = g:go_goimports_bin let bin_name = g:go_goimports_bin
endif endif
" check if the user has installed command binary. " check if the user has installed command binary.
" For example if it's goimports, let us check if it's installed, " For example if it's goimports, let us check if it's installed,
" if not the user get's a warning via go#path#CheckBinPath() " if not the user get's a warning via go#path#CheckBinPath()
let bin_path = go#path#CheckBinPath(fmt_command) let bin_path = go#path#CheckBinPath(bin_name)
if empty(bin_path) if empty(bin_path)
return return
endif endif
if fmt_command != "gofmt" if bin_name != "gofmt"
" change GOPATH too, so goimports can pick up the correct library " change GOPATH too, so goimports can pick up the correct library
let old_gopath = $GOPATH let old_gopath = $GOPATH
let $GOPATH = go#path#Detect() let $GOPATH = go#path#Detect()
let fmt_command = bin_path
endif endif
" populate the final command with user based fmt options " populate the final command with user based fmt options
let command = fmt_command . ' -w ' let command = bin_path . ' -w '
if a:withGoimport != 1 if a:withGoimport != 1
let command = command . g:go_fmt_options let command = command . g:go_fmt_options
endif endif
if fmt_command == "goimports" if bin_name == "goimports"
if !exists('b:goimports_vendor_compatible') if !exists('b:goimports_vendor_compatible')
let out = go#util#System(bin_path . " --help") let out = go#util#System(bin_path . " --help")
if out !~ "-srcdir" if out !~ "-srcdir"
@ -137,7 +135,7 @@ function! go#fmt#Format(withGoimport)
endif endif
let out = go#util#System(command . " " . l:tmpname) let out = go#util#System(command . " " . l:tmpname)
if fmt_command != "gofmt" if bin_name != "gofmt"
let $GOPATH = old_gopath let $GOPATH = old_gopath
endif endif
@ -209,5 +207,4 @@ function! go#fmt#Format(withGoimport)
endif endif
endfunction endfunction
" vim: sw=2 ts=2 et
" vim:ts=4:sw=4:et

View file

@ -301,4 +301,4 @@ function! go#guru#SameIds(selected)
echo same_ids echo same_ids
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -122,3 +122,5 @@ function! go#impl#Complete(arglead, cmdline, cursorpos)
return [] return []
endif endif
endfunction endfunction
" vim: sw=2 ts=2 et

View file

@ -210,4 +210,4 @@ function! s:Error(s)
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -115,6 +115,11 @@ endfunction
" it'll be closed. " it'll be closed.
function! s:on_exit(job_id, exit_status) function! s:on_exit(job_id, exit_status)
let std_combined = self.stderr + self.stdout let std_combined = self.stderr + self.stdout
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
execute cd self.dir
call s:callback_handlers_on_exit(s:jobs[a:job_id], a:exit_status, std_combined) call s:callback_handlers_on_exit(s:jobs[a:job_id], a:exit_status, std_combined)
if a:exit_status == 0 if a:exit_status == 0
@ -123,21 +128,18 @@ function! s:on_exit(job_id, exit_status)
let self.state = "SUCCESS" let self.state = "SUCCESS"
call go#util#EchoSuccess("SUCCESS") call go#util#EchoSuccess("SUCCESS")
execute cd . fnameescape(dir)
return return
endif endif
let self.state = "FAILED" let self.state = "FAILED"
call go#util#EchoError("FAILED") call go#util#EchoError("FAILED")
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
try
execute cd self.dir
let errors = go#tool#ParseErrors(std_combined) let errors = go#tool#ParseErrors(std_combined)
let errors = go#tool#FilterValids(errors) let errors = go#tool#FilterValids(errors)
finally
execute cd . fnameescape(dir) execute cd . fnameescape(dir)
endtry
if !len(errors) if !len(errors)
" failed to parse errors, output the original content " failed to parse errors, output the original content
@ -209,4 +211,4 @@ function! s:abort(path)
endfor endfor
endfunction endfunction
" vim:ts=2:sw=2:et " vim: sw=2 ts=2 et

View file

@ -196,4 +196,4 @@ function! go#lint#Errcheck(...) abort
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -123,4 +123,4 @@ function! go#list#Type(listtype)
endif endif
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -157,4 +157,4 @@ function! go#package#Complete(ArgLead, CmdLine, CursorPos)
return sort(keys(ret)) return sort(keys(ret))
endfunction endfunction
" vim:sw=4:et " vim: sw=2 ts=2 et

View file

@ -172,4 +172,4 @@ function! go#path#CheckBinPath(binpath)
return go_bin_path . go#util#PathSep() . basename return go_bin_path . go#util#PathSep() . basename
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -90,5 +90,4 @@ function! s:get_browser_command()
return go_play_browser_command return go_play_browser_command
endfunction endfunction
" vim: sw=2 ts=2 et
" vim:ts=4:sw=4:et

View file

@ -74,5 +74,4 @@ function! go#rename#Rename(bang, ...)
silent execute ":e" silent execute ":e"
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et
"

View file

@ -135,4 +135,4 @@ function! s:on_exit(job_id, exit_status)
unlet s:jobs[a:job_id] unlet s:jobs[a:job_id]
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -177,4 +177,4 @@ function! go#textobj#FunctionJump(mode, direction)
keepjumps call cursor(info.func.line, 1) keepjumps call cursor(info.func.line, 1)
endfunction endfunction
" vim:ts=2:sw=2:et " vim: sw=2 ts=2 et

View file

@ -182,4 +182,4 @@ function! go#tool#OpenBrowser(url)
endif endif
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -111,3 +111,4 @@ function! go#ui#OpenDefinition(filter)
norm! zz norm! zz
endfunction endfunction
" vim: sw=2 ts=2 et

View file

@ -206,4 +206,4 @@ function! go#util#EchoProgress(msg)
redraws! | echon "vim-go: " | echohl Identifier | echon a:msg | echohl None redraws! | echon "vim-go: " | echohl Identifier | echon a:msg | echohl None
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -38,4 +38,4 @@ CompilerSet errorformat+=%-G%.%# " All lines not matching a
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -28,4 +28,4 @@ au BufReadPost *.s call s:gofiletype_post()
au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl au BufRead,BufNewFile *.tmpl set filetype=gohtmltmpl
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -15,3 +15,5 @@ setlocal commentstring=//\ %s
setlocal noexpandtab setlocal noexpandtab
command! -nargs=0 AsmFmt call go#asmfmt#Format() command! -nargs=0 AsmFmt call go#asmfmt#Format()
" vim: sw=2 ts=2 et

View file

@ -60,4 +60,4 @@ if get(g:, "go_auto_type_info", 0)
setlocal updatetime=800 setlocal updatetime=800
endif endif
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -76,4 +76,4 @@ endif
" -- impl " -- impl
command! -nargs=* -buffer -complete=customlist,go#impl#Complete GoImpl call go#impl#Impl(<f-args>) command! -nargs=* -buffer -complete=customlist,go#impl#Complete GoImpl call go#impl#Impl(<f-args>)
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -70,3 +70,5 @@ nnoremap <silent> <Plug>(go-vet) :<C-u>call go#lint#Vet(!g:go_jump_to_error)<CR>
nnoremap <silent> <Plug>(go-alternate-edit) :<C-u>call go#alternate#Switch(0, "edit")<CR> nnoremap <silent> <Plug>(go-alternate-edit) :<C-u>call go#alternate#Switch(0, "edit")<CR>
nnoremap <silent> <Plug>(go-alternate-vertical) :<C-u>call go#alternate#Switch(0, "vsplit")<CR> nnoremap <silent> <Plug>(go-alternate-vertical) :<C-u>call go#alternate#Switch(0, "vsplit")<CR>
nnoremap <silent> <Plug>(go-alternate-split) :<C-u>call go#alternate#Switch(0, "split")<CR> nnoremap <silent> <Plug>(go-alternate-split) :<C-u>call go#alternate#Switch(0, "split")<CR>
" vim: sw=2 ts=2 et

View file

@ -44,3 +44,5 @@ if g:go_snippet_engine == "ultisnips"
elseif g:go_snippet_engine == "neosnippet" elseif g:go_snippet_engine == "neosnippet"
call s:GoNeosnippet() call s:GoNeosnippet()
endif endif
" vim: sw=2 ts=2 et

View file

@ -53,3 +53,5 @@ endfunction
call s:SetTagbar() call s:SetTagbar()
" vim: sw=2 ts=2 et

View file

@ -4,3 +4,5 @@ endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1
setlocal commentstring=<!--\ %s\ --> setlocal commentstring=<!--\ %s\ -->
" vim: sw=2 ts=2 et

View file

@ -75,4 +75,4 @@ function! GoIndent(lnum)
return ind return ind
endfunction endfunction
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -42,3 +42,5 @@ function! GetGoHTMLTmplIndent(lnum)
return ind return ind
endfunction endfunction
" vim: sw=2 ts=2 et

View file

@ -173,5 +173,4 @@ augroup vim-go
endif endif
augroup END augroup END
" vim: sw=2 ts=2 et
" vim:ts=4:sw=4:et

View file

@ -376,3 +376,5 @@ endif
syn sync minlines=500 syn sync minlines=500
let b:current_syntax = "go" let b:current_syntax = "go"
" vim: sw=2 ts=2 et

View file

@ -16,3 +16,5 @@ hi def link godefStackComment Comment
hi def link godefStackCurrentPosition Special hi def link godefStackCurrentPosition Special
hi def link godefStackFilename Directory hi def link godefStackFilename Directory
hi def link godefStackEntryLocationNumber LineNr hi def link godefStackEntryLocationNumber LineNr
" vim: sw=2 ts=2 et

View file

@ -12,4 +12,4 @@ unlet b:current_syntax
let b:current_syntax = "gohtmltmpl" let b:current_syntax = "gohtmltmpl"
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -82,4 +82,4 @@ hi def link goTplComment Comment
let b:current_syntax = "gotexttmpl" let b:current_syntax = "gotexttmpl"
" vim:ts=4:sw=4:et " vim: sw=2 ts=2 et

View file

@ -9,3 +9,5 @@ syn region goTitle start="\%1l" end=":"
hi def link goInterface Type hi def link goInterface Type
hi def link goTitle Label hi def link goTitle Label
" vim: sw=2 ts=2 et

View file

@ -110,7 +110,7 @@ function! s:build_stops(snippet, stops, lnum, col, indent) abort
for line in a:snippet for line in a:snippet
let col = s:build_loc_info(line, stops, lnum, col, []) let col = s:build_loc_info(line, stops, lnum, col, [])
if line isnot line[-1] if line isnot a:snippet[-1]
let lnum += 1 let lnum += 1
let col = a:indent let col = a:indent
endif endif

View file

@ -186,7 +186,7 @@ snippet iblock "" bi
{% block ${1:blockname} %}${VISUAL}{% endblock $1 %} {% block ${1:blockname} %}${VISUAL}{% endblock $1 %}
endsnippet endsnippet
snippet csfr "" bi snippet csrf "" bi
{% csrf_token %} {% csrf_token %}
endsnippet endsnippet

View file

@ -21,7 +21,7 @@ def nl(snip):
snip.rv += " " snip.rv += " "
def getArgs(group): def getArgs(group):
import re import re
word = re.compile('[a-zA-Z><.]+ \w+') word = re.compile('[a-zA-Z0-9><.]+ \w+')
return [i.split(" ") for i in word.findall(group) ] return [i.split(" ") for i in word.findall(group) ]
def camel(word): def camel(word):
@ -123,8 +123,8 @@ for i in args:
snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\ snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\
\tthis." + i[1] + " = " + i[1] + ";\n\t}\n" \tthis." + i[1] + " = " + i[1] + ";\n\t}\n"
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\ snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\n\
\n\t\treturn " + i[1] + ";\n\t}\n" \treturn " + i[1] + ";\n\t}\n"
` `
} }
endsnippet endsnippet
@ -356,8 +356,7 @@ endsnippet
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br
public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) { public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) {
this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`; this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`;
} }`!p snip.rv += "\n"`
public $2 get$1() { public $2 get$1() {
return `!p snip.rv = mixedCase(t[1])`; return `!p snip.rv = mixedCase(t[1])`;
} }

View file

@ -4,7 +4,7 @@ snippet s "String" b
"${1:key}": "${0:value}", "${1:key}": "${0:value}",
endsnippet endsnippet
snippet n "number" b snippet n "Number" b
"${1:key}": ${0:value}, "${1:key}": ${0:value},
endsnippet endsnippet
@ -13,8 +13,39 @@ snippet a "Array" b
${VISUAL}$0 ${VISUAL}$0
], ],
endsnippet endsnippet
snippet na "Named array" b
"${1:key}": [
${VISUAL}$0
],
endsnippet
snippet o "Object" b snippet o "Object" b
{ {
${VISUAL}$0 ${VISUAL}$0
}, },
endsnippet endsnippet
snippet no "Named object" b
"${1:key}": {
${VISUAL}$0
},
endsnippet
snippet null "Null" b
"${0:key}": null,
endsnippet
global !p
def compB(t, opts):
if t:
opts = [m[len(t):] for m in opts if m.startswith(t)]
if len(opts) == 1:
return opts[0]
return "(" + '|'.join(opts) + ')'
endglobal
snippet b "Bool" b
"${1:key}": $2`!p snip.rv=compB(t[2], ['true', 'false'])`,
endsnippet

View file

@ -23,7 +23,7 @@ class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
` extends ObjectBehavior ` extends ObjectBehavior
{ {
function it${1}() function it_${1}()
{ {
$0 $0
} }
@ -31,7 +31,7 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet it "function it_does_something() { ... }" snippet it "function it_does_something() { ... }"
function it${1}() function it_${1}()
{ {
${0:${VISUAL}} ${0:${VISUAL}}
} }
@ -163,11 +163,11 @@ endsnippet
# Scalar type matchers # Scalar type matchers
snippet sbscalar "$this->XYZ()->shouldBeString|Array|Bool()" snippet sbscalar "$this->XYZ()->shouldBeString|Array|Bool()"
$this->${1:method}()->shouldBe(${2:'String|Array|Bool'}); $this->${1:method}()->shouldBe${2:String|Array|Bool}();
endsnippet endsnippet
snippet snbscalar "$this->XYZ()->shouldNotBeString|Array|Bool()" snippet snbscalar "$this->XYZ()->shouldNotBeString|Array|Bool()"
$this->${1:method}()->shouldNotBe(${2:'String|Array|Bool'}); $this->${1:method}()->shouldNotBe${2:String|Array|Bool}();
endsnippet endsnippet
# Contain matcher # Contain matcher

View file

@ -3,7 +3,7 @@ priority -50
## Snippets from SnipMate, taken from ## Snippets from SnipMate, taken from
## https://github.com/scrooloose/snipmate-snippets.git ## https://github.com/scrooloose/snipmate-snippets.git
snippet getter "PHP Class Getter" b snippet gm "PHP Class Getter" b
/** /**
* Getter for $1 * Getter for $1
* *
@ -11,11 +11,11 @@ snippet getter "PHP Class Getter" b
*/ */
public function get${1/\w+\s*/\u$0/}() public function get${1/\w+\s*/\u$0/}()
{ {
return $this->$1;$3 return $this->$1;
} }
endsnippet endsnippet
snippet setter "PHP Class Setter" b snippet sm "PHP Class Setter" b
/** /**
* Setter for $1 * Setter for $1
* *
@ -24,11 +24,10 @@ snippet setter "PHP Class Setter" b
*/ */
public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
{ {
$this->$1 = $$1;$5 $this->$1 = $$1;
${6:return $this;} ${5:return $this;}
} }
$0
endsnippet endsnippet
snippet gs "PHP Class Getter Setter" b snippet gs "PHP Class Getter Setter" b
@ -39,22 +38,21 @@ snippet gs "PHP Class Getter Setter" b
*/ */
public function get${1/\w+\s*/\u$0/}() public function get${1/\w+\s*/\u$0/}()
{ {
return $this->$1;$3 return $this->$1;
} }
/** /**
* Setter for $1 * Setter for $1
* *
* @param $2 $$1 * @param $2 $$1
* @return ${4:`!p snip.rv=snip.basename`} * @return ${3:`!p snip.rv=snip.basename`}
*/ */
public function set${1/\w+\s*/\u$0/}(${5:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1) public function set${1/\w+\s*/\u$0/}(${4:${2/(void|string|int|integer|double|float|object|boolear|null|mixed|number|resource)|(.*)/(?1::$2 )/}}$$1)
{ {
$this->$1 = $$1;$6 $this->$1 = $$1;
${7:return $this;} ${5:return $this;}
} }
$0
endsnippet endsnippet
snippet pub "Public function" b snippet pub "Public function" b

View file

@ -1,3 +1,5 @@
extends html
snippet % snippet %
<% ${0} %> <% ${0} %>
snippet = snippet =

View file

@ -47,28 +47,27 @@ snippet m
{ {
${0} ${0}
} }
# setter method snippet sm "PHP Class Setter"
snippet sm
/** /**
* Sets the value of ${1:foo} * Sets the value of ${1:foo}
* *
* @param ${2:$1} $$1 ${3:description} * @param ${2:string} $$1 ${3:description}
* *
* @return ${4:`vim_snippets#Filename()`} * @return ${4:`vim_snippets#Filename()`}
*/ */
${5:public} function set${6:$2}(${7:$2 }$$1) ${5:public} function set${6:$1}(${7:$2 }$$1)
{ {
$this->${8:$1} = $$1; $this->${8:$1} = $$1;
return $this; return $this;
} }
# getter method snippet gm "PHP Class Getter Setter"
snippet gm
/** /**
* Gets the value of ${1:foo} * Gets the value of ${1:foo}
* *
* @return ${2:$1} * @return ${2:string}
*/ */
${3:public} function get${4:$2}() ${3:public} function get${4:$1}()
{ {
return $this->${5:$1}; return $this->${5:$1};
} }
@ -391,13 +390,13 @@ snippet ve "Dumb debug helper in HTML"
snippet pc "Dumb debug helper in cli" snippet pc "Dumb debug helper in cli"
var_export($1);$0 var_export($1);$0
# Getters & Setters # Getters & Setters
snippet gs snippet gs "PHP Class Getter Setter"
/** /**
* Gets the value of ${1:foo} * Gets the value of ${1:foo}
* *
* @return ${2:$1} * @return ${2:string}
*/ */
public function get${3:$2}() public function get${3:$1}()
{ {
return $this->${4:$1}; return $this->${4:$1};
} }

View file

@ -0,0 +1,36 @@
extends css
snippet $
$${1:variable}: ${0:value}
snippet imp
@import '${0}'
snippet mix
@mixin ${1:name}(${2})
${0}
snippet inc
@include ${1:mixin}(${2})
snippet ext
@extend ${0}
snippet fun
@function ${1:name}(${2:args})
${0}
snippet if
@if ${1:condition}
${0}
snippet ife
@if ${1:condition}
${2}
@else
${0}
snippet eif
@else if ${1:condition}
${0}
snippet for
@for ${1:$i} from ${2:1} through ${3:3}
${0}
snippet each
@each ${1:$item} in ${2:items}
${0}
snippet while
@while ${1:$i} ${2:>} ${3:0}
${0}

View file

@ -16,57 +16,57 @@ snippet dmo \DeclareMathOperator
# \begin{}...\end{} # \begin{}...\end{}
snippet begin \begin{} ... \end{} block snippet begin \begin{} ... \end{} block
\begin{${1:env}} \begin{${1:env}}
${0} ${0:${VISUAL}}
\end{$1} \end{$1}
# Tabular # Tabular
snippet tab tabular (or arbitrary) environment snippet tab tabular (or arbitrary) environment
\begin{${1:tabular}}{${2:c}} \begin{${1:tabular}}{${2:c}}
${0} ${0:${VISUAL}}
\end{$1} \end{$1}
snippet thm thm (or arbitrary) environment with optional argument snippet thm thm (or arbitrary) environment with optional argument
\begin[${1:author}]{${2:thm}} \begin[${1:author}]{${2:thm}}
${0} ${0:${VISUAL}}
\end{$2} \end{$2}
snippet center center environment snippet center center environment
\begin{center} \begin{center}
${0} ${0:${VISUAL}}
\end{center} \end{center}
# Align(ed) # Align(ed)
snippet ali align(ed) environment snippet ali align(ed) environment
\begin{align${1:ed}} \begin{align${1:ed}}
\label{eq:${2}} \label{eq:${2}}
${0} ${0:${VISUAL}}
\end{align$1} \end{align$1}
# Gather(ed) # Gather(ed)
snippet gat gather(ed) environment snippet gat gather(ed) environment
\begin{gather${1:ed}} \begin{gather${1:ed}}
${0} ${0:${VISUAL}}
\end{gather$1} \end{gather$1}
# Equation # Equation
snippet eq equation environment snippet eq equation environment
\begin{equation} \begin{equation}
${0} ${0:${VISUAL}}
\end{equation} \end{equation}
# Equation # Equation
snippet eql Labeled equation environment snippet eql Labeled equation environment
\begin{equation} \begin{equation}
\label{eq:${2}} \label{eq:${2}}
${0} ${0:${VISUAL}}
\end{equation} \end{equation}
# Equation # Equation
snippet eq* unnumbered equation environment snippet eq* unnumbered equation environment
\begin{equation*} \begin{equation*}
${0} ${0:${VISUAL}}
\end{equation*} \end{equation*}
# Unnumbered Equation # Unnumbered Equation
snippet \ unnumbered equation: \[ ... \] snippet \ unnumbered equation: \[ ... \]
\[ \[
${0} ${0:${VISUAL}}
\] \]
# Equation array # Equation array
snippet eqnarray eqnarray environment snippet eqnarray eqnarray environment
\begin{eqnarray} \begin{eqnarray}
${0} ${0:${VISUAL}}
\end{eqnarray} \end{eqnarray}
# Label # Label
snippet lab \label snippet lab \label
@ -90,7 +90,7 @@ snippet itemize itemize environment
\item ${0} \item ${0}
\end{itemize} \end{itemize}
snippet item \item snippet item \item
\item ${1} \item ${1:${VISUAL}}
# Description # Description
snippet desc description environment snippet desc description environment
\begin{description} \begin{description}
@ -103,18 +103,18 @@ snippet ]i \item (recursive)
# Matrix # Matrix
snippet mat smart matrix environment snippet mat smart matrix environment
\begin{${1:p/b/v/V/B/small}matrix} \begin{${1:p/b/v/V/B/small}matrix}
${0} ${0:${VISUAL}}
\end{$1matrix} \end{$1matrix}
# Cases # Cases
snippet cas cases environment snippet cas cases environment
\begin{cases} \begin{cases}
${1:equation}, &\text{ if }${2:case}\\ ${1:equation}, &\text{ if }${2:case}\\
${0} ${0:${VISUAL}}
\end{cases} \end{cases}
# Split # Split
snippet spl split environment snippet spl split environment
\begin{split} \begin{split}
${0} ${0:${VISUAL}}
\end{split} \end{split}
# Part # Part
snippet part document \part snippet part document \part
@ -203,32 +203,32 @@ snippet fcite \footcite[]{}
\footcite[${1}]{${2}}${0} \footcite[${1}]{${2}}${0}
#Formating text: italic, bold, underline, small capital, emphase .. #Formating text: italic, bold, underline, small capital, emphase ..
snippet it italic text snippet it italic text
\textit{${0:text}} \textit{${0:${VISUAL:text}}}
snippet bf bold face text snippet bf bold face text
\textbf{${0:text}} \textbf{${0:${VISUAL:text}}}
snippet under underline text snippet under underline text
\underline{${0:text}} \underline{${0:${VISUAL:text}}}
snippet emp emphasize text snippet emp emphasize text
\emph{${0:text}} \emph{${0:${VISUAL:text}}}
snippet sc small caps text snippet sc small caps text
\textsc{${0:text}} \textsc{${0:${VISUAL:text}}}
#Choosing font #Choosing font
snippet sf sans serife text snippet sf sans serife text
\textsf{${0:text}} \textsf{${0:${VISUAL:text}}}
snippet rm roman font text snippet rm roman font text
\textrm{${0:text}} \textrm{${0:${VISUAL:text}}}
snippet tt typewriter (monospace) text snippet tt typewriter (monospace) text
\texttt{${0:text}} \texttt{${0:${VISUAL:text}}}
#Math font #Math font
snippet mf mathfrak snippet mf mathfrak
\mathfrak{${0:text}} \mathfrak{${0:${VISUAL:text}}}
snippet mc mathcal snippet mc mathcal
\mathcal{${0:text}} \mathcal{${0:${VISUAL:text}}}
snippet ms mathscr snippet ms mathscr
\mathscr{${0:text}} \mathscr{${0:${VISUAL:text}}}
#misc #misc
snippet ft \footnote snippet ft \footnote
\footnote{${0:text}} \footnote{${0:${VISUAL:text}}}
snippet fig figure environment (includegraphics) snippet fig figure environment (includegraphics)
\begin{figure} \begin{figure}
\begin{center} \begin{center}
@ -260,19 +260,19 @@ snippet lim \lim_{}
\lim_{${1:n \to \infty}} ${0} \lim_{${1:n \to \infty}} ${0}
snippet frame frame environment snippet frame frame environment
\begin{frame}[${1:t}]{${2:title}} \begin{frame}[${1:t}]{${2:title}}
${0} ${0:${VISUAL}}
\end{frame} \end{frame}
snippet block block environment snippet block block environment
\begin{block}{${1:title}} \begin{block}{${1:title}}
${0} ${0:${VISUAL}}
\end{block} \end{block}
snippet alert alertblock environment snippet alert alertblock environment
\begin{alertblock}{${1:title}} \begin{alertblock}{${1:title}}
${0} ${0:${VISUAL}}
\end{alertblock} \end{alertblock}
snippet example exampleblock environment snippet example exampleblock environment
\begin{exampleblock}{${1:title}} \begin{exampleblock}{${1:title}}
${0} ${0:${VISUAL}}
\end{exampleblock} \end{exampleblock}
snippet col2 two-column environment snippet col2 two-column environment
\begin{columns} \begin{columns}
@ -301,7 +301,7 @@ snippet lra langle rangle
# Code listings # Code listings
snippet lst snippet lst
\begin{listing}[language=${1:language}] \begin{listing}[language=${1:language}]
${0} ${0:${VISUAL}}
\end{listing} \end{listing}
snippet lsi snippet lsi
\lstinline|${1}| ${0} \lstinline|${1}| ${0}