mirror of
1
0
Fork 0

Updated plugins

This commit is contained in:
amix 2016-05-14 12:57:54 +01:00
parent 5f6aa8fe09
commit f343b66088
105 changed files with 2100 additions and 4902 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,23 @@ function! ack#Ack(cmd, args) "{{{
let l:grepformat = '%f' let l:grepformat = '%f'
endif endif
" Check user policy for blank searches
if empty(a:args)
if !g:ack_use_cword_for_empty_search
echo "No regular expression found."
return
endif
endif
" If no pattern is provided, search for the word under the cursor " If no pattern is provided, search for the word under the cursor
let l:grepargs = empty(a:args) ? expand("<cword>") : a:args . join(a:000, ' ') let l:grepargs = empty(a:args) ? expand("<cword>") : a:args . join(a:000, ' ')
"Bypass search if cursor is on blank string
if l:grepargs == ""
echo "No regular expression found."
return
endif
" NOTE: we escape special chars, but not everything using shellescape to " NOTE: we escape special chars, but not everything using shellescape to
" allow for passing arguments etc " allow for passing arguments etc
let l:escaped_args = escape(l:grepargs, '|#%') let l:escaped_args = escape(l:grepargs, '|#%')

View File

@ -230,6 +230,22 @@ Example:
let g:ack_use_dispatch = 1 let g:ack_use_dispatch = 1
< <
*g:ack_use_cword_for_empty_search*
g:ack_use_cword_for_empty_search
Default: 1
Use this option to enable blank searches to run against the word under the
cursor. When this option is not set, blank searches will only output an error
message.
Example:
>
let g:ack_use_cword_for_empty_search = 0
<
============================================================================== ==============================================================================
MAPPINGS *ack-mappings* MAPPINGS *ack-mappings*

View File

@ -3,15 +3,15 @@ if exists('g:loaded_ack')
endif endif
if !exists("g:ack_default_options") if !exists("g:ack_default_options")
let g:ack_default_options = " -s -H --nocolor --nogroup --column" let g:ack_default_options = " -s -H --nopager --nocolor --nogroup --column"
endif endif
" Location of the ack utility " Location of the ack utility
if !exists("g:ackprg") if !exists("g:ackprg")
if executable('ack') if executable('ack-grep')
let g:ackprg = "ack"
elseif executable('ack-grep')
let g:ackprg = "ack-grep" let g:ackprg = "ack-grep"
elseif executable('ack')
let g:ackprg = "ack"
else else
finish finish
endif endif
@ -63,6 +63,10 @@ if !exists("g:ack_autofold_results")
let g:ack_autofold_results = 0 let g:ack_autofold_results = 0
endif endif
if !exists("g:ack_use_cword_for_empty_search")
let g:ack_use_cword_for_empty_search = 1
endif
command! -bang -nargs=* -complete=file Ack call ack#Ack('grep<bang>', <q-args>) command! -bang -nargs=* -complete=file Ack call ack#Ack('grep<bang>', <q-args>)
command! -bang -nargs=* -complete=file AckAdd call ack#Ack('grepadd<bang>', <q-args>) command! -bang -nargs=* -complete=file AckAdd call ack#Ack('grepadd<bang>', <q-args>)
command! -bang -nargs=* -complete=file AckFromSearch call ack#AckFromSearch('grep<bang>', <q-args>) command! -bang -nargs=* -complete=file AckFromSearch call ack#AckFromSearch('grep<bang>', <q-args>)

View File

@ -76,6 +76,7 @@ Faq
Yes, install [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin). Yes, install [nerdtree-git-plugin](https://github.com/Xuyuanp/nerdtree-git-plugin).
---
> Can I have the nerdtree on every tab automatically? > Can I have the nerdtree on every tab automatically?
@ -85,10 +86,12 @@ http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers
If you are interested in this behaviour then consider [vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs) If you are interested in this behaviour then consider [vim-nerdtree-tabs](https://github.com/jistr/vim-nerdtree-tabs)
---
> How can I open a NERDTree automatically when vim starts up? > How can I open a NERDTree automatically when vim starts up?
Stick this in your vimrc: `autocmd vimenter * NERDTree` Stick this in your vimrc: `autocmd vimenter * NERDTree`
---
> How can I open a NERDTree automatically when vim starts up if no files were specified? > How can I open a NERDTree automatically when vim starts up if no files were specified?
Stick this in your vimrc: Stick this in your vimrc:
@ -98,22 +101,26 @@ Stick this in your vimrc:
Note: Now start vim with plain `vim`, not `vim .` Note: Now start vim with plain `vim`, not `vim .`
---
> How can I map a specific key or shortcut to open NERDTree? > How can I map a specific key or shortcut to open NERDTree?
Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want): Stick this in your vimrc to open NERDTree with `Ctrl+n` (you can set whatever key you want):
map <C-n> :NERDTreeToggle<CR> map <C-n> :NERDTreeToggle<CR>
---
> How can I close vim if the only window left open is a NERDTree? > How can I close vim if the only window left open is a NERDTree?
Stick this in your vimrc: Stick this in your vimrc:
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
---
> Can I have different highlighting for different file extensions? > Can I have different highlighting for different file extensions?
See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-92590696 See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-92590696
---
> How can I change default arrows? > How can I change default arrows?
Use these variables in your vimrc. Note that below are default arrow symbols Use these variables in your vimrc. Note that below are default arrow symbols

View File

@ -679,6 +679,9 @@ NERD tree. These options should be set in your vimrc.
a buffer when a file is being deleted or renamed a buffer when a file is being deleted or renamed
via a context menu command. via a context menu command.
|'NERDTreeCreatePrefix'| Specify a prefix to be used when creating the
NERDTree window.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
3.2. Customisation details *NERDTreeOptionDetails* 3.2. Customisation details *NERDTreeOptionDetails*
@ -1010,6 +1013,17 @@ option: >
let NERDTreeAutoDeleteBuffer=0 let NERDTreeAutoDeleteBuffer=0
let NERDTreeAutoDeleteBuffer=1 let NERDTreeAutoDeleteBuffer=1
< <
------------------------------------------------------------------------------
*'NERDTreeCreatePrefix'*
Values: Any valid command prefix.
Default: "silent".
Internally, NERDTree uses the |:edit| command to create a buffer in which to
display its tree view. You can augment this behavior by specifying a prefix
string such as "keepalt" or similar. For example, to have NERDTree create its
tree window using `silent keepalt keepjumps edit`:
let NERDTreeCreatePrefix='silent keepalt keepjumps'
<
============================================================================== ==============================================================================
4. The NERD tree API *NERDTreeAPI* 4. The NERD tree API *NERDTreeAPI*

View File

@ -96,7 +96,7 @@ function! s:Creator.createWindowTree(dir)
"we need a unique name for each window tree buffer to ensure they are "we need a unique name for each window tree buffer to ensure they are
"all independent "all independent
exec "silent edit " . self._nextBufferName() exec g:NERDTreeCreatePrefix . " edit " . self._nextBufferName()
call self._createNERDTree(path, "window") call self._createNERDTree(path, "window")
let b:NERDTree._previousBuf = bufnr(previousBuf) let b:NERDTree._previousBuf = bufnr(previousBuf)

View File

@ -61,7 +61,7 @@ function! s:Path.cacheDisplayString() abort
endif endif
if self.isReadOnly if self.isReadOnly
let self.cachedDisplayString .= ' [RO]' let self.cachedDisplayString .= ' ['.g:NERDTreeGlyphReadOnly.']'
endif endif
endfunction endfunction

View File

@ -375,7 +375,7 @@ function! s:UI._stripMarkup(line, removeLeadingSpaces)
let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","") let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","")
"strip off any read only flag "strip off any read only flag
let line = substitute (line, ' \[RO\]', "","") let line = substitute (line, ' \['.g:NERDTreeGlyphReadOnly.'\]', "","")
"strip off any bookmark flags "strip off any bookmark flags
let line = substitute (line, ' {[^}]*}', "","") let line = substitute (line, ' {[^}]*}', "","")

View File

@ -48,6 +48,7 @@ call s:initVariable("g:NERDTreeAutoCenterThreshold", 3)
call s:initVariable("g:NERDTreeCaseSensitiveSort", 0) call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
call s:initVariable("g:NERDTreeSortHiddenFirst", 1) call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
call s:initVariable("g:NERDTreeChDirMode", 0) call s:initVariable("g:NERDTreeChDirMode", 0)
call s:initVariable("g:NERDTreeCreatePrefix", "silent")
call s:initVariable("g:NERDTreeMinimalUI", 0) call s:initVariable("g:NERDTreeMinimalUI", 0)
if !exists("g:NERDTreeIgnore") if !exists("g:NERDTreeIgnore")
let g:NERDTreeIgnore = ['\~$'] let g:NERDTreeIgnore = ['\~$']
@ -84,6 +85,8 @@ else
endif endif
endif endif
call s:initVariable("g:NERDTreeGlyphReadOnly", "RO")
if !exists('g:NERDTreeStatusline') if !exists('g:NERDTreeStatusline')
"the exists() crap here is a hack to stop vim spazzing out when "the exists() crap here is a hack to stop vim spazzing out when

View File

@ -1,6 +1,6 @@
let s:tree_up_dir_line = '.. (up a dir)' let s:tree_up_dir_line = '.. (up a dir)'
syn match NERDTreeIgnore #\~# syn match NERDTreeIgnore #\~#
syn match NERDTreeIgnore #\[RO\]# exec 'syn match NERDTreeIgnore #\['.g:NERDTreeGlyphReadOnly.'\]#'
"highlighting for the .. (up dir) line at the top of the tree "highlighting for the .. (up dir) line at the top of the tree
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#" execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
@ -31,7 +31,7 @@ syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmar
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile' exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
"highlighting for readonly files "highlighting for readonly files
syn match NERDTreeRO # *\zs.*\ze \[RO\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile exec 'syn match NERDTreeRO # *\zs.*\ze \['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile,NERDTreeExecFile syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile,NERDTreeExecFile
syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir

View File

@ -61,10 +61,11 @@ Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP,
LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix, LLVM intermediate language, Lua, Markdown, MATLAB, Mercury, NASM, Nix,
Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable
Object, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML, Object, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML,
R, Racket, Relax NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, R, Racket, RDF TriG, RDF Turtle, Relax NG, reStructuredText, RPM spec, Ruby,
SML, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, SASS/SCSS, Scala, Slim, SML, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig,
VHDL, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML, z80, Zope page templates, and TypeScript, Vala, Verilog, VHDL, VimL, xHtml, XML, XSLT, XQuery, YACC, YAML,
zsh. See the [wiki][3] for details about the corresponding supported checkers. YANG data models, z80, Zope page templates, and zsh. See the [wiki][3] for
details about the corresponding supported checkers.
A number of third-party Vim plugins also provide checkers for syntastic, A number of third-party Vim plugins also provide checkers for syntastic,
for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12], for example: [merlin][30], [omnisharp-vim][25], [rust.vim][12],

View File

@ -89,8 +89,12 @@ function! syntastic#log#debugShowOptions(level, names) abort " {{{2
call s:_logRedirect(1) call s:_logRedirect(1)
let vlist = copy(type(a:names) == type('') ? [a:names] : a:names) let vlist = copy(type(a:names) == type('') ? [a:names] : a:names)
let add_shell = index(vlist, 'shell') >= 0 && &shell !=# syntastic#util#var('shell')
if !empty(vlist) if !empty(vlist)
call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val))) . (s:_is_modified(v:val) ? ' (!)' : '')") call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val))) . (s:_is_modified(v:val) ? ' (!)' : '')")
if add_shell
call add(vlist, 'u:shell = ' . strtrans(string(syntastic#util#var('shell'))) . ' (!)')
endif
echomsg leader . join(vlist, ', ') echomsg leader . join(vlist, ', ')
endif endif
call s:_logRedirect(0) call s:_logRedirect(0)

View File

@ -120,12 +120,14 @@ function! syntastic#util#parseShebang() abort " {{{2
return { 'exe': '', 'args': [] } return { 'exe': '', 'args': [] }
endfunction " }}}2 endfunction " }}}2
" Get the value of a variable. Allow local variables to override global ones. " Get the value of a Vim variable. Allow local variables to override global ones.
function! syntastic#util#rawVar(name, ...) abort " {{{2
return get(b:, a:name, get(g:, a:name, a:0 > 0 ? a:1 : ''))
endfunction " }}}2
" Get the value of a syntastic variable. Allow local variables to override global ones.
function! syntastic#util#var(name, ...) abort " {{{2 function! syntastic#util#var(name, ...) abort " {{{2
return return call('syntastic#util#rawVar', ['syntastic_' . a:name] + a:000)
\ exists('b:syntastic_' . a:name) ? b:syntastic_{a:name} :
\ exists('g:syntastic_' . a:name) ? g:syntastic_{a:name} :
\ a:0 > 0 ? a:1 : ''
endfunction " }}}2 endfunction " }}}2
" Parse a version string. Return an array of version components. " Parse a version string. Return an array of version components.

View File

@ -1071,11 +1071,17 @@ mode only work with "vim-auto-save" version 0.1.7 or later.
Syntastic can be used along with the "vim-go" Vim plugin (see Syntastic can be used along with the "vim-go" Vim plugin (see
https://github.com/fatih/vim-go). However, both "vim-go" and syntastic run https://github.com/fatih/vim-go). However, both "vim-go" and syntastic run
syntax checks by default when you save buffers to disk. To avoid conflicts, syntax checks by default when you save buffers to disk. To avoid conflicts,
you have to either set passive mode in syntastic for the go filetype (see you have to either set passive mode in syntastic for the "go" filetype (see
|syntastic_mode_map|), or prevent "vim-go" from showing a quickfix window when |syntastic_mode_map|), or prevent "vim-go" from showing a quickfix window when
|g:go_fmt_command| fails, by setting |g:go_fmt_fail_silently| to 1. E.g.: > |g:go_fmt_command| fails, by setting |g:go_fmt_fail_silently| to 1. E.g.: >
let g:go_fmt_fail_silently = 1 let g:go_fmt_fail_silently = 1
< <
"vim-go" version 1.4 and earlier always uses |quickfix| lists. Starting with
version 1.5, "vim-go" can also use location lists (see |location-list|). To
avoid conflicts with syntastic, you probably want to configure "vim-go" to
stick with |quickfix| lists: >
let g:go_list_type = "quickfix"
<
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
7.11. vim-virtualenv *syntastic-vim-virtualenv* 7.11. vim-virtualenv *syntastic-vim-virtualenv*

View File

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

View File

@ -37,7 +37,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'eruby': ['ruby'], \ 'eruby': ['ruby'],
\ 'fortran': ['gfortran'], \ 'fortran': ['gfortran'],
\ 'glsl': ['cgc'], \ 'glsl': ['cgc'],
\ 'go': ['go'], \ 'go': [],
\ 'haml': ['haml'], \ 'haml': ['haml'],
\ 'handlebars': ['handlebars'], \ 'handlebars': ['handlebars'],
\ 'haskell': ['hdevtools', 'hlint'], \ 'haskell': ['hdevtools', 'hlint'],
@ -90,6 +90,8 @@ let s:_DEFAULT_CHECKERS = {
\ 'tex': ['lacheck', 'chktex'], \ 'tex': ['lacheck', 'chktex'],
\ 'texinfo': ['makeinfo'], \ 'texinfo': ['makeinfo'],
\ 'text': [], \ 'text': [],
\ 'trig': ['rapper'],
\ 'turtle': ['rapper'],
\ 'twig': ['twiglint'], \ 'twig': ['twiglint'],
\ 'typescript': ['tsc'], \ 'typescript': ['tsc'],
\ 'vala': ['valac'], \ 'vala': ['valac'],
@ -102,6 +104,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'xquery': ['basex'], \ 'xquery': ['basex'],
\ 'yacc': ['bison'], \ 'yacc': ['bison'],
\ 'yaml': ['jsyaml'], \ 'yaml': ['jsyaml'],
\ 'yang': ['pyang'],
\ 'z80': ['z80syntaxchecker'], \ 'z80': ['z80syntaxchecker'],
\ 'zpt': ['zptlint'], \ 'zpt': ['zptlint'],
\ 'zsh': ['zsh'], \ 'zsh': ['zsh'],

View File

@ -32,8 +32,8 @@ function! SyntaxCheckers_ada_gcc_GetLocList() dict
\ '%-G%f:%s:,' . \ '%-G%f:%s:,' .
\ '%f:%l:%c: %m,' . \ '%f:%l:%c: %m,' .
\ '%f:%l: %m', \ '%f:%l: %m',
\ 'main_flags': '-c -x ada -gnats', \ 'main_flags': '-c -x ada -gnats -gnatef',
\ 'header_flags': '-x ada -gnats', \ 'header_flags': '-x ada -gnats -gnatef',
\ 'header_names': '\.ads$' }) \ 'header_names': '\.ads$' })
endfunction endfunction

View File

@ -1,7 +1,6 @@
"============================================================================ "============================================================================
"File: cuda.vim "File: cuda.vim
"Description: Syntax checking plugin for syntastic.vim "Description: Syntax checking plugin for syntastic
"
"Author: Hannes Schulz <schulz at ais dot uni-bonn dot de> "Author: Hannes Schulz <schulz at ais dot uni-bonn dot de>
" "
"============================================================================ "============================================================================
@ -15,7 +14,7 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_cuda_nvcc_GetLocList() dict function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
if exists('g:syntastic_cuda_arch') if syntastic#util#var('cuda_arch') !=# ''
let arch_flag = '-arch=' . g:syntastic_cuda_arch let arch_flag = '-arch=' . g:syntastic_cuda_arch
else else
let arch_flag = '' let arch_flag = ''
@ -41,8 +40,8 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
\ '%DMaking %*\a in %f,'. \ '%DMaking %*\a in %f,'.
\ '%f|%l| %m' \ '%f|%l| %m'
if expand('%', 1) =~? '\m\%(.h\|.hpp\|.cuh\)$' if index(['h', 'hpp', 'cuh'], expand('%:e', 1), 0, 1) >= 0
if exists('g:syntastic_cuda_check_header') if syntastic#util#var('cuda_check_header', 0)
let makeprg = let makeprg =
\ 'echo > .syntastic_dummy.cu ; ' . \ 'echo > .syntastic_dummy.cu ; ' .
\ self.getExecEscaped() . ' ' . arch_flag . \ self.getExecEscaped() . ' ' . arch_flag .

View File

@ -18,10 +18,6 @@ let g:loaded_syntastic_go_govet_checker = 1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_go_govet_IsAvailable() dict
return executable(self.getExec())
endfunction
function! SyntaxCheckers_go_govet_GetLocList() dict function! SyntaxCheckers_go_govet_GetLocList() dict
let makeprg = self.getExecEscaped() . ' vet' let makeprg = self.getExecEscaped() . ' vet'

View File

@ -20,7 +20,7 @@ let s:ghc_mod_new = -1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict " {{{1
if !executable(self.getExec()) if !executable(self.getExec())
return 0 return 0
endif endif
@ -59,9 +59,9 @@ function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
let s:ghc_mod_bailout = syntastic#util#versionIsAtLeast(parsed_ver, [5, 4]) let s:ghc_mod_bailout = syntastic#util#versionIsAtLeast(parsed_ver, [5, 4])
return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new) && !s:ghc_mod_bailout return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new) && !s:ghc_mod_bailout
endfunction endfunction " }}}1
function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict " {{{1
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'exe': self.getExecEscaped() . ' check' . (s:ghc_mod_new ? ' --boundary=""' : '') }) \ 'exe': self.getExecEscaped() . ' check' . (s:ghc_mod_new ? ' --boundary=""' : '') })
@ -81,7 +81,7 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
\ 'preprocess': 'iconv', \ 'preprocess': 'iconv',
\ 'postprocess': ['compressWhitespace'], \ 'postprocess': ['compressWhitespace'],
\ 'returns': [0] }) \ 'returns': [0] })
endfunction endfunction " }}}1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'haskell', \ 'filetype': 'haskell',

View File

@ -0,0 +1,23 @@
"============================================================================
"File: gjslint.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_html_gjslint_checker')
finish
endif
let g:loaded_syntastic_html_gjslint_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'html',
\ 'name': 'gjslint',
\ 'redirect': 'javascript/gjslint'})
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -21,7 +21,8 @@ function! SyntaxCheckers_javascript_gjslint_GetLocList() dict
call syntastic#log#deprecationWarn('javascript_gjslint_conf', 'javascript_gjslint_args') call syntastic#log#deprecationWarn('javascript_gjslint_conf', 'javascript_gjslint_args')
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'args_after': '--nosummary --unix_mode --nodebug_indentation --nobeep' }) \ 'args': '--nodebug_indentation',
\ 'args_after': '--check_html --nosummary --unix_mode --nobeep' })
let errorformat = let errorformat =
\ "%f:%l:(New Error -%\\?\%n) %m," . \ "%f:%l:(New Error -%\\?\%n) %m," .

View File

@ -17,7 +17,7 @@ let g:loaded_syntastic_javascript_jsxhint_checker = 1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict " {{{1
if !executable(self.getExec()) if !executable(self.getExec())
return 0 return 0
endif endif
@ -32,9 +32,9 @@ function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
endif endif
return syntastic#util#versionIsAtLeast(parsed_ver, [0, 4, 1]) return syntastic#util#versionIsAtLeast(parsed_ver, [0, 4, 1])
endfunction endfunction " }}}1
function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict " {{{1
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'args_after': '--verbose' }) \ 'args_after': '--verbose' })
@ -44,7 +44,7 @@ function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')} }) \ 'defaults': {'bufnr': bufnr('')} })
endfunction endfunction " }}}1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'javascript', \ 'filetype': 'javascript',

View File

@ -15,10 +15,6 @@ if exists('g:loaded_syntastic_less_lessc_checker')
endif endif
let g:loaded_syntastic_less_lessc_checker = 1 let g:loaded_syntastic_less_lessc_checker = 1
if !exists('g:syntastic_less_options')
let g:syntastic_less_options = ''
endif
if !exists('g:syntastic_less_use_less_lint') if !exists('g:syntastic_less_use_less_lint')
let g:syntastic_less_use_less_lint = 0 let g:syntastic_less_use_less_lint = 0
endif endif
@ -34,13 +30,10 @@ function! SyntaxCheckers_less_lessc_IsAvailable() dict
endfunction endfunction
function! SyntaxCheckers_less_lessc_GetLocList() dict function! SyntaxCheckers_less_lessc_GetLocList() dict
if !exists('s:check_file') call syntastic#log#deprecationWarn('less_options', 'less_lessc_args')
let s:check_file = g:syntastic_less_use_less_lint ? s:node_file : self.getExecEscaped()
endif
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'exe': s:check_file, \ 'exe': (g:syntastic_less_use_less_lint ? s:node_file : self.getExecEscaped()),
\ 'args': g:syntastic_less_options,
\ 'args_after': '--no-color', \ 'args_after': '--no-color',
\ 'tail': '> ' . syntastic#util#DevNull() }) \ 'tail': '> ' . syntastic#util#DevNull() })

View File

@ -15,12 +15,6 @@ if exists('g:loaded_syntastic_ocaml_camlp4o_checker')
endif endif
let g:loaded_syntastic_ocaml_camlp4o_checker = 1 let g:loaded_syntastic_ocaml_camlp4o_checker = 1
if exists('g:syntastic_ocaml_camlp4r') && g:syntastic_ocaml_camlp4r != 0
let s:ocamlpp='camlp4r'
else
let s:ocamlpp='camlp4o'
endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
@ -34,6 +28,10 @@ if !exists('g:syntastic_ocaml_use_janestreet_core')
let g:syntastic_ocaml_use_janestreet_core = 0 let g:syntastic_ocaml_use_janestreet_core = 0
endif endif
if !exists('g:syntastic_ocaml_janestreet_core_dir')
let g:syntastic_ocaml_janestreet_core_dir = '.'
endif
if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable('ocamlbuild') if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable('ocamlbuild')
let g:syntastic_ocaml_use_ocamlbuild = 0 let g:syntastic_ocaml_use_ocamlbuild = 0
endif endif
@ -41,6 +39,7 @@ endif
" }}}1 " }}}1
function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict " {{{1 function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict " {{{1
let s:ocamlpp = get(g:, 'syntastic_ocaml_camlp4r', 0) ? 'camlp4r' : 'camlp4o'
return executable(s:ocamlpp) return executable(s:ocamlpp)
endfunction " }}}1 endfunction " }}}1
@ -81,31 +80,22 @@ endfunction " }}}1
" Utilities {{{1 " Utilities {{{1
function! s:GetMakeprg() " {{{2 function! s:GetMakeprg() " {{{2
if g:syntastic_ocaml_use_ocamlc return
return s:GetOcamlcMakeprg() \ g:syntastic_ocaml_use_ocamlc ? g:syntastic_ocaml_use_ocamlc :
endif \ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg() :
\ s:GetOtherMakeprg()
if g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')
return s:GetOcamlBuildMakeprg()
endif
return s:GetOtherMakeprg()
endfunction " }}}2 endfunction " }}}2
function! s:GetOcamlcMakeprg() " {{{2 function! s:GetOcamlcMakeprg() " {{{2
if g:syntastic_ocaml_use_janestreet_core let build_cmd = g:syntastic_ocaml_use_janestreet_core ?
let build_cmd = 'ocamlc -I ' \ 'ocamlc -I ' . syntastic#util#shexpand(g:syntastic_ocaml_janestreet_core_dir) : 'ocamlc'
let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir, 1) let build_cmd .= ' -c ' . syntastic#util#shexpand('%')
let build_cmd .= ' -c ' . syntastic#util#shexpand('%') return build_cmd
return build_cmd
else
return 'ocamlc -c ' . syntastic#util#shexpand('%')
endif
endfunction " }}}2 endfunction " }}}2
function! s:GetOcamlBuildMakeprg() " {{{2 function! s:GetOcamlBuildMakeprg() " {{{2
return 'ocamlbuild -quiet -no-log -tag annot,' . s:ocamlpp . ' -no-links -no-hygiene -no-sanitize ' . return 'ocamlbuild -quiet -no-log -tag annot,' . s:ocamlpp . ' -no-links -no-hygiene -no-sanitize ' .
\ syntastic#util#shexpand('%:r') . '.cmi' \ syntastic#util#shexpand('%:r') . '.cmi'
endfunction " }}}2 endfunction " }}}2
function! s:GetOtherMakeprg() " {{{2 function! s:GetOtherMakeprg() " {{{2

View File

@ -39,7 +39,7 @@ endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_perl_perl_IsAvailable() dict function! SyntaxCheckers_perl_perl_IsAvailable() dict " {{{1
if !exists('g:syntastic_perl_perl_exec') && exists('g:syntastic_perl_interpreter') if !exists('g:syntastic_perl_perl_exec') && exists('g:syntastic_perl_interpreter')
let g:syntastic_perl_perl_exec = g:syntastic_perl_interpreter let g:syntastic_perl_perl_exec = g:syntastic_perl_interpreter
endif endif
@ -48,9 +48,9 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict
" let g:syntastic_perl_interpreter='/usr/bin/env perl' " let g:syntastic_perl_interpreter='/usr/bin/env perl'
silent! call syntastic#util#system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('exit(0)')) silent! call syntastic#util#system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('exit(0)'))
return v:shell_error == 0 return v:shell_error == 0
endfunction endfunction " }}}1
function! SyntaxCheckers_perl_perl_GetLocList() dict function! SyntaxCheckers_perl_perl_GetLocList() dict " {{{1
if type(g:syntastic_perl_lib_path) == type('') if type(g:syntastic_perl_lib_path) == type('')
call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list') call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list')
let includes = split(g:syntastic_perl_lib_path, ',') let includes = split(g:syntastic_perl_lib_path, ',')
@ -81,7 +81,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'preprocess': 'perl', \ 'preprocess': 'perl',
\ 'defaults': {'type': 'W'} }) \ 'defaults': {'type': 'W'} })
endfunction endfunction " }}}1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'perl', \ 'filetype': 'perl',

View File

@ -19,7 +19,7 @@ set cpo&vim
let s:pylint_new = -1 let s:pylint_new = -1
function! SyntaxCheckers_python_pylint_IsAvailable() dict function! SyntaxCheckers_python_pylint_IsAvailable() dict " {{{1
if !executable(self.getExec()) if !executable(self.getExec())
return 0 return 0
endif endif
@ -45,9 +45,9 @@ function! SyntaxCheckers_python_pylint_IsAvailable() dict
endtry endtry
return s:pylint_new >= 0 return s:pylint_new >= 0
endfunction endfunction " }}}1
function! SyntaxCheckers_python_pylint_GetLocList() dict function! SyntaxCheckers_python_pylint_GetLocList() dict " {{{1
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'args_after': (s:pylint_new ? \ 'args_after': (s:pylint_new ?
\ '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' : \ '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' :
@ -86,7 +86,7 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict
endfor endfor
return loclist return loclist
endfunction endfunction " }}}1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'python', \ 'filetype': 'python',

View File

@ -23,6 +23,11 @@ let s:rst2pseudoxml = (executable('rst2pseudoxml.py') && !syntastic#util#isRunni
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_rst_rst2pseudoxml_IsAvailable() dict
call self.log('exec =', self.getExec())
return executable(self.getExec())
endfunction
function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'args_after': '--report=2 --exit-status=1', \ 'args_after': '--report=2 --exit-status=1',

View File

@ -43,7 +43,7 @@ function! SyntaxCheckers_scala_scalastyle_GetLocList() dict
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'exe_after': ['-jar', expand(g:syntastic_scala_scalastyle_jar, 1)], \ 'exe_after': ['-jar', expand(g:syntastic_scala_scalastyle_jar, 1)],
\ 'args_before': ['-q', 'true', '-c', expand(g:syntastic_scala_scalastyle_config_file, 1)] }) \ 'args_before': ['-c', expand(g:syntastic_scala_scalastyle_config_file, 1)] })
let errorformat = let errorformat =
\ '%trror file=%f message=%m line=%l column=%c,' . \ '%trror file=%f message=%m line=%l column=%c,' .

View File

@ -11,8 +11,10 @@ let g:loaded_syntastic_sh_shellcheck_checker = 1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_sh_shellcheck_GetLocList() dict function! SyntaxCheckers_sh_shellcheck_GetLocList() dict " {{{1
let makeprg = self.makeprgBuild({ 'args_after': '-f gcc' }) let makeprg = self.makeprgBuild({
\ 'args': s:GetShell(),
\ 'args_after': '-f gcc' })
let errorformat = let errorformat =
\ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %trror: %m,' .
@ -32,7 +34,27 @@ function! SyntaxCheckers_sh_shellcheck_GetLocList() dict
endfor endfor
return loclist return loclist
endfunction endfunction " }}}1
" Utilities {{{1
function! s:GetShell() " {{{2
let sh = ''
if syntastic#util#parseShebang()['exe'] ==# ''
if syntastic#util#rawVar('is_kornshell', 0) || syntastic#util#rawVar('is_posix', 0)
let sh = 'ksh'
elseif syntastic#util#rawVar('is_bash', 0)
let sh = 'bash'
elseif syntastic#util#rawVar('is_sh', 0)
let sh = 'sh'
endif
endif
return sh !=# '' ? '-s ' . sh : ''
endfunction " }}}2
" }}}1
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'sh', \ 'filetype': 'sh',

View File

@ -0,0 +1,23 @@
"============================================================================
"File: rapper.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: Sebastian Tramp <mail@sebastian.tramp.name>
"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_trig_rapper_checker')
finish
endif
let g:loaded_syntastic_trig_rapper_checker = 1
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'trig',
\ 'name': 'rapper',
\ 'redirect': 'turtle/rapper'})
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,46 @@
"============================================================================
"File: rapper.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: Sebastian Tramp <mail@sebastian.tramp.name>
"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_turtle_rapper_checker')
finish
endif
let g:loaded_syntastic_turtle_rapper_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_turtle_rapper_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\mFailed to convert qname \zs\S\+\ze to URI')
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_turtle_rapper_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args': '-i guess -q --count' })
let errorformat =
\ 'rapper: %trror - URI file://%f:%l - %m,' .
\ 'rapper: %tarning - URI file://%f:%l - %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'returns': [0, 1] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'turtle',
\ 'name': 'rapper'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,43 @@
"============================================================================
"File: ttl.vim
"Description: turtle syntax checker - using ttl from turtle-validator (npm)
"Maintainer: Antoine Reilles (tonio@NetBSD.org)
"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_turtle_ttl_checker')
finish
endif
let g:loaded_syntastic_turtle_ttl_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_turtle_ttl_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m"\zs[^"]\+\ze"')
return term !=# '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_turtle_ttl_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat = '%\m[Error: %m %\%%(at%\|on%\) line %l%\%.]'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'turtle',
\ 'name': 'ttl'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1,46 @@
"============================================================================
"File: pyang.vim
"Description: Syntax checking plugin for syntastic.vim
"Authors: joshua.downer@gmail.com
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_yang_pyang_checker')
finish
endif
let g:loaded_syntastic_yang_pyang_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_yang_pyang_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m"\zs[^"]\+\ze"')
return term != '' ? '\V\<' . escape(term, '\') . '\>' : ''
endfunction
function! SyntaxCheckers_yang_pyang_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': ['filterForeignErrors'] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'yang',
\ 'name': 'pyang'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

View File

@ -0,0 +1 @@
doc/tags

View File

@ -1,18 +1,18 @@
let g:airline#themes#cool#palette = {} let g:airline#themes#cool#palette = {}
" NORMAL " NORMAL
let s:N1 = [ '#585858' , '#E4E4E4' , 17 , 190 ] let s:N1 = [ '#585858' , '#E4E4E4' , 59 , 188 ]
let s:N2 = [ '#E4E4E4' , '#0087AF' , 255 , 238 ] let s:N2 = [ '#E4E4E4' , '#0087AF' , 188 , 31 ]
let s:N3 = [ '#EEEEEE' , '#005F87' , 85 , 234 ] let s:N3 = [ '#EEEEEE' , '#005F87' , 231 , 24]
let g:airline#themes#cool#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#cool#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
"let g:airline#themes#cool#palette.normal_modified = { "let g:airline#themes#cool#palette.normal_modified = {
"\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , "\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
"\ } "\ }
" INSERT " INSERT
let s:I1 = [ '#585858' , '#E4E4E4' , 17 , 45 ] let s:I1 = [ '#585858' , '#E4E4E4' , 59 , 188 ]
let s:I2 = [ '#E4E4E4' , '#47AF00' , 255 , 27 ] let s:I2 = [ '#E4E4E4' , '#47AF00' , 188 , 70 ]
let s:I3 = [ '#EEEEEE' , '#2E8700' , 15 , 17 ] let s:I3 = [ '#EEEEEE' , '#2E8700' , 231 , 28 ]
let g:airline#themes#cool#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#cool#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
"let g:airline#themes#cool#palette.insert_modified = { "let g:airline#themes#cool#palette.insert_modified = {
"\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , "\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
@ -22,26 +22,26 @@ let g:airline#themes#cool#palette.insert = airline#themes#generate_color_map(s:I
"\ } "\ }
" REPLACE " REPLACE
let s:R1 = [ '#585858' , '#E4E4E4' , 17 , 45 ] let s:R1 = [ '#585858' , '#E4E4E4' , 59 , 188 ]
let s:R2 = [ '#E4E4E4' , '#AF5F00' , 255 , 27 ] let s:R2 = [ '#E4E4E4' , '#AF5F00' , 188 , 130 ]
let s:R3 = [ '#EEEEEE' , '#875300' , 15 , 17 ] let s:R3 = [ '#EEEEEE' , '#875300' , 231 , 94 ]
let g:airline#themes#cool#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) let g:airline#themes#cool#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
"let g:airline#themes#cool#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ] "let g:airline#themes#cool#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ]
"let g:airline#themes#cool#palette.replace_modified = g:airline#themes#cool#palette.insert_modified "let g:airline#themes#cool#palette.replace_modified = g:airline#themes#cool#palette.insert_modified
" VISUAL " VISUAL
let s:V1 = [ '#585858' , '#E4E4E4' , 232 , 214 ] let s:V1 = [ '#585858' , '#E4E4E4' , 59 , 188 ]
let s:V2 = [ '#E4E4E4' , '#AF2800' , 232 , 202 ] let s:V2 = [ '#E4E4E4' , '#AF2800' , 188 , 124 ]
let s:V3 = [ '#EEEEEE' , '#872800' , 15 , 52 ] let s:V3 = [ '#EEEEEE' , '#872800' , 231 , 88 ]
let g:airline#themes#cool#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#cool#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
"let g:airline#themes#cool#palette.visual_modified = { "let g:airline#themes#cool#palette.visual_modified = {
"\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] , "\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
"\ } "\ }
" INACTIVE " INACTIVE
let s:IA1 = [ '#585858' , '#E4E4E4' , 239 , 234 , '' ] let s:IA1 = [ '#585858' , '#E4E4E4' , 59 , 188 , '' ]
let s:IA2 = [ '#E4E4E4' , '#466D79' , 239 , 235 , '' ] let s:IA2 = [ '#E4E4E4' , '#466D79' , 188 , 60 , '' ]
let s:IA3 = [ '#EEEEEE' , '#324E59' , 239 , 236 , '' ] let s:IA3 = [ '#EEEEEE' , '#324E59' , 231 , 59 , '' ]
let g:airline#themes#cool#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) let g:airline#themes#cool#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
"let g:airline#themes#cool#palette.inactive_modified = { "let g:airline#themes#cool#palette.inactive_modified = {
"\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] , "\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
@ -49,7 +49,7 @@ let g:airline#themes#cool#palette.inactive = airline#themes#generate_color_map(s
let g:airline#themes#cool#palette.accents = { let g:airline#themes#cool#palette.accents = {
\ 'red': [ '#ff0000' , '' , 160 , '' ] \ 'red': [ '#ff0000' , '' , 196 , '' ]
\ } \ }
" CTRLP " CTRLP
@ -57,7 +57,9 @@ if !get(g:, 'loaded_ctrlp', 0)
finish finish
endif endif
let g:airline#themes#cool#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( let g:airline#themes#cool#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
\ [ '#E4E4E4' , '#00AFA2' , 231 , 98 , '' ], \ [ '#E4E4E4' , '#00AFA2' , 188 , 37 , '' ],
\ [ '#EEEEEE' , '#008787' , 55 , 231 , '' ], \ [ '#EEEEEE' , '#008787' , 231 , 30 , '' ],
\ [ '#585858' , '#E4E4E4' , 189 , 55 , '' ]) \ [ '#585858' , '#E4E4E4' , 59 , 188 , '' ])

View File

@ -1,102 +0,0 @@
" Each theme is contained in its own file and declares variables scoped to the
" file. These variables represent the possible "modes" that airline can
" detect. The mode is the return value of mode(), which gets converted to a
" readable string. The following is a list currently supported modes: normal,
" insert, replace, visual, and inactive.
"
" Each mode can also have overrides. These are small changes to the mode that
" don't require a completely different look. "modified" and "paste" are two
" such supported overrides. These are simply suffixed to the major mode,
" separated by an underscore. For example, "normal_modified" would be normal
" mode where the current buffer is modified.
"
" The theming algorithm is a 2-pass system where the mode will draw over all
" parts of the statusline, and then the override is applied after. This means
" it is possible to specify a subset of the theme in overrides, as it will
" simply overwrite the previous colors. If you want simultaneous overrides,
" then they will need to change different parts of the statusline so they do
" not conflict with each other.
"
" First, let's define an empty dictionary and assign it to the "palette"
" variable. The # is a separator that maps with the directory structure. If
" you get this wrong, Vim will complain loudly.
let g:airline#themes#dark#palette = {}
" First let's define some arrays. The s: is just a VimL thing for scoping the
" variables to the current script. Without this, these variables would be
" declared globally. Now let's declare some colors for normal mode and add it
" to the dictionary. The array is in the format:
" [ guifg, guibg, ctermfg, ctermbg, opts ]. See "help attr-list" for valid
" values for the "opt" value.
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
let g:airline#themes#dark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
" Here we define overrides for when the buffer is modified. This will be
" applied after g:airline#themes#dark#palette.normal, hence why only certain keys are
" declared.
let g:airline#themes#dark#palette.normal_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ }
let s:I1 = [ '#00005f' , '#00dfff' , 17 , 45 ]
let s:I2 = [ '#ffffff' , '#005fff' , 255 , 27 ]
let s:I3 = [ '#ffffff' , '#000080' , 15 , 17 ]
let g:airline#themes#dark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#dark#palette.insert_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ }
let g:airline#themes#dark#palette.insert_paste = {
\ 'airline_a': [ s:I1[0] , '#d78700' , s:I1[2] , 172 , '' ] ,
\ }
let g:airline#themes#dark#palette.replace = copy(g:airline#themes#dark#palette.insert)
let g:airline#themes#dark#palette.replace.airline_a = [ s:I2[0] , '#af0000' , s:I2[2] , 124 , '' ]
let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified
let s:V1 = [ '#000000' , '#ffaf00' , 232 , 214 ]
let s:V2 = [ '#000000' , '#ff5f00' , 232 , 202 ]
let s:V3 = [ '#ffffff' , '#5f0000' , 15 , 52 ]
let g:airline#themes#dark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#dark#palette.visual_modified = {
\ 'airline_c': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
\ }
let s:IA1 = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
let s:IA2 = [ '#4e4e4e' , '#262626' , 239 , 235 , '' ]
let s:IA3 = [ '#4e4e4e' , '#303030' , 239 , 236 , '' ]
let g:airline#themes#dark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3)
let g:airline#themes#dark#palette.inactive_modified = {
\ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] ,
\ }
" Accents are used to give parts within a section a slightly different look or
" color. Here we are defining a "red" accent, which is used by the 'readonly'
" part by default. Only the foreground colors are specified, so the background
" colors are automatically extracted from the underlying section colors. What
" this means is that regardless of which section the part is defined in, it
" will be red instead of the section's foreground color. You can also have
" multiple parts with accents within a section.
let g:airline#themes#dark#palette.accents = {
\ 'red': [ '#ff0000' , '' , 160 , '' ]
\ }
" Here we define the color map for ctrlp. We check for the g:loaded_ctrlp
" variable so that related functionality is loaded iff the user is using
" ctrlp. Note that this is optional, and if you do not define ctrlp colors
" they will be chosen automatically from the existing palette.
if !get(g:, 'loaded_ctrlp', 0)
finish
endif
let g:airline#themes#dark#palette.ctrlp = airline#extensions#ctrlp#generate_color_map(
\ [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ],
\ [ '#ffffff' , '#875fd7' , 231 , 98 , '' ],
\ [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ])

View File

@ -27,46 +27,54 @@ let s:cterm07 = "189"
let s:cterm08 = "88" let s:cterm08 = "88"
let s:cterm09 = "209" let s:cterm09 = "209"
let s:cterm0A = "221" let s:cterm0A = "221"
let s:cterm0B = "64" let s:cterm0B = "22"
let s:cterm0C = "73" let s:cterm0C = "73"
let s:cterm0D = "25" let s:cterm0D = "25"
let s:cterm0E = "176" let s:cterm0E = "176"
let s:cterm0F = "137" let s:cterm0F = "137"
let s:guiWhite = "#ffffff" let s:guiWhite = "#ffffff"
let s:guiGray = "#666666"
let s:ctermWhite = "231" let s:ctermWhite = "231"
let s:ctermGray = "243"
let g:airline#themes#jellybeans#palette = {} let g:airline#themes#jellybeans#palette = {}
let s:modified = { 'airline_c': [ '#ffb964', '', 215, '', '' ] }
" Normal mode " Normal mode
let s:N1 = [ s:gui07 , s:gui0D , s:cterm07 , s:cterm0D ] let s:N1 = [ s:gui07 , s:gui0D , s:cterm07 , s:cterm0D ]
let s:N2 = [ s:guiWhite , s:gui01 , s:ctermWhite , s:cterm01 ] let s:N2 = [ s:guiWhite , s:gui01 , s:ctermWhite , s:cterm01 ]
let s:N3 = [ s:gui02 , s:gui00 , s:cterm02 , s:cterm00 ] let s:N3 = [ s:gui02 , s:gui00 , s:cterm02 , s:cterm00 ]
let g:airline#themes#jellybeans#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#jellybeans#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#jellybeans#palette.normal_modified = s:modified
" Insert mode " Insert mode
let s:I1 = [ s:guiWhite , s:gui0B , s:ctermWhite , s:cterm0B ] let s:I1 = [ s:guiWhite , s:gui0B , s:ctermWhite , s:cterm0B ]
let s:I2 = [ s:gui02 , s:gui01 , s:cterm03 , s:cterm01 ] let s:I2 = s:N2
let s:I3 = [ s:guiWhite , s:gui01 , s:ctermWhite , s:cterm00 ] let s:I3 = [ s:guiWhite , s:gui01 , s:ctermWhite , s:cterm00 ]
let g:airline#themes#jellybeans#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#jellybeans#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3)
let g:airline#themes#jellybeans#palette.insert_modified = s:modified
" Visual mode " Visual mode
let s:V1 = [ s:guiWhite , s:gui08 , s:ctermWhite , s:cterm08 ] let s:V1 = [ s:guiWhite , s:gui08 , s:ctermWhite , s:cterm08 ]
let s:V2 = [ s:gui02 , s:gui01 , s:cterm03 , s:cterm01 ] let s:V2 = s:N2
let s:V3 = [ s:guiWhite , s:gui01 , s:ctermWhite , s:cterm00 ] let s:V3 = s:I3
let g:airline#themes#jellybeans#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#jellybeans#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3)
let g:airline#themes#jellybeans#palette.visual_modified = s:modified
" Replace mode " Replace mode
let s:R1 = [ s:gui08 , s:gui01 , s:cterm08, s:cterm00 ] let s:R1 = [ s:gui08 , s:gui01 , s:cterm08, s:cterm00 ]
let s:R2 = [ s:gui02 , s:gui01 , s:cterm03 , s:cterm01 ] let s:R2 = s:N2
let s:R3 = [ s:guiWhite , s:gui01 , s:ctermWhite , s:cterm00 ] let s:R3 = s:I3
let g:airline#themes#jellybeans#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) let g:airline#themes#jellybeans#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3)
let g:airline#themes#jellybeans#palette.replace_modified = s:modified
" Inactive mode " Inactive mode
let s:IN1 = [ s:gui00 , s:gui01 , s:cterm00 , s:cterm01 ] let s:IN1 = [ s:guiGray , s:gui01 , s:ctermGray , s:cterm01 ]
let s:IN2 = [ s:gui02 , s:gui00 , s:cterm02 , s:cterm00 ] let s:IN2 = [ s:gui02 , s:gui00 , s:cterm02 , s:cterm00 ]
let s:IN3 = [ s:gui02 , s:gui00 , s:cterm02 , s:cterm00 ] let s:IN3 = [ s:gui02 , s:gui00 , s:cterm02 , s:cterm00 ]
let g:airline#themes#jellybeans#palette.inactive = airline#themes#generate_color_map(s:IN1, s:IN2, s:IN3) let g:airline#themes#jellybeans#palette.inactive = airline#themes#generate_color_map(s:IN1, s:IN2, s:IN3)
let g:airline#themes#jellybeans#palette.inactive_modified = s:modified
" CtrlP " CtrlP
if !get(g:, 'loaded_ctrlp', 0) if !get(g:, 'loaded_ctrlp', 0)

View File

@ -12,22 +12,44 @@ function! airline#themes#solarized#refresh()
" Colors " Colors
"""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""
" Base colors " Base colors
let s:base03 = {'t': s:ansi_colors ? 8 : (s:tty ? '0' : 234), 'g': '#002b36'} " Extended base16 support by @cuviper.
let s:base02 = {'t': s:ansi_colors ? '0' : (s:tty ? '0' : 235), 'g': '#073642'} " Via https://github.com/blueyed/vim-colors-solarized/commit/92f2f994 /
let s:base01 = {'t': s:ansi_colors ? 10 : (s:tty ? '0' : 240), 'g': '#586e75'} " https://github.com/cuviper/vim-colors-solarized.
let s:base00 = {'t': s:ansi_colors ? 11 : (s:tty ? '7' : 241), 'g': '#657b83'} if s:ansi_colors && get(g:, 'solarized_base16', 0)
let s:base0 = {'t': s:ansi_colors ? 12 : (s:tty ? '7' : 244), 'g': '#839496'} let s:base03 = {'t': 0, 'g': "#002b36"} " Base 00
let s:base1 = {'t': s:ansi_colors ? 14 : (s:tty ? '7' : 245), 'g': '#93a1a1'} let s:base02 = {'t': 18, 'g': "#073642"} " Base 01
let s:base2 = {'t': s:ansi_colors ? 7 : (s:tty ? '7' : 254), 'g': '#eee8d5'} let s:base01 = {'t': 19, 'g': "#586e75"} " Base 02
let s:base3 = {'t': s:ansi_colors ? 15 : (s:tty ? '7' : 230), 'g': '#fdf6e3'} let s:base00 = {'t': 8, 'g': "#657b83"} " Base 03
let s:yellow = {'t': s:ansi_colors ? 3 : (s:tty ? '3' : 136), 'g': '#b58900'} let s:base0 = {'t': 20, 'g': "#839496"} " Base 04
let s:orange = {'t': s:ansi_colors ? 9 : (s:tty ? '1' : 166), 'g': '#cb4b16'} let s:base1 = {'t': 7, 'g': "#93a1a1"} " Base 05
let s:red = {'t': s:ansi_colors ? 1 : (s:tty ? '1' : 160), 'g': '#dc322f'} let s:base2 = {'t': 21, 'g': "#eee8d5"} " Base 06
let s:magenta = {'t': s:ansi_colors ? 5 : (s:tty ? '5' : 125), 'g': '#d33682'} let s:base3 = {'t': 15, 'g': "#fdf6e3"} " Base 07
let s:violet = {'t': s:ansi_colors ? 13 : (s:tty ? '5' : 61 ), 'g': '#6c71c4'} let s:yellow = {'t': 3, 'g': "#dc322f"} " Base 0A
let s:blue = {'t': s:ansi_colors ? 4 : (s:tty ? '4' : 33 ), 'g': '#268bd2'} let s:orange = {'t': 16, 'g': "#cb4b16"} " Base 09
let s:cyan = {'t': s:ansi_colors ? 6 : (s:tty ? '6' : 37 ), 'g': '#2aa198'} let s:red = {'t': 1, 'g': "#b58900"} " Base 08
let s:green = {'t': s:ansi_colors ? 2 : (s:tty ? '2' : 64 ), 'g': '#859900'} let s:magenta = {'t': 17, 'g': "#859900"} " Base 0F
let s:violet = {'t': 5, 'g': "#2aa198"} " Base 0E
let s:blue = {'t': 4, 'g': "#268bd2"} " Base 0D
let s:cyan = {'t': 6, 'g': "#6c71c4"} " Base 0C
let s:green = {'t': 2, 'g': "#d33682"} " Base 0B
else
let s:base03 = {'t': s:ansi_colors ? 8 : (s:tty ? '0' : 234), 'g': '#002b36'}
let s:base02 = {'t': s:ansi_colors ? '0' : (s:tty ? '0' : 235), 'g': '#073642'}
let s:base01 = {'t': s:ansi_colors ? 10 : (s:tty ? '0' : 240), 'g': '#586e75'}
let s:base00 = {'t': s:ansi_colors ? 11 : (s:tty ? '7' : 241), 'g': '#657b83'}
let s:base0 = {'t': s:ansi_colors ? 12 : (s:tty ? '7' : 244), 'g': '#839496'}
let s:base1 = {'t': s:ansi_colors ? 14 : (s:tty ? '7' : 245), 'g': '#93a1a1'}
let s:base2 = {'t': s:ansi_colors ? 7 : (s:tty ? '7' : 254), 'g': '#eee8d5'}
let s:base3 = {'t': s:ansi_colors ? 15 : (s:tty ? '7' : 230), 'g': '#fdf6e3'}
let s:yellow = {'t': s:ansi_colors ? 3 : (s:tty ? '3' : 136), 'g': '#b58900'}
let s:orange = {'t': s:ansi_colors ? 9 : (s:tty ? '1' : 166), 'g': '#cb4b16'}
let s:red = {'t': s:ansi_colors ? 1 : (s:tty ? '1' : 160), 'g': '#dc322f'}
let s:magenta = {'t': s:ansi_colors ? 5 : (s:tty ? '5' : 125), 'g': '#d33682'}
let s:violet = {'t': s:ansi_colors ? 13 : (s:tty ? '5' : 61 ), 'g': '#6c71c4'}
let s:blue = {'t': s:ansi_colors ? 4 : (s:tty ? '4' : 33 ), 'g': '#268bd2'}
let s:cyan = {'t': s:ansi_colors ? 6 : (s:tty ? '6' : 37 ), 'g': '#2aa198'}
let s:green = {'t': s:ansi_colors ? 2 : (s:tty ? '2' : 64 ), 'g': '#859900'}
endif
"""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""
" Simple mappings " Simple mappings

View File

@ -0,0 +1,128 @@
*airline-themes.txt* Themes for vim-airline
_ _ _ _ ~
__ _(_)_ __ ___ __ _(_)_ __| (_)_ __ ___ ~
\ \ / / | '_ ` _ \ _____ / _` | | '__| | | '_ \ / _ \ ~
\ V /| | | | | | |_____| (_| | | | | | | | | | __/ ~
\_/ |_|_| |_| |_| \__,_|_|_| |_|_|_| |_|\___| ~
~
==============================================================================
CONTENTS *airline-theme-contents*
01. Intro ........................................ |airline-themes-intro|
02. Features ........................................... |airline-themes|
03. Configuration ........................ |airline-themes-configuration|
04. Contributions ........................ |airline-themes-contributions|
05. License .................................... |airline-themes-license|
==============================================================================
INTRODUCTION *airline-themes-intro*
This is a plugin for vim-airline and provides several themes to be used in
conjuction with |vim-airline|
==============================================================================
FEATURES *airline-themes-list*
Currently this repository contains the following themes:
* badwolf
* base16
* base16_3024
* base16_apathy
* base16_ashes
* base16_atelierdune
* base16_atelierforest
* base16_atelierheath
* base16_atelierlakeside
* base16_atelierseaside
* base16_bespin
* base16_brewer
* base16_bright
* base16_chalk
* base16_codeschool
* base16_colors
* base16_default
* base16_eighties
* base16_embers
* base16_flat
* base16_google
* base16_grayscale
* base16_greenscreen
* base16_harmonic16
* base16_hopscotch
* base16_isotope
* base16_londontube
* base16_marrakesh
* base16_mocha
* base16_monokai
* base16_ocean
* base16_paraiso
* base16_pop
* base16_railscasts
* base16_shapeshifter
* base16_solarized
* base16_summerfruit
* base16_tomorrow
* base16_twilight
* base16color
* behelit
* bubblegum
* cool
* dark
* distinguished
* durant
* hybrid
* hybridline
* jellybeans
* kalisi
* kolor
* laederon
* light
* lucius
* luna
* molokai
* monochrome
* murmur
* papercolor
* powerlineish
* raven
* serene
* silver
* simple
* sol
* solarized (|airline-theme-solarized|)
* term
* tomorrow
* ubaryd
* understated
* wombat
* xtermlight
* zenburn
==============================================================================
NAME *airline-themes-configuration*
|airline-theme-solarized|
*g:solarized_base16*
Base16 has a Solarized theme with the usual colors, but mapped in the
terminal differently. The main difference is that the bright colors,
Ansi 9-15, are left the same as their Ansi 1-7 counterparts. The
remaining solarized colors are mapped into higher indexes by using
Base16 Shell. To enable it:
>
let g:solarized_base16 = 1
>
See also https://github.com/blueyed/vim-colors-solarized/commit/92f2f994.
==============================================================================
CONTRIBUTIONS *airline-themes-contributions*
Contributions and pull requests are welcome.
==============================================================================
LICENSE *airline-themes-license*
MIT License. Copyright © 2013-2016 Bailey Ling, et al
vim:tw=78:ts=8:ft=help:norl:

View File

@ -3,7 +3,10 @@
- vim: ???? - vim: ????
- vim-airline: ???? - vim-airline: ????
- OS: ???? - OS: ????
if you are using terminal:
- terminal: ???? - terminal: ????
- $TERM variable: ???
- color configuration (:set t_Co?):
#### actual behavior #### actual behavior

View File

@ -8,7 +8,8 @@ function! s:prototype.split(...)
endfunction endfunction
function! s:prototype.add_section_spaced(group, contents) function! s:prototype.add_section_spaced(group, contents)
call self.add_section(a:group, (g:airline_symbols.space).a:contents.(g:airline_symbols.space)) let spc = empty(a:contents) ? '' : g:airline_symbols.space
call self.add_section(a:group, spc.a:contents.spc)
endfunction endfunction
function! s:prototype.add_section(group, contents) function! s:prototype.add_section(group, contents)
@ -37,12 +38,28 @@ function! s:prototype.build()
let i = 0 let i = 0
let length = len(self._sections) let length = len(self._sections)
let split = 0 let split = 0
let is_empty = 0
let prev_group = ''
while i < length while i < length
let section = self._sections[i] let section = self._sections[i]
let group = section[0] let group = section[0]
let contents = section[1] let contents = section[1]
let pgroup = prev_group
let prev_group = s:get_prev_group(self._sections, i) let prev_group = s:get_prev_group(self._sections, i)
if is_empty
let prev_group = pgroup
endif
let is_empty = s:section_is_empty(self, contents)
if is_empty
" need to fix highlighting groups, since we
" have skipped a section, we actually need
" the previous previous group and so the
" seperator goes from the previous previous group
" to the current group
let pgroup = group
endif
if group == '' if group == ''
let line .= contents let line .= contents
@ -54,12 +71,16 @@ function! s:prototype.build()
if prev_group == '' if prev_group == ''
let line .= '%#'.group.'#' let line .= '%#'.group.'#'
elseif split elseif split
let line .= s:get_transitioned_seperator(self, prev_group, group, side) if !is_empty
let line .= s:get_transitioned_seperator(self, prev_group, group, side)
endif
let split = 0 let split = 0
else else
let line .= s:get_seperator(self, prev_group, group, side) if !is_empty
let line .= s:get_seperator(self, prev_group, group, side)
endif
endif endif
let line .= s:get_accented_line(self, group, contents) let line .= is_empty ? '' : s:get_accented_line(self, group, contents)
endif endif
let i = i + 1 let i = i + 1
@ -118,6 +139,43 @@ function! s:get_accented_line(self, group, contents)
return line return line
endfunction endfunction
function! s:section_is_empty(self, content)
let start=1
" do not check for inactive windows
if a:self._context.active == 0
return 0
endif
" only check, if airline#skip_empty_sections == 1
if get(g:, 'airline_skip_empty_sections', 0) == 0
return 0
endif
" assume accents sections to be never empty
" (avoides, that on startup the mode message becomes empty)
if match(a:content, '%#__accent_[^#]*#.*__restore__#') > -1
return 0
endif
let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start)
if empty(list)
return 0 " no function in statusline text
endif
while len(list) > 0
let expr = list[0]
try
" catch all exceptions, just in case
if !empty(eval(expr))
return 0
endif
catch
return 0
endtry
let start += 1
let list=matchlist(a:content, '%{\zs.\{-}\ze}', 1, start)
endw
return 1
endfunction
function! airline#builder#new(context) function! airline#builder#new(context)
let builder = copy(s:prototype) let builder = copy(s:prototype)
let builder._context = a:context let builder._context = a:context

View File

@ -123,7 +123,11 @@ function! airline#extensions#load()
if exists('g:airline_extensions') if exists('g:airline_extensions')
for ext in g:airline_extensions for ext in g:airline_extensions
call airline#extensions#{ext}#init(s:ext) try
call airline#extensions#{ext}#init(s:ext)
catch /^Vim\%((\a\+)\)\=:E117/ " E117, function does not exist
call airline#util#warning("Extension '".ext."' not installed, ignoring!")
endtry
endfor endfor
return return
endif endif

View File

@ -73,7 +73,7 @@ function! s:get_git_untracked(file)
if has_key(s:untracked_git, a:file) if has_key(s:untracked_git, a:file)
let untracked = s:untracked_git[a:file] let untracked = s:untracked_git[a:file]
else else
let output = system('git status --porcelain -- '. a:file) let output = system('git status --porcelain -- '. shellescape(a:file))
if output[0:1] is# '??' && output[3:-2] is? a:file if output[0:1] is# '??' && output[3:-2] is? a:file
let untracked = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) let untracked = get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists)
endif endif
@ -92,7 +92,7 @@ function! s:get_hg_untracked(file)
if has_key(s:untracked_hg, a:file) if has_key(s:untracked_hg, a:file)
let untracked = s:untracked_hg[a:file] let untracked = s:untracked_hg[a:file]
else else
let untracked = (system('hg status -u -- '. a:file)[0] is# '?' ? let untracked = (system('hg status -u -- '. shellescape(a:file))[0] is# '?' ?
\ get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) : '') \ get(g:, 'airline#extensions#branch#notexists', g:airline_symbols.notexists) : '')
let s:untracked_hg[a:file] = untracked let s:untracked_hg[a:file] = untracked
endif endif

View File

@ -22,6 +22,9 @@ function! s:get_section(winnr, key, ...)
endif endif
endif endif
let spc = g:airline_symbols.space let spc = g:airline_symbols.space
if !exists('g:airline_section_{a:key}')
return ''
endif
let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key})
let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')] let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')]
return empty(text) ? '' : prefix.text.suffix return empty(text) ? '' : prefix.text.suffix
@ -40,7 +43,7 @@ endfunction
" deactivate it, until this is properly fixed: " deactivate it, until this is properly fixed:
" https://groups.google.com/d/msg/vim_dev/sb1jmVirXPU/mPhvDnZ-CwAJ " https://groups.google.com/d/msg/vim_dev/sb1jmVirXPU/mPhvDnZ-CwAJ
if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81'))) if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch81')))
function s:add_section(builder, context, key) function! s:add_section(builder, context, key)
" i have no idea why the warning section needs special treatment, but it's " i have no idea why the warning section needs special treatment, but it's
" needed to prevent separators from showing up " needed to prevent separators from showing up
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
@ -56,7 +59,7 @@ if s:section_use_groups && (v:version >= 704 || (v:version >= 703 && has('patch8
endfunction endfunction
else else
" older version don't like the use of %(%) " older version don't like the use of %(%)
function s:add_section(builder, context, key) function! s:add_section(builder, context, key)
if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key))) if ((a:key == 'error' || a:key == 'warning') && empty(s:get_section(a:context.winnr, a:key)))
return return
endif endif

View File

@ -15,6 +15,13 @@ endfunction
function! airline#extensions#quickfix#init(ext) function! airline#extensions#quickfix#init(ext)
call a:ext.add_statusline_func('airline#extensions#quickfix#apply') call a:ext.add_statusline_func('airline#extensions#quickfix#apply')
call a:ext.add_inactive_statusline_func('airline#extensions#quickfix#inactive_qf_window')
endfunction
function! airline#extensions#quickfix#inactive_qf_window(...)
if getbufvar(a:2.bufnr, '&filetype') is# 'qf' && !empty(getwinvar(a:2.winnr, 'quickfix_title', ''))
call setwinvar(a:2.winnr, 'airline_section_c', '[%{get(w:, "quickfix_title", "")}] %f %m')
endif
endfunction endfunction
function! s:get_text() function! s:get_text()

View File

@ -73,7 +73,7 @@ function! airline#extensions#tabline#buffers#get()
" Neovim feature: Have clickable buffers " Neovim feature: Have clickable buffers
if has("tablineat") if has("tablineat")
call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#switchbuf@') call b.add_raw('%'.nr.'@airline#extensions#tabline#buffers#clickbuf@')
endif endif
if s:buffer_idx_mode if s:buffer_idx_mode
if len(s:number_map) > 0 if len(s:number_map) > 0
@ -180,7 +180,7 @@ function! s:jump_to_tab(offset)
endif endif
endfunction endfunction
function s:map_keys() function! s:map_keys()
if s:buffer_idx_mode if s:buffer_idx_mode
noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR> noremap <silent> <Plug>AirlineSelectTab1 :call <SID>select_tab(0)<CR>
noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR> noremap <silent> <Plug>AirlineSelectTab2 :call <SID>select_tab(1)<CR>
@ -196,10 +196,18 @@ function s:map_keys()
endif endif
endfunction endfunction
function airline#extensions#tabline#buffers#switchbuf(minwid, clicks, button, modifiers) abort function! airline#extensions#tabline#buffers#clickbuf(minwid, clicks, button, modifiers) abort
" Run the following code only on a single left mouse button click without modifiers pressed " Clickable buffers
" works only in recent NeoVim with has('tablineat') " works only in recent NeoVim with has('tablineat')
if a:clicks == 1 && a:button is# 'l' && a:modifiers !~# '[^ ]'
sil execute 'buffer' a:minwid " single mouse button click without modifiers pressed
if a:clicks == 1 && a:modifiers !~# '[^ ]'
if a:button is# 'l'
" left button - switch to buffer
silent execute 'buffer' a:minwid
elseif a:button is# 'm'
" middle button - delete buffer
silent execute 'bdelete' a:minwid
endif
endif endif
endfunction endfunction

View File

@ -94,7 +94,7 @@ function! airline#extensions#tabline#tabs#get()
return s:current_tabline return s:current_tabline
endfunction endfunction
function s:map_keys() function! s:map_keys()
noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR> noremap <silent> <Plug>AirlineSelectTab1 :1tabn<CR>
noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR> noremap <silent> <Plug>AirlineSelectTab2 :2tabn<CR>
noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR> noremap <silent> <Plug>AirlineSelectTab3 :3tabn<CR>

View File

@ -13,12 +13,9 @@ let s:long_format = get(g:, 'airline#extensions#whitespace#long_format', 'long[%
let s:mixed_indent_file_format = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', 'mix-indent-file[%s]') let s:mixed_indent_file_format = get(g:, 'airline#extensions#whitespace#mixed_indent_file_format', 'mix-indent-file[%s]')
let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0) let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0)
let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] } let s:skip_check_ft = {'make': ['indent', 'mixed-indent-file'] }
let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000)
let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1)
let s:c_like_langs = get(g:, 'airline#extensions#c_like_langs', [ 'c', 'cpp', 'cuda', 'javascript', 'ld', 'php' ])
let s:c_like_langs = ['c', 'cpp', 'cuda', 'java', 'javascript', 'ld']
function! s:check_mixed_indent() function! s:check_mixed_indent()
if s:indent_algo == 1 if s:indent_algo == 1
@ -139,7 +136,13 @@ function! airline#extensions#whitespace#init(...)
unlet! b:airline_whitespace_check unlet! b:airline_whitespace_check
augroup airline_whitespace augroup airline_whitespace
autocmd! autocmd!
autocmd CursorHold,BufWritePost * unlet! b:airline_whitespace_check autocmd CursorHold,BufWritePost * call <sid>ws_refresh()
augroup END augroup END
endfunction endfunction
function! s:ws_refresh()
unlet! b:airline_whitespace_check
if get(g:, 'airline_skip_empty_sections', 0)
exe ':AirlineRefresh'
endif
endfunction

View File

@ -48,7 +48,7 @@ function! s:wordcount()
endif endif
endfunction endfunction
function s:get_decimal_group() function! s:get_decimal_group()
if match(v:lang, '\v\cC|en') > -1 if match(v:lang, '\v\cC|en') > -1
return ',' return ','
elseif match(v:lang, '\v\cde|dk|fr|pt') > -1 elseif match(v:lang, '\v\cde|dk|fr|pt') > -1

View File

@ -63,6 +63,7 @@ function! airline#init#bootstrap()
\ 'readonly': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO', \ 'readonly': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a2" : 'RO',
\ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? "\u2739" : '!', \ 'whitespace': get(g:, 'airline_powerline_fonts', 0) ? "\u2739" : '!',
\ 'linenr': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a1" : ':', \ 'linenr': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a1" : ':',
\ 'maxlinenr': get(g:, 'airline_powerline_fonts', 0) ? "\u2630" : '',
\ 'branch': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : '', \ 'branch': get(g:, 'airline_powerline_fonts', 0) ? "\ue0a0" : '',
\ 'notexists': "\u2204", \ 'notexists': "\u2204",
\ 'modified': '+', \ 'modified': '+',
@ -88,6 +89,9 @@ function! airline#init#bootstrap()
call airline#parts#define('linenr', { call airline#parts#define('linenr', {
\ 'raw': '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#', \ 'raw': '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#',
\ 'accent': 'bold'}) \ 'accent': 'bold'})
call airline#parts#define('maxlinenr', {
\ 'raw': '%#__accent_bold#/%L%{g:airline_symbols.maxlinenr}%#__restore__#',
\ 'accent': 'bold'})
call airline#parts#define_function('ffenc', 'airline#parts#ffenc') call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic',
\ 'eclim', 'whitespace','windowswap', 'ycm_error_count', 'ycm_warning_count']) \ 'eclim', 'whitespace','windowswap', 'ycm_error_count', 'ycm_warning_count'])
@ -97,8 +101,8 @@ function! airline#init#bootstrap()
endfunction endfunction
function! airline#init#gui_mode() function! airline#init#gui_mode()
return ((has('nvim') && exists('$NVIM_TUI_ENABLE_TRUE_COLOR')) return ((has('nvim') && exists('$NVIM_TUI_ENABLE_TRUE_COLOR') && !exists("+termguicolors"))
\ || has('gui_running') || (has("termtruecolor") && &guicolors == 1)) ? \ || has('gui_running') || (has("termtruecolor") && &guicolors == 1) || (has("termguicolors") && &termguicolors == 1)) ?
\ 'gui' : 'cterm' \ 'gui' : 'cterm'
endfunction endfunction
@ -127,7 +131,7 @@ function! airline#init#sections()
let g:airline_section_y = airline#section#create_right(['ffenc']) let g:airline_section_y = airline#section#create_right(['ffenc'])
endif endif
if !exists('g:airline_section_z') if !exists('g:airline_section_z')
let g:airline_section_z = airline#section#create(['windowswap', '%3p%%'.spc, 'linenr', ':%3v ']) let g:airline_section_z = airline#section#create(['windowswap', '%3p%%'.spc, 'linenr', 'maxlinenr', spc.':%3v'])
endif endif
if !exists('g:airline_section_error') if !exists('g:airline_section_error')
let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic', 'eclim']) let g:airline_section_error = airline#section#create(['ycm_error_count', 'syntastic', 'eclim'])

View File

@ -19,6 +19,12 @@ function! airline#util#append(text, minwidth)
return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text
endfunction endfunction
function! airline#util#warning(msg)
echohl WarningMsg
echomsg "airline: ".a:msg
echohl Normal
endfunction
function! airline#util#prepend(text, minwidth) function! airline#util#prepend(text, minwidth)
if a:minwidth > 0 && winwidth(0) < a:minwidth if a:minwidth > 0 && winwidth(0) < a:minwidth
return '' return ''

View File

@ -140,6 +140,10 @@ values):
* disable the Airline customization for selective windows (this is a * disable the Airline customization for selective windows (this is a
window-local variable so you can disable it for only some windows) > window-local variable so you can disable it for only some windows) >
let w:airline_disabled = 1 let w:airline_disabled = 1
* Do not draw separators for empty sections (only for the active window)
>
let g:airline_skip_empty_sections = 1
< <
============================================================================== ==============================================================================
@ -190,6 +194,8 @@ its contents. >
let g:airline_symbols.linenr = '␊' let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤' let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶' let g:airline_symbols.linenr = '¶'
let g:airline_symbols.maxlinenr = '☰'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.branch = '⎇' let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ' let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ' let g:airline_symbols.paste = 'Þ'
@ -491,6 +497,10 @@ eclim <https://eclim.org>
* configure custom trailing whitespace regexp rule > * configure custom trailing whitespace regexp rule >
let g:airline#extensions#whitespace#trailing_regexp = '\s$' let g:airline#extensions#whitespace#trailing_regexp = '\s$'
* configure, which filetypes have special treatment of /* */ comments,
matters for mix-indent-file algorithm: >
let airline#extensions#c_like_langs = ['c', 'cpp', 'cuda', 'javascript', 'ld', 'php']
< <
------------------------------------- *airline-tabline* ------------------------------------- *airline-tabline*
Note: If you're using the ctrlspace tabline only the option marked with (c) Note: If you're using the ctrlspace tabline only the option marked with (c)
@ -508,6 +518,11 @@ are supported!
* enable/disable displaying buffers with a single tab. (c) * enable/disable displaying buffers with a single tab. (c)
let g:airline#extensions#tabline#show_buffers = 1 let g:airline#extensions#tabline#show_buffers = 1
< <
Note: If you are using neovim (has('tablineat') = 1), then you can click
on the tabline with the left mouse button to switch to that buffer, and
with the middle mouse button to delete that buffer.
* enable/disable displaying tabs, regardless of number. (c) * enable/disable displaying tabs, regardless of number. (c)
let g:airline#extensions#tabline#show_tabs = 1 let g:airline#extensions#tabline#show_tabs = 1
< <

View File

@ -37,6 +37,14 @@ function! s:on_window_changed()
if pumvisible() && (!&previewwindow || g:airline_exclude_preview) if pumvisible() && (!&previewwindow || g:airline_exclude_preview)
return return
endif endif
" Handle each window only once, since we might come here several times for
" different autocommands.
let l:key = [bufnr('%'), winnr(), winnr('$')]
if get(t:, 'airline_last_window_changed', []) == l:key
\ && &stl is# '%!airline#statusline('.winnr().')'
return
endif
let t:airline_last_window_changed = l:key
call s:init() call s:init()
call airline#update_statusline() call airline#update_statusline()
endfunction endfunction
@ -52,7 +60,7 @@ function! s:on_colorscheme_changed()
call airline#load_theme() call airline#load_theme()
endfunction endfunction
function airline#cmdwinenter(...) function! airline#cmdwinenter(...)
call airline#extensions#apply_left_override('Command Line', '') call airline#extensions#apply_left_override('Command Line', '')
endfunction endfunction
@ -79,10 +87,11 @@ function! s:airline_toggle()
autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter') autocmd CmdwinLeave * call airline#remove_statusline_func('airline#cmdwinenter')
autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed() autocmd GUIEnter,ColorScheme * call <sid>on_colorscheme_changed()
autocmd VimEnter,WinEnter,BufWinEnter,FileType,BufUnload,VimResized * autocmd SessionLoadPost,VimEnter,WinEnter,BufWinEnter,FileType,BufUnload *
\ call <sid>on_window_changed() \ call <sid>on_window_changed()
autocmd TabEnter * :unlet! w:airline_lastmode autocmd VimResized * call <sid>airline_refresh()
autocmd TabEnter * :unlet! w:airline_lastmode w:airline_active
autocmd BufWritePost */autoload/airline/themes/*.vim autocmd BufWritePost */autoload/airline/themes/*.vim
\ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0] \ exec 'source '.split(globpath(&rtp, 'autoload/airline/themes/'.g:airline_theme.'.vim', 1), "\n")[0]
\ | call airline#load_theme() \ | call airline#load_theme()
@ -110,7 +119,11 @@ function! s:airline_theme(...)
endfunction endfunction
function! s:airline_refresh() function! s:airline_refresh()
silent doautocmd User AirlineBeforeRefresh let nomodeline=''
if v:version > 703 || v:version == 703 && has("patch438")
let nomodeline = '<nomodeline>'
endif
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
call airline#load_theme() call airline#load_theme()
call airline#update_statusline() call airline#update_statusline()
endfunction endfunction

View File

@ -112,11 +112,6 @@ function! s:define_commands() abort
endfor endfor
endfunction endfunction
augroup fugitive_utility
autocmd!
autocmd User Fugitive call s:define_commands()
augroup END
let s:abstract_prototype = {} let s:abstract_prototype = {}
" Section: Initialization " Section: Initialization
@ -213,6 +208,7 @@ function! fugitive#detect(path) abort
endif endif
try try
let [save_mls, &modelines] = [&mls, 0] let [save_mls, &modelines] = [&mls, 0]
call s:define_commands()
doautocmd User Fugitive doautocmd User Fugitive
finally finally
let &mls = save_mls let &mls = save_mls
@ -347,7 +343,7 @@ function! s:repo_translate(spec) dict abort
elseif filereadable(refs.'remotes/'.a:spec) elseif filereadable(refs.'remotes/'.a:spec)
return refs.'remotes/'.a:spec return refs.'remotes/'.a:spec
elseif filereadable(refs.'remotes/'.a:spec.'/HEAD') elseif filereadable(refs.'remotes/'.a:spec.'/HEAD')
return refs.'remotes/'.a:spec,'/HEAD' return refs.'remotes/'.a:spec.'/HEAD'
else else
try try
let ref = self.rev_parse(matchstr(a:spec,'[^:]*')) let ref = self.rev_parse(matchstr(a:spec,'[^:]*'))
@ -704,7 +700,7 @@ function! s:Git(bang, args) abort
let args = matchstr(a:args,'\v\C.{-}%($|\\@<!%(\\\\)*\|)@=') let args = matchstr(a:args,'\v\C.{-}%($|\\@<!%(\\\\)*\|)@=')
if exists(':terminal') if exists(':terminal')
let dir = s:repo().tree() let dir = s:repo().tree()
tabedit % -tabedit %
execute 'lcd' fnameescape(dir) execute 'lcd' fnameescape(dir)
execute 'terminal' git args execute 'terminal' git args
else else
@ -1089,7 +1085,7 @@ function! s:Commit(args, ...) abort
if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod
execute 'keepalt edit '.s:fnameescape(msgfile) execute 'keepalt edit '.s:fnameescape(msgfile)
elseif a:args =~# '\%(^\| \)-\%(-verbose\|\w*v\)\>' elseif a:args =~# '\%(^\| \)-\%(-verbose\|\w*v\)\>'
execute 'keepalt '.(tabpagenr()-1).'tabedit '.s:fnameescape(msgfile) execute 'keepalt -tabedit '.s:fnameescape(msgfile)
elseif s:buffer().type() ==# 'index' elseif s:buffer().type() ==# 'index'
execute 'keepalt edit '.s:fnameescape(msgfile) execute 'keepalt edit '.s:fnameescape(msgfile)
execute (search('^#','n')+1).'wincmd+' execute (search('^#','n')+1).'wincmd+'

View File

@ -1,27 +1,94 @@
## 1.6 (unreleased) ## 1.7 (unreleased)
FEATURES:
* New **`:GoImpl`** command that generates method stubs for implementing an interface. Checkout the [demo](https://twitter.com/fatih/status/729991365581545472) to see how it works. [gh-846]
* New `<C-w><C-]>` and `<C-w>]>` shortcuts to split current window and jumpt to the identifier under cursor. [gh-838]
IMPROVEMENTS:
* Enable passing the `-tags` flag to `:GoDef`. Now you can pass build tags to `:GoDef` via `:GoGuruTags` or `g:go_guru_tags`
* Internal refactoring to use custom `system()` function that wraps both the standard `system()` call and `vimproc`. Now all system calls will take advantage and will use `vimproc` if installed. [gh-801]
* Added new `http.HandlerFunc` snippets with `hf` and `hhf` shortcuts [gh-816]
* Added new `Example` and `Benchmark` snippets with `example` and `benchmark` shortcuts [gh-836]
* Search tool binaries first in `GOBIN` and then in `PATH` as most of vim-go users installs it to `GOBIN` mostly [gh-823]
BUG FIXES:
* Fix `(go-freevars)` plug mapping to work as in visual mode instead of noncompatible normal mode [gh-832]
* Commands based on guru now shows a more meaningful error message instead of just showing the exit status (-1)
* Fix `:GoCoverage` accidently enabling syntax highlighting for users who don't use syntax (i.e syntax off) [gh-827]
* Fix commenting out block of texts for Go templates (filetype gothtmltmpl) [gh-813]
* Fix `:GoImplements` failing because of an empty scope definition. Now we default to current package to make it usable.
* Fix `:GoPlay` posting to non HTTPS url. [gh-847]
## 1.6 (April 25, 2016)
FEATURES: FEATURES:
* New `CHANGELOG.md` file (which you're reading now). This will make it easier * New `CHANGELOG.md` file (which you're reading now). This will make it easier
for me to track changes and release versions for me to track changes and release versions
* **`:GoCoverage`**: is now highlighting the current source file for * **`:GoCoverage`** is now highlighting the current source file for
covered/uncovered lines. If called again it clears the highlighting. This is covered/uncovered lines. If called again it runs the tests and updates the
a pretty good addition to vim-go and I suggest to check out the gif that shows annotation. Use `:GoCoverageClear` to clear the coverage annotation.
it in action: https://twitter.com/fatih/status/716722650383564800 [gh-786] This is a pretty good addition to vim-go and I suggest to check out the gif
* **`:GoCoverageBrowser`**: opens a new annotated HTML page. This is the old that shows it in action: https://twitter.com/fatih/status/716722650383564800
[gh-786]
* **`:GoCoverageToggle`** just like `:GoCoverage` but acts as a toggle. If run
again it clears the annotation.
* **`:GoCoverageBrowser`** opens a new annotated HTML page. This is the old
`:GoCoverage` behavior [gh-786] `:GoCoverage` behavior [gh-786]
* **`GoDoc`**: uses now `[gogetdoc](https://github.com/zmb3/gogetdoc)` to * **`:GoDoc`** uses now [gogetdoc](https://github.com/zmb3/gogetdoc) to
lookup and display the comment documentation for the identifier under the lookup and display the comment documentation for the identifier under the
cursor. This is more superior as it support looking up dot imports, named cursor. This is more superior as it support looking up dot imports, named
imports and imports where package name and file name are different [gh-782] imports and imports where package name and file name are different [gh-782]
* **`guru support`**: `oracle` is replaced by the new tool `guru`. `oracle.vim`
is therefore renamed to `guru.vim`. I've also refactored the code to make it
much more easier to maintain and add additional features in future (such as
upcoming JSON decoding). vim-go is now fully compatible with `guru`. Please
be sure you have installed `guru`. You can easily do it with
`:GoInstallBinaries`.
* **`:GoDef`** uses now `guru definition` under the hood instead of `godef`.
This fixes the following issues: 1. dot imports 2. vendor imports 3. folder
!= package name imports. The tool `godef` is also deprecated and not used
anymore.
* **`:GoDef`** does have now history of the call stack. This means you can
easily jump back to your last entry. This can be done with the new command
`:GoDefPop` or the mapping `CTRL-t`. To see the stack and jump between entries
you can use the new command `:GoDefStack`, which shows the list of all stack
entries. To reset the stack list anytime you can call `:GoDefStackClear`
[gh-776]
IMPROVEMENTS: IMPROVEMENTS:
* **`:GoCoverage`** is now executed async when used within Neovim [gh-686] * **`:GoCoverage`** is executed asynchronously when used within Neovim [gh-686]
* **`:GoTestFunc`** supports now testable examples [gh-794]
* **`:GoDef`** can jump to existing buffers instead of opening a new window
(split, vsplit or tab). By default it's disabled to not break the old
behavior, can be enabled with `let g:go_def_reuse_buffer = 1`
BUG FIXES: BUG FIXES:
* Fix not showing documentation for dot, named and package/file name being different imports [gh-332] * Fix not showing documentation for dot, named and package/file name being different imports [gh-332]
* Term mode: fix closing location list if result is successful after a failed attempt [gh-768] * Term mode: fix closing location list if result is successful after a failed attempt [gh-768]
* Syntax: fix gotexttmpl identifier highlighting [gh-778] * Syntax: fix gotexttmpl identifier highlighting [gh-778]
* Doc: fix wrong wording for `go-run` mapping. It's for the whole main package,
not for the current file
BACKWARDS INCOMPATIBILITIES:
* `:GoDef` doesn't accept any identifier as an argument. This is not suported
via `guru definition` and also was not widely used either. Also with this, we
significantly simplified the existing def.vim code
* `:GoOracleScope` and `:GoOracleTags` are deprecated in favor of
`:GoGuruScope` and `:GoGuruTags`. Also `g:go_oracle_scope` is renamed to
`g:go_guru_scope`
* `g:go_guru_scope` accepts a variable in type of `list` instead of `string`.
i.g: `let g:go_guru_scope = ["github.com/fatih/structs", "golang.org/x/tools/..."]`
## Previous releases
Previous changelogs can be found here: https://github.com/fatih/vim-go/releases

View File

@ -30,7 +30,7 @@ disabled/enabled easily.
(golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors (golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors
* Lint your code with `:GoLint` * Lint your code with `:GoLint`
* Run your code through `:GoVet` to catch static errors * Run your code through `:GoVet` to catch static errors
* Advanced source analysis tools utilizing oracle, 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` * Precise type-safe renaming of identifiers with `:GoRename`
* List all source files and dependencies * List all source files and dependencies
@ -50,14 +50,11 @@ disabled/enabled easily.
in their own new terminal. (beta) in their own new terminal. (beta)
* Alternate between implementation and test code with `:GoAlternate` * Alternate between implementation and test code with `:GoAlternate`
## 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)! This is fully optional and is just a way to support vim-go's ongoing development directly. Thanks!
[https://www.patreon.com/fatih](https://www.patreon.com/fatih)
## Install ## Install
Master branch is supposed to be a development branch. So stuff here can break and change.
Please try use always the [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, so I highly recommend to
use a common and well known plugin manager to install vim-go. Do not use vim-go use a common and well known plugin manager to install vim-go. Do not use vim-go
with other Go oriented vim plugins. For Pathogen just clone the repo. For other with other Go oriented vim plugins. For Pathogen just clone the repo. For other
@ -108,10 +105,11 @@ After that just open the help page to see all commands:
:help vim-go :help vim-go
## Mappings ## Example Mappings
vim-go has several `<Plug>` mappings which can be used to create custom vim-go has several `<Plug>` mappings which can be used to create custom
mappings. Below are some examples you might find useful: 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 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` build` and `go test` for the current package with `<leader>b` and `<leader>t`
@ -259,6 +257,15 @@ let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } 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 ## More info
Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more Check out the [Wiki](https://github.com/fatih/vim-go/wiki) page for more
@ -267,10 +274,18 @@ information. It includes
section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many section](https://github.com/fatih/vim-go/wiki/FAQ-Troubleshooting), and many
other [various pieces](https://github.com/fatih/vim-go/wiki) of information. other [various pieces](https://github.com/fatih/vim-go/wiki) of information.
## 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)! This is fully optional and is
just a way to support vim-go's ongoing development directly. Thanks!
[https://www.patreon.com/fatih](https://www.patreon.com/fatih)
## Credits ## Credits
* Go Authors for official vim plugins * Go Authors for official vim plugins
* Gocode, Godef, Golint, Oracle, Goimports, Gotags, Errcheck projects and * Gocode, Godef, Golint, Guru, Goimports, Gotags, Errcheck projects and
authors of those projects. authors of those projects.
* Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode, * Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode,
vim-godef) vim-godef)

View File

@ -87,8 +87,8 @@ function! ctrlp#decls#enter()
let command .= printf(" -dir %s", dir) let command .= printf(" -dir %s", dir)
endif endif
let out = system(command) let out = go#util#System(command)
if v:shell_error != 0 if go#util#ShellError() != 0
call go#util#EchoError(out) call go#util#EchoError(out)
return return
endif endif

View File

@ -32,10 +32,10 @@ function! go#asmfmt#Format()
if empty(path) if empty(path)
return return
endif endif
let out = system(path . ' -w ' . l:tmpname) let out = go#util#System(path . ' -w ' . l:tmpname)
" If there's no error, replace the current file with the output. " If there's no error, replace the current file with the output.
if v:shell_error == 0 if go#util#ShellError() == 0
" Remove undo point caused by BufWritePre. " Remove undo point caused by BufWritePre.
try | silent undojoin | catch | endtry try | silent undojoin | catch | endtry

View File

@ -229,7 +229,7 @@ function! go#cmd#Test(bang, compile, ...)
let l:listtype = "quickfix" let l:listtype = "quickfix"
if v:shell_error if go#util#ShellError() != 0
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd() let dir = getcwd()
try try
@ -272,7 +272,7 @@ function! go#cmd#TestFunc(bang, ...)
" "
" for the full list " for the full list
" :help search " :help search
let test = search("func Test", "bcnW") let test = search('func \(Test\|Example\)', "bcnW")
if test == 0 if test == 0
echo "vim-go: [test] no test found immediate to cursor" echo "vim-go: [test] no test found immediate to cursor"
@ -299,7 +299,7 @@ function! go#cmd#Generate(bang, ...)
" :make expands '%' and '#' wildcards, so they must also be escaped " :make expands '%' and '#' wildcards, so they must also be escaped
let goargs = go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1) let goargs = go#util#Shelljoin(map(copy(a:000), "expand(v:val)"), 1)
if v:shell_error if go#util#ShellError() != 0
let &makeprg = "go generate " . goargs let &makeprg = "go generate " . goargs
else else
let gofiles = go#util#Shelljoin(go#tool#Files(), 1) let gofiles = go#util#Shelljoin(go#tool#Files(), 1)

View File

@ -19,44 +19,12 @@ fu! s:gocodeCurrentBuffer()
return file return file
endf endf
if go#vimproc#has_vimproc()
let s:vim_system = get(g:, 'gocomplete#system_function', 'vimproc#system2')
let s:vim_shell_error = get(g:, 'gocomplete#shell_error_function', 'vimproc#get_last_status')
else
let s:vim_system = get(g:, 'gocomplete#system_function', 'system')
let s:vim_shell_error = ''
endif
fu! s:shell_error()
if empty(s:vim_shell_error)
return v:shell_error
endif
return call(s:vim_shell_error, [])
endf
fu! s:system(str, ...)
return call(s:vim_system, [a:str] + a:000)
endf
fu! s:gocodeShellescape(arg)
if go#vimproc#has_vimproc()
return vimproc#shellescape(a:arg)
endif
try
let ssl_save = &shellslash
set noshellslash
return shellescape(a:arg)
finally
let &shellslash = ssl_save
endtry
endf
fu! s:gocodeCommand(cmd, preargs, args) fu! s:gocodeCommand(cmd, preargs, args)
for i in range(0, len(a:args) - 1) for i in range(0, len(a:args) - 1)
let a:args[i] = s:gocodeShellescape(a:args[i]) let a:args[i] = go#util#Shellescape(a:args[i])
endfor endfor
for i in range(0, len(a:preargs) - 1) for i in range(0, len(a:preargs) - 1)
let a:preargs[i] = s:gocodeShellescape(a:preargs[i]) let a:preargs[i] = go#util#Shellescape(a:preargs[i])
endfor endfor
let bin_path = go#path#CheckBinPath(g:go_gocode_bin) let bin_path = go#path#CheckBinPath(g:go_gocode_bin)
@ -69,11 +37,11 @@ fu! s:gocodeCommand(cmd, preargs, args)
let old_gopath = $GOPATH let old_gopath = $GOPATH
let $GOPATH = go#path#Detect() let $GOPATH = go#path#Detect()
let result = s:system(printf('%s %s %s %s', s:gocodeShellescape(bin_path), join(a:preargs), s:gocodeShellescape(a:cmd), join(a:args))) let result = go#util#System(printf('%s %s %s %s', go#util#Shellescape(bin_path), join(a:preargs), go#util#Shellescape(a:cmd), join(a:args)))
let $GOPATH = old_gopath let $GOPATH = old_gopath
if s:shell_error() != 0 if go#util#ShellError() != 0
return "[\"0\", []]" return "[\"0\", []]"
else else
if &encoding != 'utf-8' if &encoding != 'utf-8'

View File

@ -1,16 +1,35 @@
let s:toggle = 0 let s:toggle = 0
" Buffer creates a new cover profile with 'go test -coverprofile' and changes " Buffer creates a new cover profile with 'go test -coverprofile' and changes
" teh current buffers highlighting to show covered and uncovered sections of " the current buffers highlighting to show covered and uncovered sections of
" the code. If run again it clears the annotation " the code. If run again it clears the annotation.
function! go#coverage#Buffer(bang, ...) function! go#coverage#BufferToggle(bang, ...)
if s:toggle if s:toggle
call go#coverage#Clear() call go#coverage#Clear()
return return
endif endif
if a:0 == 0
return call(function('go#coverage#Buffer'), [a:bang])
endif
return call(function('go#coverage#Buffer'), [a:bang] + a:000)
endfunction
" Buffer creates a new cover profile with 'go test -coverprofile' and changes
" teh current buffers highlighting to show covered and uncovered sections of
" the code. Calling it again reruns the tests and shows the last updated
" coverage.
function! go#coverage#Buffer(bang, ...)
" we use matchaddpos() which was introduce with 7.4.330, be sure we have
" it: http://ftp.vim.org/vim/patches/7.4/7.4.330
if !exists("*matchaddpos")
call go#util#EchoError("GoCoverage is supported with Vim version 7.4-330 or later")
return -1
endif
let s:toggle = 1 let s:toggle = 1
let l:tmpname=tempname() let l:tmpname = tempname()
let args = [a:bang, 0, "-coverprofile", l:tmpname] let args = [a:bang, 0, "-coverprofile", l:tmpname]
if a:0 if a:0
@ -35,7 +54,7 @@ function! go#coverage#Buffer(bang, ...)
return return
endif endif
if !v:shell_error if go#util#ShellError() == 0
call go#coverage#overlay(l:tmpname) call go#coverage#overlay(l:tmpname)
endif endif
@ -44,7 +63,10 @@ endfunction
" Clear clears and resets the buffer annotation matches " Clear clears and resets the buffer annotation matches
function! go#coverage#Clear() function! go#coverage#Clear()
if exists("g:syntax_on") | syntax enable | endif " only reset the syntax if the user has syntax enabled
if !empty(&syntax)
if exists("g:syntax_on") | syntax enable | endif
endif
if exists("s:toggle") | let s:toggle = 0 | endif if exists("s:toggle") | let s:toggle = 0 | endif
@ -59,7 +81,7 @@ endfunction
" Browser creates a new cover profile with 'go test -coverprofile' and opens " Browser creates a new cover profile with 'go test -coverprofile' and opens
" a new HTML coverage page from that profile in a new browser " a new HTML coverage page from that profile in a new browser
function! go#coverage#Browser(bang, ...) function! go#coverage#Browser(bang, ...)
let l:tmpname=tempname() let l:tmpname = tempname()
let args = [a:bang, 0, "-coverprofile", l:tmpname] let args = [a:bang, 0, "-coverprofile", l:tmpname]
if a:0 if a:0
@ -71,7 +93,7 @@ function! go#coverage#Browser(bang, ...)
let s:coverage_browser_handler_jobs[id] = l:tmpname let s:coverage_browser_handler_jobs[id] = l:tmpname
return return
endif endif
if !v:shell_error if go#util#ShellError() == 0
let openHTML = 'go tool cover -html='.l:tmpname let openHTML = 'go tool cover -html='.l:tmpname
call go#tool#ExecuteInDir(openHTML) call go#tool#ExecuteInDir(openHTML)
endif endif

View File

@ -1,26 +1,8 @@
if !exists("g:go_godef_bin") let s:go_stack = []
let g:go_godef_bin = "godef" let s:go_stack_level = 0
endif
if go#vimproc#has_vimproc() function! go#def#Jump(mode)
let s:vim_system = get(g:, 'gocomplete#system_function', 'vimproc#system2') let bin_path = go#path#CheckBinPath("guru")
else
let s:vim_system = get(g:, 'gocomplete#system_function', 'system')
endif
fu! s:system(str, ...)
return call(s:vim_system, [a:str] + a:000)
endf
" modified and improved version of vim-godef
function! go#def#Jump(...)
if !len(a:000)
let arg = "-o=" . go#util#OffsetCursor()
else
let arg = a:1
endif
let bin_path = go#path#CheckBinPath(g:go_godef_bin)
if empty(bin_path) if empty(bin_path)
return return
endif endif
@ -28,233 +10,193 @@ function! go#def#Jump(...)
let old_gopath = $GOPATH let old_gopath = $GOPATH
let $GOPATH = go#path#Detect() let $GOPATH = go#path#Detect()
let flags = ""
if exists('g:go_guru_tags')
let tags = get(g:, 'go_guru_tags')
let flags = printf(" -tags %s", tags)
endif
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?') let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
let command = bin_path . " -t -f=" . shellescape(fname) . " -i " . shellescape(arg) let command = printf("%s %s definition %s:#%s", bin_path, flags, shellescape(fname), go#util#OffsetCursor())
" get output of godef let out = go#util#System(command)
let out = s:system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding())) if go#util#ShellError() != 0
call go#util#EchoError(out)
" First line is <file>:<line>:<col>
" Second line is <identifier><space><type>
let godefout=split(out, go#util#LineEnding())
" jump to it
call s:godefJump(godefout, "")
let $GOPATH = old_gopath
endfunction
function! go#def#JumpMode(mode)
let arg = "-o=" . go#util#OffsetCursor()
let bin_path = go#path#CheckBinPath(g:go_godef_bin)
if empty(bin_path)
return return
endif endif
let old_gopath = $GOPATH call s:jump_to_declaration(out, a:mode)
let $GOPATH = go#path#Detect()
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
let command = bin_path . " -t -f=" . shellescape(fname) . " -i " . shellescape(arg)
" get output of godef
let out = s:system(command, join(getbufline(bufnr('%'), 1, '$'), go#util#LineEnding()))
" First line is <file>:<line>:<col>
" Second line is <identifier><space><type>
let godefout=split(out, go#util#LineEnding())
" jump to it
call s:godefJump(godefout, a:mode)
let $GOPATH = old_gopath let $GOPATH = old_gopath
endfunction endfunction
function! s:jump_to_declaration(out, mode)
function! s:getOffset() " strip line ending
return "-o=" . go#util#OffsetCursor() let out = split(a:out, go#util#LineEnding())[0]
endfunction if go#util#IsWin()
let parts = split(out, '\(^[a-zA-Z]\)\@<!:')
function! s:godefJump(out, mode)
let old_errorformat = &errorformat
let &errorformat = "%f:%l:%c"
" Location is the first line of godef output. Ideally in the proper format
" but it could also be an error
let location = a:out[0]
" Echo the godef error if we had one.
if location =~ 'godef: '
let gderr=substitute(location, go#util#LineEnding() . '$', '', '')
call go#util#EchoError(gderr)
return
endif
let parts = split(a:out[0], ':')
" parts[0] contains filename
let fileName = parts[0]
" Don't jump if it's the same identifier we just jumped to
if len(w:go_stack) > 0 && w:go_stack[w:go_stack_level-1]['ident'] == a:out[1] && w:go_stack[w:go_stack_level-1]['file'] == fileName
return
endif
" needed for restoring back user setting this is because there are two
" modes of switchbuf which we need based on the split mode
let old_switchbuf = &switchbuf
if a:mode == "tab"
let &switchbuf = "usetab"
if bufloaded(fileName) == 0
tab split
endif
elseif a:mode == "split"
split
elseif a:mode == "vsplit"
vsplit
else
" Don't jump in this window if it's been modified
if getbufvar(bufnr('%'), "&mod")
call go#util#EchoError("No write since last change")
return
endif
endif
let stack_entry = {'line': line("."), 'col': col("."),
\'file': expand('%:p'), 'ident': a:out[1]}
" jump to file now
call s:goToFileLocation(location)
"
" Remove anything newer than the current position, just like basic
" vim tag support
if w:go_stack_level == 0
let w:go_stack = []
else
let w:go_stack = w:go_stack[0:w:go_stack_level-1]
endif
" increment the stack counter
let w:go_stack_level += 1
" push it on to the jumpstack
call add(w:go_stack, stack_entry)
let &switchbuf = old_switchbuf
endfunction
function! go#def#StackUI()
if len(w:go_stack) == 0
call go#util#EchoError("godef stack empty")
return
endif
let stackOut = ['" <Up>,<Down>:navigate <Enter>:jump <Esc>,q:exit']
let i = 0
while i < len(w:go_stack)
let entry = w:go_stack[i]
let prefix = ""
if i == w:go_stack_level
let prefix = ">"
else
let prefix = " "
endif
call add(stackOut, printf("%s %d %s|%d col %d|%s", prefix, i+1, entry["file"], entry["line"], entry["col"], entry["ident"]))
let i += 1
endwhile
if w:go_stack_level == i
call add(stackOut, "> ")
endif
call go#ui#OpenWindow("GoDef Stack", stackOut, "godefstack")
noremap <buffer> <silent> <CR> :<C-U>call go#def#SelectStackEntry()<CR>
noremap <buffer> <silent> <Esc> :<C-U>call go#ui#CloseWindow()<CR>
noremap <buffer> <silent> q :<C-U>call go#ui#CloseWindow()<CR>
endfunction
function! go#def#StackPop(...)
if len(w:go_stack) == 0
call go#util#EchoError("godef stack empty")
return
endif
if w:go_stack_level == 0
call go#util#EchoError("at bottom of the godef stack")
return
endif
if !len(a:000)
let numPop = 1
else
let numPop = a:1
endif
let newLevel = str2nr(w:go_stack_level) - str2nr(numPop)
call go#def#StackJump(newLevel + 1)
endfunction
function! go#def#StackJump(...)
if len(w:go_stack) == 0
call go#util#EchoError("godef stack empty")
return
endif
if !len(a:000)
" Display interactive stack
call go#def#StackUI()
return
else else
let jumpTarget= a:1 let parts = split(out, ':')
endif endif
if jumpTarget !~ '^\d\+$' let filename = parts[0]
if jumpTarget !~ '^\s*$' let line = parts[1]
call go#util#EchoError("location must be a number") let col = parts[2]
endif let ident = parts[3]
return
endif
let jumpTarget=str2nr(jumpTarget) - 1 " Remove anything newer than the current position, just like basic
if jumpTarget >= 0 && jumpTarget < len(w:go_stack) " vim tag support
let w:go_stack_level = jumpTarget if s:go_stack_level == 0
let target = w:go_stack[w:go_stack_level] let s:go_stack = []
else
let s:go_stack = s:go_stack[0:s:go_stack_level-1]
endif
" jump " increment the stack counter
call s:goToFileLocation(target["file"], target["line"], target["col"]) let s:go_stack_level += 1
else
call go#util#EchoError("invalid godef stack location. Try :GoDefJump to see the list of valid entries")
endif
endfunction
function! s:goToFileLocation(...) " push it on to the jumpstack
let old_errorformat = &errorformat let stack_entry = {'line': line("."), 'col': col("."), 'file': expand('%:p'), 'ident': ident}
let &errorformat = "%f:%l:%c" call add(s:go_stack, stack_entry)
" put the error format into location list so we can jump automatically to " needed for restoring back user setting this is because there are two
" it " modes of switchbuf which we need based on the split mode
if a:0 == 3 let old_switchbuf = &switchbuf
lgetexpr printf("%s:%s:%s", a:1, a:2, a:3)
elseif a:0 == 1
lgetexpr a:1
else
lgetexpr ""
endif
sil ll 1 " jump to existing buffer if, 1. we have enabled it, 2. the buffer is loaded
normal zz " and 3. there is buffer window number we switch to
if get(g:, 'go_def_reuse_buffer', 0) && bufloaded(filename) != 0 && bufwinnr(filename) != -1
" jumpt to existing buffer if it exists
execute bufwinnr(filename) . 'wincmd w'
elseif a:mode == "tab"
let &switchbuf = "usetab"
if bufloaded(filename) == 0
tab split
endif
elseif a:mode == "split"
split
elseif a:mode == "vsplit"
vsplit
endif
let &errorformat = old_errorformat " open the file and jump to line and column
exec 'edit '.filename
call cursor(line, col)
" also align the line to middle of the view
normal! zz
let &switchbuf = old_switchbuf
endfunction endfunction
function! go#def#SelectStackEntry() function! go#def#SelectStackEntry()
let target_window = go#ui#GetReturnWindow() let target_window = go#ui#GetReturnWindow()
if empty(target_window) if empty(target_window)
let target_window = winnr() let target_window = winnr()
endif endif
let highlighted_stack_entry = matchstr(getline("."), '^..\zs\(\d\+\)')
if !empty(highlighted_stack_entry) let highlighted_stack_entry = matchstr(getline("."), '^..\zs\(\d\+\)')
execute target_window . "wincmd w" if !empty(highlighted_stack_entry)
call go#def#StackJump(str2nr(highlighted_stack_entry)) execute target_window . "wincmd w"
endif call go#def#Stack(str2nr(highlighted_stack_entry))
call go#ui#CloseWindow() endif
call go#ui#CloseWindow()
endfunction endfunction
function! go#def#StackUI()
if len(s:go_stack) == 0
call go#util#EchoError("godef stack empty")
return
endif
let stackOut = ['" <Up>,<Down>:navigate <Enter>:jump <Esc>,q:exit']
let i = 0
while i < len(s:go_stack)
let entry = s:go_stack[i]
let prefix = ""
if i == s:go_stack_level
let prefix = ">"
else
let prefix = " "
endif
call add(stackOut, printf("%s %d %s|%d col %d|%s",
\ prefix, i+1, entry["file"], entry["line"], entry["col"], entry["ident"]))
let i += 1
endwhile
if s:go_stack_level == i
call add(stackOut, "> ")
endif
call go#ui#OpenWindow("GoDef Stack", stackOut, "godefstack")
noremap <buffer> <silent> <CR> :<C-U>call go#def#SelectStackEntry()<CR>
noremap <buffer> <silent> <Esc> :<C-U>call go#ui#CloseWindow()<CR>
noremap <buffer> <silent> q :<C-U>call go#ui#CloseWindow()<CR>
endfunction
function! go#def#StackClear(...)
let s:go_stack = []
let s:go_stack_level = 0
endfunction
function! go#def#StackPop(...)
if len(s:go_stack) == 0
call go#util#EchoError("godef stack empty")
return
endif
if s:go_stack_level == 0
call go#util#EchoError("at bottom of the godef stack")
return
endif
if !len(a:000)
let numPop = 1
else
let numPop = a:1
endif
let newLevel = str2nr(s:go_stack_level) - str2nr(numPop)
call go#def#Stack(newLevel + 1)
endfunction
function! go#def#Stack(...)
if len(s:go_stack) == 0
call go#util#EchoError("godef stack empty")
return
endif
if !len(a:000)
" Display interactive stack
call go#def#StackUI()
return
else
let jumpTarget = a:1
endif
if jumpTarget !~ '^\d\+$'
if jumpTarget !~ '^\s*$'
call go#util#EchoError("location must be a number")
endif
return
endif
let jumpTarget = str2nr(jumpTarget) - 1
if jumpTarget >= 0 && jumpTarget < len(s:go_stack)
let s:go_stack_level = jumpTarget
let target = s:go_stack[s:go_stack_level]
" jump
exec 'edit '.target["file"]
call cursor(target["line"], target["col"])
normal! zz
else
call go#util#EchoError("invalid location. Try :GoDefStack to see the list of valid entries")
endif
endfunction

View File

@ -88,8 +88,8 @@ function! go#doc#Open(newmode, mode, ...)
let command = printf("%s -pos %s:#%s", bin_path, fname, offset) let command = printf("%s -pos %s:#%s", bin_path, fname, offset)
let out = system(command) let out = go#util#System(command)
if v:shell_error != 0 if go#util#ShellError() != 0
call go#util#EchoError(out) call go#util#EchoError(out)
return return
endif endif

View File

@ -65,11 +65,11 @@ function! go#fmt#Format(withGoimport)
try try
mkview! mkview!
catch catch
let l:curw=winsaveview() let l:curw = winsaveview()
endtry endtry
else else
" Save cursor position and many other things. " Save cursor position and many other things.
let l:curw=winsaveview() let l:curw = winsaveview()
endif endif
" Write current unsaved buffer to a temp file " Write current unsaved buffer to a temp file
@ -81,7 +81,7 @@ function! go#fmt#Format(withGoimport)
" prevent an additional undo jump due to BufWritePre auto command and also " prevent an additional undo jump due to BufWritePre auto command and also
" restore 'redo' history because it's getting being destroyed every " restore 'redo' history because it's getting being destroyed every
" BufWritePre " BufWritePre
let tmpundofile=tempname() let tmpundofile = tempname()
exe 'wundo! ' . tmpundofile exe 'wundo! ' . tmpundofile
endif endif
@ -115,7 +115,7 @@ function! go#fmt#Format(withGoimport)
if fmt_command == "goimports" if fmt_command == "goimports"
if !exists('b:goimports_vendor_compatible') if !exists('b:goimports_vendor_compatible')
let out = system("goimports --help") let out = go#util#System("goimports --help")
if out !~ "-srcdir" if out !~ "-srcdir"
echohl WarningMsg echohl WarningMsg
echomsg "vim-go: goimports does not support srcdir." echomsg "vim-go: goimports does not support srcdir."
@ -135,7 +135,10 @@ function! go#fmt#Format(withGoimport)
endif endif
" execute our command... " execute our command...
let out = system(command . " " . l:tmpname) if go#util#IsWin()
let l:tmpname = tr(l:tmpname, '\', '/')
endif
let out = go#util#System(command . " " . l:tmpname)
if fmt_command != "gofmt" if fmt_command != "gofmt"
let $GOPATH = old_gopath let $GOPATH = old_gopath
@ -145,7 +148,7 @@ function! go#fmt#Format(withGoimport)
"if there is no error on the temp file replace the output with the current "if there is no error on the temp file replace the output with the current
"file (if this fails, we can always check the outputs first line with: "file (if this fails, we can always check the outputs first line with:
"splitted =~ 'package \w\+') "splitted =~ 'package \w\+')
if v:shell_error == 0 if go#util#ShellError() == 0
" remove undo point caused via BufWritePre " remove undo point caused via BufWritePre
try | silent undojoin | catch | endtry try | silent undojoin | catch | endtry

View File

@ -0,0 +1,303 @@
" guru.vim -- Vim integration for the Go guru.
func! s:RunGuru(mode, format, selected, needs_scope) range abort
"return with a warning if the binary doesn't exist
let bin_path = go#path#CheckBinPath("guru")
if empty(bin_path)
return {'err': "bin path not found"}
endif
let filename = expand('%:p')
let dirname = expand('%:p:h')
let pkg = go#package#ImportPath(dirname)
" this is important, check it!
if pkg == -1 && a:needs_scope
return {'err': "current directory is not inside of a valid GOPATH"}
endif
" start constructing the 'command' variable
let command = bin_path
" enable outputting in json format
if a:format == "json"
let command .= " -json"
endif
" check for any tags
if exists('g:go_guru_tags')
let tags = get(g:, 'go_guru_tags')
let command .= printf(" -tags %s", tags)
endif
" some modes require scope to be defined (such as callers). For these we
" choose a sensible setting, which is using the current file's package
let scopes = []
if a:needs_scope
let scopes = [pkg]
endif
" check for any user defined scope setting. users can define the scope,
" in package pattern form. examples:
" golang.org/x/tools/cmd/guru # a single package
" golang.org/x/tools/... # all packages beneath dir
" ... # the entire workspace.
if exists('g:go_guru_scope')
" check that the setting is of type list
if type(get(g:, 'go_guru_scope')) != type([])
return {'err' : "go_guru_scope should of type list"}
endif
let scopes = get(g:, 'go_guru_scope')
endif
" now add the scope to our command if there is any
if !empty(scopes)
" strip trailing slashes for each path in scoped. bug:
" https://github.com/golang/go/issues/14584
let scopes = go#util#StripTrailingSlash(scopes)
" create shell-safe entries of the list
let scopes = go#util#Shelllist(scopes)
" guru expect a comma-separated list of patterns, construct it
let scope = join(scopes, ",")
let command .= printf(" -scope %s", scope)
endif
let pos = printf("#%s", go#util#OffsetCursor())
if a:selected != -1
" means we have a range, get it
let pos1 = go#util#Offset(line("'<"), col("'<"))
let pos2 = go#util#Offset(line("'>"), col("'>"))
let pos = printf("#%s,#%s", pos1, pos2)
endif
" this is our final command
let command .= printf(' %s %s:%s', a:mode, shellescape(filename), pos)
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
" the query might take time, let us give some feedback
call go#util#EchoProgress("analysing ...")
" run, forrest run!!!
let out = go#util#System(command)
let $GOPATH = old_gopath
if go#util#ShellError() != 0
" the output contains the error message
return {'err' : out}
endif
return {'out': out}
endfunc
" This uses Vim's errorformat to parse the output from Guru's 'plain output
" and put it into location list. I believe using errorformat is much more
" easier to use. If we need more power we can always switch back to parse it
" via regex.
func! s:loclistSecond(output)
" backup users errorformat, will be restored once we are finished
let old_errorformat = &errorformat
" match two possible styles of errorformats:
"
" 'file:line.col-line2.col2: message'
" 'file:line:col: message'
"
" We discard line2 and col2 for the first errorformat, because it's not
" useful and location only has the ability to show one line and column
" number
let errformat = "%f:%l.%c-%[%^:]%#:\ %m,%f:%l:%c:\ %m"
call go#list#ParseFormat("locationlist", errformat, split(a:output, "\n"))
let errors = go#list#Get("locationlist")
call go#list#Window("locationlist", len(errors))
endfun
function! go#guru#Scope(...)
if a:0
if a:0 == 1 && a:1 == '""'
unlet g:go_guru_scope
call go#util#EchoSuccess("guru scope is cleared")
else
let g:go_guru_scope = a:000
call go#util#EchoSuccess("guru scope changed to: ". join(a:000, ","))
endif
return
endif
if !exists('g:go_guru_scope')
call go#util#EchoError("guru scope is not set")
else
call go#util#EchoSuccess("current guru scope: ". join(g:go_guru_scope, ","))
endif
endfunction
function! go#guru#Tags(...)
if a:0
if a:0 == 1 && a:1 == '""'
unlet g:go_guru_tags
call go#util#EchoSuccess("guru tags is cleared")
else
let g:go_guru_tags = a:1
call go#util#EchoSuccess("guru tags changed to: ". a:1)
endif
return
endif
if !exists('g:go_guru_tags')
call go#util#EchoSuccess("guru tags is not set")
else
call go#util#EchoSuccess("current guru tags: ". a:1)
endif
endfunction
" Show 'implements' relation for selected package
function! go#guru#Implements(selected)
let out = s:RunGuru('implements', 'plain', a:selected, 1)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
call s:loclistSecond(out.out)
endfunction
" Describe selected syntax: definition, methods, etc
function! go#guru#Describe(selected)
let out = s:RunGuru('describe', 'plain', a:selected, 0)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
call s:loclistSecond(out.out)
endfunction
" Show possible targets of selected function call
function! go#guru#Callees(selected)
let out = s:RunGuru('callees', 'plain', a:selected, 1)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
call s:loclistSecond(out.out)
endfunction
" Show possible callers of selected function
function! go#guru#Callers(selected)
let out = s:RunGuru('callers', 'plain', a:selected, 1)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
call s:loclistSecond(out.out)
endfunction
" Show path from callgraph root to selected function
function! go#guru#Callstack(selected)
let out = s:RunGuru('callstack', 'plain', a:selected, 1)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
call s:loclistSecond(out.out)
endfunction
" Show free variables of selection
function! go#guru#Freevars(selected)
" Freevars requires a selection
if a:selected == -1
call go#util#EchoError("GoFreevars requires a selection (range) of code")
return
endif
let out = s:RunGuru('freevars', 'plain', a:selected, 0)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
call s:loclistSecond(out.out)
endfunction
" Show send/receive corresponding to selected channel op
function! go#guru#ChannelPeers(selected)
let out = s:RunGuru('peers', 'plain', a:selected, 1)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
call s:loclistSecond(out.out)
endfunction
" Show all refs to entity denoted by selected identifier
function! go#guru#Referrers(selected)
let out = s:RunGuru('referrers', 'plain', a:selected, 0)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
call s:loclistSecond(out.out)
endfunction
function! go#guru#What(selected)
" nvim doesn't have JSON support, though they work on it:
" https://github.com/neovim/neovim/pull/4131
if has('nvim')
return {'err': "GoWhat is not supported in Neovim"}
endif
" json_encode() and friends are introduced with this patch
" https://groups.google.com/d/msg/vim_dev/vLupTNhQhZ8/cDGIk0JEDgAJ
if !has('patch-7.4.1304')
return {'err': "GoWhat is supported with Vim version 7.4-1304 or later"}
endif
let out = s:RunGuru('what', 'json', a:selected, 0)
if has_key(out, 'err')
return out.err
endif
call s:loclistSecond(out.out)
let result = json_decode(out.out)
if type(result) != type({})
return {'err': "malformed output from guru"}
endif
if !has_key(result, 'what')
return {'err': "no what query found for the given identifier"}
endif
return {'out': result.what}
endfunction
function! go#guru#SameIds(selected)
let result = go#guru#What(a:selected)
if has_key(out, 'err')
call go#util#EchoError(out.err)
return
endif
if !has_key(result.out, 'sameids')
call go#util#EchoError("no same_ids founds for the given identifier")
return -1
endif
let same_ids = result.what.sameids
echo same_ids
endfunction
" vim:ts=4:sw=4:et

View File

@ -0,0 +1,124 @@
function! go#impl#Impl(...)
let binpath = go#path#CheckBinPath('impl')
if empty(binpath)
return
endif
let recv = ""
let iface = ""
if a:0 == 0
" user didn't passed anything, just called ':GoImpl'
let receiveType = expand("<cword>")
let recv = printf("%s *%s", tolower(receiveType)[0], receiveType)
let iface = input("vim-go: generating method stubs for interface: ")
redraw!
if empty(iface)
call go#util#EchoError('usage: interface type is not provided')
return
endif
elseif a:0 == 1
" we assume the user only passed the interface type,
" i.e: ':GoImpl io.Writer'
let receiveType = expand("<cword>")
let recv = printf("%s *%s", tolower(receiveType)[0], receiveType)
let iface = a:1
elseif a:0 > 2
" user passed receiver and interface type both,
" i.e: 'GoImpl f *Foo io.Writer'
let recv = join(a:000[:-2], ' ')
let iface = a:000[-1]
else
call go#util#EchoError('usage: GoImpl {receiver} {interface}')
return
endif
let result = go#util#System(printf("%s '%s' '%s'", binpath, recv, iface))
if go#util#ShellError() != 0
call go#util#EchoError(result)
return
endif
if result ==# ''
return
end
let pos = getpos('.')
put =''
put =result
call setpos('.', pos)
endfunction
if exists('*uniq')
function! s:uniq(list)
return uniq(a:list)
endfunction
else
" Note: Believe that the list is sorted
function! s:uniq(list)
let i = len(a:list) - 1
while 0 < i
if a:list[i-1] ==# a:list[i]
call remove(a:list, i)
let i -= 2
else
let i -= 1
endif
endwhile
return a:list
endfunction
endif
function! s:root_dirs()
let dirs = []
let root = go#util#GOROOT()
if root !=# '' && isdirectory(root)
call add(dirs, root)
endif
let paths = map(split(go#util#GOPATH(), go#util#PathListSep()), "substitute(v:val, '\\\\', '/', 'g')")
if go#util#ShellError()
return []
endif
if !empty(filter(paths, 'isdirectory(v:val)'))
call extend(dirs, paths)
endif
return dirs
endfunction
function! s:go_packages(dirs)
let pkgs = []
for d in a:dirs
let pkg_root = expand(d . '/pkg/' . go#util#OSARCH())
call extend(pkgs, split(globpath(pkg_root, '**/*.a', 1), "\n"))
endfor
return map(pkgs, "fnamemodify(v:val, ':t:r')")
endfunction
function! s:interface_list(pkg)
let contents = split(go#util#System('go doc ' . a:pkg), "\n")
if go#util#ShellError()
return []
endif
call filter(contents, 'v:val =~# ''^type\s\+\h\w*\s\+interface''')
return map(contents, 'a:pkg . "." . matchstr(v:val, ''^type\s\+\zs\h\w*\ze\s\+interface'')')
endfunction
" Complete package and interface for {interface}
function! go#impl#Complete(arglead, cmdline, cursorpos)
let words = split(a:cmdline, '\s\+', 1)
if words[-1] ==# ''
return s:uniq(sort(s:go_packages(s:root_dirs())))
elseif words[-1] =~# '^\h\w*$'
return s:uniq(sort(filter(s:go_packages(s:root_dirs()), 'stridx(v:val, words[-1]) == 0')))
elseif words[-1] =~# '^\h\w*\.\%(\h\w*\)\=$'
let [pkg, interface] = split(words[-1], '\.', 1)
echomsg pkg
return s:uniq(sort(filter(s:interface_list(pkg), 'v:val =~? words[-1]')))
else
return []
endif
endfunction

View File

@ -27,8 +27,8 @@ function! go#import#SwitchImport(enabled, localname, path, bang)
endif endif
if a:bang == "!" if a:bang == "!"
let out = system("go get -u -v ".shellescape(path)) let out = go#util#System("go get -u -v ".shellescape(path))
if v:shell_error if go#util#ShellError() != 0
call s:Error("Can't find import: " . path . ":" . out) call s:Error("Can't find import: " . path . ":" . out)
endif endif
endif endif

View File

@ -64,7 +64,7 @@ function! go#lint#Gometa(autosave, ...) abort
let out = go#tool#ExecuteInDir(meta_command) let out = go#tool#ExecuteInDir(meta_command)
let l:listtype = "quickfix" let l:listtype = "quickfix"
if v:shell_error == 0 if go#util#ShellError() == 0
redraw | echo redraw | echo
call go#list#Clean(l:listtype) call go#list#Clean(l:listtype)
call go#list#Window(l:listtype) call go#list#Window(l:listtype)
@ -102,7 +102,7 @@ function! go#lint#Golint(...) abort
let goargs = go#util#Shelljoin(a:000) let goargs = go#util#Shelljoin(a:000)
endif endif
let out = system(bin_path . " " . goargs) let out = go#util#System(bin_path . " " . goargs)
if empty(out) if empty(out)
echon "vim-go: " | echohl Function | echon "[lint] PASS" | echohl None echon "vim-go: " | echohl Function | echon "[lint] PASS" | echohl None
return return
@ -127,7 +127,7 @@ function! go#lint#Vet(bang, ...)
endif endif
let l:listtype = "quickfix" let l:listtype = "quickfix"
if v:shell_error if go#util#ShellError() != 0
let errors = go#tool#ParseErrors(split(out, '\n')) let errors = go#tool#ParseErrors(split(out, '\n'))
call go#list#Populate(l:listtype, errors) call go#list#Populate(l:listtype, errors)
call go#list#Window(l:listtype, len(errors)) call go#list#Window(l:listtype, len(errors))
@ -167,7 +167,7 @@ function! go#lint#Errcheck(...) abort
let out = go#tool#ExecuteInDir(command) let out = go#tool#ExecuteInDir(command)
let l:listtype = "quickfix" let l:listtype = "quickfix"
if v:shell_error if go#util#ShellError() != 0
let errformat = "%f:%l:%c:\ %m, %f:%l:%c\ %#%m" let errformat = "%f:%l:%c:\ %m, %f:%l:%c\ %#%m"
" Parse and populate our location list " Parse and populate our location list

View File

@ -1,233 +0,0 @@
" oracle.vim -- Vim integration for the Go oracle.
"
" Part of this plugin was taken directly from the oracle repo, however it's
" massively changed for a better integration into vim-go. Thanks Alan Donovan
" for the first iteration based on quickfix! - Fatih Arslan
"
if !exists("g:go_oracle_bin")
let g:go_oracle_bin = "oracle"
endif
" Parses (via regex) Oracle's 'plain' format output and puts them into a
" location list
func! s:loclist(output)
let llist = []
" Parse GNU-style 'file:line.col-line.col: message' format.
let mx = '^\(\a:[\\/][^:]\+\|[^:]\+\):\(\d\+\):\(\d\+\):\(.*\)$'
for line in split(a:output, "\n")
let ml = matchlist(line, mx)
" Ignore non-match lines or warnings
if ml == [] || ml[4] =~ '^ warning:'
continue
endif
let item = {
\ 'filename': ml[1],
\ 'text': ml[4],
\ 'lnum': ml[2],
\ 'col': ml[3],
\}
let bnr = bufnr(fnameescape(ml[1]))
if bnr != -1
let item['bufnr'] = bnr
endif
call add(llist, item)
endfor
call go#list#Populate("locationlist", llist)
call go#list#Window("locationlist", len(llist))
endfun
" This uses Vim's errorformat to parse the output from Oracle's 'plain output
" and put it into location list. I believe using errorformat is much more
" easier to use. If we need more power we can always switch back to parse it
" via regex.
func! s:loclistSecond(output)
" backup users errorformat, will be restored once we are finished
let old_errorformat = &errorformat
" match two possible styles of errorformats:
"
" 'file:line.col-line2.col2: message'
" 'file:line:col: message'
"
" We discard line2 and col2 for the first errorformat, because it's not
" useful and location only has the ability to show one line and column
" number
let errformat = "%f:%l.%c-%[%^:]%#:\ %m,%f:%l:%c:\ %m"
call go#list#ParseFormat("locationlist", errformat, split(a:output, "\n"))
let errors = go#list#Get("locationlist")
call go#list#Window("locationlist", len(errors))
endfun
func! s:RunOracle(mode, selected, needs_package) range abort
let fname = expand('%:p')
let dname = expand('%:p:h')
let pkg = go#package#ImportPath(dname)
if exists('g:go_oracle_scope')
" let the user defines the scope, must be a space separated string,
" example: 'fmt math net/http'
let scopes = split(get(g:, 'go_oracle_scope'))
elseif a:needs_package || exists('g:go_oracle_include_tests') && pkg != -1
" give import path so it includes all _test.go files too
let scopes = [pkg]
else
" best usable way, only pass the package itself, without the test
" files
let scopes = go#tool#Files()
endif
"return with a warning if the bin doesn't exist
let bin_path = go#path#CheckBinPath(g:go_oracle_bin)
if empty(bin_path)
return
endif
if exists('g:go_oracle_tags')
let tags = get(g:, 'go_oracle_tags')
else
let tags = ""
endif
if a:selected != -1
let pos1 = go#util#Offset(line("'<"), col("'<"))
let pos2 = go#util#Offset(line("'>"), col("'>"))
let cmd = printf('%s -format plain -pos=%s:#%d,#%d -tags=%s %s',
\ bin_path,
\ shellescape(fname), pos1, pos2, tags, a:mode)
else
let pos = go#util#OffsetCursor()
let cmd = printf('%s -format plain -pos=%s:#%d -tags=%s %s',
\ bin_path,
\ shellescape(fname), pos, tags, a:mode)
endif
" strip trailing slashes for each path in scoped. bug:
" https://github.com/golang/go/issues/14584
let scopes = go#util#StripTrailingSlash(scopes)
" now append each scope to the end as Oracle's scope parameter. It can be
" a packages or go files, dependent on the User's own choice. For more
" info check Oracle's User Manual section about scopes:
" https://docs.google.com/document/d/1SLk36YRjjMgKqe490mSRzOPYEDe0Y_WQNRv-EiFYUyw/view#heading=h.nwso96pj07q8
let cmd .= ' ' . go#util#Shelljoin(scopes)
echon "vim-go: " | echohl Identifier | echon "analysing ..." | echohl None
let old_gopath = $GOPATH
let $GOPATH = go#path#Detect()
let out = system(cmd)
let $GOPATH = old_gopath
if v:shell_error
" unfortunaly oracle outputs a very long stack trace that is not
" parsable to show the real error. But the main issue is usually the
" package which doesn't build.
redraw | echon "vim-go: " | echohl Statement | echon out | echohl None
return ""
endif
return out
endfunc
function! go#oracle#Scope(...)
if a:0
if a:0 == 1 && a:1 == '""'
unlet g:go_oracle_scope
echon "vim-go: " | echohl Function | echon "oracle scope is cleared"| echohl None
else
let g:go_oracle_scope = join(a:000, ' ')
echon "vim-go: " | echohl Function | echon "oracle scope changed to: '". g:go_oracle_scope ."'" | echohl None
endif
return
endif
if !exists('g:go_oracle_scope')
echon "vim-go: " | echohl Function | echon "oracle scope is not set"| echohl None
else
echon "vim-go: " | echohl Function | echon "current oracle scope: '". g:go_oracle_scope ."'" | echohl None
endif
endfunction
function! go#oracle#Tags(...)
if a:0
if a:0 == 1 && a:1 == '""'
unlet g:go_oracle_tags
echon "vim-go: " | echohl Function | echon "oracle tags is cleared"| echohl None
else
let g:go_oracle_tags = a:1
echon "vim-go: " | echohl Function | echon "oracle tags changed to: '". g:go_oracle_tags ."'" | echohl None
endif
return
endif
if !exists('g:go_oracle_tags')
echon "vim-go: " | echohl Function | echon "oracle tags is not set"| echohl None
else
echon "vim-go: " | echohl Function | echon "current oracle tags: '". g:go_oracle_tags ."'" | echohl None
endif
endfunction
" Show 'implements' relation for selected package
function! go#oracle#Implements(selected)
let out = s:RunOracle('implements', a:selected, 0)
call s:loclistSecond(out)
endfunction
" Describe selected syntax: definition, methods, etc
function! go#oracle#Describe(selected)
let out = s:RunOracle('describe', a:selected, 0)
call s:loclistSecond(out)
endfunction
" Show possible targets of selected function call
function! go#oracle#Callees(selected)
let out = s:RunOracle('callees', a:selected, 1)
call s:loclistSecond(out)
endfunction
" Show possible callers of selected function
function! go#oracle#Callers(selected)
let out = s:RunOracle('callers', a:selected, 1)
call s:loclistSecond(out)
endfunction
" Show path from callgraph root to selected function
function! go#oracle#Callstack(selected)
let out = s:RunOracle('callstack', a:selected, 1)
call s:loclistSecond(out)
endfunction
" Show free variables of selection
function! go#oracle#Freevars(selected)
" Freevars requires a selection
if a:selected == -1
echon "vim-go: " | echohl Statement | echon "GoFreevars requires a selection (range) of code "| echohl None
return
endif
let out = s:RunOracle('freevars', a:selected, 0)
call s:loclistSecond(out)
endfunction
" Show send/receive corresponding to selected channel op
function! go#oracle#ChannelPeers(selected)
let out = s:RunOracle('peers', a:selected, 1)
call s:loclistSecond(out)
endfunction
" Show all refs to entity denoted by selected identifier
function! go#oracle#Referrers(selected)
let out = s:RunOracle('referrers', a:selected, 0)
call s:loclistSecond(out)
endfunction
" vim:ts=4:sw=4:et
"

View File

@ -33,8 +33,8 @@ function! go#package#Paths()
if !exists("s:goroot") if !exists("s:goroot")
if executable('go') if executable('go')
let s:goroot = substitute(system('go env GOROOT'), '\n', '', 'g') let s:goroot = substitute(go#util#System('go env GOROOT'), '\n', '', 'g')
if v:shell_error if go#util#ShellError() != 0
echomsg '''go env GOROOT'' failed' echomsg '''go env GOROOT'' failed'
endif endif
else else
@ -95,8 +95,8 @@ function! go#package#FromPath(arg)
endfunction endfunction
function! go#package#CompleteMembers(package, member) function! go#package#CompleteMembers(package, member)
silent! let content = system('godoc ' . a:package) silent! let content = go#util#System('godoc ' . a:package)
if v:shell_error || !len(content) if go#util#ShellError() || !len(content)
return [] return []
endif endif
let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'") let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'")
@ -117,7 +117,7 @@ function! go#package#Complete(ArgLead, CmdLine, CursorPos)
let words = split(a:CmdLine, '\s\+', 1) let words = split(a:CmdLine, '\s\+', 1)
" do not complete package members for these commands " do not complete package members for these commands
let neglect_commands = ["GoImportAs", "GoOracleScope"] let neglect_commands = ["GoImportAs", "GoGuruScope"]
if len(words) > 2 && index(neglect_commands, words[0]) == -1 if len(words) > 2 && index(neglect_commands, words[0]) == -1
" Complete package members " Complete package members

View File

@ -138,27 +138,25 @@ endfunction
function! go#path#CheckBinPath(binpath) function! go#path#CheckBinPath(binpath)
" remove whitespaces if user applied something like 'goimports ' " remove whitespaces if user applied something like 'goimports '
let binpath = substitute(a:binpath, '^\s*\(.\{-}\)\s*$', '\1', '') let binpath = substitute(a:binpath, '^\s*\(.\{-}\)\s*$', '\1', '')
" save off original path
let old_path = $PATH
" check if we have an appropriate bin_path
let go_bin_path = go#path#BinPath()
if !empty(go_bin_path)
" append our GOBIN and GOPATH paths and be sure they can be found there...
" let us search in our GOBIN and GOPATH paths
let $PATH = go_bin_path . go#util#PathListSep() . $PATH
endif
" if it's in PATH just return it " if it's in PATH just return it
if executable(binpath) if executable(binpath)
let $PATH = old_path
return binpath return binpath
endif endif
" just get the basename " just get the basename
let basename = fnamemodify(binpath, ":t") let basename = fnamemodify(binpath, ":t")
" check if we have an appropriate bin_path
let go_bin_path = go#path#BinPath()
if empty(go_bin_path)
echo "vim-go: could not find '" . basename . "'. Run :GoInstallBinaries to fix it."
return ""
endif
" append our GOBIN and GOPATH paths and be sure they can be found there...
" let us search in our GOBIN and GOPATH paths
let old_path = $PATH
let $PATH = $PATH . go#util#PathListSep() .go_bin_path
if !executable(basename) if !executable(basename)
echo "vim-go: could not find '" . basename . "'. Run :GoInstallBinaries to fix it." echo "vim-go: could not find '" . basename . "'. Run :GoInstallBinaries to fix it."
" restore back! " restore back!

View File

@ -13,13 +13,13 @@ function! go#play#Share(count, line1, line2)
let share_file = tempname() let share_file = tempname()
call writefile(split(content, "\n"), share_file, "b") call writefile(split(content, "\n"), share_file, "b")
let command = "curl -s -X POST http://play.golang.org/share --data-binary '@".share_file."'" let command = "curl -s -X POST https://play.golang.org/share --data-binary '@".share_file."'"
let snippet_id = system(command) let snippet_id = go#util#System(command)
" we can remove the temp file because it's now posted. " we can remove the temp file because it's now posted.
call delete(share_file) call delete(share_file)
if v:shell_error if go#util#ShellError() != 0
echo 'A error has occured. Run this command to see what the problem is:' echo 'A error has occured. Run this command to see what the problem is:'
echo command echo command
return return
@ -77,7 +77,7 @@ function! s:get_browser_command()
if go_play_browser_command == '' if go_play_browser_command == ''
if has('win32') || has('win64') if has('win32') || has('win64')
let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%'
elseif has('mac') || has('macunix') || has('gui_macvim') || system('uname') =~? '^darwin' elseif has('mac') || has('macunix') || has('gui_macvim') || go#util#System('uname') =~? '^darwin'
let go_play_browser_command = 'open %URL%' let go_play_browser_command = 'open %URL%'
elseif executable('xdg-open') elseif executable('xdg-open')
let go_play_browser_command = 'xdg-open %URL%' let go_play_browser_command = 'xdg-open %URL%'

View File

@ -41,7 +41,7 @@ function! go#rename#Rename(bang, ...)
let clean = split(out, '\n') let clean = split(out, '\n')
let l:listtype = "quickfix" let l:listtype = "quickfix"
if v:shell_error if go#util#ShellError() != 0
let errors = go#tool#ParseErrors(split(out, '\n')) let errors = go#tool#ParseErrors(split(out, '\n'))
call go#list#Populate(l:listtype, errors) call go#list#Populate(l:listtype, errors)
call go#list#Window(l:listtype, len(errors)) call go#list#Window(l:listtype, len(errors))

View File

@ -36,8 +36,8 @@ function! go#textobj#Function(mode)
let command .= " -parse-comments" let command .= " -parse-comments"
endif endif
let out = system(command) let out = go#util#System(command)
if v:shell_error != 0 if go#util#ShellError() != 0
call go#util#EchoError(out) call go#util#EchoError(out)
return return
endif endif
@ -129,8 +129,8 @@ function! go#textobj#FunctionJump(mode, direction)
let command .= " -parse-comments" let command .= " -parse-comments"
endif endif
let out = system(command) let out = go#util#System(command)
if v:shell_error != 0 if go#util#ShellError() != 0
call go#util#EchoError(out) call go#util#EchoError(out)
return return
endif endif

View File

@ -26,7 +26,7 @@ function! go#tool#Imports()
let command = "go list -f $'{{range $f := .Imports}}{{$f}}\n{{end}}'" let command = "go list -f $'{{range $f := .Imports}}{{$f}}\n{{end}}'"
endif endif
let out = go#tool#ExecuteInDir(command) let out = go#tool#ExecuteInDir(command)
if v:shell_error if go#util#ShellError() != 0
echo out echo out
return imports return imports
endif endif
@ -51,7 +51,7 @@ function! go#tool#ParseErrors(lines)
call add(errors, {"text": fatalerrors[1]}) call add(errors, {"text": fatalerrors[1]})
elseif !empty(tokens) elseif !empty(tokens)
" strip endlines of form ^M " strip endlines of form ^M
let out=substitute(tokens[3], '\r$', '', '') let out = substitute(tokens[3], '\r$', '', '')
call add(errors, { call add(errors, {
\ "filename" : fnamemodify(tokens[1], ':p'), \ "filename" : fnamemodify(tokens[1], ':p'),
@ -114,7 +114,7 @@ function! go#tool#ExecuteInDir(cmd) abort
let dir = getcwd() let dir = getcwd()
try try
execute cd . fnameescape(expand("%:p:h")) execute cd . fnameescape(expand("%:p:h"))
let out = system(a:cmd) let out = go#util#System(a:cmd)
finally finally
execute cd . fnameescape(dir) execute cd . fnameescape(dir)
endtry endtry
@ -129,7 +129,7 @@ function! go#tool#Exists(importpath)
let command = "go list ". a:importpath let command = "go list ". a:importpath
let out = go#tool#ExecuteInDir(command) let out = go#tool#ExecuteInDir(command)
if v:shell_error if go#util#ShellError() != 0
return -1 return -1
endif endif
@ -144,7 +144,7 @@ function! s:get_browser_command()
if go_play_browser_command == '' if go_play_browser_command == ''
if go#util#IsWin() if go#util#IsWin()
let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%' let go_play_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%'
elseif has('mac') || has('macunix') || has('gui_macvim') || system('uname') =~? '^darwin' elseif has('mac') || has('macunix') || has('gui_macvim') || go#util#System('uname') =~? '^darwin'
let go_play_browser_command = 'open %URL%' let go_play_browser_command = 'open %URL%'
elseif executable('xdg-open') elseif executable('xdg-open')
let go_play_browser_command = 'xdg-open %URL%' let go_play_browser_command = 'xdg-open %URL%'
@ -175,7 +175,7 @@ function! go#tool#OpenBrowser(url)
exec cmd exec cmd
else else
let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g') let cmd = substitute(cmd, '%URL%', '\=shellescape(a:url)', 'g')
call system(cmd) call go#util#System(cmd)
endif endif
endfunction endfunction

View File

@ -37,6 +37,67 @@ function! go#util#IsWin()
return 0 return 0
endfunction endfunction
function! go#util#GOARCH()
return substitute(go#util#System('go env GOARCH'), '\n', '', 'g')
endfunction
function! go#util#GOOS()
return substitute(go#util#System('go env GOOS'), '\n', '', 'g')
endfunction
function! go#util#GOROOT()
return substitute(go#util#System('go env GOROOT'), '\n', '', 'g')
endfunction
function! go#util#GOPATH()
return substitute(go#util#System('go env GOPATH'), '\n', '', 'g')
endfunction
function! go#util#OSARCH()
return go#util#GOOS() . '_' . go#util#GOARCH()
endfunction
"Check if has vimproc
function! s:has_vimproc()
if !exists('g:go#use_vimproc')
if go#util#IsWin()
try
call vimproc#version()
let exists_vimproc = 1
catch
let exists_vimproc = 0
endtry
else
let exists_vimproc = 0
endif
let g:go#use_vimproc = exists_vimproc
endif
return g:go#use_vimproc
endfunction
if s:has_vimproc()
let s:vim_system = get(g:, 'gocomplete#system_function', 'vimproc#system2')
let s:vim_shell_error = get(g:, 'gocomplete#shell_error_function', 'vimproc#get_last_status')
else
let s:vim_system = get(g:, 'gocomplete#system_function', 'system')
let s:vim_shell_error = ''
endif
function! go#util#System(str, ...)
return call(s:vim_system, [a:str] + a:000)
endfunction
function! go#util#ShellError()
if empty(s:vim_shell_error)
return v:shell_error
endif
return call(s:vim_shell_error, [])
endfunction
" StripPath strips the path's last character if it's a path separator. " StripPath strips the path's last character if it's a path separator.
" example: '/foo/bar/' -> '/foo/bar' " example: '/foo/bar/' -> '/foo/bar'
function! go#util#StripPathSep(path) function! go#util#StripPathSep(path)
@ -70,6 +131,19 @@ function! go#util#Shelljoin(arglist, ...)
endtry endtry
endfunction endfunction
fu! go#util#Shellescape(arg)
if s:has_vimproc()
return vimproc#shellescape(a:arg)
endif
try
let ssl_save = &shellslash
set noshellslash
return shellescape(a:arg)
finally
let &shellslash = ssl_save
endtry
endf
" Shelllist returns a shell-safe representation of the items in the given " Shelllist returns a shell-safe representation of the items in the given
" arglist. The {special} argument of shellescape() may optionally be passed. " arglist. The {special} argument of shellescape() may optionally be passed.
function! go#util#Shelllist(arglist, ...) function! go#util#Shelllist(arglist, ...)

View File

@ -1,21 +0,0 @@
"Check if has vimproc
function! go#vimproc#has_vimproc()
if !exists('g:go#use_vimproc')
if go#util#IsWin()
try
call vimproc#version()
let exists_vimproc = 1
catch
let exists_vimproc = 0
endtry
else
let exists_vimproc = 0
endif
let g:go#use_vimproc = exists_vimproc
endif
return g:go#use_vimproc
endfunction
" vim:ts=4:sw=4:et

View File

@ -53,7 +53,7 @@ easily.
(golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors (golint, vet, errcheck, deadcode, etc..) and shows the warnings/errors
* Lint your code with `:GoLint` * Lint your code with `:GoLint`
* Run your code through `:GoVet` to catch static errors * Run your code through `:GoVet` to catch static errors
* Advanced source analysis tools utilizing oracle, 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` * Precise type-safe renaming of identifiers with `:GoRename`
* List all source files and dependencies * List all source files and dependencies
@ -226,8 +226,8 @@ CTRL-]
navigate software. For more information on displaying the stack, see navigate software. For more information on displaying the stack, see
|:GoDefJump| |:GoDefJump|
*:GoDefJump* *:GoDefStack*
:GoDefJump [number] :GoDefStack [number]
This command Jumps to a given location in the jumpstack, retaining all other This command Jumps to a given location in the jumpstack, retaining all other
entries. Jumps to non-existent entries will print an informative message, entries. Jumps to non-existent entries will print an informative message,
@ -251,6 +251,11 @@ CTRL-]
Jumps to non-existent entries will print an informative message, but are Jumps to non-existent entries will print an informative message, but are
otherwise a noop. otherwise a noop.
*:GoDefStackClear*
:GoDefStackClear
Clears the current stack list and resets it.
*:GoDefPop* *:GoDefPop*
:GoDefPop [count] :GoDefPop [count]
CTRL-t CTRL-t
@ -382,10 +387,23 @@ CTRL-t
:GoCoverage[!] [options] :GoCoverage[!] [options]
Create a coverage profile and annotates the current file's source code. If Create a coverage profile and annotates the current file's source code. If
called again clears the annotation (works as a toggle) called again it rerurns the tests.
If [!] is not given the first error is jumped to. If [!] is not given the first error is jumped to.
*:GoCoverageToggle*
:GoCoverageToggle[!] [options]
Create a coverage profile and annotates the current file's source code. If
called again clears the annotation (works as a toggle).
If [!] is not given the first error is jumped to.
*:GoCoverageClear*
:GoCoverageClear [options]
Clears the coverage annotation.
*:GoCoverageBrowser* *:GoCoverageBrowser*
:GoCoverageBrowser[!] [options] :GoCoverageBrowser[!] [options]
@ -445,13 +463,29 @@ CTRL-t
If [!] is not given the first error is jumped to. If [!] is not given the first error is jumped to.
*:GoOracleScope* *:GoGuruScope*
:GoOracleScope [path1] [path2] ... :GoGuruScope [pattern] [pattern2] ... [patternN]
Changes the custom |g:go_oracle_scope| setting and overrides it with the Changes the custom |g:go_guru_scope| setting and overrides it with the
given import paths. The custom scope is cleared (unset) if `""` is given given package patterns. The custom scope is cleared (unset) if `""` is
as the only path. If no arguments is given it prints the current custom given as the only path. If no arguments is given it prints the current
scope. custom scope. Example patterns are:
>
golang.org/x/tools/cmd/guru # a single package
golang.org/x/tools/... # all packages beneath dir
... # the entire workspace.
<
Example usage, the following sets the scope to a `github.com/fatih/color`
and to all packages under `golang.org/x/tools/`:
>
:GoGuruScope github.com/fatih/color golang.org/x/tools/...
<
The following sets it to the entire workspace:
>
:GoGuruScope ...
<
Under the hood, the patterns are all joined to a comma-separated list and
passed to `guru`'s `-scope` flag.
*:GoCallees* *:GoCallees*
:GoCallees :GoCallees
@ -474,7 +508,7 @@ CTRL-t
type (for an expression), its value (for a constant expression), its size, type (for an expression), its value (for a constant expression), its size,
alignment, method set and interfaces (for a type), its declaration (for an alignment, method set and interfaces (for a type), its declaration (for an
identifier), etc. Almost any piece of syntax may be described, and the identifier), etc. Almost any piece of syntax may be described, and the
oracle will try to print all the useful information it can. guru will try to print all the useful information it can.
*:GoCallstack* *:GoCallstack*
:GoCallstack :GoCallstack
@ -527,10 +561,10 @@ CTRL-t
the variable |g:go_metalinter_command|. To override the maximum linters the variable |g:go_metalinter_command|. To override the maximum linters
execution time use |g:go_metalinter_deadline| variable. execution time use |g:go_metalinter_deadline| variable.
*:GoOracleTags* *:GoGuruTags*
:GoOracleTags [tags] :GoGuruTags [tags]
Changes the custom |g:go_oracle_tags| setting and overrides it with the Changes the custom |g:go_guru_tags| setting and overrides it with the
given build tags. This command cooperate with GoReferrers command when given build tags. This command cooperate with GoReferrers command when
there exist mulitiple build tags in your project, then you can set one there exist mulitiple build tags in your project, then you can set one
of the build tags for GoReferrers to find more accurate. of the build tags for GoReferrers to find more accurate.
@ -585,12 +619,24 @@ CTRL-t
definitions. By default set to: `"func,type"`. Possible options are: definitions. By default set to: `"func,type"`. Possible options are:
`{func,type}` `{func,type}`
*:GoImpl*
:GoImpl [receiver] [interface]
Generates method stubs for implementing an interface. If no arguments is
passed it takes the identifier under the cursor to be the receiver and
asks for the interface type to be generated. If used with arguments, the
receiver and the interface needs to be specified. Example usages:
>
:GoImpl f *Foo io.Writer
:GoImpl T io.ReadWriteCloser
<
=============================================================================== ===============================================================================
MAPPINGS *go-mappings* MAPPINGS *go-mappings*
vim-go has several <Plug> keys which can be used to create custom mappings vim-go has several <Plug> keys which can be used to create custom mappings
For example, to create a mapping that `go run` the current file create a For example, to create a mapping that `go run` for the current package, create
mapping for the `(go-run)`: > a mapping for the `(go-run)`: >
au FileType go nmap <leader>r <Plug>(go-run) au FileType go nmap <leader>r <Plug>(go-run)
@ -600,7 +646,7 @@ documentation in the |go-commands| section. Available <Plug> keys are:
*(go-run)* *(go-run)*
Calls `go run` for the current file Calls `go run` for the current main package
*(go-run-tab)* *(go-run-tab)*
@ -651,7 +697,18 @@ Calls `go test -c` for the current package
*(go-coverage)* *(go-coverage)*
Calls `go test -coverprofile-temp.out` for the current package Calls `go test -coverprofile-temp.out` for the current package and shows the
coverage annotation.
*(go-coverage-clear)*
Clears the coverage annotation
*(go-coverage-toggle)*
Calls `go test -coverprofile-temp.out` for the current package and shows the
coverage annotation. If run agains it acts as a toggle and clears the
annotation.
*(go-vet)* *(go-vet)*
@ -699,23 +756,36 @@ Goto declaration/definition. Results are shown in the current buffer.
*(go-def-split)* *(go-def-split)*
Goto declaration/definition. Results are shown in a split window. Goto declaration/definition. Results are shown in a split window.
Jumps to an existing buffer if |g:go_def_reuse_buffer| is enabled.
*(go-def-vertical)* *(go-def-vertical)*
Goto declaration/definition. Results are shown in a vertical split window. Goto declaration/definition. Results are shown in a vertical split window.
Jumps to an existing buffer if |g:go_def_reuse_buffer| is enabled.
*(go-def-tab)* *(go-def-tab)*
Goto declaration/definition. Results are shown in a tab window. Goto declaration/definition. Results are shown in a tab window.
Jumps to an existing buffer if |g:go_def_reuse_buffer| is enabled.
*(go-implements)* *(go-def-stack)*
Shows the godef tag stack
*(go-def-stack-clear)*
Resets and clers the tasg stack
*(go-def-pop)*
Jump to previous entry in the tag stack
*(go-implements)*
Show the interfaces that the type under the cursor implements. Show the interfaces that the type under the cursor implements.
*(go-rename)* *(go-rename)*
Rename the identifier under the cursor to the desired new name Rename the identifier under the cursor to the desired new name
@ -912,6 +982,14 @@ these keys or mappings. Default is enabled. >
let g:go_def_mapping_enabled = 1 let g:go_def_mapping_enabled = 1
< <
*'g:go_def_reuse_buffer'*
Use this option to jump to an existing buffer for the split, vsplit and tab
mappings of |:GoDef|. By default it's disabled. >
let g:go_def_reuse_buffer = 0
<
*'g:go_dispatch_enabled'* *'g:go_dispatch_enabled'*
Use this option to enable/disable the use of Dispatch to execute the Use this option to enable/disable the use of Dispatch to execute the
@ -950,16 +1028,16 @@ is used. Use "neosnippet" for neosnippet.vim: >
let g:go_snippet_engine = "ultisnips" let g:go_snippet_engine = "ultisnips"
< <
*'g:go_oracle_scope'* *'g:go_guru_scope'*
Use this option to define the scope of the analysis to be passed for oracle Use this option to define the scope of the analysis to be passed for guru
related commands, such as |GoImplements|, |GoCallers|, etc. By default it's related commands, such as |GoImplements|, |GoCallers|, etc.You can change it
not set, so only the current package's go files are passed as scope. You can on-the-fly with |GoGuruScope|. The input should be a a list of package
change it on-the-fly with |GoOracleScope|. For more info, please have a look pattern. An example input might be:
at oracle's user manual: `["github.com/fatih/color","github.com/fatih/structs"]` By default it's not set,
https://golang.org/s/oracle-user-manual#heading=h.nwso96pj07q8 > so the relevant commands defaults are being used.
>
let g:go_oracle_scope = '' let g:go_guru_scope = []
< <
*'g:go_highlight_array_whitespace_error'* *'g:go_highlight_array_whitespace_error'*
@ -1216,7 +1294,7 @@ You'll see a more detailed error. If this works, vim-go will work too.
CREDITS *go-credits* CREDITS *go-credits*
* Go Authors for official vim plugins * Go Authors for official vim plugins
* Gocode, Godef, Golint, Oracle, Goimports, Errcheck projects and authors of * Gocode, Godef, Golint, Guru, Goimports, Errcheck projects and authors of
those projects. those projects.
* Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode, * Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode,
vim-godef) vim-godef)

View File

@ -29,9 +29,13 @@ if get(g:, "go_doc_keywordprg_enabled", 1)
endif endif
if get(g:, "go_def_mapping_enabled", 1) if get(g:, "go_def_mapping_enabled", 1)
nnoremap <buffer> <silent> gd :GoDef<cr> " these are default Vim mappings, we're overriding them to make them
nnoremap <buffer> <silent> <C-]> :GoDef<cr> " useful again for Go source code
nnoremap <buffer> <silent> <C-t> :<C-U>call go#def#StackPop(v:count1)<cr> nnoremap <buffer> <silent> gd :GoDef<cr>
nnoremap <buffer> <silent> <C-]> :GoDef<cr>
nnoremap <buffer> <silent> <C-w><C-]> :<C-u>call go#def#Jump("split")<CR>
nnoremap <buffer> <silent> <C-w>] :<C-u>call go#def#Jump("split")<CR>
nnoremap <buffer> <silent> <C-t> :<C-U>call go#def#StackPop(v:count1)<cr>
endif endif
if get(g:, "go_textobj_enabled", 1) if get(g:, "go_textobj_enabled", 1)

View File

@ -1,24 +1,27 @@
" gorename " -- gorename
command! -nargs=? GoRename call go#rename#Rename(<bang>0,<f-args>) command! -nargs=? GoRename call go#rename#Rename(<bang>0,<f-args>)
" oracle " -- guru
command! -nargs=* -complete=customlist,go#package#Complete GoOracleScope call go#oracle#Scope(<f-args>) command! -nargs=* -complete=customlist,go#package#Complete GoGuruScope call go#guru#Scope(<f-args>)
command! -range=% GoImplements call go#oracle#Implements(<count>) command! -range=% GoImplements call go#guru#Implements(<count>)
command! -range=% GoCallees call go#oracle#Callees(<count>) command! -range=% GoCallees call go#guru#Callees(<count>)
command! -range=% GoDescribe call go#oracle#Describe(<count>) command! -range=% GoDescribe call go#guru#Describe(<count>)
command! -range=% GoCallers call go#oracle#Callers(<count>) command! -range=% GoCallers call go#guru#Callers(<count>)
command! -range=% GoCallstack call go#oracle#Callstack(<count>) command! -range=% GoCallstack call go#guru#Callstack(<count>)
command! -range=% GoFreevars call go#oracle#Freevars(<count>) command! -range=% GoFreevars call go#guru#Freevars(<count>)
command! -range=% GoChannelPeers call go#oracle#ChannelPeers(<count>) command! -range=% GoChannelPeers call go#guru#ChannelPeers(<count>)
command! -range=% GoReferrers call go#oracle#Referrers(<count>) command! -range=% GoReferrers call go#guru#Referrers(<count>)
command! -nargs=? GoOracleTags call go#oracle#Tags(<f-args>) command! -nargs=? GoGuruTags call go#guru#Tags(<f-args>)
" tool " TODO(arslan): enable this once the function is implemented
" command! -range=% GoSameIds call go#guru#SameIds(<count>)
" -- tool
command! -nargs=0 GoFiles echo go#tool#Files() command! -nargs=0 GoFiles echo go#tool#Files()
command! -nargs=0 GoDeps echo go#tool#Deps() command! -nargs=0 GoDeps echo go#tool#Deps()
command! -nargs=* GoInfo call go#complete#Info(0) command! -nargs=* GoInfo call go#complete#Info(0)
" cmd " -- cmd
command! -nargs=* -bang GoBuild call go#cmd#Build(<bang>0,<f-args>) command! -nargs=* -bang GoBuild call go#cmd#Build(<bang>0,<f-args>)
command! -nargs=* -bang GoGenerate call go#cmd#Generate(<bang>0,<f-args>) command! -nargs=* -bang GoGenerate call go#cmd#Generate(<bang>0,<f-args>)
command! -nargs=* -bang -complete=file GoRun call go#cmd#Run(<bang>0,<f-args>) command! -nargs=* -bang -complete=file GoRun call go#cmd#Run(<bang>0,<f-args>)
@ -29,15 +32,18 @@ command! -nargs=* -bang GoTestCompile call go#cmd#Test(<bang>0, 1, <f-args>)
" -- cover " -- cover
command! -nargs=* -bang GoCoverage call go#coverage#Buffer(<bang>0, <f-args>) command! -nargs=* -bang GoCoverage call go#coverage#Buffer(<bang>0, <f-args>)
command! -nargs=* -bang GoCoverageClear call go#coverage#Clear()
command! -nargs=* -bang GoCoverageToggle call go#coverage#BufferToggle(<bang>0, <f-args>)
command! -nargs=* -bang GoCoverageBrowser call go#coverage#Browser(<bang>0, <f-args>) command! -nargs=* -bang GoCoverageBrowser call go#coverage#Browser(<bang>0, <f-args>)
" -- play " -- play
command! -nargs=0 -range=% GoPlay call go#play#Share(<count>, <line1>, <line2>) command! -nargs=0 -range=% GoPlay call go#play#Share(<count>, <line1>, <line2>)
" -- def " -- def
command! -nargs=* -range GoDef :call go#def#Jump(<f-args>) command! -nargs=* -range GoDef :call go#def#Jump('')
command! -nargs=? GoDefPop :call go#def#StackPop(<f-args>) command! -nargs=? GoDefPop :call go#def#StackPop(<f-args>)
command! -nargs=? GoDefJump :call go#def#StackJump(<f-args>) command! -nargs=? GoDefStack :call go#def#Stack(<f-args>)
command! -nargs=? GoDefStackClear :call go#def#StackClear(<f-args>)
" -- doc " -- doc
command! -nargs=* -range -complete=customlist,go#package#Complete GoDoc call go#doc#Open('new', 'split', <f-args>) command! -nargs=* -range -complete=customlist,go#package#Complete GoDoc call go#doc#Open('new', 'split', <f-args>)
@ -67,4 +73,7 @@ if globpath(&rtp, 'plugin/ctrlp.vim') != ""
command! -nargs=? -complete=dir GoDeclsDir call ctrlp#init(ctrlp#decls#cmd(1, <q-args>)) command! -nargs=? -complete=dir GoDeclsDir call ctrlp#init(ctrlp#decls#cmd(1, <q-args>))
endif endif
" -- impl
command! -nargs=* -buffer -complete=customlist,go#impl#Complete GoImpl call go#impl#Impl(<f-args>)
" vim:ts=4:sw=4:et " vim:ts=4:sw=4:et

View File

@ -25,6 +25,8 @@ nnoremap <silent> <Plug>(go-test-func) :<C-u>call go#cmd#TestFunc(!g:go_jump_to_
nnoremap <silent> <Plug>(go-test-compile) :<C-u>call go#cmd#Test(!g:go_jump_to_error, 1)<CR> nnoremap <silent> <Plug>(go-test-compile) :<C-u>call go#cmd#Test(!g:go_jump_to_error, 1)<CR>
nnoremap <silent> <Plug>(go-coverage) :<C-u>call go#coverage#Buffer(!g:go_jump_to_error)<CR> nnoremap <silent> <Plug>(go-coverage) :<C-u>call go#coverage#Buffer(!g:go_jump_to_error)<CR>
nnoremap <silent> <Plug>(go-coverage-clear) :<C-u>call go#coverage#Clear()<CR>
nnoremap <silent> <Plug>(go-coverage-toggle) :<C-u>call go#coverage#BufferToggle(!g:go_jump_to_error)<CR>
nnoremap <silent> <Plug>(go-coverage-browser) :<C-u>call go#coverage#Browser(!g:go_jump_to_error)<CR> nnoremap <silent> <Plug>(go-coverage-browser) :<C-u>call go#coverage#Browser(!g:go_jump_to_error)<CR>
nnoremap <silent> <Plug>(go-files) :<C-u>call go#tool#Files()<CR> nnoremap <silent> <Plug>(go-files) :<C-u>call go#tool#Files()<CR>
@ -32,21 +34,28 @@ nnoremap <silent> <Plug>(go-deps) :<C-u>call go#tool#Deps()<CR>
nnoremap <silent> <Plug>(go-info) :<C-u>call go#complete#Info(0)<CR> nnoremap <silent> <Plug>(go-info) :<C-u>call go#complete#Info(0)<CR>
nnoremap <silent> <Plug>(go-import) :<C-u>call go#import#SwitchImport(1, '', expand('<cword>'), '')<CR> nnoremap <silent> <Plug>(go-import) :<C-u>call go#import#SwitchImport(1, '', expand('<cword>'), '')<CR>
nnoremap <silent> <Plug>(go-implements) :<C-u>call go#oracle#Implements(-1)<CR> nnoremap <silent> <Plug>(go-implements) :<C-u>call go#guru#Implements(-1)<CR>
nnoremap <silent> <Plug>(go-callees) :<C-u>call go#oracle#Callees(-1)<CR> nnoremap <silent> <Plug>(go-callees) :<C-u>call go#guru#Callees(-1)<CR>
nnoremap <silent> <Plug>(go-callers) :<C-u>call go#oracle#Callers(-1)<CR> nnoremap <silent> <Plug>(go-callers) :<C-u>call go#guru#Callers(-1)<CR>
nnoremap <silent> <Plug>(go-describe) :<C-u>call go#oracle#Describe(-1)<CR> nnoremap <silent> <Plug>(go-describe) :<C-u>call go#guru#Describe(-1)<CR>
nnoremap <silent> <Plug>(go-callstack) :<C-u>call go#oracle#Callstack(-1)<CR> nnoremap <silent> <Plug>(go-callstack) :<C-u>call go#guru#Callstack(-1)<CR>
nnoremap <silent> <Plug>(go-freevars) :<C-u>call go#oracle#Freevars(-1)<CR> xnoremap <silent> <Plug>(go-freevars) :<C-u>call go#guru#Freevars(0)<CR>
nnoremap <silent> <Plug>(go-channelpeers) :<C-u>call go#oracle#ChannelPeers(-1)<CR> nnoremap <silent> <Plug>(go-channelpeers) :<C-u>call go#guru#ChannelPeers(-1)<CR>
nnoremap <silent> <Plug>(go-referrers) :<C-u>call go#oracle#Referrers(-1)<CR> nnoremap <silent> <Plug>(go-referrers) :<C-u>call go#guru#Referrers(-1)<CR>
" TODO(arslan): enable this once the function is implemented
" nnoremap <silent> <Plug>(go-sameids) :<C-u>call go#guru#SameIds(-1)<CR>
nnoremap <silent> <Plug>(go-rename) :<C-u>call go#rename#Rename(!g:go_jump_to_error)<CR> nnoremap <silent> <Plug>(go-rename) :<C-u>call go#rename#Rename(!g:go_jump_to_error)<CR>
nnoremap <silent> <Plug>(go-def) :<C-u>call go#def#Jump()<CR> nnoremap <silent> <Plug>(go-def) :<C-u>call go#def#Jump('')<CR>
nnoremap <silent> <Plug>(go-def-vertical) :<C-u>call go#def#JumpMode("vsplit")<CR> nnoremap <silent> <Plug>(go-def-vertical) :<C-u>call go#def#Jump("vsplit")<CR>
nnoremap <silent> <Plug>(go-def-split) :<C-u>call go#def#JumpMode("split")<CR> nnoremap <silent> <Plug>(go-def-split) :<C-u>call go#def#Jump("split")<CR>
nnoremap <silent> <Plug>(go-def-tab) :<C-u>call go#def#JumpMode("tab")<CR> nnoremap <silent> <Plug>(go-def-tab) :<C-u>call go#def#Jump("tab")<CR>
nnoremap <silent> <Plug>(go-def-pop) :<C-u>call go#def#StackPop()<CR>
nnoremap <silent> <Plug>(go-def-stack) :<C-u>call go#def#Stack()<CR>
nnoremap <silent> <Plug>(go-def-stack-clear) :<C-u>call go#def#StackClear()<CR>
nnoremap <silent> <Plug>(go-doc) :<C-u>call go#doc#Open("new", "split")<CR> nnoremap <silent> <Plug>(go-doc) :<C-u>call go#doc#Open("new", "split")<CR>
nnoremap <silent> <Plug>(go-doc-tab) :<C-u>call go#doc#Open("tabnew", "tabe")<CR> nnoremap <silent> <Plug>(go-doc-tab) :<C-u>call go#doc#Open("tabnew", "tabe")<CR>

View File

@ -0,0 +1,6 @@
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
setlocal commentstring=<!--\ %s\ -->

View File

@ -327,6 +327,18 @@ func Test${1:Function}(t *testing.T) {
} }
endsnippet endsnippet
snippet hf "http.HandlerFunc" !b
func ${1:handler}(w http.ResponseWriter, r *http.Request) {
${0:fmt.Fprintf(w, "hello world")}
}
endsnippet
snippet hhf "mux.HandleFunc" !b
${1:http}.HandleFunc("${2:/}", func(w http.ResponseWriter, r *http.Request) {
${0:fmt.Fprintf(w, "hello world")}
})
endsnippet
# quick test server # quick test server
snippet tsrv "httptest.NewServer" snippet tsrv "httptest.NewServer"
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@ -351,6 +363,21 @@ if err != nil {
} }
endsnippet endsnippet
snippet example "func ExampleXYZ() { ... }"
func Example${1:Method}() {
${0:${VISUAL}}
// Output:
}
endsnippet
snippet benchmark "func BenchmarkXYZ(b *testing.B) { ... }"
func Benchmark${1:Method}(b *testing.B) {
for i := 0; i < b.N; i++ {
${0:${VISUAL}}
}
}
endsnippet
# variable declaration # variable declaration
snippet var "var x Type [= ...]" snippet var "var x Type [= ...]"
var ${1:x} ${2:Type}${3: = ${0:value}} var ${1:x} ${2:Type}${3: = ${0:value}}
@ -372,7 +399,6 @@ if !reflect.DeepEqual(${1:expected}, ${2:actual}) {
} }
endsnippet endsnippet
global !p global !p
import re import re

View File

@ -305,6 +305,21 @@ abbr if err != nil { t.Fatalf(...) }
if err != nil { if err != nil {
t.Fatalf("${1}") t.Fatalf("${1}")
} }
# test example
snippet example
func Example${1:Method}() {
${0}
// Output:
}
endsnippet
# test benchmark
snippet benchmark
func Benchmark${1:Method}(b *testing.B) {
for i := 0; i < b.N; i++ {
${0}
}
}
endsnippet
# variable declaration # variable declaration
snippet var snippet var
abbr var x Type [= ...] abbr var x Type [= ...]
@ -323,3 +338,15 @@ abbr equals: test two identifiers with DeepEqual
fmt.Printf("%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\n\n", filepath.Base(file), line, $1, $2) fmt.Printf("%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\n\n", filepath.Base(file), line, $1, $2)
t.FailNow() t.FailNow()
} }
snippet hf
abbr http.HandlerFunc
func ${1:handler}(w http.ResponseWriter, r *http.Request) {
${0:fmt.Fprintf(w, "hello world")}
}
snippet hhf
abbr mux.HandleFunc(...)
${1:http}.HandleFunc("${2:/}", func(w http.ResponseWriter, r *http.Request) {
${0:fmt.Fprintf(w, "hello world")}
})

View File

@ -4,15 +4,13 @@ if exists("g:go_loaded_install")
endif endif
let g:go_loaded_install = 1 let g:go_loaded_install = 1
" these packages are used by vim-go and can be automatically installed if " these packages are used by vim-go and can be automatically installed if
" needed by the user with GoInstallBinaries " needed by the user with GoInstallBinaries
let s:packages = [ let s:packages = [
\ "github.com/nsf/gocode", \ "github.com/nsf/gocode",
\ "github.com/alecthomas/gometalinter", \ "github.com/alecthomas/gometalinter",
\ "golang.org/x/tools/cmd/goimports", \ "golang.org/x/tools/cmd/goimports",
\ "github.com/rogpeppe/godef", \ "golang.org/x/tools/cmd/guru",
\ "golang.org/x/tools/cmd/oracle",
\ "golang.org/x/tools/cmd/gorename", \ "golang.org/x/tools/cmd/gorename",
\ "github.com/golang/lint/golint", \ "github.com/golang/lint/golint",
\ "github.com/kisielk/errcheck", \ "github.com/kisielk/errcheck",
@ -20,6 +18,7 @@ let s:packages = [
\ "github.com/klauspost/asmfmt/cmd/asmfmt", \ "github.com/klauspost/asmfmt/cmd/asmfmt",
\ "github.com/fatih/motion", \ "github.com/fatih/motion",
\ "github.com/zmb3/gogetdoc", \ "github.com/zmb3/gogetdoc",
\ "github.com/josharian/impl",
\ ] \ ]
" These commands are available on any filetypes " These commands are available on any filetypes
@ -54,7 +53,7 @@ function! s:GoInstallBinaries(updateBinaries)
let old_path = $PATH let old_path = $PATH
" vim's executable path is looking in PATH so add our go_bin path to it " vim's executable path is looking in PATH so add our go_bin path to it
let $PATH = $PATH . go#util#PathListSep() .go_bin_path let $PATH = go_bin_path . go#util#PathListSep() . $PATH
" when shellslash is set on MS-* systems, shellescape puts single quotes " when shellslash is set on MS-* systems, shellescape puts single quotes
" around the output string. cmd on Windows does not handle single quotes " around the output string. cmd on Windows does not handle single quotes
@ -68,7 +67,7 @@ function! s:GoInstallBinaries(updateBinaries)
let cmd = "go get -u -v " let cmd = "go get -u -v "
let s:go_version = matchstr(system("go version"), '\d.\d.\d') let s:go_version = matchstr(go#util#System("go version"), '\d.\d.\d')
" https://github.com/golang/go/issues/10791 " https://github.com/golang/go/issues/10791
if s:go_version > "1.4.0" && s:go_version < "1.5.0" if s:go_version > "1.4.0" && s:go_version < "1.5.0"
@ -92,8 +91,8 @@ function! s:GoInstallBinaries(updateBinaries)
endif endif
let out = system(cmd . shellescape(pkg)) let out = go#util#System(cmd . shellescape(pkg))
if v:shell_error if go#util#ShellError() != 0
echo "Error installing ". pkg . ": " . out echo "Error installing ". pkg . ": " . out
endif endif
endif endif
@ -168,10 +167,6 @@ augroup vim-go
if get(g:, "go_metalinter_autosave", 0) if get(g:, "go_metalinter_autosave", 0)
autocmd BufWritePost *.go call go#lint#Gometa(1) autocmd BufWritePost *.go call go#lint#Gometa(1)
endif endif
" initialize window-local godef stack
au BufReadPre,WinEnter *.go if !exists('w:go_stack') | let w:go_stack = [] | endif
au BufReadPre,WinEnter *.go if !exists('w:go_stack_level') | let w:go_stack_level = 0 | endif
augroup END augroup END

View File

@ -1,9 +1,5 @@
# VIM-LESS # VIM-LESS
**This project is looking for new contributors / a new maintainer. [issue 51](https://github.com/groenewege/vim-less/issues/51)**
---
This vim bundle adds syntax highlighting, indenting and autocompletion for the dynamic stylesheet language [LESS](http://lesscss.org). This vim bundle adds syntax highlighting, indenting and autocompletion for the dynamic stylesheet language [LESS](http://lesscss.org).
This bundle is compatible with [vim-css-color](https://github.com/skammer/vim-css-color), This bundle is compatible with [vim-css-color](https://github.com/skammer/vim-css-color),

View File

@ -16,6 +16,10 @@ documents you can enable it in your `.vimrc` like so:
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh'] let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
To disable markdown syntax concealing add the following to your vimrc:
let g:markdown_syntax_conceal = 0
## 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

@ -81,7 +81,10 @@ syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" conta
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline
let s:concealends = has('conceal') ? ' concealends' : '' let s:concealends = ''
if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1
let s:concealends = ' concealends'
endif
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends
exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends

View File

@ -36,6 +36,8 @@ endsnippet
#service service provider #service service provider
snippet l_ssp "Laravel service provider for service" b snippet l_ssp "Laravel service provider for service" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2
@ -62,6 +64,8 @@ endsnippet
#repository service provider #repository service provider
snippet l_rsp "Laravel service provider for repository" b snippet l_rsp "Laravel service provider for repository" b
<?php
/*! /*!
* \namespace $2 * \namespace $2
* \class $3 * \class $3
@ -100,6 +104,8 @@ endsnippet
#model #model
snippet l_md "Laravel simple model" b snippet l_md "Laravel simple model" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2
@ -123,6 +129,8 @@ endsnippet
#abstract repository #abstract repository
snippet l_ar "Laravel abstract Repository" b snippet l_ar "Laravel abstract Repository" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2
@ -189,6 +197,8 @@ endsnippet
#repository #repository
snippet l_r "Laravel Repository" b snippet l_r "Laravel Repository" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $3 * \class $3
@ -207,6 +217,8 @@ endsnippet
#service #service
snippet l_s "Laravel Service" b snippet l_s "Laravel Service" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2
@ -233,6 +245,8 @@ endsnippet
#facade #facade
snippet l_f "Laravel Facade" b snippet l_f "Laravel Facade" b
<?php
/*! /*!
* \namespace $1 * \namespace $1
* \class $2 * \class $2

View File

@ -0,0 +1,38 @@
# Snippets for phpspec
priority -50
snippet spec "phpspec class" b
<?php
namespace `!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
/**
* @author `!v g:snips_author`
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
` extends ObjectBehavior
{
public function it${1:_does_something}()
{
$0
}
}
endsnippet
snippet it "phpspec function it..." b
public function it${1:_does_something}()
{
$0
}
endsnippet

View File

@ -3,15 +3,17 @@
priority -50 priority -50
snippet test "phpunit test class" b snippet test "phpunit test class" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
/** /**
* @author `whoami` * @author `!v g:snips_author`
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()

View File

@ -4,15 +4,17 @@
priority -50 priority -50
snippet classn "Basic class with namespace snippet" b snippet classn "Basic class with namespace snippet" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
/** /**
* ${1:@author `whoami`} * ${1:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -26,9 +28,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet contr "Symfony2 controller" b snippet contr "Symfony2 controller" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -40,7 +44,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
* ${1:@author `whoami`} * ${1:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -49,6 +53,18 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
} }
endsnippet endsnippet
snippet sfa "Symfony 2 Controller action"
/**
* @Route("/${1:route_name}", name="$1")
* @Template()
*/
public function $1Action($2)
{
$3
return ${4:array();}$0
}
endsnippet
snippet act "Symfony2 action" b snippet act "Symfony2 action" b
/** /**
* @Route("${3}", name="${4}") * @Route("${3}", name="${4}")
@ -72,13 +88,15 @@ public function ${1}Action(${2})
${6} ${6}
return []; return [];
}`!p }`!p
abspath = os.path.abspath(path)` relpath = os.path.relpath(path)`
endsnippet endsnippet
snippet comm "Symfony2 command" b snippet comm "Symfony2 command" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -90,7 +108,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* ${3:@author `whoami`} * ${3:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -113,9 +131,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet subs "Symfony2 subscriber" b snippet subs "Symfony2 subscriber" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -123,7 +143,7 @@ if m:
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/** /**
* ${1:@author `whoami`} * ${1:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -144,9 +164,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet transf "Symfony2 form data transformer" b snippet transf "Symfony2 form data transformer" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -155,7 +177,7 @@ use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Exception\TransformationFailedException;
/** /**
* ${3:@author `whoami`} * ${3:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -178,9 +200,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet ent "Symfony2 doctrine entity" b snippet ent "Symfony2 doctrine entity" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -188,7 +212,7 @@ if m:
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* ${3:@author `whoami`} * ${3:@author `!v g:snips_author`}
* *
* @ORM\Entity() * @ORM\Entity()
* @ORM\Table(name="`!p * @ORM\Table(name="`!p
@ -215,9 +239,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet form "Symfony2 form type" b snippet form "Symfony2 form type" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -227,7 +253,7 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/** /**
* ${2:@author `whoami`} * ${2:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()
@ -259,9 +285,11 @@ snip.rv = re.match(r'.*(?=\.)', fn).group()
endsnippet endsnippet
snippet ev "Symfony2 event" b snippet ev "Symfony2 event" b
<?php
namespace `!p namespace `!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`; `;
@ -269,7 +297,7 @@ if m:
use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\Event;
/** /**
* ${2:@author `whoami`} * ${2:@author `!v g:snips_author`}
*/ */
class `!p class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group() snip.rv = re.match(r'.*(?=\.)', fn).group()

View File

@ -11,6 +11,12 @@ snippet def "def"
define('${1:VARIABLE_NAME}', ${2:'definition'});${3} define('${1:VARIABLE_NAME}', ${2:'definition'});${3}
endsnippet endsnippet
snippet wh "while"
while (${1}) {
${0:${VISUAL}}
}
endsnippet
snippet do "do" snippet do "do"
do { do {
${2:// code... } ${2:// code... }
@ -39,9 +45,9 @@ interface ${1:someClass}
} // END interface $1" } // END interface $1"
endsnippet endsnippet
snippet else "else" snippet el "else"
else { else {
${1:// code...} ${0:${VISUAL}}
} }
endsnippet endsnippet
@ -62,14 +68,14 @@ $_GET['${1}']${2}
endsnippet endsnippet
snippet if "if" snippet if "if"
if (${1:/* condition */}) { if (${1}) {
${2:// code...} ${0:${VISUAL}}
} }
endsnippet endsnippet
snippet elif "elseif" snippet eif "elseif"
elseif (${1:/* condition */}) { elseif (${1}) {
${2:// code...} ${0:${VISUAL}}
} }
endsnippet endsnippet
@ -268,8 +274,8 @@ endsnippet
snippet ns "namespace declaration" b snippet ns "namespace declaration" b
namespace ${1:`!p namespace ${1:`!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`}; `};
@ -279,8 +285,8 @@ snippet class "Class declaration template" b
<?php <?php
namespace ${1:`!p namespace ${1:`!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`}; `};
@ -298,8 +304,8 @@ snippet interface "Interface declaration template" b
<?php <?php
namespace ${1:`!p namespace ${1:`!p
abspath = os.path.abspath(path) relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', abspath) m = re.search(r'[A-Z].+(?=/)', relpath)
if m: if m:
snip.rv = m.group().replace('/', '\\') snip.rv = m.group().replace('/', '\\')
`}; `};
@ -314,6 +320,24 @@ interface $1
} }
endsnippet endsnippet
snippet trait "Trait declaration template" b
<?php
namespace ${1:`!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
/**
* Trait ${1:`!p snip.rv=snip.basename`}
* @author ${2:`!v g:snips_author`}
*/
trait $1
{
}
endsnippet
snippet construct "__construct()" b snippet construct "__construct()" b
/** /**
@ -333,19 +357,6 @@ snippet pc "Dumb debug helper in cli"
var_export($1);$0 var_export($1);$0
endsnippet endsnippet
# Symfony 2 based snippets
snippet sfa "Symfony 2 Controller action"
/**
* @Route("/${1:route_name}", name="$1")
* @Template()
*/
public function $1Action($2)
{
$3
return ${4:array();}$0
}
endsnippet
snippet inheritdoc "@inheritdoc docblock" snippet inheritdoc "@inheritdoc docblock"
/** /**
* {@inheritdoc} * {@inheritdoc}

View File

@ -245,6 +245,9 @@ def write_function_docstring(t, snip):
snip.rv += '\n' + snip.mkline('', indent='') snip.rv += '\n' + snip.mkline('', indent='')
snip += triple_quotes(snip) snip += triple_quotes(snip)
def get_dir_and_file_name(snip):
return os.getcwd().split(os.sep)[-1] + '.' + snip.basename
endglobal endglobal
######################################## ########################################
@ -687,4 +690,18 @@ ${1:${VISUAL:doc}}
`!p snip.rv = triple_quotes(snip)` `!p snip.rv = triple_quotes(snip)`
endsnippet endsnippet
snippet pmdoc "pocoo style module doc string" b
# -*- coding: utf-8 -*-
"""
`!p snip.rv = get_dir_and_file_name(snip)`
`!p snip.rv = '~' * len(get_dir_and_file_name(snip))`
${1:DESCRIPTION}
:copyright: (c) `date +%Y` by ${2:YOUR_NAME}.
:license: ${3:LICENSE_NAME}, see LICENSE for more details.
"""
$0
endsnippet
# vim:ft=snippets: # vim:ft=snippets:

View File

@ -20,10 +20,28 @@ endsnippet
snippet if "twig if" b snippet if "twig if" b
{% if ${1} %} {% if ${1} %}
${2} ${0:${VISUAL}}
{% endif %} {% endif %}
endsnippet endsnippet
snippet ife "twig if ... else" b
{% if ${1} %}
${2}
{% else %}
${0}
{% endif %}
endsnippet
snippet el "twig else"
{% else %}
${0:${VISUAL}}
endsnippet
snippet eif "twig elseif"
{% elseif ${1} %}
${0:${VISUAL}}
endsnippet
snippet for "twig for" b snippet for "twig for" b
{% for ${1} in ${2} %} {% for ${1} in ${2} %}
${3} ${3}

View File

@ -106,6 +106,19 @@ snippet cout
snippet cin snippet cin
std::cin >> ${1}; std::cin >> ${1};
## ##
## Casts
# static
snippet sca
static_cast<${1:unsigned}>(${2:expr})${3}
# dynamic
snippet dca
dynamic_cast<${1:unsigned}>(${2:expr})${3}
# reinterpret
snippet rca
reinterpret_cast<${1:unsigned}>(${2:expr})${3}
# const
snippet cca
const_cast<${1:unsigned}>(${2:expr})${3}
## Iteration ## Iteration
# for i # for i
snippet fori snippet fori

View File

@ -24,6 +24,10 @@ snippet incl
# behavior directive # behavior directive
snippet beh snippet beh
-behaviour(${1:behaviour}). -behaviour(${1:behaviour}).
snippet ifd
-ifdef(${1:TEST}).
${0}
-endif.
# if expression # if expression
snippet if snippet if
if if
@ -483,21 +487,21 @@ snippet testsuite
-module(${0:`vim_snippets#Filename('', 'my')`}). -module(${0:`vim_snippets#Filename('', 'my')`}).
-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct.hrl").
%% Test server callbacks %% Test server callbacks
-export([suite/0, all/0, groups/0, -export([suite/0, all/0, groups/0,
init_per_suite/1, end_per_suite/1, init_per_suite/1, end_per_suite/1,
init_per_group/2, end_per_group/2, init_per_group/2, end_per_group/2,
init_per_testcase/2, end_per_testcase/2]). init_per_testcase/2, end_per_testcase/2]).
%% Test cases %% Test cases
-export([ -export([
]). ]).
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% COMMON TEST CALLBACK FUNCTIONS %% COMMON TEST CALLBACK FUNCTIONS
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: suite() -> Info %% Function: suite() -> Info
%% %%
@ -512,7 +516,7 @@ snippet testsuite
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
suite() -> suite() ->
[{timetrap,{minutes,10}}]. [{timetrap,{minutes,10}}].
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: init_per_suite(Config0) -> %% Function: init_per_suite(Config0) ->
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
@ -529,7 +533,7 @@ snippet testsuite
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
init_per_suite(Config) -> init_per_suite(Config) ->
Config. Config.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} %% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
%% %%
@ -540,7 +544,7 @@ snippet testsuite
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
end_per_suite(_Config) -> end_per_suite(_Config) ->
ok. ok.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: init_per_group(GroupName, Config0) -> %% Function: init_per_group(GroupName, Config0) ->
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
@ -556,7 +560,7 @@ snippet testsuite
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
init_per_group(_GroupName, Config) -> init_per_group(_GroupName, Config) ->
Config. Config.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: end_per_group(GroupName, Config0) -> %% Function: end_per_group(GroupName, Config0) ->
%% void() | {save_config,Config1} %% void() | {save_config,Config1}
@ -570,7 +574,7 @@ snippet testsuite
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
end_per_group(_GroupName, _Config) -> end_per_group(_GroupName, _Config) ->
ok. ok.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: init_per_testcase(TestCase, Config0) -> %% Function: init_per_testcase(TestCase, Config0) ->
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} %% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
@ -589,7 +593,7 @@ snippet testsuite
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
init_per_testcase(_TestCase, Config) -> init_per_testcase(_TestCase, Config) ->
Config. Config.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: end_per_testcase(TestCase, Config0) -> %% Function: end_per_testcase(TestCase, Config0) ->
%% void() | {save_config,Config1} | {fail,Reason} %% void() | {save_config,Config1} | {fail,Reason}
@ -605,7 +609,7 @@ snippet testsuite
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
end_per_testcase(_TestCase, _Config) -> end_per_testcase(_TestCase, _Config) ->
ok. ok.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: groups() -> [Group] %% Function: groups() -> [Group]
%% %%
@ -629,7 +633,7 @@ snippet testsuite
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
groups() -> groups() ->
[]. [].
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: all() -> GroupsAndTestCases | {skip,Reason} %% Function: all() -> GroupsAndTestCases | {skip,Reason}
%% %%
@ -644,14 +648,14 @@ snippet testsuite
%% Description: Returns the list of groups and test cases that %% Description: Returns the list of groups and test cases that
%% are to be executed. %% are to be executed.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
all() -> all() ->
[]. [].
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% TEST CASES %% TEST CASES
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Function: TestCase(Config0) -> %% Function: TestCase(Config0) ->
%% ok | exit() | {skip,Reason} | {comment,Comment} | %% ok | exit() | {skip,Reason} | {comment,Comment} |

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