mirror of
1
0
Fork 0

Updated plugins

This commit is contained in:
amix 2017-05-02 14:42:08 +02:00
parent c4fbfe8aa8
commit 85e105159e
63 changed files with 1389 additions and 737 deletions

View File

@ -78,9 +78,9 @@ The quickfix results window is augmented with these convenience mappings:
? a quick summary of these keys, repeat to close ? a quick summary of these keys, repeat to close
o to open (same as Enter) o to open (same as Enter)
O to open and close the quickfix window O to open and close the quickfix window
go to preview file, open but maintain focus on ack.vim results go to preview file, keeping focus on the results
t to open in new tab t to open in new tab
T to open in new tab without moving to it T to open in new tab, keeping focus on the results
h to open in horizontal split h to open in horizontal split
H to open in horizontal split, keeping focus on the results H to open in horizontal split, keeping focus on the results
v to open in vertical split v to open in vertical split

View File

@ -2305,7 +2305,7 @@ fu! s:lastvisual()
let cview = winsaveview() let cview = winsaveview()
let [ovreg, ovtype] = [getreg('v'), getregtype('v')] let [ovreg, ovtype] = [getreg('v'), getregtype('v')]
let [oureg, outype] = [getreg('"'), getregtype('"')] let [oureg, outype] = [getreg('"'), getregtype('"')]
sil! norm! gv"vy sil! norm! gV"vy
let selected = s:regisfilter('v') let selected = s:regisfilter('v')
cal setreg('v', ovreg, ovtype) cal setreg('v', ovreg, ovtype)
cal setreg('"', oureg, outype) cal setreg('"', oureg, outype)

View File

@ -31,7 +31,7 @@ endf
" Public {{{1 " Public {{{1
fu! ctrlp#line#init(bufnr) fu! ctrlp#line#init(bufnr)
let [lines, bufnr] = [[], exists('s:bufnr') ? s:bufnr : a:bufnr] let [lines, bufnr] = [[], exists('s:bufnr') ? s:bufnr : a:bufnr]
let bufs = exists('s:lnmode') && s:lnmode ? ctrlp#buffers('id') : [bufnr] let bufs = exists('s:lnmode') && !empty(s:lnmode) ? ctrlp#buffers('id') : [bufnr]
for bufnr in bufs for bufnr in bufs
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)] let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
if lfb == [] && bufn != '' if lfb == [] && bufn != ''

View File

@ -1,4 +1,4 @@
*ctrlp.txt* 模糊的 文件, 缓冲区, 最近最多使用, 标签, ... 检索. v1.79 *ctrlp.txt* 支持模糊匹配的 文件, 缓冲区, 最近最多使用, 标签, ... 检索. v1.79
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'* *CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
=============================================================================== ===============================================================================
# # # #
@ -68,7 +68,7 @@ OPTIONS *ctrlp-options*
|ctrlp_arg_map|...............是否拦截<c-y> 和 <c-o> 命令。 |ctrlp_arg_map|...............是否拦截<c-y> 和 <c-o> 命令。
|ctrlp_follow_symlinks|.......是否跟随链接。 |ctrlp_follow_symlinks|.......是否跟随链接。
|ctrlp_lazy_update|...........停止输入时才更新。 |ctrlp_lazy_update|...........停止输入时才更新。
|ctrlp_default_input|.........为提示符面板提供一个种子 |ctrlp_default_input|.........为提示符面板提供一个初始字符串
|ctrlp_abbrev|................输入缩写。 |ctrlp_abbrev|................输入缩写。
|ctrlp_key_loop|..............为多字节输入开启输入事件循环。 |ctrlp_key_loop|..............为多字节输入开启输入事件循环。
|ctrlp_prompt_mappings|.......改变提示符面板内部的按键绑定。 |ctrlp_prompt_mappings|.......改变提示符面板内部的按键绑定。
@ -76,6 +76,7 @@ OPTIONS *ctrlp-options*
|ctrlp_open_single_match|.....当只有一个候选时自动接受。 |ctrlp_open_single_match|.....当只有一个候选时自动接受。
|ctrlp_brief_prompt|..........提示符为空的时候使用<bs>退出 CtrlP。 |ctrlp_brief_prompt|..........提示符为空的时候使用<bs>退出 CtrlP。
|ctrlp_match_current_file|....在匹配条目中包含当前文件。 |ctrlp_match_current_file|....在匹配条目中包含当前文件。
|ctrlp_types|.................內建类型的名称。
最近最多使用模式: 最近最多使用模式:
|ctrlp_mruf_max|..............记录的最近最多使用的最大数据。 |ctrlp_mruf_max|..............记录的最近最多使用的最大数据。
@ -154,6 +155,7 @@ OPTIONS *ctrlp-options*
结果集的最大数目: 结果集的最大数目:
results:{n} - 列出最多 {n} 条结果 (默认: 和最大高度同步). results:{n} - 列出最多 {n} 条结果 (默认: 和最大高度同步).
0代表没有限制。
注意: 当一个设置项没有被设置时,将会使用默认值。 注意: 当一个设置项没有被设置时,将会使用默认值。
@ -254,7 +256,7 @@ OPTIONS *ctrlp-options*
考虑清楚。 考虑清楚。
*'g:ctrlp_custom_ignore'* *'g:ctrlp_custom_ignore'*
作为对 |'wildignore'| 的补充用来设置你只是想在CtrlP中隐藏的文件和目录。使用正 作为对 |'wildignore'| 和 |g:ctrlp_show_hidden| 的补充用来设置你只是想在CtrlP中隐藏的文件和目录。使用正
则表达式来指定匹配模式: > 则表达式来指定匹配模式: >
let g:ctrlp_custom_ignore = '' let g:ctrlp_custom_ignore = ''
< <
@ -439,13 +441,19 @@ OPTIONS *ctrlp-options*
*'g:ctrlp_match_current_file'* *'g:ctrlp_match_current_file'*
在匹配条目中包含当前文件: 在匹配条目中包含当前文件: >
let g:ctrlp_match_current_file = 1 let g:ctrlp_match_current_file = 1
默认情况下,当前文件不包含在列表中。 默认情况下,当前文件不包含在列表中。
注意: 当使用 |g:ctrlp_match_func| 时不会应用这个选项。 注意: 当使用 |g:ctrlp_match_func| 时不会应用这个选项。
*'g:ctrlp_types'*
通过设置这个列表变量的值来定制核心类型: >
let g:ctrlp_types = ['mru', 'fil']
类型默认为: >
let g:ctrlp_types = ['fil', 'buf', 'mru'].
*'g:ctrlp_abbrev'* *'g:ctrlp_abbrev'*
定义可以在提示面包内被扩展(内部的或者可见的)的输入缩写: > 定义可以在提示面包内被扩展(内部的或者可见的)的输入缩写: >
@ -817,7 +825,8 @@ MRU mode options:~
:CtrlP [起始目录] :CtrlP [起始目录]
用文件搜索模式打开CtrlP。 用文件搜索模式打开CtrlP。
如果没有给定参数,|g:ctrlp_working_path_mode| 会被用来决定起始目录。 如果没有给定参数,|g:ctrlp_working_path_mode| 会被用来决定起始目录。临时覆盖
这个参数 的方法见 |:CtrlPCurFile| 和 |:CtrlPCurWD| 。
在输入时你可以使用 <tab> 自动补全[起始目录]。 在输入时你可以使用 <tab> 自动补全[起始目录]。
@ -825,6 +834,16 @@ MRU mode options:~
:CtrlPBuffer :CtrlPBuffer
用缓冲区搜索模式打开CtrlP。 用缓冲区搜索模式打开CtrlP。
*:CtrlPCurFile*
:CtrlPCurFile
行为类似变量 |g:ctrlp_working_path_mode| = '' 时执行 |:CtrlP| ,忽略这个变量
现在的值。
*:CtrlPCurWD*
:CtrlPCurWD
行为类似变量 |g:ctrlp_working_path_mode| = '' 时执行 |:CtrlP| ,忽略这个变量
现在的值。
*:CtrlPMRU* *:CtrlPMRU*
:CtrlPMRU :CtrlPMRU
用最近最多使用模式打开CtrlP。 用最近最多使用模式打开CtrlP。
@ -1259,7 +1278,8 @@ h) 使用?打开帮助文件。
缓冲标签模式选项:~ 缓冲标签模式选项:~
*'g:ctrlp_buftag_ctags_bin'* *'g:ctrlp_buftag_ctags_bin'*
如果ctags没有在环境变量中配置使用该选项来指定它的位置: > 如果ctags没有在环境变量中配置或者一个二进制ctags文件存在于
/opt/local/bin 或 /usr/local/bin使用该选项来指定它的位置: >
let g:ctrlp_buftag_ctags_bin = '' let g:ctrlp_buftag_ctags_bin = ''
< <
@ -1411,6 +1431,31 @@ Git 仓库: https://github.com/ctrlpvim/ctrlp.vim
=============================================================================== ===============================================================================
更新日志 *ctrlp-changelog* 更新日志 *ctrlp-changelog*
* 新选项 |g:ctrlp_custom_tag_files| 用来指定自定义的标签文件。
* 设置 g:ctrlp_match_window 为0来不限制窗口大小
Before 2016/11/28~
+ 新命令: |YankLine()| 来复制整个文件。
+ 新选项: |g:ctrlp_types| 来选择內建类型。
+ 新特性: 异步在新线程中调用 |g:ctrlp_user_command| 。 设置
|g:user_command_async| 为1来启用。
+ 为 delphi, rust 和 golang提供buffertag支持。
+ 新选项: |g:ctrlp_brief_prompt|,
|g:match_current_file|,
|g:ctrlp_compare_lim|.
+ 新功能: 自动忽略扩展。
+ 为 ant, tex, dosbatch, matlab 和 vhdl提供buffertag支持。
+ 新选项 |g:ctrlp_line_prefix| 来结合第三方插件。
+ 新选项 |g:open_single_match| 在 matches 中打开单个文件。
+ 添加启动方式 <plug>(ctrlp) 。
+ 接受 bang for CtrlPBookmarkDirAdd 来避免确认。
+ 处理像 "g:ctrlp_TYPE_MODE" 大小写混合的变量名。
例如: let g:ctrlp_path_sort
+ 新选项: |g:ctrlp_custom_ancestors|
在2014/08/08之前~
+ 新的支持高亮的缓冲区浏览模式 (建议 |+conceal|) + 新的支持高亮的缓冲区浏览模式 (建议 |+conceal|)
+ 新选项: |g:ctrlp_bufname_mod|, + 新选项: |g:ctrlp_bufname_mod|,
|g:ctrlp_bufpath_mod| |g:ctrlp_bufpath_mod|

View File

@ -1,4 +1,4 @@
goyo.txt goyo Last change: April 1 2017 goyo.txt goyo Last change: April 2 2017
GOYO - TABLE OF CONTENTS *goyo* *goyo-toc* GOYO - TABLE OF CONTENTS *goyo* *goyo-toc*
============================================================================== ==============================================================================
@ -12,7 +12,7 @@ GOYO - TABLE OF CONTENTS *goyo* *goyo-to
Pros. Pros.
License License
GOYO.VIM (고요) *goyo* GOYO.VIM (고요) *goyo-vim*
============================================================================== ==============================================================================
Distraction-free writing in Vim. Distraction-free writing in Vim.

View File

@ -4,19 +4,26 @@ sudo: false
install: install:
- git clone --depth=1 https://github.com/thinca/vim-themis /tmp/themis - git clone --depth=1 https://github.com/thinca/vim-themis /tmp/themis
- git clone https://github.com/vim/vim $HOME/vim - (if ! test -d $HOME/vim-$VIM_VERSION/bin; then
- (if ! test -d $HOME/vim-7.4/bin; then cd $HOME/vim && git checkout . && git checkout v7.4 && ./configure --prefix=$HOME/vim-7.4 && make && make install; fi) git clone https://github.com/vim/vim $HOME/vim &&
- (if ! test -d $HOME/vim-7.3/bin; then cd $HOME/vim && git checkout . && git checkout v7.3 && ./configure --prefix=$HOME/vim-7.3 && make && make install; fi) cd $HOME/vim &&
- (if ! test -d $HOME/vim-7.2.051/bin; then cd $HOME/vim && git checkout . && git checkout v7.2.051 && ./configure --prefix=$HOME/vim-7.2.051 && make && make install; fi) git checkout v$VIM_VERSION &&
./configure --prefix=$HOME/vim-$VIM_VERSION &&
make &&
make install;
fi)
cache: cache:
directories: directories:
- $HOME/vim-7.4 - $HOME/vim-$VIM_VERSION
- $HOME/vim-7.3
- $HOME/vim-7.2.051 env:
- VIM_VERSION=8.0.0000
- VIM_VERSION=7.4
- VIM_VERSION=7.3
- VIM_VERSION=7.2.051
script: script:
- export PATH=$HOME/vim-$VIM_VERSION/bin:$PATH
- vim --version
- /tmp/themis/bin/themis --reporter spec - /tmp/themis/bin/themis --reporter spec
- PATH=$HOME/vim-7.4/bin/:$PATH /tmp/themis/bin/themis --reporter spec
- PATH=$HOME/vim-7.3/bin/:$PATH /tmp/themis/bin/themis --reporter spec
- PATH=$HOME/vim-7.2.051/bin/:$PATH /tmp/themis/bin/themis --reporter spec

View File

@ -65,7 +65,7 @@ This software is released under the MIT License, see LICENSE.
git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim
### Vundle (https://github.com/gmarik/Vundle.vim) ### Vundle (https://github.com/VundleVim/Vundle.vim)
1. Add the following configuration to your `.vimrc`. 1. Add the following configuration to your `.vimrc`.
Plugin 'itchyny/lightline.vim' Plugin 'itchyny/lightline.vim'

View File

@ -92,7 +92,7 @@ endfunction
" same as :exec cmd but eventignore=all is set for the duration " same as :exec cmd but eventignore=all is set for the duration
function! nerdtree#exec(cmd) function! nerdtree#exec(cmd)
let old_ei = &ei let old_ei = &ei
set ei=all set ei=BufEnter,BufLeave,VimEnter
exec a:cmd exec a:cmd
let &ei = old_ei let &ei = old_ei
endfunction endfunction

View File

@ -58,15 +58,15 @@ their script to find them.
At the time of this writing, syntastic has checking plugins for ACPI At the time of this writing, syntastic has checking plugins for ACPI
Source Language, ActionScript, Ada, Ansible configurations, API Blueprint, Source Language, ActionScript, Ada, Ansible configurations, API Blueprint,
AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C, AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C, C++,
C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, C#, Cabal, Chef, CMake, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata,
GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript,
JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, JSON, JSX, Julia, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua,
MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl Markdown, MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl,
POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug (formerly Perl POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug
Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG, (formerly Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax
reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity, NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity,
Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL,
Vim help, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models, z80, Vim help, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, YANG data models, z80,
Zope page templates, and Zsh. See the [manual][checkers] for details about the Zope page templates, and Zsh. See the [manual][checkers] for details about the

View File

@ -8,6 +8,37 @@ set cpo&vim
" Public functions {{{1 " Public functions {{{1
function! syntastic#preprocess#bandit(errors) abort " {{{2
let out = []
let json = s:_decode_JSON(join(a:errors, ''))
if type(json) == type({}) && has_key(json, 'results') && type(json['results']) == type([])
for issue in json['results']
if type(issue) == type({})
try
call add(out,
\ issue['filename'] . ':' .
\ issue['line_number'] . ':' .
\ { 'LOW': 'I', 'MEDIUM': 'W', 'HIGH': 'E' }[issue['issue_severity']] . ':' .
\ issue['test_id'][1:] . ':' .
\ issue['issue_text'] .
\ ' [' . issue['test_name'] . '] (confidence: ' . issue['issue_confidence'] . ')')
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue))
let out = []
break
endtry
else
call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue))
endif
endfor
else
call syntastic#log#warn('checker python/bandit: unrecognized error format (crashed checker?)')
endif
return out
endfunction " }}}2
function! syntastic#preprocess#cabal(errors) abort " {{{2 function! syntastic#preprocess#cabal(errors) abort " {{{2
let out = [] let out = []
let star = 0 let star = 0
@ -435,7 +466,7 @@ echomsg string(out)
endfunction " }}}2 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, ''\v^((ERROR|WARNING): )?\zs(\([^)]+\))\s(.+)$'', ''\4 \3'', "")')
endfunction " }}}2 endfunction " }}}2
function! syntastic#preprocess#validator(errors) abort " {{{2 function! syntastic#preprocess#validator(errors) abort " {{{2

View File

@ -23,6 +23,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang*
C++......................................|syntastic-checkers-cpp| C++......................................|syntastic-checkers-cpp|
Cabal....................................|syntastic-checkers-cabal| Cabal....................................|syntastic-checkers-cabal|
Chef.....................................|syntastic-checkers-chef| Chef.....................................|syntastic-checkers-chef|
CMake....................................|syntastic-checkers-cmake|
COBOL....................................|syntastic-checkers-cobol| COBOL....................................|syntastic-checkers-cobol|
Coco.....................................|syntastic-checkers-co| Coco.....................................|syntastic-checkers-co|
CoffeeScript.............................|syntastic-checkers-coffee| CoffeeScript.............................|syntastic-checkers-coffee|
@ -58,6 +59,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang*
Java.....................................|syntastic-checkers-java| Java.....................................|syntastic-checkers-java|
JavaScript...............................|syntastic-checkers-javascript| JavaScript...............................|syntastic-checkers-javascript|
JSON.....................................|syntastic-checkers-json| JSON.....................................|syntastic-checkers-json|
Julia....................................|syntastic-checkers-julia|
LESS.....................................|syntastic-checkers-less| LESS.....................................|syntastic-checkers-less|
Lex......................................|syntastic-checkers-lex| Lex......................................|syntastic-checkers-lex|
@ -530,12 +532,14 @@ The following checkers are available for C (filetype "c"):
3. ClangCheck...............|syntastic-c-clang_check| 3. ClangCheck...............|syntastic-c-clang_check|
4. Clang-Tidy...............|syntastic-c-clang_tidy| 4. Clang-Tidy...............|syntastic-c-clang_tidy|
5. Cppcheck.................|syntastic-c-cppcheck| 5. Cppcheck.................|syntastic-c-cppcheck|
6. GCC......................|syntastic-c-gcc| 6. cppclean.................|syntastic-c-cppclean|
7. make.....................|syntastic-c-make| 7. Flawfinder...............|syntastic-c-flawfinder|
8. OClint...................|syntastic-c-oclint| 8. GCC......................|syntastic-c-gcc|
9. PC-Lint..................|syntastic-c-pc_lint| 9. make.....................|syntastic-c-make|
10. Sparse..................|syntastic-c-sparse| 10. OClint..................|syntastic-c-oclint|
11. Splint..................|syntastic-c-splint| 11. PC-Lint.................|syntastic-c-pc_lint|
12. Sparse..................|syntastic-c-sparse|
13. Splint..................|syntastic-c-splint|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
1. AVR-GCC *syntastic-c-avrgcc* 1. AVR-GCC *syntastic-c-avrgcc*
@ -693,7 +697,57 @@ one option per line (cf. |syntastic-config-files|).
See also: |syntastic-cpp-cppcheck|. See also: |syntastic-cpp-cppcheck|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6. GCC *syntastic-c-gcc* 6. cppclean *syntastic-c-cppclean*
Name: cppclean
Maintainer: LCD 47 <lcd047@gmail.com>
"cppclean" attempts to find problems in C++ source that slow development in
large code bases, for example various forms of unused code. See the project's
page at GitHub for more information:
https://github.com/myint/cppclean
Installation~
Install it with "pip": >
pip install cppclean
<
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
See also: |syntastic-cpp-cppclean|.
------------------------------------------------------------------------------
7. Flawfinder *syntastic-c-flawfinder*
Name: flawfinder
Maintainer: LCD 47 <lcd047@gmail.com>
"Flawfinder" scans C/C++ source code for possible security weaknesses. See the
project's page for more information:
https://www.dwheeler.com/flawfinder
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
Additionally:
*'g:syntastic_c_flawfinder_thres'*
Type: integer
Default: 3
Error threshold. Policy violations with a severity above this value are
highlighted as errors, the others are considered warnings by syntastic.
See also: |syntastic-cpp-flawfinder|.
------------------------------------------------------------------------------
8. GCC *syntastic-c-gcc*
Name: gcc Name: gcc
Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com> Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com>
@ -790,7 +844,7 @@ executable.
See also: |syntastic-cpp-gcc|. See also: |syntastic-cpp-gcc|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
7. make *syntastic-c-make* 9. make *syntastic-c-make*
Name: make Name: make
Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com> Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com>
@ -801,7 +855,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
8. OClint *syntastic-c-oclint* 10. OClint *syntastic-c-oclint*
Name: oclint Name: oclint
Maintainer: "UnCO" Lin <undercooled@lavabit.com> Maintainer: "UnCO" Lin <undercooled@lavabit.com>
@ -840,7 +894,7 @@ Config files pointed to by 'g:syntastic_oclint_config_file' are then ignored.
See also: |syntastic-cpp-oclint|. See also: |syntastic-cpp-oclint|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
9. PC-Lint *syntastic-c-pc_lint* 11. PC-Lint *syntastic-c-pc_lint*
Name: pc_lint Name: pc_lint
Maintainer: Steve Bragg <steve@empresseffects.com> Maintainer: Steve Bragg <steve@empresseffects.com>
@ -867,7 +921,7 @@ current directory and in parent directories; first such file found is used.
See also: |syntastic-cpp-pc_lint|. See also: |syntastic-cpp-pc_lint|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
10. Sparse *syntastic-c-sparse* 12. Sparse *syntastic-c-sparse*
Name: sparse Name: sparse
Maintainer: Daniel Walker <dwalker@fifo99.com> Maintainer: Daniel Walker <dwalker@fifo99.com>
@ -899,7 +953,7 @@ your vimrc: >
This allows "Sparse" to read "GCC"'s private include files. This allows "Sparse" to read "GCC"'s private include files.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
11. Splint *syntastic-c-splint* 13. Splint *syntastic-c-splint*
Name: splint Name: splint
Maintainer: LCD 47 <lcd047@gmail.com> Maintainer: LCD 47 <lcd047@gmail.com>
@ -955,11 +1009,13 @@ The following checkers are available for C++ (filetype "cpp"):
2. ClangCheck...............|syntastic-cpp-clang_check| 2. ClangCheck...............|syntastic-cpp-clang_check|
3. Clang-Tidy...............|syntastic-cpp-clang_tidy| 3. Clang-Tidy...............|syntastic-cpp-clang_tidy|
4. Cppcheck.................|syntastic-cpp-cppcheck| 4. Cppcheck.................|syntastic-cpp-cppcheck|
5. Cpplint..................|syntastic-cpp-cpplint| 5. cppclean.................|syntastic-cpp-cppclean|
6. GCC......................|syntastic-cpp-gcc| 6. Cpplint..................|syntastic-cpp-cpplint|
7. OClint...................|syntastic-cpp-oclint| 7. Flawfinder...............|syntastic-cpp-flawfinder|
8. PC-Lint..................|syntastic-cpp-pc_lint| 8. GCC......................|syntastic-cpp-gcc|
9. Vera++...................|syntastic-cpp-verapp| 9. OClint...................|syntastic-cpp-oclint|
10. PC-Lint.................|syntastic-cpp-pc_lint|
11. Vera++..................|syntastic-cpp-verapp|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
1. AVR-GCC *syntastic-cpp-avrgcc* 1. AVR-GCC *syntastic-cpp-avrgcc*
@ -1103,7 +1159,31 @@ one option per line (cf. |syntastic-config-files|).
See also: |syntastic-c-cppcheck|. See also: |syntastic-c-cppcheck|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
5. Cpplint *syntastic-cpp-cpplint* 5. cppclean *syntastic-cpp-cppclean*
Name: cppclean
Maintainer: LCD 47 <lcd047@gmail.com>
"cppclean" attempts to find problems in C++ source that slow development in
large code bases, for example various forms of unused code. See the project's
page at GitHub for more information:
https://github.com/myint/cppclean
Installation~
Install it with "pip": >
pip install cppclean
<
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
See also: |syntastic-c-cppclean|.
------------------------------------------------------------------------------
6. Cpplint *syntastic-cpp-cpplint*
Name: cpplint Name: cpplint
Maintainer: LCD 47 <lcd047@gmail.com> Maintainer: LCD 47 <lcd047@gmail.com>
@ -1139,7 +1219,33 @@ However, if your "cpplint" was installed with "pip", the script's name is
let g:syntastic_cpp_cpplint_exec = "cpplint" let g:syntastic_cpp_cpplint_exec = "cpplint"
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6. GCC *syntastic-cpp-gcc* 7. Flawfinder *syntastic-cpp-flawfinder*
Name: flawfinder
Maintainer: LCD 47 <lcd047@gmail.com>
"Flawfinder" scans C/C++ source code for possible security weaknesses. See the
project's page for more information:
https://www.dwheeler.com/flawfinder
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
Additionally:
*'g:syntastic_cpp_flawfinder_thres'*
Type: integer
Default: 3
Error threshold. Policy violations with a severity above this value are
highlighted as errors, the others are considered warnings by syntastic.
See also: |syntastic-c-flawfinder|.
------------------------------------------------------------------------------
8. GCC *syntastic-cpp-gcc*
Name: gcc Name: gcc
Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com> Maintainer: Gregor Uhlenheuer <kongo2002@gmail.com>
@ -1236,7 +1342,7 @@ executable.
See also: |syntastic-c-gcc|. See also: |syntastic-c-gcc|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
7. OClint *syntastic-cpp-oclint* 9. OClint *syntastic-cpp-oclint*
Name: oclint Name: oclint
Maintainer: "UnCO" Lin <undercooled@lavabit.com> Maintainer: "UnCO" Lin <undercooled@lavabit.com>
@ -1276,7 +1382,7 @@ Config files pointed to by 'g:syntastic_oclint_config_file' are then ignored.
See also: |syntastic-c-oclint|. See also: |syntastic-c-oclint|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
8. PC-Lint *syntastic-cpp-pc_lint* 10. PC-Lint *syntastic-cpp-pc_lint*
Name: pc_lint Name: pc_lint
Maintainer: Steve Bragg <steve@empresseffects.com> Maintainer: Steve Bragg <steve@empresseffects.com>
@ -1303,7 +1409,7 @@ current directory and in parent directories; first such file found is used.
See also: |syntastic-c-pc_lint|. See also: |syntastic-c-pc_lint|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
9. Vera++ *syntastic-cpp-verapp* 11. Vera++ *syntastic-cpp-verapp*
Name: verapp Name: verapp
Maintainer: Lucas Verney <phyks@phyks.me> Maintainer: Lucas Verney <phyks@phyks.me>
@ -1381,6 +1487,34 @@ You probably also need a plugin to set |filetype| for Chef files, such as
https://github.com/dougireton/vim-chef https://github.com/dougireton/vim-chef
==============================================================================
SYNTAX CHECKERS FOR CMAKE *syntastic-checkers-cmake*
The following checkers are available for CMake (filetype "cmake"):
1. cmakelint................|syntastic-cmake-cmakelint|
------------------------------------------------------------------------------
1. cmakelint *syntastic-cmake-cmakelint*
Name: cmakelint
Maintainer: LCD 47 <lcd047@gmail.com>
"cmakelint" is a style checker for "CMake" files (https://cmake.org/).
See the project's page at GitHub more information:
https://github.com/richq/cmake-lint
Installation~
Install it with "pip": >
pip install cmakelint
<
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
============================================================================== ==============================================================================
SYNTAX CHECKERS FOR COBOL *syntastic-checkers-cobol* SYNTAX CHECKERS FOR COBOL *syntastic-checkers-cobol*
@ -2244,10 +2378,37 @@ SYNTAX CHECKERS FOR GETTEXT PO *syntastic-checkers-po*
The following checkers are available for gettext .po files (filetype "po"): The following checkers are available for gettext .po files (filetype "po"):
1. msgfmt...................|syntastic-po-msgfmt| 1. Dennis...................|syntastic-po-dennis|
2. msgfmt...................|syntastic-po-msgfmt|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
1. msgfmt *syntastic-po-msgfmt* 1. Dennis *syntastic-po-dennis*
Name: dennis
Maintainer: LCD 47 <lcd047@gmail.com>
"Dennis" is a set of utilities for working with gettext Portable Object
(http://www.gnu.org/software/gettext/manual/html_node/PO-Files.html)
translation files:
https://github.com/willkg/dennis/
See the program's manual for further details:
http://dennis.readthedocs.io/en/latest/linting.html
Installation~
Install it with "pip": >
pip install dennis
<
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------
2. msgfmt *syntastic-po-msgfmt*
Name: msgfmt Name: msgfmt
Maintainer: Ryo Okubo <syucream1031@gmail.com> Maintainer: Ryo Okubo <syucream1031@gmail.com>
@ -3591,6 +3752,44 @@ Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
==============================================================================
SYNTAX CHECKERS FOR JULIA *syntastic-checkers-julia*
The following checkers are available for Julia (filetype "julia"):
1. lint.....................|syntastic-julia-lint|
------------------------------------------------------------------------------
1. lint *syntastic-julia-lint*
Name: lint
Maintainer: LCD 47 <lcd047@gmail.com>
This is a checker for Julia files (https://julialang.org/), using the Julia
package "Lint". See the package's documentation for more information:
http://lintjl.readthedocs.io/
Installation~
You need to install Julia itself, and the package "Lint". You can install
"Lint" from the Julia package manager, with the command: >
Pkg.add("Lint")
<
Checker Options~
This checker doesn't call the "makeprgBuild()" function, and thus it ignores
the usual 'g:syntastic_julia_lint_<option>' variables. The only exception is
'g:syntastic_julia_lint_exec', which can still be used to override the "julia"
executable.
Note~
You probably also need a plugin to set |filetype| for Julia files, such as
"julia-vim":
https://github.com/JuliaEditorSupport/julia-vim
============================================================================== ==============================================================================
SYNTAX CHECKERS FOR LESS *syntastic-checkers-less* SYNTAX CHECKERS FOR LESS *syntastic-checkers-less*
@ -4629,20 +4828,49 @@ SYNTAX CHECKERS FOR PYTHON *syntastic-checkers-python*
The following checkers are available for Python (filetype "python"): The following checkers are available for Python (filetype "python"):
1. flake8...................|syntastic-python-flake8| 1. Bandit...................|syntastic-python-bandit|
2. Frosted..................|syntastic-python-frosted| 2. flake8...................|syntastic-python-flake8|
3. mypy.....................|syntastic-python-mypy| 3. Frosted..................|syntastic-python-frosted|
4. Prospector...............|syntastic-python-prospector| 4. mypy.....................|syntastic-python-mypy|
5. py3kwarn.................|syntastic-python-py3kwarn| 5. Prospector...............|syntastic-python-prospector|
6. pycodestyle..............|syntastic-python-pycodestyle| 6. py3kwarn.................|syntastic-python-py3kwarn|
7. pydocstyle...............|syntastic-python-pydocstyle| 7. pycodestyle..............|syntastic-python-pycodestyle|
8. Pyflakes.................|syntastic-python-pyflakes| 8. pydocstyle...............|syntastic-python-pydocstyle|
9. Pylama...................|syntastic-python-pylama| 9. Pyflakes.................|syntastic-python-pyflakes|
10. Pylint..................|syntastic-python-pylint| 10. Pylama..................|syntastic-python-pylama|
11. python..................|syntastic-python-python| 11. Pylint..................|syntastic-python-pylint|
12. python..................|syntastic-python-python|
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
1. flake8 *syntastic-python-flake8* 1. Bandit *syntastic-python-bandit*
Name: bandit
Maintainer: LCD 47 <lcd047@gmail.com>
"Bandit" is an AST-based static analyzer for Python from OpenStack Security
Group (http://openstack.org). See the project's official documentation for
details:
https://wiki.openstack.org/wiki/Security/Projects/Bandit
Installation~
Install it with "pip": >
pip install bandit
<
Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.
Note~
In order to check all files in a project, rather than the current file: >
let g:syntastic_python_bandit_fname = ['/path/to/project']
let g:syntastic_python_bandit_args = '-r'
<
------------------------------------------------------------------------------
2. flake8 *syntastic-python-flake8*
Name: flake8 Name: flake8
Maintainers: Sylvain Soliman <Sylvain.Soliman+git@gmail.com> Maintainers: Sylvain Soliman <Sylvain.Soliman+git@gmail.com>
@ -4662,7 +4890,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2. Frosted *syntastic-python-frosted* 3. Frosted *syntastic-python-frosted*
Name: frosted Name: frosted
Maintainer: LCD 47 <lcd047@gmail.com> Maintainer: LCD 47 <lcd047@gmail.com>
@ -4678,7 +4906,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
3. mypy *syntastic-python-mypy* 4. mypy *syntastic-python-mypy*
Name: mypy Name: mypy
Maintainer: Russ Hewgill <Russ.Hewgill@gmail.com> Maintainer: Russ Hewgill <Russ.Hewgill@gmail.com>
@ -4694,7 +4922,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
4. Prospector *syntastic-python-prospector* 5. Prospector *syntastic-python-prospector*
Name: prospector Name: prospector
Maintainer: LCD 47 <lcd047@gmail.com> Maintainer: LCD 47 <lcd047@gmail.com>
@ -4717,7 +4945,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
5. py3kwarn *syntastic-python-py3kwarn* 6. py3kwarn *syntastic-python-py3kwarn*
Name: py3kwarn Name: py3kwarn
Author: Liam Curry <liam@curry.name> Author: Liam Curry <liam@curry.name>
@ -4733,7 +4961,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
6. pycodestyle *syntastic-python-pycodestyle* 7. pycodestyle *syntastic-python-pycodestyle*
Name: pycodestyle Name: pycodestyle
Maintainer: LCD 47 <lcd047@gmail.com> Maintainer: LCD 47 <lcd047@gmail.com>
@ -4750,7 +4978,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
7. pydocstyle *syntastic-python-pydocstyle* 8. pydocstyle *syntastic-python-pydocstyle*
Name: pydocstyle Name: pydocstyle
Maintainer: LCD 47 <lcd047@gmail.com> Maintainer: LCD 47 <lcd047@gmail.com>
@ -4768,7 +4996,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
8. Pyflakes *syntastic-python-pyflakes* 9. Pyflakes *syntastic-python-pyflakes*
Name: pyflakes Name: pyflakes
Authors: Martin Grenfell <martin.grenfell@gmail.com> Authors: Martin Grenfell <martin.grenfell@gmail.com>
@ -4786,7 +5014,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
9. Pylama *syntastic-python-pylama* 10. Pylama *syntastic-python-pylama*
Name: pylama Name: pylama
Maintainer: LCD 47 <lcd047@gmail.com> Maintainer: LCD 47 <lcd047@gmail.com>
@ -4812,7 +5040,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
10. Pylint *syntastic-python-pylint* 11. Pylint *syntastic-python-pylint*
Name: pylint Name: pylint
Author: Parantapa Bhattacharya <parantapa@gmail.com> Author: Parantapa Bhattacharya <parantapa@gmail.com>
@ -4842,7 +5070,7 @@ recognise any messages. Example: >
\ '--msg-template="{path}:{line}:{column}:{C}: [{symbol} {msg_id}] {msg}"' \ '--msg-template="{path}:{line}:{column}:{C}: [{symbol} {msg_id}] {msg}"'
< <
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
11. python *syntastic-python-python* 12. python *syntastic-python-python*
Name: python Name: python
Maintainer: LCD 47 <lcd047@gmail.com> Maintainer: LCD 47 <lcd047@gmail.com>

View File

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

View File

@ -19,6 +19,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'c': ['gcc'], \ 'c': ['gcc'],
\ 'cabal': ['cabal'], \ 'cabal': ['cabal'],
\ 'chef': ['foodcritic'], \ 'chef': ['foodcritic'],
\ 'cmake': ['cmakelint'],
\ 'co': ['coco'], \ 'co': ['coco'],
\ 'cobol': ['cobc'], \ 'cobol': ['cobc'],
\ 'coffee': ['coffee', 'coffeelint'], \ 'coffee': ['coffee', 'coffeelint'],
@ -50,6 +51,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'java': ['javac'], \ 'java': ['javac'],
\ 'javascript': ['jshint', 'jslint'], \ 'javascript': ['jshint', 'jslint'],
\ 'json': ['jsonlint', 'jsonval'], \ 'json': ['jsonlint', 'jsonval'],
\ 'julia': [],
\ 'less': ['lessc'], \ 'less': ['lessc'],
\ 'lex': ['flex'], \ 'lex': ['flex'],
\ 'limbo': ['limbo'], \ 'limbo': ['limbo'],

View File

@ -0,0 +1,40 @@
"============================================================================
"File: cppclean.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_c_cppclean_checker')
finish
endif
let g:loaded_syntastic_c_cppclean_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_cppclean_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'cppclean' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,61 @@
"============================================================================
"File: flawfinder.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_c_flawfinder_checker')
finish
endif
let g:loaded_syntastic_c_flawfinder_checker = 1
if !exists('g:syntastic_c_flawfinder_sort')
let g:syntastic_c_flawfinder_sort = 1
endif
if !exists('g:syntastic_c_flawfinder_thres')
let g:syntastic_c_flawfinder_thres = 3
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_flawfinder_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m^(\S\+)\s\+\zs\S\+\ze:')
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_c_flawfinder_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '--columns --dataonly --singleline --quiet' })
let errorformat = '%f:%l:%c: [%n] %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0] })
for e in loclist
let e['type'] = e['nr'] < g:syntastic_{self.getFiletype()}_flawfinder_thres ? 'W' : 'E'
let e['nr'] = 0
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'c',
\ 'name': 'flawfinder' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,40 @@
"============================================================================
"File: cmakelint.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_cmake_cmakelint_checker')
finish
endif
let g:loaded_syntastic_cmake_cmakelint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cmake_cmakelint_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%f:%l: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cmake',
\ 'name': 'cmakelint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,22 @@
"============================================================================
"File: cppclean.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: Benjamin Bannier <bbannier 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_cpp_cppclean_checker')
finish
endif
let g:loaded_syntastic_cpp_cppclean_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'cppclean',
\ 'redirect': 'c/cppclean'})
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,26 @@
"============================================================================
"File: flawfinder.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: Benjamin Bannier <bbannier 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_cpp_flawfinder_checker')
finish
endif
let g:loaded_syntastic_cpp_flawfinder_checker = 1
if !exists('g:syntastic_cpp_flawfinder_thres')
let g:syntastic_cpp_flawfinder_thres = 3
endif
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cpp',
\ 'name': 'flawfinder',
\ 'redirect': 'c/flawfinder'})
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -30,7 +30,10 @@ function! SyntaxCheckers_dart_dartanalyzer_GetHighlightRegex(error)
endfunction endfunction
function! SyntaxCheckers_dart_dartanalyzer_GetLocList() dict function! SyntaxCheckers_dart_dartanalyzer_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--machine' }) if !exists('s:format_machine')
let s:format_machine = syntastic#util#versionIsAtLeast(self.getVersion(), [1, 23]) ? '--format=machine' : '--machine'
endif
let makeprg = self.makeprgBuild({ 'args_after': s:format_machine })
" Machine readable format looks like: " Machine readable format looks like:
" SEVERITY|TYPE|ERROR_CODE|FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE " SEVERITY|TYPE|ERROR_CODE|FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE

View File

@ -0,0 +1,51 @@
"============================================================================
"File: 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_julia_lint_checker')
finish
endif
let g:loaded_syntastic_julia_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_julia_lint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m^\S\+\ze:')
return term !=# '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_julia_lint_IsAvailable() dict
return
\ executable(self.getExec()) &&
\ syntastic#util#system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('import Lint')) ==# '' &&
\ v:shell_error == 0
endfunction
function! SyntaxCheckers_julia_lint_GetLocList() dict
let buf = bufnr('')
let makeprg = self.getExecEscaped() . ' -e ' . syntastic#util#shescape('using Lint; display(filter(err -> !isinfo(err), lintfile("' . escape(bufname(buf), '\"') . '")))')
let errorformat = '%f:%l %t%n %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'julia',
\ 'name': 'lint',
\ 'exec': 'julia' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -1,6 +1,6 @@
"============================================================================ "============================================================================
"File: php.vim "File: php.vim
"Description: Syntax checking plugin for syntastic.vim "Description: Syntax checking plugin for syntastic
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com> "Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
"License: This program is free software. It comes without any warranty, "License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute " to the extent permitted by applicable law. You can redistribute
@ -26,7 +26,7 @@ endfunction
function! SyntaxCheckers_php_php_GetLocList() dict function! SyntaxCheckers_php_php_GetLocList() dict
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'args': '-d error_reporting=E_ALL', \ 'args': '-d error_reporting=E_ALL',
\ 'args_after': '-l -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0' }) \ 'args_after': '-l -d error_log= -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0' })
let errorformat = let errorformat =
\ '%-GNo syntax errors detected in%.%#,'. \ '%-GNo syntax errors detected in%.%#,'.

View File

@ -0,0 +1,43 @@
"============================================================================
"File: dennis.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_po_dennis_checker')
finish
endif
let g:loaded_syntastic_po_dennis_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_po_dennis_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'exe_after': 'lint',
\ 'post_args_after': '--reporter line' })
let errorformat = '%f:%l:%c:%t%n:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'po',
\ 'name': 'dennis',
\ 'exec': 'dennis-cmd' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,54 @@
"============================================================================
"File: bandit
"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_python_bandit_checker')
finish
endif
let g:loaded_syntastic_python_bandit_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_python_bandit_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '--format json',
\ 'tail': '2> ' . syntastic#util#DevNull() })
let errorformat = '%f:%l:%t:%n:%m'
let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' }
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'env': env,
\ 'preprocess': 'bandit',
\ 'returns': [0, 1] })
for e in loclist
if e['type'] ==? 'I'
let e['type'] = 'W'
let e['subtype'] = 'Style'
endif
endfor
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'python',
\ 'name': 'bandit' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -30,8 +30,10 @@ function! SyntaxCheckers_typescript_tslint_GetLocList() dict
\ 'args_after': '--format verbose', \ 'args_after': '--format verbose',
\ 'fname_before': (s:tslint_new ? '' : '-f') }) \ 'fname_before': (s:tslint_new ? '' : '-f') })
" (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter let errorformat =
let errorformat = '%f[%l\, %c]: %m' \ '%EERROR: %f[%l\, %c]: %m,' .
\ '%WWARNING: %f[%l\, %c]: %m,' .
\ '%E%f[%l\, %c]: %m'
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,

View File

@ -36,8 +36,14 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item) " {{{1
endfunction " }}}1 endfunction " }}}1
function! SyntaxCheckers_vim_vimlint_IsAvailable() dict " {{{1 function! SyntaxCheckers_vim_vimlint_IsAvailable() dict " {{{1
let vimlparser = globpath(&runtimepath, 'autoload/vimlparser.vim', 1) try
let vimlint = globpath(&runtimepath, 'autoload/vimlint.vim', 1) " Vim 7.2-051 and later
let vimlparser = globpath(&runtimepath, 'autoload/vimlparser.vim', 1)
let vimlint = globpath(&runtimepath, 'autoload/vimlint.vim', 1)
catch /\m^Vim\%((\a\+)\)\=:E118/
let vimlparser = globpath(&runtimepath, 'autoload/vimlparser.vim')
let vimlint = globpath(&runtimepath, 'autoload/vimlint.vim')
endtry
call self.log("globpath(&runtimepath, 'autoload/vimlparser.vim', 1) = " . string(vimlparser) . ', ' . call self.log("globpath(&runtimepath, 'autoload/vimlparser.vim', 1) = " . string(vimlparser) . ', ' .
\ "globpath(&runtimepath, 'autoload/vimlint.vim', 1) = " . string(vimlint)) \ "globpath(&runtimepath, 'autoload/vimlint.vim', 1) = " . string(vimlint))
return vimlparser !=# '' && vimlint !=# '' return vimlparser !=# '' && vimlint !=# ''

View File

@ -35,9 +35,15 @@ and you never get any warnings about the file changing outside Vim.
making it like `git add` when called from a work tree file and like making it like `git add` when called from a work tree file and like
`git checkout` when called from the index or a blob in history. `git checkout` when called from the index or a blob in history.
Use `:Gbrowse` to open the current file on GitHub, with optional line Use `:Gbrowse` to open the current file on the web front-end of your favorite
range (try it in visual mode!). If your current repository isn't on hosting provider, with optional line range (try it in visual mode!). Built-in
GitHub, `git instaweb` will be spun up instead. support is provided for `git instaweb`, and plugins are available for popular
providers such as [GitHub][rhubarb.vim], [GitLab][fugitive-gitlab.vim], and
[Bitbucket][fubitive.vim].
[rhubarb.vim]: https://github.com/tpope/vim-rhubarb
[fugitive-gitlab.vim]: https://github.com/shumphrey/fugitive-gitlab.vim
[fubitive.vim]: https://github.com/tommcdo/vim-fubitive
Add `%{fugitive#statusline()}` to `'statusline'` to get an indicator Add `%{fugitive#statusline()}` to `'statusline'` to get an indicator
with the current branch in (surprise!) your statusline. with the current branch in (surprise!) your statusline.

View File

@ -181,7 +181,9 @@ that are part of Git repositories).
to the right or bottom, depending on 'diffopt' and to the right or bottom, depending on 'diffopt' and
the width of the window relative to 'textwidth'. Use the width of the window relative to 'textwidth'. Use
|do| and |dp| and write to the index file to simulate |do| and |dp| and write to the index file to simulate
"git add --patch". "git add --patch". For the three-way diff, there is
also d2o and d3o pulling the hunk to the middle from
the left or the right window, respectively.
*fugitive-:Gsdiff* *fugitive-:Gsdiff*
:Gsdiff [revision] Like |:Gdiff|, but always split horizontally. :Gsdiff [revision] Like |:Gdiff|, but always split horizontally.
@ -232,9 +234,7 @@ that are part of Git repositories).
Upstream providers can be added by installing an Upstream providers can be added by installing an
appropriate Vim plugin. For example, GitHub can be appropriate Vim plugin. For example, GitHub can be
supported by installing rhubarb.vim, available at supported by installing rhubarb.vim, available at
<https://github.com/tpope/vim-rhubarb>. (Native <https://github.com/tpope/vim-rhubarb>.
support for GitHub is currently included, but that is
slated to be removed.)
The hosting provider is determined by looking at the The hosting provider is determined by looking at the
remote for the current or specified branch and falls remote for the current or specified branch and falls

View File

@ -70,6 +70,10 @@ endfunction
let s:git_versions = {} let s:git_versions = {}
function! s:git_command() abort
return get(g:, 'fugitive_git_command', g:fugitive_git_executable)
endfunction
function! fugitive#git_version(...) abort function! fugitive#git_version(...) abort
if !has_key(s:git_versions, g:fugitive_git_executable) if !has_key(s:git_versions, g:fugitive_git_executable)
let s:git_versions[g:fugitive_git_executable] = matchstr(system(g:fugitive_git_executable.' --version'), "\\S\\+\n") let s:git_versions[g:fugitive_git_executable] = matchstr(system(g:fugitive_git_executable.' --version'), "\\S\\+\n")
@ -127,7 +131,12 @@ function! fugitive#extract_git_dir(path) abort
if s:shellslash(a:path) =~# '^fugitive://.*//' if s:shellslash(a:path) =~# '^fugitive://.*//'
return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//') return matchstr(s:shellslash(a:path), '\C^fugitive://\zs.\{-\}\ze//')
endif endif
let root = s:shellslash(simplify(fnamemodify(a:path, ':p:s?[\/]$??'))) if isdirectory(a:path)
let path = fnamemodify(a:path, ':p:s?[\/]$??')
else
let path = fnamemodify(a:path, ':p:h:s?[\/]$??')
endif
let root = s:shellslash(resolve(path))
let previous = "" let previous = ""
while root !=# previous while root !=# previous
if root =~# '\v^//%([^/]+/?)?$' if root =~# '\v^//%([^/]+/?)?$'
@ -179,6 +188,9 @@ function! fugitive#detect(path) abort
let dir = fugitive#extract_git_dir(a:path) let dir = fugitive#extract_git_dir(a:path)
if dir !=# '' if dir !=# ''
let b:git_dir = dir let b:git_dir = dir
if empty(fugitive#buffer().path())
silent! exe haslocaldir() ? 'lcd .' : 'cd .'
endif
endif endif
endif endif
if exists('b:git_dir') if exists('b:git_dir')
@ -374,12 +386,14 @@ endfunction
call s:add_methods('repo',['dir','tree','bare','translate','head']) call s:add_methods('repo',['dir','tree','bare','translate','head'])
function! s:repo_git_command(...) dict abort function! s:repo_git_command(...) dict abort
let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir) let git = s:git_command() . ' --git-dir='.s:shellesc(self.git_dir)
return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'') return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'')
endfunction endfunction
function! s:repo_git_chomp(...) dict abort function! s:repo_git_chomp(...) dict abort
return s:sub(system(call(self.git_command,a:000,self)),'\n$','') let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir)
let output = git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'')
return s:sub(system(output),'\n$','')
endfunction endfunction
function! s:repo_git_chomp_in_tree(...) dict abort function! s:repo_git_chomp_in_tree(...) dict abort
@ -456,7 +470,7 @@ endfunction
call s:add_methods('repo',['dirglob','superglob']) call s:add_methods('repo',['dirglob','superglob'])
function! s:repo_config(conf) dict abort function! s:repo_config(conf) dict abort
return matchstr(system(s:repo().git_command('config').' '.a:conf),"[^\r\n]*") return matchstr(s:repo().git_chomp('config',a:conf),"[^\r\n]*")
endfun endfun
function! s:repo_user() dict abort function! s:repo_user() dict abort
@ -480,9 +494,9 @@ call s:add_methods('repo',['config', 'user', 'aliases'])
function! s:repo_keywordprg() dict abort function! s:repo_keywordprg() dict abort
let args = ' --git-dir='.escape(self.dir(),"\\\"' ") let args = ' --git-dir='.escape(self.dir(),"\\\"' ")
if has('gui_running') && !has('win32') if has('gui_running') && !has('win32')
return g:fugitive_git_executable . ' --no-pager' . args . ' log -1' return s:git_command() . ' --no-pager' . args . ' log -1'
else else
return g:fugitive_git_executable . args . ' show' return s:git_command() . args . ' show'
endif endif
endfunction endfunction
@ -693,7 +707,7 @@ function! s:Git(bang, args) abort
if a:bang if a:bang
return s:Edit('edit', 1, a:args) return s:Edit('edit', 1, a:args)
endif endif
let git = g:fugitive_git_executable let git = s:git_command()
if has('gui_running') && !has('win32') if has('gui_running') && !has('win32')
let git .= ' --no-pager' let git .= ' --no-pager'
endif endif
@ -1211,7 +1225,7 @@ function! s:Merge(cmd, bang, args) abort
\ !empty(s:repo().git_chomp('diff-files', '--diff-filter=U'))) \ !empty(s:repo().git_chomp('diff-files', '--diff-filter=U')))
let &l:makeprg = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U' let &l:makeprg = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U'
else else
let &l:makeprg = s:sub(g:fugitive_git_executable . ' ' . a:cmd . let &l:makeprg = s:sub(s:git_command() . ' ' . a:cmd .
\ (a:args =~# ' \%(--no-edit\|--abort\|-m\)\>' ? '' : ' --edit') . \ (a:args =~# ' \%(--no-edit\|--abort\|-m\)\>' ? '' : ' --edit') .
\ ' ' . a:args, ' *$', '') \ ' ' . a:args, ' *$', '')
endif endif
@ -1390,6 +1404,9 @@ function! s:Edit(cmd,bang,...) abort
return 'redraw|echo '.string(':!'.git.' '.args) return 'redraw|echo '.string(':!'.git.' '.args)
else else
let temp = resolve(tempname()) let temp = resolve(tempname())
if has('win32')
let temp = fnamemodify(fnamemodify(temp, ':h'), ':p').fnamemodify(temp, ':t')
endif
let s:temp_files[s:cpath(temp)] = { 'dir': buffer.repo().dir(), 'args': arglist } let s:temp_files[s:cpath(temp)] = { 'dir': buffer.repo().dir(), 'args': arglist }
silent execute a:cmd.' '.temp silent execute a:cmd.' '.temp
if a:cmd =~# 'pedit' if a:cmd =~# 'pedit'
@ -1632,7 +1649,7 @@ function! s:Dispatch(bang, args)
try try
let b:current_compiler = 'git' let b:current_compiler = 'git'
let &l:errorformat = s:common_efm let &l:errorformat = s:common_efm
let &l:makeprg = g:fugitive_git_executable . ' ' . a:args let &l:makeprg = substitute(s:git_command() . ' ' . a:args, '\s\+$', '', '')
execute cd fnameescape(s:repo().tree()) execute cd fnameescape(s:repo().tree())
if exists(':Make') == 2 if exists(':Make') == 2
noautocmd Make noautocmd Make
@ -2011,6 +2028,9 @@ function! s:Blame(bang,line1,line2,count,args) abort
endif endif
let top = line('w0') + &scrolloff let top = line('w0') + &scrolloff
let current = line('.') let current = line('.')
if has('win32')
let temp = fnamemodify(fnamemodify(temp, ':h'), ':p').fnamemodify(temp, ':t')
endif
let s:temp_files[s:cpath(temp)] = { 'dir': s:repo().dir(), 'args': cmd } let s:temp_files[s:cpath(temp)] = { 'dir': s:repo().dir(), 'args': cmd }
exe 'keepalt leftabove vsplit '.temp exe 'keepalt leftabove vsplit '.temp
let b:fugitive_blamed_bufnr = bufnr let b:fugitive_blamed_bufnr = bufnr
@ -2188,7 +2208,7 @@ endfunction
function! s:RehighlightBlame() abort function! s:RehighlightBlame() abort
for [hash, cterm] in items(s:hash_colors) for [hash, cterm] in items(s:hash_colors)
if !empty(cterm) || has('gui_running') if !empty(cterm) || has('gui_running') || has('termguicolors') && &termguicolors
exe 'hi FugitiveblameHash'.hash.' guifg=#'.hash.get(s:hash_colors, hash, '') exe 'hi FugitiveblameHash'.hash.' guifg=#'.hash.get(s:hash_colors, hash, '')
else else
exe 'hi link FugitiveblameHash'.hash.' Identifier' exe 'hi link FugitiveblameHash'.hash.' Identifier'
@ -2260,10 +2280,11 @@ function! s:Browse(bang,line1,count,...) abort
if path =~# '^\.git/refs/remotes/.' if path =~# '^\.git/refs/remotes/.'
if empty(remote) if empty(remote)
let remote = matchstr(path, '^\.git/refs/remotes/\zs[^/]\+') let remote = matchstr(path, '^\.git/refs/remotes/\zs[^/]\+')
let branch = matchstr(path, '^\.git/refs/remotes/[^/]\+/\zs.\+')
else
let merge = matchstr(path, '^\.git/refs/remotes/[^/]\+/\zs.\+')
let path = '.git/refs/heads/'.merge
endif endif
let merge = matchstr(path, '^\.git/refs/remotes/[^/]\+/\zs.\+')
let branch = ''
let path = '.git/refs/heads/'.merge
elseif path =~# '^\.git/refs/heads/.' elseif path =~# '^\.git/refs/heads/.'
let branch = path[16:-1] let branch = path[16:-1]
elseif !exists('branch') elseif !exists('branch')
@ -2300,9 +2321,14 @@ function! s:Browse(bang,line1,count,...) abort
if empty(remote) if empty(remote)
let remote = '.' let remote = '.'
let raw = s:repo().git_chomp('remote','get-url','origin') let remote_for_url = 'origin'
else else
let raw = s:repo().git_chomp('remote','get-url',remote) let remote_for_url = remote
endif
if fugitive#git_version() =~# '^[01]\.|^2\.[0-6]\.'
let raw = s:repo().git_chomp('config','remote.'.remote_for_url.'.url')
else
let raw = s:repo().git_chomp('remote','get-url',remote_for_url)
endif endif
if raw ==# '' if raw ==# ''
let raw = remote let raw = remote
@ -2365,46 +2391,8 @@ function! s:github_url(opts, ...) abort
if repo ==# '' if repo ==# ''
return '' return ''
endif endif
let path = substitute(a:opts.path, '^/', '', '') call s:warn('Install rhubarb.vim for GitHub support')
if index(domains, 'http://' . matchstr(repo, '^[^:/]*')) >= 0 return 'https://github.com/tpope/vim-rhubarb'
let root = 'http://' . s:sub(repo,':','/')
else
let root = 'https://' . s:sub(repo,':','/')
endif
if path =~# '^\.git/refs/heads/'
let branch = a:opts.repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1]
if branch ==# ''
return root . '/commits/' . path[16:-1]
else
return root . '/commits/' . branch
endif
elseif path =~# '^\.git/refs/tags/'
return root . '/releases/tag/' . path[15:-1]
elseif path =~# '^\.git/refs/remotes/[^/]\+/.'
return root . '/commits/' . matchstr(path,'remotes/[^/]\+/\zs.*')
elseif path =~# '.git/\%(config$\|hooks\>\)'
return root . '/admin'
elseif path =~# '^\.git\>'
return root
endif
if a:opts.commit =~# '^\d\=$'
let commit = a:opts.repo.rev_parse('HEAD')
else
let commit = a:opts.commit
endif
if get(a:opts, 'type', '') ==# 'tree' || a:opts.path =~# '/$'
let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
elseif get(a:opts, 'type', '') ==# 'blob' || a:opts.path =~# '[^/]$'
let url = root . '/blob/' . commit . '/' . path
if get(a:opts, 'line2') && a:opts.line1 == a:opts.line2
let url .= '#L' . a:opts.line1
elseif get(a:opts, 'line2')
let url .= '#L' . a:opts.line1 . '-L' . a:opts.line2
endif
else
let url = root . '/commit/' . commit
endif
return url
endfunction endfunction
function! s:instaweb_url(opts) abort function! s:instaweb_url(opts) abort
@ -2662,7 +2650,7 @@ function! s:BufReadObject() abort
let b:fugitive_type = s:repo().git_chomp('cat-file','-t',hash) let b:fugitive_type = s:repo().git_chomp('cat-file','-t',hash)
endif endif
if b:fugitive_type !~# '^\%(tag\|commit\|tree\|blob\)$' if b:fugitive_type !~# '^\%(tag\|commit\|tree\|blob\)$'
return "echoerr 'fugitive: unrecognized git type'" return "echoerr ".string("fugitive: unrecognized git type '".b:fugitive_type."'")
endif endif
let firstline = getline('.') let firstline = getline('.')
if !exists('b:fugitive_display_format') && b:fugitive_type != 'blob' if !exists('b:fugitive_display_format') && b:fugitive_type != 'blob'
@ -2906,7 +2894,7 @@ function! s:cfile() abort
let ref = matchstr(getline('.'),'\x\{40\}') let ref = matchstr(getline('.'),'\x\{40\}')
echoerr "warning: unknown context ".matchstr(getline('.'),'^\l*') echoerr "warning: unknown context ".matchstr(getline('.'),'^\l*')
elseif getline('.') =~# '^[+-]\{3\} [ab/]' elseif getline('.') =~# '^[+-]\{3\} [abciwo12]\=/'
let ref = getline('.')[4:] let ref = getline('.')[4:]
elseif getline('.') =~# '^[+-]' && search('^@@ -\d\+,\d\+ +\d\+,','bnW') elseif getline('.') =~# '^[+-]' && search('^@@ -\d\+,\d\+ +\d\+,','bnW')
@ -2920,7 +2908,7 @@ function! s:cfile() abort
let lnum -= 1 let lnum -= 1
endwhile endwhile
let offset += matchstr(getline(lnum), type.'\zs\d\+') let offset += matchstr(getline(lnum), type.'\zs\d\+')
let ref = getline(search('^'.type.'\{3\} [ab]/','bnW'))[4:-1] let ref = getline(search('^'.type.'\{3\} [abciwo12]/','bnW'))[4:-1]
let dcmds = [offset, 'normal!zv'] let dcmds = [offset, 'normal!zv']
elseif getline('.') =~# '^rename from ' elseif getline('.') =~# '^rename from '
@ -2929,22 +2917,22 @@ function! s:cfile() abort
let ref = 'b/'.getline('.')[10:] let ref = 'b/'.getline('.')[10:]
elseif getline('.') =~# '^@@ -\d\+,\d\+ +\d\+,' elseif getline('.') =~# '^@@ -\d\+,\d\+ +\d\+,'
let diff = getline(search('^diff --git \%(a/.*\|/dev/null\) \%(b/.*\|/dev/null\)', 'bcnW')) let diff = getline(search('^diff --git \%([abciwo12]/.*\|/dev/null\) \%([abciwo12]/.*\|/dev/null\)', 'bcnW'))
let offset = matchstr(getline('.'), '+\zs\d\+') let offset = matchstr(getline('.'), '+\zs\d\+')
let dref = matchstr(diff, '\Cdiff --git \zs\%(a/.*\|/dev/null\)\ze \%(b/.*\|/dev/null\)') let dref = matchstr(diff, '\Cdiff --git \zs\%([abciwo12]/.*\|/dev/null\)\ze \%([abciwo12]/.*\|/dev/null\)')
let ref = matchstr(diff, '\Cdiff --git \%(a/.*\|/dev/null\) \zs\%(b/.*\|/dev/null\)') let ref = matchstr(diff, '\Cdiff --git \%([abciwo12]/.*\|/dev/null\) \zs\%([abciwo12]/.*\|/dev/null\)')
let dcmd = 'Gdiff! +'.offset let dcmd = 'Gdiff! +'.offset
elseif getline('.') =~# '^diff --git \%(a/.*\|/dev/null\) \%(b/.*\|/dev/null\)' elseif getline('.') =~# '^diff --git \%([abciwo12]/.*\|/dev/null\) \%([abciwo12]/.*\|/dev/null\)'
let dref = matchstr(getline('.'),'\Cdiff --git \zs\%(a/.*\|/dev/null\)\ze \%(b/.*\|/dev/null\)') let dref = matchstr(getline('.'),'\Cdiff --git \zs\%([abciwo12]/.*\|/dev/null\)\ze \%([abciwo12]/.*\|/dev/null\)')
let ref = matchstr(getline('.'),'\Cdiff --git \%(a/.*\|/dev/null\) \zs\%(b/.*\|/dev/null\)') let ref = matchstr(getline('.'),'\Cdiff --git \%([abciwo12]/.*\|/dev/null\) \zs\%([abciwo12]/.*\|/dev/null\)')
let dcmd = 'Gdiff!' let dcmd = 'Gdiff!'
elseif getline('.') =~# '^index ' && getline(line('.')-1) =~# '^diff --git \%(a/.*\|/dev/null\) \%(b/.*\|/dev/null\)' elseif getline('.') =~# '^index ' && getline(line('.')-1) =~# '^diff --git \%([abciwo12]/.*\|/dev/null\) \%([abciwo12]/.*\|/dev/null\)'
let line = getline(line('.')-1) let line = getline(line('.')-1)
let dref = matchstr(line,'\Cdiff --git \zs\%(a/.*\|/dev/null\)\ze \%(b/.*\|/dev/null\)') let dref = matchstr(line,'\Cdiff --git \zs\%([abciwo12]/.*\|/dev/null\)\ze \%([abciwo12]/.*\|/dev/null\)')
let ref = matchstr(line,'\Cdiff --git \%(a/.*\|/dev/null\) \zs\%(b/.*\|/dev/null\)') let ref = matchstr(line,'\Cdiff --git \%([abciwo12]/.*\|/dev/null\) \zs\%([abciwo12]/.*\|/dev/null\)')
let dcmd = 'Gdiff!' let dcmd = 'Gdiff!'
elseif line('$') == 1 && getline('.') =~ '^\x\{40\}$' elseif line('$') == 1 && getline('.') =~ '^\x\{40\}$'
@ -2957,18 +2945,21 @@ function! s:cfile() abort
let ref = '' let ref = ''
endif endif
if myhash ==# '' let prefixes = {
let ref = s:sub(ref,'^a/','HEAD:') \ '1': '',
let ref = s:sub(ref,'^b/',':0:') \ '2': '',
if exists('dref') \ 'b': ':0:',
let dref = s:sub(dref,'^a/','HEAD:') \ 'i': ':0:',
endif \ 'o': '',
else \ 'w': ''}
let ref = s:sub(ref,'^a/',myhash.'^:')
let ref = s:sub(ref,'^b/',myhash.':') if len(myhash)
if exists('dref') let prefixes.a = myhash.'^:'
let dref = s:sub(dref,'^a/',myhash.'^:') let prefixes.b = myhash.':'
endif endif
let ref = s:sub(ref, '^\(\w\)/', 'get(prefixes, submatch(1), "HEAD:")')
if exists('dref')
let dref = s:sub(dref, '^\(\w\)/', 'get(prefixes, submatch(1), "HEAD:")')
endif endif
if ref ==# '/dev/null' if ref ==# '/dev/null'
@ -3076,7 +3067,7 @@ function! fugitive#foldtext() abort
endif endif
endfor endfor
if filename ==# '' if filename ==# ''
let filename = matchstr(getline(v:foldstart), '^diff .\{-\} a/\zs.*\ze b/') let filename = matchstr(getline(v:foldstart), '^diff .\{-\} [abciow12]/\zs.*\ze [abciow12]/')
endif endif
if filename ==# '' if filename ==# ''
let filename = getline(v:foldstart)[5:-1] let filename = getline(v:foldstart)[5:-1]

View File

@ -215,6 +215,7 @@ By default the signs are updated as follows:
| Switch buffer | To notice change to git index | `g:gitgutter_eager` | | Switch buffer | To notice change to git index | `g:gitgutter_eager` |
| Switch tab | To notice change to git index | `g:gitgutter_eager` | | Switch tab | To notice change to git index | `g:gitgutter_eager` |
| Focus the GUI | To notice change to git index | `g:gitgutter_eager` (not gVim on Windows) | | Focus the GUI | To notice change to git index | `g:gitgutter_eager` (not gVim on Windows) |
| After shell command | To notice change to git index | `g:gitgutter_eager` |
| Read a file into a buffer | To display initial signs | [always] | | Read a file into a buffer | To display initial signs | [always] |
| Save a buffer | So non-realtime signs are up to date | [always] | | Save a buffer | So non-realtime signs are up to date | [always] |
| Change a file outside Vim | To notice `git stash` | [always] | | Change a file outside Vim | To notice `git stash` | [always] |
@ -338,11 +339,11 @@ See above for configuring maps for hunk-jumping and staging/undoing.
#### Use a custom `grep` command #### Use a custom `grep` command
If you use an alternative to grep, or your grep does not support the `color` flag, you can tell vim-gitgutter to use it here. It only needs to support extended POSIX regex. If you use an alternative to grep, you can tell vim-gitgutter to use it here.
```viml ```viml
" Default: " Default:
let g:gitgutter_grep_command = 'grep --color=never -e' let g:gitgutter_grep_command = 'grep'
``` ```
#### To turn off vim-gitgutter by default #### To turn off vim-gitgutter by default
@ -526,7 +527,7 @@ Here are some things you can check:
* Your git config is compatible with the version of git returned by the command above. * Your git config is compatible with the version of git returned by the command above.
* Your Vim supports signs (`:echo has('signs')` should give `1`). * Your Vim supports signs (`:echo has('signs')` should give `1`).
* Your file is being tracked by git and has unstaged changes. * Your file is being tracked by git and has unstaged changes.
* If your grep does not support the `color` flag, add `let g:gitgutter_grep_command = 'grep -e'` to your `~/.vimrc`. * If you have aliased or configured `grep` to use any flags, add `let g:gitgutter_grep_command = 'grep'` to your `~/.vimrc`.
### Shameless Plug ### Shameless Plug

View File

@ -4,7 +4,10 @@ if exists('g:gitgutter_grep_command')
else else
let s:grep_available = executable('grep') let s:grep_available = executable('grep')
if s:grep_available if s:grep_available
let s:grep_command = 'grep --color=never -e' let s:grep_command = 'grep'
if $GREP_OPTIONS =~# '--color=always'
let s:grep_command .= ' --color=never'
endif
endif endif
endif endif
let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@' let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'

View File

@ -274,7 +274,7 @@ TO USE A CUSTOM GREP COMMAND
To use a custom invocation for grep, use this: To use a custom invocation for grep, use this:
> >
let g:gitgutter_grep_command = 'grep --color=never -e' let g:gitgutter_grep_command = 'grep'
< <
TO TURN OFF VIM-GITGUTTER BY DEFAULT TO TURN OFF VIM-GITGUTTER BY DEFAULT

View File

@ -196,30 +196,17 @@ augroup gitgutter
endif endif
if g:gitgutter_eager if g:gitgutter_eager
autocmd BufWritePost,FileChangedShellPost * call gitgutter#process_buffer(bufnr(''), 0) autocmd BufWritePost,FileChangedShellPost,ShellCmdPost * call gitgutter#process_buffer(bufnr(''), 0)
" When you enter a new tab, BufEnter is only fired if the buffer you enter
" is not the one you came from.
"
" For example:
"
" `:tab split` fires TabEnter but not BufEnter.
" `:tab new` fires TabEnter and BufEnter.
"
" As and when both TabEnter and BufEnter are fired, we do not want to
" process the entered buffer twice. We avoid this by setting and clearing
" a flag.
autocmd BufEnter * autocmd BufEnter *
\ if gettabvar(tabpagenr(), 'gitgutter_didtabenter') | \ if gettabvar(tabpagenr(), 'gitgutter_didtabenter') |
\ call settabvar(tabpagenr(), 'gitgutter_didtabenter', 0) | \ call settabvar(tabpagenr(), 'gitgutter_didtabenter', 0) |
\ call gitgutter#all() |
\ else | \ else |
\ call gitgutter#process_buffer(bufnr(''), 0) | \ call gitgutter#process_buffer(bufnr(''), 0) |
\ endif \ endif
autocmd TabEnter * autocmd TabEnter * call settabvar(tabpagenr(), 'gitgutter_didtabenter', 1)
\ call settabvar(tabpagenr(), 'gitgutter_didtabenter', 1) |
\ call gitgutter#all()
if !has('gui_win32') if !has('gui_win32')
autocmd FocusGained * call gitgutter#all() autocmd FocusGained * call gitgutter#all()

View File

@ -1,5 +1,13 @@
## unplanned ## unplanned
IMPROVEMENTS
* :GoMetaLinter can now exclude linters with the new `g:go_metalinter_excludes` option [gh-1253]
BUG FIXES:
* job: fix race between channel close and job exit [gh-1247]
## 1.12 - (March 29, 2017) ## 1.12 - (March 29, 2017)
FEATURES: FEATURES:

View File

@ -4,336 +4,64 @@
<img style="float: right;" src="assets/vim-go.png" alt="Vim-go logo"/> <img style="float: right;" src="assets/vim-go.png" alt="Vim-go logo"/>
</p> </p>
Go (golang) support for Vim, which comes with pre-defined sensible settings (like
auto gofmt on save), with autocomplete, snippet support, improved syntax
highlighting, go toolchain commands, and more. If needed vim-go installs all
necessary binaries for providing seamless Vim integration with current
commands. It's highly customizable and each individual feature can be
disabled/enabled easily.
## Features ## Features
* Improved Syntax highlighting with items such as Functions, Operators, Methods. This plugin adds Go language support for Vim, with the following main features:
* Auto completion support via `gocode`
* Better `gofmt` on save, which keeps cursor position and doesn't break your undo * Build with `:GoBuild`, install with `:GoInstall` or test
history with `:GoTest` (run single tests via `:GoTestFunc`)
* Go to symbol/declaration with `:GoDef` * Show test coverage with `:GoCoverage` or in browser with `:GoCoverageBrowser`
* Look up documentation with `:GoDoc` inside Vim or open it in browser * Goto definition with `:GoDef`
* Automatically import packages via `:GoImport` or plug it into autosave * Quick jump to declarations with `:GoDecls` or `:GoDeclsDir`
* Compile your package with `:GoBuild`, install it with `:GoInstall` or test * Show documentation with `:GoDoc` inside or in browser with `:GoDocBrowser`
them with `:GoTest` (also supports running single tests via `:GoTestFunc`)
* Quickly execute your current file/files with `:GoRun` * Quickly execute your current file/files with `:GoRun`
* Automatic `GOPATH` detection based on the directory structure (i.e. `gb`
projects, `godep` vendored projects)
* Change or display `GOPATH` with `:GoPath`
* Create a coverage profile and display annotated source code to see which
functions are covered with `:GoCoverage`
* Call `gometalinter` with `:GoMetaLinter`, which invokes all possible linters
(golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors
* Lint your code with `:GoLint`
* Run your code through `:GoVet` to catch static errors
* Advanced source analysis tools utilizing guru, such as `:GoImplements`, * Advanced source analysis tools utilizing guru, such as `:GoImplements`,
`:GoCallees`, and `:GoReferrers` `:GoCallees`, and `:GoReferrers`
* Precise type-safe renaming of identifiers with `:GoRename` * Change or display `GOPATH` with `:GoPath`
* List all source files and dependencies * Multiple 3rd linter support with `:GoMetaLinter`
* Unchecked error checking with `:GoErrCheck` * Renaming identifiers with `:GoRename`
* Integrated and improved snippets, supporting `ultisnips` or `neosnippet` * Share your code to [play.golang.org](http://play.golang.org) with `:GoPlay`
* Share your current code to [play.golang.org](http://play.golang.org) with `:GoPlay` * Switch between `*.go` and `*_test.go` code with `:GoAlternate`
* On-the-fly type information about the word under the cursor. Plug it into * Add/Remove tags on struct fields with `:GoAddTags`
your custom vim function. * Add import paths via `:GoImport` or remove them with `:GoDrop`
* Go asm formatting on save * Custom vim text objects such as `a function (af)` or `inner function (if)`
* Tagbar support to show tags of the source code in a sidebar with `gotags` * ... and many more! Please see [doc/vim-go.txt](doc/vim-go.txt) for more information.
* Custom vim text objects such as `a function` or `inner function`
list.
* Jump to function or type declarations with `:GoDecls` or `:GoDeclsDir`
* Vim 8.0 support. Async execution for most commands, various underlying improvements.
* NeoVim support (beta). Async execution for some commands.
* Alternate between implementation and test code with `:GoAlternate`
Checkout the official [tutorial](https://github.com/fatih/vim-go-tutorial)
that goes literally over all features and shows many tips and tricks. It shows
how to install vim-go and explains many unknown use cases. Recommended for
beginners as well as advanced users: https://github.com/fatih/vim-go-tutorial
## Install ## Install
Master branch is supposed to be a development branch. So stuff here can break Master branch is a **development** branch. Please use with caution.
and change. Please try use always the [latest I recommend to use the [**latest stable release**](https://github.com/fatih/vim-go/releases/latest)
release](https://github.com/fatih/vim-go/releases/latest)
Vim-go follows the standard runtime path structure, so I highly recommend to Vim-go follows the standard runtime path structure. Below are some helper lines
use a common and well known plugin manager to install vim-go. Do not use vim-go for popular package managers:
with other Go oriented vim plugins. For Pathogen just clone the repo. For other
plugin managers add the appropriate lines and execute the plugin's install
command.
* [Pathogen](https://github.com/tpope/vim-pathogen) * [Pathogen](https://github.com/tpope/vim-pathogen)
* `git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go` * `git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go`
* [vim-plug](https://github.com/junegunn/vim-plug) * [vim-plug](https://github.com/junegunn/vim-plug)
* `Plug 'fatih/vim-go'` * `Plug 'fatih/vim-go'`
* [NeoBundle](https://github.com/Shougo/neobundle.vim) * [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages)
* `NeoBundle 'fatih/vim-go'` * `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go`
* [Vundle](https://github.com/gmarik/vundle)
* `Plugin 'fatih/vim-go'`
* [Vim packages](http://vimhelp.appspot.com/repeat.txt.html#packages) (since Vim 7.4.1528)
* `git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go`
Please be sure all necessary binaries are installed (such as `gocode`, `godef`, After installing, please install all necessary binaries. We have a handy
`goimports`, etc.). You can easily install them with the included command for it:
`:GoInstallBinaries` command. If invoked, all necessary binaries will be
automatically downloaded and installed to your `$GOBIN` environment (if not set
it will use `$GOPATH/bin`). Note that this command requires `git` for fetching
the individual Go packages. Additionally, use `:GoUpdateBinaries` to update the
installed binaries.
### Optional ```
:GoInstallBinaries
```
* Autocompletion is enabled by default via `<C-x><C-o>`. To get real-time for more information please check out the [documentation](doc/vim-go.txt)
completion (completion by type) install:
[neocomplete](https://github.com/Shougo/neocomplete.vim) for Vim or
[deoplete](https://github.com/Shougo/deoplete.nvim) and
[deoplete-go](https://github.com/zchee/deoplete-go) for NeoVim or
[SimpleAutoCmplPop](https://github.com/roxma/SimpleAutoComplPop)
* To display source code tag information on a sidebar install
[tagbar](https://github.com/majutsushi/tagbar).
* For snippet features install:
[neosnippet](https://github.com/Shougo/neosnippet.vim) or
[ultisnips](https://github.com/SirVer/ultisnips).
* Screenshot color scheme is a slightly modified molokai:
[fatih/molokai](https://github.com/fatih/molokai).
* For a better documentation viewer checkout:
[go-explorer](https://github.com/garyburd/go-explorer).
## Usage ## Usage
Many of the plugin's [features](#features) are enabled by default. There are no Official documentation can be found under [doc/vim-go.txt](doc/vim-go.txt). You can display it from within Vim with:
additional settings needed. All usages and commands are listed in
`doc/vim-go.txt`. Note that help tags needs to be populated. Check your plugin
manager settings to generate the documentation (some do it automatically).
After that just open the help page to see all commands:
:help vim-go
## Example Mappings
vim-go has several `<Plug>` mappings which can be used to create custom
mappings. Unless otherwise specified, none of these mappings are enabled
by default. Here some examples you might find useful:
Run commands such as `go run` for the current file with `<leader>r` or `go
build` and `go test` for the current package with `<leader>b` and `<leader>t`
respectively. Display beautifully annotated source code to see which functions
are covered with `<leader>c`.
```vim
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <leader>c <Plug>(go-coverage)
```
By default the mapping `gd` is enabled, which opens the target identifier in
current buffer. You can also open the definition/declaration, in a new vertical,
horizontal, or tab, for the word under your cursor:
```vim
au FileType go nmap <leader>ds <Plug>(go-def-split)
au FileType go nmap <leader>dv <Plug>(go-def-vertical)
au FileType go nmap <leader>dt <Plug>(go-def-tab)
```
Open the relevant Godoc for the word under the cursor with `<leader>gd` or open
it vertically with `<leader>gv`
```vim
au FileType go nmap <leader>gd <Plug>(go-doc)
au FileType go nmap <leader>gv <Plug>(go-doc-vertical)
```
Or open the Godoc in browser
```vim
au FileType go nmap <leader>gb <Plug>(go-doc-browser)
```
Show a list of interfaces which is implemented by the type under your cursor
with `<leader>s`
```vim
au FileType go nmap <leader>s <Plug>(go-implements)
```
Show type info for the word under your cursor with `<leader>i` (useful if you
have disabled auto showing type info via `g:go_auto_type_info`)
```vim
au FileType go nmap <leader>i <Plug>(go-info)
```
Rename the identifier under the cursor to a new name
```vim
au FileType go nmap <leader>e <Plug>(go-rename)
```
More `<Plug>` mappings can be seen with `:he go-mappings`. Also these are just
recommendations, you are free to create more advanced mappings or functions
based on `:he go-commands`.
## Settings
Below are some settings you might find useful. For the full list see `:he
go-settings`.
By default syntax-highlighting for Functions, Methods and Structs is disabled.
To change it:
```vim
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
```
Enable goimports to automatically insert import paths instead of gofmt:
```vim
let g:go_fmt_command = "goimports"
```
By default vim-go shows errors for the fmt command, to disable it:
```vim
let g:go_fmt_fail_silently = 1
```
Disable auto fmt on save:
```vim
let g:go_fmt_autosave = 0
```
Disable opening browser after posting your snippet to `play.golang.org`:
```vim
let g:go_play_open_browser = 0
```
By default when `:GoInstallBinaries` is called, the binaries are installed to
`$GOBIN` or `$GOPATH/bin`. To change it:
```vim
let g:go_bin_path = expand("~/.gotools")
let g:go_bin_path = "/home/fatih/.mypath" "or give absolute path
```
Disable updating dependencies when installing/updating binaries:
```vim
let g:go_get_update = 0
```
### Using with Neovim (beta)
Note: Neovim currently is not a first class citizen for vim-go. You are free
to open bug, however I'm not using Neovim so it's hard for me to test it.
vim-go might not work well as good as in Vim. I'm happy to accept pull requests
or very detailed bug reports. If you're interested to improve the state of
Neovim in vim-go you're always welcome!
Run `:GoRun` in a new tab, horizontal split or vertical split terminal
```vim
au FileType go nmap <leader>rt <Plug>(go-run-tab)
au FileType go nmap <leader>rs <Plug>(go-run-split)
au FileType go nmap <leader>rv <Plug>(go-run-vertical)
```
By default new terminals are opened in a vertical split. To change it
```vim
let g:go_term_mode = "split"
```
By default the testing commands run asynchronously in the background and
display results with `go#jobcontrol#Statusline()`. To make them run in a new
terminal
```vim
let g:go_term_enabled = 1
```
### Using with Syntastic
Sometimes when using both `vim-go` and `syntastic` Vim will start lagging while
saving and opening files. The following fixes this:
```vim
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
```
Another issue with `vim-go` and `syntastic` is that the location list window
that contains the output of commands such as `:GoBuild` and `:GoTest` might not appear.
To resolve this:
```vim
let g:go_list_type = "quickfix"
```
## More info
Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more
information. It includes
[Screencasts](https://github.com/fatih/vim-go/wiki/Screencasts), an [FAQ
section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many
other [various pieces](https://github.com/fatih/vim-go/wiki) of information.
## Development & Testing
vim-go supports now test files. Please check `autoload` folder for examples. If
you add a new feature be sure you also include the `_test.vim` file next to the
script. Test functions should be starting with `Test_`, example:
```viml
function Test_run_fmt()
call assert_equal(expected, actual)
...
endfunction
```
You can locally test it by running:
``` ```
make :help vim-go
``` ```
We also have an [official vim-go
This will run all tests and print either `PASS` or `FAIL` to indicate the final tutorial](https://github.com/fatih/vim-go-tutorial).
status of all tests.
Additionally, each new pull request will trigger a new Travis-ci job.
## Donation
People have asked for this for a long time, now you can be a fully supporter by
[being a patron](https://www.patreon.com/fatih)!
By being a patron, you are enabling vim-go to grow and mature, helping me to
invest in bug fixes, new documentation, and improving both current and future
features. It's completely optional and is just a direct way to support Vim-go's
ongoing development. Thanks!
[https://www.patreon.com/fatih](https://www.patreon.com/fatih)
## Credits
* Go Authors for official vim plugins
* Gocode, Godef, Golint, Guru, Goimports, Gotags, Errcheck projects and
authors of those projects.
* Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode,
vim-godef)
* [Contributors](https://github.com/fatih/vim-go/graphs/contributors) of vim-go
## License ## License
The BSD 3-Clause License - see `LICENSE` for more details The BSD 3-Clause License - see [`LICENSE`](LICENSE) for more details

View File

@ -445,7 +445,7 @@ function s:cmd_job(args) abort
let start_options = { let start_options = {
\ 'callback': callbacks.callback, \ 'callback': callbacks.callback,
\ 'close_cb': callbacks.close_cb, \ 'exit_cb': callbacks.exit_cb,
\ } \ }
" modify GOPATH if needed " modify GOPATH if needed

View File

@ -288,7 +288,7 @@ function s:coverage_job(args)
let start_options = { let start_options = {
\ 'callback': callbacks.callback, \ 'callback': callbacks.callback,
\ 'close_cb': callbacks.close_cb, \ 'exit_cb': callbacks.exit_cb,
\ } \ }
" modify GOPATH if needed " modify GOPATH if needed

View File

@ -303,7 +303,7 @@ function s:def_job(args) abort
let start_options = { let start_options = {
\ 'callback': callbacks.callback, \ 'callback': callbacks.callback,
\ 'close_cb': callbacks.close_cb, \ 'exit_cb': callbacks.exit_cb,
\ } \ }
if &modified if &modified

View File

@ -155,21 +155,12 @@ function! s:async_guru(args) abort
endif endif
endif endif
function! s:close_cb(chan) closure let messages = []
let messages = [] function! s:callback(chan, msg) closure
while ch_status(a:chan, {'part': 'out'}) == 'buffered' call add(messages, a:msg)
let msg = ch_read(a:chan, {'part': 'out'}) endfunction
call add(messages, msg)
endwhile
while ch_status(a:chan, {'part': 'err'}) == 'buffered'
let msg = ch_read(a:chan, {'part': 'err'})
call add(messages, msg)
endwhile
let l:job = ch_getjob(a:chan)
let l:info = job_info(l:job)
function! s:exit_cb(job, exitval) closure
let out = join(messages, "\n") let out = join(messages, "\n")
let status = { let status = {
@ -178,21 +169,22 @@ function! s:async_guru(args) abort
\ 'state': "finished", \ 'state': "finished",
\ } \ }
if l:info.exitval if a:exitval
let status.state = "failed" let status.state = "failed"
endif endif
call go#statusline#Update(status_dir, status) call go#statusline#Update(status_dir, status)
if has_key(a:args, 'custom_parse') if has_key(a:args, 'custom_parse')
call a:args.custom_parse(l:info.exitval, out) call a:args.custom_parse(a:exitval, out)
else else
call s:parse_guru_output(l:info.exitval, out, a:args.mode) call s:parse_guru_output(a:exitval, out, a:args.mode)
endif endif
endfunction endfunction
let start_options = { let start_options = {
\ 'close_cb': funcref("s:close_cb"), \ 'callback': funcref("s:callback"),
\ 'exit_cb': funcref("s:exit_cb"),
\ } \ }
if has_key(result, 'stdin_content') if has_key(result, 'stdin_content')

View File

@ -30,28 +30,17 @@ function go#job#Spawn(args)
call add(self.messages, a:msg) call add(self.messages, a:msg)
endfunction endfunction
function cbs.close_cb(chan) dict function cbs.exit_cb(job, exitval) dict
let l:job = ch_getjob(a:chan)
let l:status = job_status(l:job)
" the job might be in fail status, we assume by default it's failed.
" However if it's dead, we can use the real exitval
let exitval = 1
if l:status == "dead"
let l:info = job_info(l:job)
let exitval = l:info.exitval
endif
if has_key(self, 'custom_cb') if has_key(self, 'custom_cb')
call self.custom_cb(l:job, exitval, self.messages) call self.custom_cb(a:job, a:exitval, self.messages)
endif endif
if has_key(self, 'error_info_cb') if has_key(self, 'error_info_cb')
call self.error_info_cb(l:job, exitval, self.messages) call self.error_info_cb(a:job, a:exitval, self.messages)
endif endif
if get(g:, 'go_echo_command_info', 1) if get(g:, 'go_echo_command_info', 1)
if exitval == 0 if a:exitval == 0
call go#util#EchoSuccess("SUCCESS") call go#util#EchoSuccess("SUCCESS")
else else
call go#util#EchoError("FAILED") call go#util#EchoError("FAILED")
@ -59,7 +48,7 @@ function go#job#Spawn(args)
endif endif
let l:listtype = go#list#Type("quickfix") let l:listtype = go#list#Type("quickfix")
if exitval == 0 if a:exitval == 0
call go#list#Clean(l:listtype) call go#list#Clean(l:listtype)
call go#list#Window(l:listtype) call go#list#Window(l:listtype)
return return
@ -99,9 +88,9 @@ function go#job#Spawn(args)
let cbs.callback = a:args.callback let cbs.callback = a:args.callback
endif endif
" override close callback handler if user provided it " override exit callback handler if user provided it
if has_key(a:args, 'close_cb') if has_key(a:args, 'exit_cb')
let cbs.close_cb = a:args.close_cb let cbs.exit_cb = a:args.exit_cb
endif endif
return cbs return cbs

View File

@ -10,6 +10,10 @@ if !exists("g:go_metalinter_enabled")
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
endif endif
if !exists("g:go_metalinter_excludes")
let g:go_metalinter_excludes = []
endif
if !exists("g:go_golint_bin") if !exists("g:go_golint_bin")
let g:go_golint_bin = "golint" let g:go_golint_bin = "golint"
endif endif
@ -40,6 +44,10 @@ function! go#lint#Gometa(autosave, ...) abort
let cmd += ["--enable=".linter] let cmd += ["--enable=".linter]
endfor endfor
for exclude in g:go_metalinter_excludes
let cmd += ["--exclude=".exclude]
endfor
" path " path
let cmd += [expand('%:p:h')] let cmd += [expand('%:p:h')]
else else
@ -252,23 +260,14 @@ function s:lint_job(args)
copen copen
endfunction endfunction
function! s:close_cb(chan) closure function! s:exit_cb(job, exitval) closure
let l:job = ch_getjob(a:chan)
let l:status = job_status(l:job)
let exitval = 1
if l:status == "dead"
let l:info = job_info(l:job)
let exitval = l:info.exitval
endif
let status = { let status = {
\ 'desc': 'last status', \ 'desc': 'last status',
\ 'type': "gometaliner", \ 'type': "gometaliner",
\ 'state': "finished", \ 'state': "finished",
\ } \ }
if exitval if a:exitval
let status.state = "failed" let status.state = "failed"
endif endif
@ -297,7 +296,7 @@ function s:lint_job(args)
let start_options = { let start_options = {
\ 'callback': funcref("s:callback"), \ 'callback': funcref("s:callback"),
\ 'close_cb': funcref("s:close_cb"), \ 'exit_cb': funcref("s:exit_cb"),
\ } \ }
call job_start(a:args.cmd, start_options) call job_start(a:args.cmd, start_options)

View File

@ -71,28 +71,25 @@ function s:rename_job(args)
let status_dir = expand('%:p:h') let status_dir = expand('%:p:h')
function! s:close_cb(chan) closure function! s:exit_cb(job, exitval) closure
let l:job = ch_getjob(a:chan)
let l:info = job_info(l:job)
let status = { let status = {
\ 'desc': 'last status', \ 'desc': 'last status',
\ 'type': "gorename", \ 'type': "gorename",
\ 'state': "finished", \ 'state': "finished",
\ } \ }
if l:info.exitval if a:exitval
let status.state = "failed" let status.state = "failed"
endif endif
call go#statusline#Update(status_dir, status) call go#statusline#Update(status_dir, status)
call s:parse_errors(l:info.exitval, a:args.bang, messages) call s:parse_errors(a:exitval, a:args.bang, messages)
endfunction endfunction
let start_options = { let start_options = {
\ 'callback': funcref("s:callback"), \ 'callback': funcref("s:callback"),
\ 'close_cb': funcref("s:close_cb"), \ 'exit_cb': funcref("s:exit_cb"),
\ } \ }
" modify GOPATH if needed " modify GOPATH if needed

View File

@ -21,8 +21,10 @@ CONTENTS *go-contents*
5. Text Objects.................................|go-text-objects| 5. Text Objects.................................|go-text-objects|
6. Functions....................................|go-functions| 6. Functions....................................|go-functions|
7. Settings.....................................|go-settings| 7. Settings.....................................|go-settings|
8. Troubleshooting..............................|go-troubleshooting| 8. FAQ/Troubleshooting..........................|go-troubleshooting|
9. Credits......................................|go-credits| 9. Development..................................|go-development|
10. Donation.....................................|go-donation|
11. Credits......................................|go-credits|
============================================================================== ==============================================================================
INTRO *go-intro* INTRO *go-intro*
@ -100,7 +102,7 @@ command.
Plugin 'fatih/vim-go' Plugin 'fatih/vim-go'
* Vim |packages| (since Vim 7.4.1528) * Vim |packages|
> >
git clone https://github.com/fatih/vim-go.git \ git clone https://github.com/fatih/vim-go.git \
~/.vim/pack/plugins/start/vim-go ~/.vim/pack/plugins/start/vim-go
@ -1349,6 +1351,13 @@ Specifies the currently enabled linters for the |:GoMetaLinter| command. By
default it's using `vet`, `golint` and `errcheck`. default it's using `vet`, `golint` and `errcheck`.
> >
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
<
*'g:go_metalinter_excludes'*
Specifies the linters to be excluded from the |:GoMetaLinter| command. By
default it's empty
>
let g:go_metalinter_excludes = []
< <
*'g:go_metalinter_command'* *'g:go_metalinter_command'*
@ -1530,7 +1539,29 @@ default it's 60 seconds. Must be in milliseconds.
let g:go_statusline_duration = 60000 let g:go_statusline_duration = 60000
< <
============================================================================== ==============================================================================
TROUBLESHOOTING *go-troubleshooting* DEVELOPMENT *go-development*
vim-go supports test files written in VimL. Please check `autoload` folder for
examples. If you add a new feature be sure you also include the `_test.vim`
file next to the script. Test functions should be starting with `Test_`,
example:
>
function Test_run_fmt()
call assert_equal(expected, actual)
...
endfunction
<
You can locally test it by running:
>
make
<
This will run all tests and print either `PASS` or `FAIL` to indicate the final
status of all tests. Additionally, each new pull request will trigger a new
Travis-ci job.
==============================================================================
FAQ TROUBLESHOOTING *go-troubleshooting*
I get "not an editor command" error when I invoke :GoXXX~ I get "not an editor command" error when I invoke :GoXXX~
@ -1568,15 +1599,63 @@ If you see errors like this:
> >
Error installing golang.org/x/tools/cmd/goimports Error installing golang.org/x/tools/cmd/goimports
< <
that means your local Go setup is broken or the remote website is down. For that means your local Go setup is broken or the remote website is down. For
example sometimes code.google.com times out. To test, just execute a simple example sometimes code.google.com times out. To test, just execute a simple
`go get`: `go get`:
>
go get golang.org/x/tools/cmd/goimports go get golang.org/x/tools/cmd/goimports
< <
You'll see a more detailed error. If this works, vim-go will work too. You'll see a more detailed error. If this works, vim-go will work too.
How do I use vim-go with syntastic?~
Sometimes when using both `vim-go` and `syntastic` Vim will start lagging
while saving and opening files. The following fixes this:
>
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
<
Another issue with `vim-go` and `syntastic` is that the location list window
that contains the output of commands such as `:GoBuild` and `:GoTest` might
not appear. To resolve this:
>
let g:go_list_type = "quickfix"
<
Using with NeoVim~
Note: Neovim currently is not a first class citizen for vim-go. You are free
to open bug, however I'm not using Neovim so it's hard for me to test it.
vim-go might not work well as good as in Vim. I'm happy to accept pull requests
or very detailed bug reports. If you're interested to improve the state of
Neovim in vim-go you're always welcome!
Run `:GoRun` in a new tab, horizontal split or vertical split terminal
>
au FileType go nmap <leader>rt <Plug>(go-run-tab)
au FileType go nmap <leader>rs <Plug>(go-run-split)
au FileType go nmap <leader>rv <Plug>(go-run-vertical)
<
By default new terminals are opened in a vertical split. To change it
>
let g:go_term_mode = "split"
>
==============================================================================
DONATION *go-donation*
People have asked for this for a long time, now you can be a fully supporter
by being a patreon at: https://www.patreon.com/fatih
By being a patron, you are enabling vim-go to grow and mature, helping me to
invest in bug fixes, new documentation, and improving both current and future
features. It's completely optional and is just a direct way to support Vim-go's
ongoing development. Thanks!
Check it out: https://www.patreon.com/fatih
============================================================================== ==============================================================================
CREDITS *go-credits* CREDITS *go-credits*

View File

@ -20,6 +20,14 @@ To disable markdown syntax concealing add the following to your vimrc:
let g:markdown_syntax_conceal = 0 let g:markdown_syntax_conceal = 0
Syntax highlight is synchronized in 50 lines. It may cause collapsed
highlighting at large fenced code block.
In the case, please set larger value in your vimrc:
let g:markdown_minlines = 100
Note that setting too large value may cause bad performance on highlighting.
## License ## License
Copyright © Tim Pope. Distributed under the same terms as Vim itself. Copyright © Tim Pope. Distributed under the same terms as Vim itself.

View File

@ -41,10 +41,35 @@ function! MarkdownFold()
return "=" return "="
endfunction endfunction
function! MarkdownFoldText()
let hash_indent = s:HashIndent(v:foldstart)
let title = substitute(getline(v:foldstart), '^#\+\s*', '', '')
let foldsize = (v:foldend - v:foldstart + 1)
let linecount = '['.foldsize.' lines]'
return hash_indent.' '.title.' '.linecount
endfunction
function! s:HashIndent(lnum)
let hash_header = matchstr(getline(a:lnum), '^#\{1,6}')
if len(hash_header) > 0
" hashtag header
return hash_header
else
" == or -- header
let nextline = getline(a:lnum + 1)
if nextline =~ '^=\+\s*$'
return repeat('#', 1)
elseif nextline =~ '^-\+\s*$'
return repeat('#', 2)
endif
endif
endfunction
if has("folding") && exists("g:markdown_folding") if has("folding") && exists("g:markdown_folding")
setlocal foldexpr=MarkdownFold() setlocal foldexpr=MarkdownFold()
setlocal foldmethod=expr setlocal foldmethod=expr
let b:undo_ftplugin .= " foldexpr< foldmethod<" setlocal foldtext=MarkdownFoldText()
let b:undo_ftplugin .= " foldexpr< foldmethod< foldtext<"
endif endif
" vim:set sw=2: " vim:set sw=2:

View File

@ -33,7 +33,10 @@ endfor
unlet! s:type unlet! s:type
unlet! s:done_include unlet! s:done_include
syn sync minlines=10 if !exists('g:markdown_minlines')
let g:markdown_minlines = 50
endif
execute 'syn sync minlines=' . g:markdown_minlines
syn case ignore syn case ignore
syn match markdownValid '[<>]\c[a-z/$!]\@!' syn match markdownValid '[<>]\c[a-z/$!]\@!'

View File

@ -188,6 +188,9 @@ endfunction
With this locking and unlocking we prevent neocomplete to trigger it's function calls until we are finished with multiple cursors editing. With this locking and unlocking we prevent neocomplete to trigger it's function calls until we are finished with multiple cursors editing.
Plugins themselves can register `User` autocommands on `MultipleCursorsPre` and
`MultipleCursorsPost` for automatic integration.
### Highlight ### Highlight
The plugin uses the highlight group `multiple_cursors_cursor` and `multiple_cursors_visual` to highlight the virtual cursors and their visual selections respectively. You can customize them by putting something similar like the following in your vimrc: The plugin uses the highlight group `multiple_cursors_cursor` and `multiple_cursors_visual` to highlight the virtual cursors and their visual selections respectively. You can customize them by putting something similar like the following in your vimrc:

View File

@ -111,8 +111,11 @@ endfunction
" attempted to be created at the next occurrence of the visual selection " attempted to be created at the next occurrence of the visual selection
function! multiple_cursors#new(mode, word_boundary) function! multiple_cursors#new(mode, word_boundary)
" Call before function if exists only once until it is canceled (<Esc>) " Call before function if exists only once until it is canceled (<Esc>)
if exists('*Multiple_cursors_before') && !s:before_function_called if !s:before_function_called
exe "call Multiple_cursors_before()" doautocmd User MultipleCursorsPre
if exists('*Multiple_cursors_before')
exe "call Multiple_cursors_before()"
endif
let s:before_function_called = 1 let s:before_function_called = 1
endif endif
let s:use_word_boundary = a:word_boundary let s:use_word_boundary = a:word_boundary
@ -436,8 +439,11 @@ function! s:CursorManager.reset(restore_view, restore_setting, ...) dict
call self.restore_user_settings() call self.restore_user_settings()
endif endif
" Call after function if exists and only if action is canceled (<Esc>) " Call after function if exists and only if action is canceled (<Esc>)
if exists('*Multiple_cursors_after') && a:0 && s:before_function_called if a:0 && s:before_function_called
exe "call Multiple_cursors_after()" if exists('*Multiple_cursors_after')
exe "call Multiple_cursors_after()"
endif
doautocmd User MultipleCursorsPost
let s:before_function_called = 0 let s:before_function_called = 0
endif endif
endfunction endfunction

View File

@ -37,7 +37,9 @@ syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo,@Spell
syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend syn region pugCommentBlock start="\z(\s\+\|^\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" contains=pugCommentTodo,@Spell keepend
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" contains=pugCommentTodo,@Spell syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->" contains=pugCommentTodo,@Spell
syn region pugAngular2 start="(" end=")" contains=htmlEvent syn region pugAngular2 start="(" end=")" contains=htmlEvent
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent syn region pugJavascriptString start=+"+ skip=+\\\("\|$\)+ end=+"\|$+ contained
syn region pugJavascriptString start=+'+ skip=+\\\('\|$\)+ end=+'\|$+ contained
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=pugJavascriptString,pugHtmlArg,pugAngular2,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass syn match pugClassChar "\." containedin=htmlTagName nextgroup=pugClass
syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar
syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId
@ -99,6 +101,7 @@ hi def link pugCommentTodo Todo
hi def link pugComment Comment hi def link pugComment Comment
hi def link pugCommentBlock Comment hi def link pugCommentBlock Comment
hi def link pugHtmlConditionalComment pugComment hi def link pugHtmlConditionalComment pugComment
hi def link pugJavascriptString String
let b:current_syntax = "pug" let b:current_syntax = "pug"

View File

@ -40,7 +40,7 @@
" in your mapping will look like this: " in your mapping will look like this:
" "
" nnoremap <silent> <Plug>MyMap " nnoremap <silent> <Plug>MyMap
" \ :<C-U>execute 'silent! call repeat#setreg("\<lt>Plug>MyMap", v:register)'<Bar> " \ :<C-U>silent! call repeat#setreg("\<lt>Plug>MyMap", v:register)<Bar>
" \ call <SID>MyFunction(v:register, ...)<Bar> " \ call <SID>MyFunction(v:register, ...)<Bar>
" \ silent! call repeat#set("\<lt>Plug>MyMap")<CR> " \ silent! call repeat#set("\<lt>Plug>MyMap")<CR>

View File

@ -96,6 +96,20 @@ will load the `ruby-rails` scope whenever the `ruby` scope is active. The
buffer. The [vim-rails](https://github.com/tpope/vim-rails) plugin automatically buffer. The [vim-rails](https://github.com/tpope/vim-rails) plugin automatically
does `:SnipMateLoadScope rails` when editing a Rails project for example. does `:SnipMateLoadScope rails` when editing a Rails project for example.
> What are the snippet parser versions and what's the difference between them?
Originally SnipMate used regex to parse a snippet. Determining where stops were,
what the placeholders were, where mirrors were, etc. were all done with regex.
Needless to say this was a little fragile. When the time came for a rewritten
parser, some incompatibilities were a little necessary. Rather than break
everyone's snippets everywhere, we provided both the new (version 1) and the old
(version 0) and let the user choose between them.
Version 0 is considered legacy and not a lot of effort is going to go into
improving or even maintaining it. Version 1 is the future, and one can expect
new features to only exist for version 1 users. A full list of differences can
be found in the docs at `:h SnipMate-parser-versions`.
## Release Notes ## ## Release Notes ##
### 0.89 - 2016-05-29 ### ### 0.89 - 2016-05-29 ###

View File

@ -148,7 +148,8 @@ g:snipMate.snippet_version
1 Use the newer parser 1 Use the newer parser
If unset, SnipMate defaults to version 0. The If unset, SnipMate defaults to version 0. The
value of this option is also used for all value of this option is also used for all
.snippet files. .snippet files. See |SnipMate-parser-versions|
for more information.
g:snipMate.override g:snipMate.override
As detailed below, when two snippets with the As detailed below, when two snippets with the
@ -265,14 +266,18 @@ Note: Hard tabs in the expansion text are required. When the snippet is
expanded in the text and 'expandtab' is set, each tab will be replaced with expanded in the text and 'expandtab' is set, each tab will be replaced with
spaces based on 'softtabstop' if nonzero or 'shiftwidth' otherwise. spaces based on 'softtabstop' if nonzero or 'shiftwidth' otherwise.
Which version parser the snippets in a file should be used with can be
specified with a version line, e.g.: > SnipMate currently provides two versions for the snippet parser. The
differences between them can be found at |SnipMate-parser-versions|. Which
version parser the snippets in a file should be used with can be specified
with a version line, e.g.: >
version 1 version 1
Specification of a version applies to the snippets following it. Multiple Specification of a version applies to the snippets following it. Multiple
version specifications can appear in a single file to intermix version 0 and version specifications can appear in a single file to intermix version 0 and
version 1 snippets. version 1 snippets. The default is determined by the
g:snipMate.snippet_version option. |SnipMate-options|
Comments can be made in .snippets files by starting a line with a # character. Comments can be made in .snippets files by starting a line with a # character.
However these can't be used inside of snippet definitions: > However these can't be used inside of snippet definitions: >
@ -286,7 +291,7 @@ However these can't be used inside of snippet definitions: >
This should hopefully be clear with the included syntax highlighting. This should hopefully be clear with the included syntax highlighting.
*snipMate-extends* *SnipMate-extends*
Borrowing from UltiSnips, .snippets files can also contain an extends Borrowing from UltiSnips, .snippets files can also contain an extends
directive, for example: > directive, for example: >
@ -296,6 +301,11 @@ will tell SnipMate to also read html, javascript, and css snippets.
SNIPPET SYNTAX *snippet-syntax* *SnipMate-syntax* SNIPPET SYNTAX *snippet-syntax* *SnipMate-syntax*
As mentioned above, there are two versions of the snippet parser. They are
selected by the g:snipMate.snippet_version option (|SnipMate-options|) or the
version directive in .snippets files. Differences will be mentioned throughout
with a summary at |SnipMate-parser-versions|.
Anywhere in a snippet, a backslash escapes the character following it, Anywhere in a snippet, a backslash escapes the character following it,
regardless of whether that character is special or not. That is, '\a' will regardless of whether that character is special or not. That is, '\a' will
always result in an 'a' in the output. A single backslash can be output by always result in an 'a' in the output. A single backslash can be output by
@ -366,13 +376,15 @@ edited. These look like a tab stop without a placeholder; $1 for example. In
the event that no placeholder is specified for a certain tab stop--say $1--the the event that no placeholder is specified for a certain tab stop--say $1--the
first instance becomes the tab stop and the rest become mirrors. first instance becomes the tab stop and the rest become mirrors.
Additionally substitutions similar to |:substitute| can be performed. For Additionally, in version 1 of the parser, substitutions similar to
instance ${1/foo/bar/g} will replace all instances of "foo" in the $1 mirror |:substitute| can be performed. For instance ${1/foo/bar/g} will replace all
with "bar". This uses |substitute()| behind the scenes. instances of "foo" in the $1 mirror with "bar". This uses |substitute()|
behind the scenes.
Note: Just like with tab stops, braces can be used to avoid ambiguities: ${1}2 Note: Just like with tab stops, braces can be used to avoid ambiguities: ${1}2
is a mirror of the first tab stop followed by a 2. Version 0 of the snippet is a mirror of the first tab stop followed by a 2. Version 0 of the snippet
parser offers no way to resolve such ambiguities. parser offers no way to resolve such ambiguities. Version 0 also requires that
a tabstop have a placeholder before its mirrors work.
As an example, > As an example, >
@ -436,6 +448,39 @@ Example: >
<div> <div>
${0:${VISUAL:<!-- content -->}} ${0:${VISUAL:<!-- content -->}}
</div> </div>
<
*SnipMate-parser-versions*
Parser Versions~
SnipMate provides two versions for its snippet parser. Version 0 is the legacy
regex based version and is updated sparingly. Version 1 is the revamped
version with new features. Any newly developed features will likely only be
available to version 1 users.
Which version is used is determined by version directives in snippet files
(|SnipMate-snippet-files|) and by the g:snipMate.snippet_version option
(|SnipMate-options|).
A complete list of current differences is as follows:
- Backslash escaping is guaranteed to work in version 1. In certain edge cases
this may not work in version 0.
- Certain syntactic errors, such as a missing closing brace for a tabstop, are
more gracefully handled in version 1. In most cases, the parser will either
discard the error or, as in the previous example, end an item at the end of
line. Version 0 may not be predictable in this regard.
- Braces are not mandatory in version 1. SnipMate will determine which
instance of a stop ID to use based on the presence of a placeholder, or
whichever instance occurs first. Braces can therefore be used to
disambiguate between stop 12, $12, and stop 1 followed by a 2, ${1}2. In
other words, version 0 makes a distinction between a mirror and a stop while
version 1 resolves the differences for you.
- Placeholders are not mandatory to enable mirror support in version 1.
- Version 0 uses the confusing syntax {VISUAL} to refer to visual content.
Version 1 treats it as just another stop ID, so both $VISUAL and ${VISUAL}
work. Plus version 1 allows a default value in case no visual selection has
been made.
- Transformations similar to |:substitute| can be preformed on any mirror,
including visual content.
============================================================================== ==============================================================================
SNIPPET SOURCES *SnipMate-snippet-sources* SNIPPET SOURCES *SnipMate-snippet-sources*

View File

@ -4,25 +4,6 @@
priority -50 priority -50
snippet let "let variable declaration" b
let ${1:name}${2:: ${3:type}} = $4;
endsnippet
snippet letm "let mut variable declaration" b
let mut ${1:name}${2:: ${3:type}} = $4;
endsnippet
snippet fn "A function, optionally with arguments and return type."
fn ${1:function_name}($2)${3/..*/ -> /}$3 {
${VISUAL}$0
}
endsnippet
snippet pfn "A public function, optionally with arguments and return type."
pub fn ${1:function_name}($2)${3/..*/ -> /}$3 {
${VISUAL}$0
}
endsnippet
snippet arg "Function Arguments" i snippet arg "Function Arguments" i
${1:a}: ${2:T}${3:, arg} ${1:a}: ${2:T}${3:, arg}
@ -38,18 +19,6 @@ ${1:move }|$2| {
} }
endsnippet endsnippet
snippet pri "print!(..)" b
print!("$1"${2/..*/, /}$2);
endsnippet
snippet pln "println!(..)" b
println!("$1"${2/..*/, /}$2);
endsnippet
snippet fmt "format!(..)"
format!("$1"${2/..*/, /}$2);
endsnippet
snippet macro "macro_rules!" b snippet macro "macro_rules!" b
macro_rules! ${1:name} { macro_rules! ${1:name} {
(${2:matcher}) => ( (${2:matcher}) => (
@ -58,49 +27,8 @@ macro_rules! ${1:name} {
} }
endsnippet endsnippet
snippet mod "A module" b
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
${VISUAL}$0
}
endsnippet
snippet for "for .. in .." b
for ${1:i} in $2 {
${VISUAL}$0
}
endsnippet
snippet todo "A Todo comment"
// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")`
endsnippet
snippet st "Struct" b
struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
${VISUAL}$0
}
endsnippet
# TODO: fancy dynamic field mirroring like Python slotclass
snippet stn "Struct with new constructor." b
pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
fd$0
}
impl $1 {
pub fn new($2) -> $1 {
$1 { $3 }
}
}
endsnippet
snippet fd "Struct field definition" w snippet fd "Struct field definition" w
${1:name}: ${2:Type}, ${1:name}: ${2:Type},
endsnippet endsnippet
snippet impl "Struct/Trait implementation" b
impl ${1:Type/Trait}${2: for ${3:Type}} {
$0
}
endsnippet
# vim:ft=snippets: # vim:ft=snippets:

View File

@ -78,6 +78,14 @@ snippet sec "Section" b
$0 $0
endsnippet endsnippet
snippet sec* "Section" b
\section*{${1:section name}}
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
endsnippet
snippet sub "Subsection" b snippet sub "Subsection" b
\subsection{${1:subsection name}} \subsection{${1:subsection name}}
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} \label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
@ -85,6 +93,13 @@ snippet sub "Subsection" b
$0 $0
endsnippet endsnippet
snippet sub* "Subsection" b
\subsection*{${1:subsection name}}
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
endsnippet
snippet ssub "Subsubsection" b snippet ssub "Subsubsection" b
\subsubsection{${1:subsubsection name}} \subsubsection{${1:subsubsection name}}
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} \label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
@ -92,6 +107,13 @@ snippet ssub "Subsubsection" b
$0 $0
endsnippet endsnippet
snippet ssub* "Subsubsection" b
\subsubsection*{${1:subsubsection name}}
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
endsnippet
snippet par "Paragraph" b snippet par "Paragraph" b
\paragraph{${1:paragraph name}} \paragraph{${1:paragraph name}}
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} \label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
@ -112,7 +134,7 @@ $0
endsnippet endsnippet
snippet pac "Package" b snippet pac "Package" b
\usepackage[${1:options}]{${2:package}}$0 \usepackage`!p snip.rv='[' if t[1] else ""`${1:options}`!p snip.rv = ']' if t[1] else ""`{${2:package}}$0
endsnippet endsnippet
snippet lp "Long parenthesis" snippet lp "Long parenthesis"

View File

@ -58,28 +58,34 @@
# #
# Main # Main
snippet sim snippet sim
${1:public }static int Main(string[] args) { ${1:public} static int Main(string[] args)
{
${0} ${0}
return 0; return 0;
} }
snippet simc snippet simc
public class Application { public class Application
${1:public }static int Main(string[] args) { {
${1:public} static int Main(string[] args)
{
${0} ${0}
return 0; return 0;
} }
} }
snippet svm snippet svm
${1:public }static void Main(string[] args) { ${1:public} static void Main(string[] args)
{
${0} ${0}
} }
# if condition # if condition
snippet if snippet if
if (${1:true}) { if (${1:true})
{
${0:${VISUAL}} ${0:${VISUAL}}
} }
snippet el snippet el
else { else
{
${0:${VISUAL}} ${0:${VISUAL}}
} }
snippet ifs snippet ifs
@ -92,81 +98,99 @@ snippet ?
${1} ? ${2} : ${0} ${1} ? ${2} : ${0}
# do while loop # do while loop
snippet do snippet do
do { do
{
${0:${VISUAL}} ${0:${VISUAL}}
} while (${1:true}); } while (${1:true});
# while loop # while loop
snippet wh snippet wh
while (${1:true}) { while (${1:true})
{
${0:${VISUAL}} ${0:${VISUAL}}
} }
# for loop # for loop
snippet for snippet for
for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) { for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++})
{
${0} ${0}
} }
snippet forr snippet forr
for (int ${1:i} = ${2:length}; $1 >= 0; $1--) { for (int ${1:i} = ${2:length}; $1 >= 0; $1--)
{
${0} ${0}
} }
# foreach # foreach
snippet fore snippet fore
foreach (${1:var} ${2:entry} in ${3}) { foreach (${1:var} ${2:entry} in ${3})
{
${0} ${0}
} }
snippet foreach snippet foreach
foreach (${1:var} ${2:entry} in ${3}) { foreach (${1:var} ${2:entry} in ${3})
{
${0} ${0}
} }
snippet each snippet each
foreach (${1:var} ${2:entry} in ${3}) { foreach (${1:var} ${2:entry} in ${3})
{
${0} ${0}
} }
# interfaces # interfaces
snippet interface snippet interface
public interface ${1:`vim_snippets#Filename()`} { public interface ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
snippet if+ snippet if+
public interface ${1:`vim_snippets#Filename()`} { public interface ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
# class bodies # class bodies
snippet class snippet class
public class ${1:`vim_snippets#Filename()`} { public class ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
snippet cls snippet cls
${2:public} class ${1:`vim_snippets#Filename()`} { ${2:public} class ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
snippet cls+ snippet cls+
public class ${1:`vim_snippets#Filename()`} { public class ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
snippet cls+^ snippet cls+^
public static class ${1:`vim_snippets#Filename()`} { public static class ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
snippet cls& snippet cls&
internal class ${1:`vim_snippets#Filename()`} { internal class ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
snippet cls&^ snippet cls&^
internal static class ${1:`vim_snippets#Filename()`} { internal static class ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
snippet cls| snippet cls|
protected class ${1:`vim_snippets#Filename()`} { protected class ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
snippet cls|% snippet cls|%
protected abstract class ${1:`vim_snippets#Filename()`} { protected abstract class ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
# constructor # constructor
snippet ctor snippet ctor
public ${1:`vim_snippets#Filename()`}() { public ${1:`vim_snippets#Filename()`}()
{
${0} ${0}
} }
# properties - auto properties by default. # properties - auto properties by default.
@ -266,101 +290,124 @@ snippet ps-
private string ${1} { get; set; } private string ${1} { get; set; }
# members - void # members - void
snippet m snippet m
${1:public} ${2:void} ${3}(${4}) { ${1:public} ${2:void} ${3}(${4})
{
${0} ${0}
} }
snippet m+ snippet m+
public ${1:void} ${2}(${3}) { public ${1:void} ${2}(${3})
{
${0} ${0}
} }
snippet m& snippet m&
internal ${1:void} ${2}(${3}) { internal ${1:void} ${2}(${3})
{
${0} ${0}
} }
snippet m| snippet m|
protected ${1:void} ${2}(${3}) { protected ${1:void} ${2}(${3})
{
${0} ${0}
} }
snippet m- snippet m-
private ${1:void} ${2}(${3}) { private ${1:void} ${2}(${3})
{
${0} ${0}
} }
# members - int # members - int
snippet mi snippet mi
${1:public} int ${2}(${3}) { ${1:public} int ${2}(${3})
{
${0:return 0;} ${0:return 0;}
} }
snippet mi+ snippet mi+
public int ${1}(${2}) { public int ${1}(${2})
{
${0:return 0;} ${0:return 0;}
} }
snippet mi& snippet mi&
internal int ${1}(${2}) { internal int ${1}(${2})
{
${0:return 0;} ${0:return 0;}
} }
snippet mi| snippet mi|
protected int ${1}(${2}) { protected int ${1}(${2})
{
${0:return 0;} ${0:return 0;}
} }
snippet mi- snippet mi-
private int ${1}(${2}) { private int ${1}(${2})
{
${0:return 0;} ${0:return 0;}
} }
# members - bool # members - bool
snippet mb snippet mb
${1:public} bool ${2}(${3}) { ${1:public} bool ${2}(${3})
{
${0:return false;} ${0:return false;}
} }
snippet mb+ snippet mb+
public bool ${1}(${2}) { public bool ${1}(${2})
{
${0:return false;} ${0:return false;}
} }
snippet mb& snippet mb&
internal bool ${1}(${2}) { internal bool ${1}(${2})
{
${0:return false;} ${0:return false;}
} }
snippet mb| snippet mb|
protected bool ${1}(${2}) { protected bool ${1}(${2})
{
${0:return false;} ${0:return false;}
} }
snippet mb- snippet mb-
private bool ${1}(${2}) { private bool ${1}(${2})
{
${0:return false;} ${0:return false;}
} }
# members - string # members - string
snippet ms snippet ms
${1:public} string ${2}(${3}) { ${1:public} string ${2}(${3})
{
${0:return "";} ${0:return "";}
} }
snippet ms+ snippet ms+
public string ${1}(${2}) { public string ${1}(${2})
{
${0:return "";} ${0:return "";}
} }
snippet ms& snippet ms&
internal string ${1}(${2}) { internal string ${1}(${2})
{
${0:return "";} ${0:return "";}
} }
snippet ms| snippet ms|
protected string ${1:}(${2:}) { protected string ${1:}(${2:})
{
${0:return "";} ${0:return "";}
} }
snippet ms- snippet ms-
private string ${1}(${2}) { private string ${1}(${2})
{
${0:return "";} ${0:return "";}
} }
# structure # structure
snippet struct snippet struct
public struct ${1:`vim_snippets#Filename()`} { public struct ${1:`vim_snippets#Filename()`}
{
${0} ${0}
} }
# enumeration # enumeration
snippet enum snippet enum
enum ${1} { enum ${1}
{
${0} ${0}
} }
snippet enum+ snippet enum+
public enum ${1} { public enum ${1}
{
${0} ${0}
} }
# preprocessor directives # preprocessor directives
@ -391,8 +438,10 @@ snippet cw
# equals override # equals override
snippet eq snippet eq
public override bool Equals(object obj) { public override bool Equals(object obj)
if (obj == null || GetType() != obj.GetType()) { {
if (obj == null || GetType() != obj.GetType())
{
return false; return false;
} }
${0:throw new NotImplementedException();} ${0:throw new NotImplementedException();}
@ -400,7 +449,8 @@ snippet eq
} }
# exception # exception
snippet exc snippet exc
public class ${1:MyException} : ${2:Exception} { public class ${1:MyException} : ${2:Exception}
{
public $1() { } public $1() { }
public $1(string message) : base(message) { } public $1(string message) : base(message) { }
public $1(string message, Exception inner) : base(message, inner) { } public $1(string message, Exception inner) : base(message, inner) { }
@ -411,24 +461,28 @@ snippet exc
} }
# indexer # indexer
snippet index snippet index
public ${1:object} this[${2:int} index] { public ${1:object} this[${2:int} index]
{
get { ${0} } get { ${0} }
set { ${0} } set { ${0} }
} }
# eventhandler # eventhandler
snippet inv snippet inv
EventHandler temp = ${1:MyEvent}; EventHandler temp = ${1:MyEvent};
if (${2:temp} != null) { if (${2:temp} != null)
{
$2(); $2();
} }
# lock # lock
snippet lock snippet lock
lock (${1:this}) { lock (${1:this})
{
${0} ${0}
} }
# namespace # namespace
snippet namespace snippet namespace
namespace ${1:MyNamespace} { namespace ${1:MyNamespace}
{
${0} ${0}
} }
# property # property
@ -436,35 +490,42 @@ snippet prop
public ${1:int} ${2:MyProperty} { get; set; } public ${1:int} ${2:MyProperty} { get; set; }
snippet propf snippet propf
private ${1:int} ${2:myVar}; private ${1:int} ${2:myVar};
public $1 ${3:MyProperty} { public $1 ${3:MyProperty}
get { return $2; } {
set { $2 = value; } get { return $2; }
} set { $2 = value; }
}
snippet propg snippet propg
public ${1:int} ${2:MyProperty} { get; private set; } public ${1:int} ${2:MyProperty} { get; private set; }
# switch # switch
snippet switch snippet switch
switch (${1:switch_on}) { switch (${1:switch_on})
{
${0} ${0}
default: default:
} }
# try # try
snippet try snippet try
try { try
${0:${VISUAL}} {
}
catch (${1:System.Exception}) {
throw;
}
snippet tryf
try {
${0:${VISUAL}} ${0:${VISUAL}}
} }
finally { catch (${1:System.Exception})
{
throw;
}
snippet tryf
try
{
${0:${VISUAL}}
}
finally
{
${1} ${1}
} }
# using # using
snippet usi snippet usi
using(${1:resource}) { using (${1:resource})
{
${0} ${0}
} }

View File

@ -2,6 +2,12 @@ snippet do
do do
${0:${VISUAL}} ${0:${VISUAL}}
end end
snippet put IO.puts
IO.puts "${0}"
snippet ins IO.inspect
IO.inspect ${0}
snippet insl IO.inspect with label
IO.inspect(${0}label: "${1:label}")
snippet if if .. do .. end snippet if if .. do .. end
if ${1} do if ${1} do
${0:${VISUAL}} ${0:${VISUAL}}
@ -44,14 +50,14 @@ snippet for
for ${1:item} <- ${2:items} do for ${1:item} <- ${2:items} do
${0} ${0}
end end
snippet for:
for ${1:item} <- ${2:items}, do: ${0}
snippet fori snippet fori
for ${1:item} <- ${2:items}, into: ${3} do for ${1:item} <- ${2:items}, into: ${3} do
${0} ${0}
end end
snippet wi snippet wi
with( with ${1:item} <- ${2:items} do
${1:item} <- ${2:items}
) do
${0} ${0}
end end
snippet wie snippet wie
@ -63,6 +69,16 @@ snippet wie
${4} -> ${4} ->
${0} ${0}
end end
snippet sp
@spec ${1:name}(${2:args}) :: ${3:returns}
snippet op
@opaque ${1:type_name} :: ${2:type}
snippet ty
@type ${1:type_name} :: ${2:type}
snippet typ
@typep ${1:type_name} :: ${2:type}
snippet cb
@callback ${1:name}(${2:args}) :: ${3:returns}
snippet df snippet df
def ${1:name}, do: ${2} def ${1:name}, do: ${2}
snippet def snippet def
@ -157,3 +173,15 @@ snippet qu
snippet beh snippet beh
@behaviour ${1:Mix.Task} @behaviour ${1:Mix.Task}
${0} ${0}
snippet >e pipe to each
|> Enum.each(fn ${1} -> ${0} end)
snippet >m pipe to map
|> Enum.map(fn ${1} -> ${0} end)
snippet >f pipe to filter
|> Enum.filter(fn ${1} -> ${0} end)
snippet >r pipe to reduce
|> Enum.reduce(${1:acc}, fn ${2}, ${3:acc} -> ${0} end)
snippet >i pipe to inspect
|> IO.inspect
snippet >il pipe to inspect with label
|> IO.inspect(label: "${1:label}")

View File

@ -34,7 +34,8 @@ snippet -
${0} ${0}
snippet let snippet let
let let
${1} = ${2} ${1} =
${2}
in in
${0} ${0}
snippet if snippet if

View File

@ -91,6 +91,8 @@ snippet func
end function $1 end function $1
snippet pr snippet pr
write(*,*) $0 write(*,*) $0
snippet dpr
write(*,*) '$1 = ', $1
snippet read snippet read
read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0 read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) $0
snippet write snippet write

View File

@ -0,0 +1,46 @@
snippet mod
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`
${0}
snippet imp
import ${0:List}
snippet fn
${1:fn} : ${2:a} -> ${3:a}
$1 ${4} =
${0}
snippet fn1
${1:fn} : ${2:a} -> ${3:a}
$1 ${4} =
${0}
snippet fn2
${1:fn} : ${2:a} -> ${3:a} -> ${4:a}
$1 ${5} =
${0}
snippet fn3
${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
$1 ${6} =
${0}
snippet fn0
${1:fn} : ${2:a}
$1 =
${0}
snippet case
case ${1} of
${2} =>
${0}
snippet let
let
${1} =
${2}
in
${0}
snippet wh
where
${0}
snippet if
if ${1} then
${2:${VISUAL}}
else
${0}
${0}
snippet \ "Lambda function (\x => ...)"
(\\${1:_} => ${0})

View File

@ -3,9 +3,9 @@ snippet mod
( (
) where ) where
import Prelude import Prelude
${0} ${0}
snippet imp snippet imp
import ${0:Data.List} import ${0:Data.List}
snippet impq snippet impq
@ -50,3 +50,8 @@ snippet testunit
Assert.equal Assert.equal
"Hello, world!" "Hello, world!"
"Hello, sailor!" "Hello, sailor!"
snippet if
if ${1} then
${2:${VISUAL}}
else
${0}

View File

@ -150,6 +150,10 @@ snippet pdbbb
snippet rpdb snippet rpdb
import rpdb import rpdb
rpdb.set_trace() rpdb.set_trace()
# web python debugger (wdb)
snippet wdb
import wdb
wdb.set_trace()
# ptpython # ptpython
snippet ptpython snippet ptpython
from ptpython.repl import embed from ptpython.repl import embed

View File

@ -703,9 +703,9 @@ snippet is
snippet isn snippet isn
it { should_not ${0} } it { should_not ${0} }
snippet iexp snippet iexp
it { expect(${1:object}).${1} ${0} } it { expect(${1:object}).${2} ${0} }
snippet iexpb snippet iexpb
it { expect { ${1:object} }.${1} ${0} } it { expect { ${1:object} }.${2} ${0} }
snippet iiexp snippet iiexp
it { is_expected.to ${0} } it { is_expected.to ${0} }
snippet iiexpn snippet iiexpn

View File

@ -39,10 +39,17 @@ snippet letm "let mut variable declaration with type inference"
let mut ${1} = ${2}; let mut ${1} = ${2};
snippet lettm "let mut variable declaration with explicit type annotation" snippet lettm "let mut variable declaration with explicit type annotation"
let mut ${1}: ${2} = ${3}; let mut ${1}: ${2} = ${3};
snippet pri "print!"
print!("${1}");
snippet pri, "print! with format param"
print!("${1}", ${2});
snippet pln "println!" snippet pln "println!"
println!("${1}"); println!("${1}");
snippet pln, "println! with format param" snippet pln, "println! with format param"
println!("${1}", ${2}); println!("${1}", ${2});
snippet fmt "format!"
format!("${1}", ${2});
# Modules # Modules
snippet ec "extern crate" snippet ec "extern crate"
extern crate ${1:sync}; extern crate ${1:sync};

View File

@ -149,12 +149,12 @@ snippet sub* \subsection*
\\label{sub:${2:$1}} \\label{sub:${2:$1}}
${0} ${0}
# Sub Sub Section # Sub Sub Section
snippet subs \subsubsection snippet ssub \subsubsection
\\subsubsection{${1:subsubsection name}} \\subsubsection{${1:subsubsection name}}
\\label{ssub:${2:$1}} \\label{ssub:${2:$1}}
${0} ${0}
# Sub Sub Section without number # Sub Sub Section without number
snippet subs* \subsubsection* snippet ssub* \subsubsection*
\\subsubsection*{${1:subsubsection name}} \\subsubsection*{${1:subsubsection name}}
\\label{ssub:${2:$1}} \\label{ssub:${2:$1}}
${0} ${0}