Updated plugins
This commit is contained in:
parent
fe46dfbbe6
commit
ccb7854aa2
103 changed files with 1729 additions and 445 deletions
|
@ -0,0 +1,37 @@
|
||||||
|
" =============================================================================
|
||||||
|
" Filename: autoload/lightline/colorscheme/darcula.vim
|
||||||
|
" Author: kkopec
|
||||||
|
" License: MIT License
|
||||||
|
" Last Change: 2017/02/11 21:18:54.
|
||||||
|
" =============================================================================
|
||||||
|
|
||||||
|
let s:black = [ '#2b2b2b', 235 ]
|
||||||
|
let s:gray = [ '#323232', 236 ]
|
||||||
|
let s:white = [ '#a9b7c6', 250 ]
|
||||||
|
let s:blue = [ '#6897bb' , 67 ]
|
||||||
|
let s:green = [ '#629755', 71 ]
|
||||||
|
let s:purple = [ '#9876aa', 104 ]
|
||||||
|
let s:red = [ '#ff6b68', 204 ]
|
||||||
|
let s:yellow = [ '#ffc66d', 222 ]
|
||||||
|
|
||||||
|
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
|
||||||
|
let s:p.normal.left = [ [ s:black, s:purple ], [ s:purple, s:gray ] ]
|
||||||
|
let s:p.normal.right = [ [ s:black, s:purple ], [ s:purple, s:gray ] ]
|
||||||
|
let s:p.inactive.left = [ [ s:black, s:blue ], [ s:blue, s:gray ] ]
|
||||||
|
let s:p.inactive.right = [ [ s:black, s:blue ], [ s:blue, s:gray ] ]
|
||||||
|
let s:p.insert.left = [ [ s:black, s:green ], [ s:green, s:gray ] ]
|
||||||
|
let s:p.insert.right = [ [ s:black, s:green ], [ s:green, s:gray ] ]
|
||||||
|
let s:p.replace.left = [ [ s:black, s:red ], [ s:red, s:gray ] ]
|
||||||
|
let s:p.replace.right = [ [ s:black, s:red ], [ s:red, s:gray ] ]
|
||||||
|
let s:p.visual.left = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ]
|
||||||
|
let s:p.visual.right = [ [ s:black, s:yellow ], [ s:yellow, s:gray ] ]
|
||||||
|
let s:p.normal.middle = [ [ s:white, s:gray ] ]
|
||||||
|
let s:p.inactive.middle = [ [ s:white, s:gray ] ]
|
||||||
|
let s:p.tabline.left = [ [ s:blue, s:gray ] ]
|
||||||
|
let s:p.tabline.tabsel = [ [ s:black, s:blue ] ]
|
||||||
|
let s:p.tabline.middle = [ [ s:blue, s:gray ] ]
|
||||||
|
let s:p.tabline.right = [ [ s:black, s:blue ] ]
|
||||||
|
let s:p.normal.error = [ [ s:red, s:black ] ]
|
||||||
|
let s:p.normal.warning = [ [ s:yellow, s:black ] ]
|
||||||
|
|
||||||
|
let g:lightline#colorscheme#darcula#palette = lightline#colorscheme#flatten(s:p)
|
|
@ -223,7 +223,8 @@ OPTIONS *lightline-option*
|
||||||
The colorscheme for lightline.vim.
|
The colorscheme for lightline.vim.
|
||||||
Currently, wombat, solarized, powerline, jellybeans, Tomorrow,
|
Currently, wombat, solarized, powerline, jellybeans, Tomorrow,
|
||||||
Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Eighties,
|
Tomorrow_Night, Tomorrow_Night_Blue, Tomorrow_Night_Eighties,
|
||||||
PaperColor, seoul256, landscape, one, Dracula, Molokai and 16color are available.
|
PaperColor, seoul256, landscape, one, Dracula, darcula,
|
||||||
|
Molokai and 16color are available.
|
||||||
The default value is:
|
The default value is:
|
||||||
>
|
>
|
||||||
let g:lightline.colorscheme = 'default'
|
let g:lightline.colorscheme = 'default'
|
||||||
|
|
|
@ -20,108 +20,105 @@ endfunction
|
||||||
"FUNCTION: s:UI._dumpHelp {{{1
|
"FUNCTION: s:UI._dumpHelp {{{1
|
||||||
"prints out the quick help
|
"prints out the quick help
|
||||||
function! s:UI._dumpHelp()
|
function! s:UI._dumpHelp()
|
||||||
let old_h = @h
|
|
||||||
if self.getShowHelp()
|
if self.getShowHelp()
|
||||||
let @h= "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n"
|
let help = "\" NERD tree (" . nerdtree#version() . ") quickhelp~\n"
|
||||||
let @h=@h."\" ============================\n"
|
let help .= "\" ============================\n"
|
||||||
let @h=@h."\" File node mappings~\n"
|
let help .= "\" File node mappings~\n"
|
||||||
let @h=@h."\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n"
|
let help .= "\" ". (g:NERDTreeMouseMode ==# 3 ? "single" : "double") ."-click,\n"
|
||||||
let @h=@h."\" <CR>,\n"
|
let help .= "\" <CR>,\n"
|
||||||
if self.nerdtree.isTabTree()
|
if self.nerdtree.isTabTree()
|
||||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in prev window\n"
|
let help .= "\" ". g:NERDTreeMapActivateNode .": open in prev window\n"
|
||||||
else
|
else
|
||||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open in current window\n"
|
let help .= "\" ". g:NERDTreeMapActivateNode .": open in current window\n"
|
||||||
endif
|
endif
|
||||||
if self.nerdtree.isTabTree()
|
if self.nerdtree.isTabTree()
|
||||||
let @h=@h."\" ". g:NERDTreeMapPreview .": preview\n"
|
let help .= "\" ". g:NERDTreeMapPreview .": preview\n"
|
||||||
endif
|
endif
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||||
let @h=@h."\" middle-click,\n"
|
let help .= "\" middle-click,\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenSplit .": open split\n"
|
let help .= "\" ". g:NERDTreeMapOpenSplit .": open split\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapPreviewSplit .": preview split\n"
|
let help .= "\" ". g:NERDTreeMapPreviewSplit .": preview split\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n"
|
let help .= "\" ". g:NERDTreeMapOpenVSplit .": open vsplit\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
|
let help .= "\" ". g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
|
||||||
|
|
||||||
let @h=@h."\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Directory node mappings~\n"
|
let help .= "\" Directory node mappings~\n"
|
||||||
let @h=@h."\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n"
|
let help .= "\" ". (g:NERDTreeMouseMode ==# 1 ? "double" : "single") ."-click,\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open & close node\n"
|
let help .= "\" ". g:NERDTreeMapActivateNode .": open & close node\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n"
|
let help .= "\" ". g:NERDTreeMapOpenRecursively .": recursively open node\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapCloseDir .": close parent of node\n"
|
let help .= "\" ". g:NERDTreeMapCloseDir .": close parent of node\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n"
|
let help .= "\" ". g:NERDTreeMapCloseChildren .": close all child nodes of\n"
|
||||||
let @h=@h."\" current node recursively\n"
|
let help .= "\" current node recursively\n"
|
||||||
let @h=@h."\" middle-click,\n"
|
let help .= "\" middle-click,\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n"
|
let help .= "\" ". g:NERDTreeMapOpenExpl.": explore selected dir\n"
|
||||||
|
|
||||||
let @h=@h."\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Bookmark table mappings~\n"
|
let help .= "\" Bookmark table mappings~\n"
|
||||||
let @h=@h."\" double-click,\n"
|
let help .= "\" double-click,\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open bookmark\n"
|
let help .= "\" ". g:NERDTreeMapActivateNode .": open bookmark\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
let help .= "\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
let help .= "\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
let help .= "\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
||||||
|
|
||||||
let @h=@h."\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Tree navigation mappings~\n"
|
let help .= "\" Tree navigation mappings~\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapJumpRoot .": go to root\n"
|
let help .= "\" ". g:NERDTreeMapJumpRoot .": go to root\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapJumpParent .": go to parent\n"
|
let help .= "\" ". g:NERDTreeMapJumpParent .": go to parent\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n"
|
let help .= "\" ". g:NERDTreeMapJumpFirstChild .": go to first child\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapJumpLastChild .": go to last child\n"
|
let help .= "\" ". g:NERDTreeMapJumpLastChild .": go to last child\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n"
|
let help .= "\" ". g:NERDTreeMapJumpNextSibling .": go to next sibling\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n"
|
let help .= "\" ". g:NERDTreeMapJumpPrevSibling .": go to prev sibling\n"
|
||||||
|
|
||||||
let @h=@h."\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Filesystem mappings~\n"
|
let help .= "\" Filesystem mappings~\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n"
|
let help .= "\" ". g:NERDTreeMapChangeRoot .": change tree root to the\n"
|
||||||
let @h=@h."\" selected dir\n"
|
let help .= "\" selected dir\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n"
|
let help .= "\" ". g:NERDTreeMapUpdir .": move tree root up a dir\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n"
|
let help .= "\" ". g:NERDTreeMapUpdirKeepOpen .": move tree root up a dir\n"
|
||||||
let @h=@h."\" but leave old root open\n"
|
let help .= "\" but leave old root open\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n"
|
let help .= "\" ". g:NERDTreeMapRefresh .": refresh cursor dir\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n"
|
let help .= "\" ". g:NERDTreeMapRefreshRoot .": refresh current root\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapMenu .": Show menu\n"
|
let help .= "\" ". g:NERDTreeMapMenu .": Show menu\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapChdir .":change the CWD to the\n"
|
let help .= "\" ". g:NERDTreeMapChdir .":change the CWD to the\n"
|
||||||
let @h=@h."\" selected dir\n"
|
let help .= "\" selected dir\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapCWD .":change tree root to CWD\n"
|
let help .= "\" ". g:NERDTreeMapCWD .":change tree root to CWD\n"
|
||||||
|
|
||||||
let @h=@h."\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Tree filtering mappings~\n"
|
let help .= "\" Tree filtering mappings~\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n"
|
let help .= "\" ". g:NERDTreeMapToggleHidden .": hidden files (" . (self.getShowHidden() ? "on" : "off") . ")\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n"
|
let help .= "\" ". g:NERDTreeMapToggleFilters .": file filters (" . (self.isIgnoreFilterEnabled() ? "on" : "off") . ")\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n"
|
let help .= "\" ". g:NERDTreeMapToggleFiles .": files (" . (self.getShowFiles() ? "on" : "off") . ")\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n"
|
let help .= "\" ". g:NERDTreeMapToggleBookmarks .": bookmarks (" . (self.getShowBookmarks() ? "on" : "off") . ")\n"
|
||||||
|
|
||||||
"add quickhelp entries for each custom key map
|
"add quickhelp entries for each custom key map
|
||||||
let @h=@h."\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Custom mappings~\n"
|
let help .= "\" Custom mappings~\n"
|
||||||
for i in g:NERDTreeKeyMap.All()
|
for i in g:NERDTreeKeyMap.All()
|
||||||
if !empty(i.quickhelpText)
|
if !empty(i.quickhelpText)
|
||||||
let @h=@h."\" ". i.key .": ". i.quickhelpText ."\n"
|
let help .= "\" ". i.key .": ". i.quickhelpText ."\n"
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
let @h=@h."\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Other mappings~\n"
|
let help .= "\" Other mappings~\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n"
|
let help .= "\" ". g:NERDTreeMapQuit .": Close the NERDTree window\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n"
|
let help .= "\" ". g:NERDTreeMapToggleZoom .": Zoom (maximize-minimize)\n"
|
||||||
let @h=@h."\" the NERDTree window\n"
|
let help .= "\" the NERDTree window\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n"
|
let help .= "\" ". g:NERDTreeMapHelp .": toggle help\n"
|
||||||
let @h=@h."\"\n\" ----------------------------\n"
|
let help .= "\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Bookmark commands~\n"
|
let help .= "\" Bookmark commands~\n"
|
||||||
let @h=@h."\" :Bookmark [<name>]\n"
|
let help .= "\" :Bookmark [<name>]\n"
|
||||||
let @h=@h."\" :BookmarkToRoot <name>\n"
|
let help .= "\" :BookmarkToRoot <name>\n"
|
||||||
let @h=@h."\" :RevealBookmark <name>\n"
|
let help .= "\" :RevealBookmark <name>\n"
|
||||||
let @h=@h."\" :OpenBookmark <name>\n"
|
let help .= "\" :OpenBookmark <name>\n"
|
||||||
let @h=@h."\" :ClearBookmarks [<names>]\n"
|
let help .= "\" :ClearBookmarks [<names>]\n"
|
||||||
let @h=@h."\" :ClearAllBookmarks\n"
|
let help .= "\" :ClearAllBookmarks\n"
|
||||||
silent! put h
|
silent! put =help
|
||||||
elseif !self.isMinimal()
|
elseif !self.isMinimal()
|
||||||
let @h="\" Press ". g:NERDTreeMapHelp ." for help\n"
|
let help ="\" Press ". g:NERDTreeMapHelp ." for help\n"
|
||||||
silent! put h
|
silent! put =help
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let @h = old_h
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -440,10 +437,7 @@ function! s:UI.render()
|
||||||
call cursor(line(".")+1, col("."))
|
call cursor(line(".")+1, col("."))
|
||||||
|
|
||||||
"draw the tree
|
"draw the tree
|
||||||
let old_o = @o
|
silent put =self.nerdtree.root.renderToString()
|
||||||
let @o = self.nerdtree.root.renderToString()
|
|
||||||
silent put o
|
|
||||||
let @o = old_o
|
|
||||||
|
|
||||||
"delete the blank line at the top of the buffer
|
"delete the blank line at the top of the buffer
|
||||||
silent 1,1delete _
|
silent 1,1delete _
|
||||||
|
|
|
@ -101,10 +101,10 @@ enabled.
|
||||||
Syntastic itself has rather relaxed requirements: it doesn't have any external
|
Syntastic itself has rather relaxed requirements: it doesn't have any external
|
||||||
dependencies, and it needs a version of [Vim][vim] compiled with a few common
|
dependencies, and it needs a version of [Vim][vim] compiled with a few common
|
||||||
features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`,
|
features: `autocmd`, `eval`, `file_in_path`, `modify_fname`, `quickfix`,
|
||||||
`reltime`, and `user_commands`. Not all possible combinations of features that
|
`reltime`, `statusline`, and `user_commands`. Not all possible combinations of
|
||||||
include the ones above make equal sense on all operating systems, but Vim
|
features that include the ones above make equal sense on all operating systems,
|
||||||
version 7 or later with the "normal", "big", or "huge" feature sets should be
|
but Vim version 7 or later with the "normal", "big", or "huge" feature sets
|
||||||
fine.
|
should be fine.
|
||||||
|
|
||||||
Syntastic should work with any modern plugin managers for Vim, such as
|
Syntastic should work with any modern plugin managers for Vim, such as
|
||||||
[NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam],
|
[NeoBundle][neobundle], [Pathogen][pathogen], [Vim-Addon-Manager][vam],
|
||||||
|
|
|
@ -132,9 +132,9 @@ endfunction " }}}2
|
||||||
" returns
|
" returns
|
||||||
"
|
"
|
||||||
" {'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
|
" {'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
|
||||||
function! syntastic#util#parseShebang() abort " {{{2
|
function! syntastic#util#parseShebang(buf) abort " {{{2
|
||||||
for lnum in range(1, 5)
|
for lnum in range(1, 5)
|
||||||
let line = getline(lnum)
|
let line = get(getbufline(a:buf, lnum), 0, '')
|
||||||
if line =~# '^#!'
|
if line =~# '^#!'
|
||||||
let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '')
|
let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '')
|
||||||
let exe = matchstr(line, '\m^\S*\ze')
|
let exe = matchstr(line, '\m^\S*\ze')
|
||||||
|
|
|
@ -164,7 +164,7 @@ When syntax errors are detected a flag will be shown. The content of the flag
|
||||||
is derived from the |'syntastic_stl_format'| option.
|
is derived from the |'syntastic_stl_format'| option.
|
||||||
|
|
||||||
Please note that these settings might conflict with other Vim plugins that
|
Please note that these settings might conflict with other Vim plugins that
|
||||||
change the way statusline works. Refer to the |syntastic-compatibility| notes
|
change the way 'statusline' works. Refer to the |syntastic-compatibility| notes
|
||||||
below and to the respective plugins' documentation for possible solutions.
|
below and to the respective plugins' documentation for possible solutions.
|
||||||
|
|
||||||
In particular see |syntastic-airline| below if you're using the "airline" Vim
|
In particular see |syntastic-airline| below if you're using the "airline" Vim
|
||||||
|
|
|
@ -19,7 +19,7 @@ if has('reltime')
|
||||||
lockvar! g:_SYNTASTIC_START
|
lockvar! g:_SYNTASTIC_START
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:_SYNTASTIC_VERSION = '3.8.0-21'
|
let g:_SYNTASTIC_VERSION = '3.8.0-26'
|
||||||
lockvar g:_SYNTASTIC_VERSION
|
lockvar g:_SYNTASTIC_VERSION
|
||||||
|
|
||||||
" Sanity checks {{{1
|
" Sanity checks {{{1
|
||||||
|
@ -36,7 +36,8 @@ for s:feature in [
|
||||||
\ 'modify_fname',
|
\ 'modify_fname',
|
||||||
\ 'quickfix',
|
\ 'quickfix',
|
||||||
\ 'reltime',
|
\ 'reltime',
|
||||||
\ 'user_commands'
|
\ 'statusline',
|
||||||
|
\ 'user_commands',
|
||||||
\ ]
|
\ ]
|
||||||
if !has(s:feature)
|
if !has(s:feature)
|
||||||
call syntastic#log#error('need Vim compiled with feature ' . s:feature)
|
call syntastic#log#error('need Vim compiled with feature ' . s:feature)
|
||||||
|
|
|
@ -34,19 +34,20 @@ function! SyntaxCheckers_asm_gcc_IsAvailable() dict " {{{1
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! SyntaxCheckers_asm_gcc_GetLocList() dict " {{{1
|
function! SyntaxCheckers_asm_gcc_GetLocList() dict " {{{1
|
||||||
|
let buf = bufnr('')
|
||||||
return syntastic#c#GetLocList('asm', 'gcc', {
|
return syntastic#c#GetLocList('asm', 'gcc', {
|
||||||
\ 'errorformat':
|
\ 'errorformat':
|
||||||
\ '%-G%f:%s:,' .
|
\ '%-G%f:%s:,' .
|
||||||
\ '%f:%l:%c: %trror: %m,' .
|
\ '%f:%l:%c: %trror: %m,' .
|
||||||
\ '%f:%l:%c: %tarning: %m,' .
|
\ '%f:%l:%c: %tarning: %m,' .
|
||||||
\ '%f:%l: %m',
|
\ '%f:%l: %m',
|
||||||
\ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect()) })
|
\ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect(buf)) })
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
" Utilities {{{1
|
" Utilities {{{1
|
||||||
|
|
||||||
function! s:GetDialect() " {{{2
|
function! s:GetDialect(buf) " {{{2
|
||||||
return syntastic#util#var('asm_dialect', expand('%:e', 1) ==? 'asm' ? 'intel' : 'att')
|
return syntastic#util#bufVar(a:buf, 'asm_dialect', fnamemodify(bufname(a:buf), ':e') ==? 'asm' ? 'intel' : 'att')
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
|
|
@ -23,7 +23,8 @@ if !exists('g:syntastic_pc_lint_config_file')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
|
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
|
||||||
let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, expand('%:p:h', 1))
|
let buf = bufnr('')
|
||||||
|
let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, fnamemodify(bufname(buf), ':p:h'))
|
||||||
call self.log('config =', config)
|
call self.log('config =', config)
|
||||||
|
|
||||||
" -hFs1 - show filename, add space after messages, try to make message 1 line
|
" -hFs1 - show filename, add space after messages, try to make message 1 line
|
||||||
|
|
|
@ -31,6 +31,7 @@ function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_cabal_cabal_GetLocList() dict
|
function! SyntaxCheckers_cabal_cabal_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.getExecEscaped() . ' check'
|
let makeprg = self.getExecEscaped() . ' check'
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
|
@ -40,9 +41,9 @@ function! SyntaxCheckers_cabal_cabal_GetLocList() dict
|
||||||
return SyntasticMake({
|
return SyntasticMake({
|
||||||
\ 'makeprg': makeprg,
|
\ 'makeprg': makeprg,
|
||||||
\ 'errorformat': errorformat,
|
\ 'errorformat': errorformat,
|
||||||
\ 'cwd': expand('%:p:h', 1),
|
\ 'cwd': fnamemodify(bufname(buf), ':p:h'),
|
||||||
\ 'preprocess': 'cabal',
|
\ 'preprocess': 'cabal',
|
||||||
\ 'defaults': {'bufnr': bufnr('')} })
|
\ 'defaults': {'bufnr': buf} })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||||
|
|
|
@ -18,7 +18,8 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
||||||
let arch_flag = syntastic#util#var('cuda_arch')
|
let buf = bufnr('')
|
||||||
|
let arch_flag = syntastic#util#bufVar(buf, 'cuda_arch')
|
||||||
if arch_flag !=# ''
|
if arch_flag !=# ''
|
||||||
let arch_flag = '-arch=' . arch_flag
|
let arch_flag = '-arch=' . arch_flag
|
||||||
call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' .
|
call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' .
|
||||||
|
@ -27,9 +28,9 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
||||||
|
|
||||||
let build_opts = {}
|
let build_opts = {}
|
||||||
let dummy = ''
|
let dummy = ''
|
||||||
if index(['h', 'hpp', 'cuh'], expand('%:e', 1), 0, 1) >= 0
|
if index(['h', 'hpp', 'cuh'], fnamemodify(bufname(buf), ':e'), 0, 1) >= 0
|
||||||
if syntastic#util#var('cuda_check_header', 0)
|
if syntastic#util#bufVar(buf, 'cuda_check_header', 0)
|
||||||
let dummy = expand('%:p:h', 1) . syntastic#util#Slash() . '.syntastic_dummy.cu'
|
let dummy = fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . '.syntastic_dummy.cu'
|
||||||
let build_opts = {
|
let build_opts = {
|
||||||
\ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;',
|
\ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;',
|
||||||
\ 'fname_before': '.syntastic_dummy.cu -include' }
|
\ 'fname_before': '.syntastic_dummy.cu -include' }
|
||||||
|
@ -62,7 +63,18 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
||||||
\ '%DMaking %*\a in %f,'.
|
\ '%DMaking %*\a in %f,'.
|
||||||
\ '%f|%l| %m'
|
\ '%f|%l| %m'
|
||||||
|
|
||||||
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
let loclist = SyntasticMake({
|
||||||
|
\ 'makeprg': makeprg,
|
||||||
|
\ 'errorformat': errorformat,
|
||||||
|
\ 'defaults': {'type': 'E'} })
|
||||||
|
|
||||||
|
for e in loclist
|
||||||
|
let pat = matchstr(e['text'], '\m\c^\s*warning:\s*\zs.*')
|
||||||
|
if pat !=# ''
|
||||||
|
let e['text'] = pat
|
||||||
|
let e['type'] = 'W'
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
if dummy !=# ''
|
if dummy !=# ''
|
||||||
call delete(dummy)
|
call delete(dummy)
|
||||||
|
|
|
@ -44,8 +44,9 @@ function! SyntaxCheckers_d_dmd_IsAvailable() dict " {{{1
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! SyntaxCheckers_d_dmd_GetLocList() dict " {{{1
|
function! SyntaxCheckers_d_dmd_GetLocList() dict " {{{1
|
||||||
|
let buf = bufnr('')
|
||||||
if !exists('g:syntastic_d_include_dirs')
|
if !exists('g:syntastic_d_include_dirs')
|
||||||
let g:syntastic_d_include_dirs = s:GetIncludes(self, expand('%:p:h'))
|
let g:syntastic_d_include_dirs = s:GetIncludes(self, fnamemodify(bufname(buf), ':p:h'))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return syntastic#c#GetLocList('d', 'dmd', {
|
return syntastic#c#GetLocList('d', 'dmd', {
|
||||||
|
|
|
@ -27,9 +27,10 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_elixir_elixir_GetLocList() dict
|
function! SyntaxCheckers_elixir_elixir_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let make_options = {}
|
let make_options = {}
|
||||||
let compile_command = 'elixir'
|
let compile_command = 'elixir'
|
||||||
let mix_file = syntastic#util#findFileInParent('mix.exs', expand('%:p:h', 1))
|
let mix_file = syntastic#util#findFileInParent('mix.exs', fnamemodify(bufname(buf), ':p:h'))
|
||||||
|
|
||||||
if filereadable(mix_file)
|
if filereadable(mix_file)
|
||||||
let compile_command = 'mix compile'
|
let compile_command = 'mix compile'
|
||||||
|
|
|
@ -25,11 +25,13 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_erlang_escript_GetLocList() dict
|
function! SyntaxCheckers_erlang_escript_GetLocList() dict
|
||||||
if expand('%:e', 1) ==# 'hrl'
|
let buf = bufnr('')
|
||||||
|
|
||||||
|
if fnamemodify(bufname(buf), ':e') ==# 'hrl'
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let shebang = syntastic#util#parseShebang()
|
let shebang = syntastic#util#parseShebang(buf)
|
||||||
if shebang['exe'] ==# 'escript'
|
if shebang['exe'] ==# 'escript'
|
||||||
let args = '-s'
|
let args = '-s'
|
||||||
let post_args = ''
|
let post_args = ''
|
||||||
|
@ -39,7 +41,7 @@ function! SyntaxCheckers_erlang_escript_GetLocList() dict
|
||||||
endif
|
endif
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args_after': args,
|
\ 'args_after': args,
|
||||||
\ 'fname': syntastic#util#shexpand('%:p'),
|
\ 'fname': syntastic#util#shexpand(fnamemodify(bufname(buf), ':p')),
|
||||||
\ 'post_args_after': post_args })
|
\ 'post_args_after': post_args })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
|
|
|
@ -31,7 +31,8 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
|
||||||
let s:ruby_new = syntastic#util#versionIsAtLeast(self.getVersion(), [1, 9])
|
let s:ruby_new = syntastic#util#versionIsAtLeast(self.getVersion(), [1, 9])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let fname = "'" . escape(expand('%', 1), "\\'") . "'"
|
let buf = bufnr('')
|
||||||
|
let fname = "'" . escape(bufname(buf), "\\'") . "'"
|
||||||
|
|
||||||
" TODO: encodings became useful in ruby 1.9 :)
|
" TODO: encodings became useful in ruby 1.9 :)
|
||||||
if s:ruby_new
|
if s:ruby_new
|
||||||
|
@ -69,7 +70,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
|
||||||
\ 'makeprg': makeprg,
|
\ 'makeprg': makeprg,
|
||||||
\ 'errorformat': errorformat,
|
\ 'errorformat': errorformat,
|
||||||
\ 'env': env,
|
\ 'env': env,
|
||||||
\ 'defaults': { 'bufnr': bufnr(''), 'vcol': 1 } })
|
\ 'defaults': { 'bufnr': buf, 'vcol': 1 } })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||||
|
|
|
@ -28,8 +28,9 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_glsl_cgc_GetLocList() dict " {{{1
|
function! SyntaxCheckers_glsl_cgc_GetLocList() dict " {{{1
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args_before': '-oglsl -profile ' . s:GetProfile(),
|
\ 'args_before': '-oglsl -profile ' . s:GetProfile(buf),
|
||||||
\ 'args': (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') })
|
\ 'args': (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
|
@ -43,27 +44,11 @@ endfunction " }}}1
|
||||||
|
|
||||||
" Utilities {{{1
|
" Utilities {{{1
|
||||||
|
|
||||||
function! s:GetProfile() " {{{2
|
function! s:GetProfile(buf) " {{{2
|
||||||
let save_view = winsaveview()
|
let profile = matchstr(get(filter(getbufline(a:buf, 1, 100), 'v:val =~# "\\m\\C^//\\s*profile:"'), 0, ''), '\m\C^//\s*profile:\s*\zs.*')
|
||||||
let old_foldenable = &foldenable
|
if profile ==# ''
|
||||||
let old_lazyredraw = &lazyredraw
|
let extensions = syntastic#util#bufVar(a:buf, 'glsl_extensions', s:glsl_extensions)
|
||||||
|
let profile = get(extensions, tolower(fnamemodify(bufname(a:buf), ':e')), 'gpu_vert')
|
||||||
let &lazyredraw = 1
|
|
||||||
let &foldenable = 0
|
|
||||||
call cursor(1, 1)
|
|
||||||
|
|
||||||
let magic = '\m\C^// profile:\s*'
|
|
||||||
let line = search(magic, 'c')
|
|
||||||
|
|
||||||
call winrestview(save_view)
|
|
||||||
let &foldenable = old_foldenable
|
|
||||||
let &lazyredraw = old_lazyredraw
|
|
||||||
|
|
||||||
if line
|
|
||||||
let profile = matchstr(getline(line), magic . '\zs.*')
|
|
||||||
else
|
|
||||||
let extensions = exists('g:syntastic_glsl_extensions') ? g:syntastic_glsl_extensions : s:glsl_extensions
|
|
||||||
let profile = get(extensions, tolower(expand('%:e', 1)), 'gpu_vert')
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return profile
|
return profile
|
||||||
|
|
|
@ -30,6 +30,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
||||||
if !exists('s:go_new')
|
if !exists('s:go_new')
|
||||||
let s:go_new = syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [1, 5])
|
let s:go_new = syntastic#util#versionIsAtLeast(self.getVersion(self.getExecEscaped() . ' version'), [1, 5])
|
||||||
endif
|
endif
|
||||||
|
let buf = bufnr('')
|
||||||
|
|
||||||
" Check with gofmt first, since `go build` and `go test` might not report
|
" Check with gofmt first, since `go build` and `go test` might not report
|
||||||
" syntax errors in the current file if another file with syntax error is
|
" syntax errors in the current file if another file with syntax error is
|
||||||
|
@ -53,14 +54,14 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
||||||
|
|
||||||
" Test files, i.e. files with a name ending in `_test.go`, are not
|
" Test files, i.e. files with a name ending in `_test.go`, are not
|
||||||
" compiled by `go build`, therefore `go test` must be called for those.
|
" compiled by `go build`, therefore `go test` must be called for those.
|
||||||
if match(expand('%', 1), '\m_test\.go$') == -1
|
if bufname(buf) =~# '\m_test\.go$'
|
||||||
let cmd = 'build'
|
|
||||||
let opts = syntastic#util#var('go_go_build_args', s:go_new ? '-buildmode=archive' : '')
|
|
||||||
let cleanup = 0
|
|
||||||
else
|
|
||||||
let cmd = 'test -c'
|
let cmd = 'test -c'
|
||||||
let opts = syntastic#util#var('go_go_test_args', s:go_new ? '-buildmode=archive' : '')
|
let opts = syntastic#util#bufVar(buf, 'go_go_test_args', s:go_new ? '-buildmode=archive' : '')
|
||||||
let cleanup = 1
|
let cleanup = 1
|
||||||
|
else
|
||||||
|
let cmd = 'build'
|
||||||
|
let opts = syntastic#util#bufVar(buf, 'go_go_build_args', s:go_new ? '-buildmode=archive' : '')
|
||||||
|
let cleanup = 0
|
||||||
endif
|
endif
|
||||||
let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts
|
let opt_str = (type(opts) != type('') || opts !=# '') ? join(syntastic#util#argsescape(opts)) : opts
|
||||||
let makeprg = self.getExecEscaped() . ' ' . cmd . ' ' . opt_str
|
let makeprg = self.getExecEscaped() . ' ' . cmd . ' ' . opt_str
|
||||||
|
@ -82,12 +83,12 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
||||||
let errors = SyntasticMake({
|
let errors = SyntasticMake({
|
||||||
\ 'makeprg': makeprg,
|
\ 'makeprg': makeprg,
|
||||||
\ 'errorformat': errorformat,
|
\ 'errorformat': errorformat,
|
||||||
\ 'cwd': expand('%:p:h', 1),
|
\ 'cwd': fnamemodify(bufname(buf), ':p:h'),
|
||||||
\ 'env': {'GOGC': 'off'},
|
\ 'env': {'GOGC': 'off'},
|
||||||
\ 'defaults': {'type': 'e'} })
|
\ 'defaults': {'type': 'e'} })
|
||||||
|
|
||||||
if cleanup
|
if cleanup
|
||||||
call delete(expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:p:h:t', 1) . '.test')
|
call delete(fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . fnamemodify(bufname(buf), ':p:h') . '.test')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return errors
|
return errors
|
||||||
|
|
|
@ -19,9 +19,10 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_go_gometalinter_GetLocList() dict
|
function! SyntaxCheckers_go_gometalinter_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args': '-t',
|
\ 'args': '-t',
|
||||||
\ 'fname': syntastic#util#shexpand('%:p:h') })
|
\ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p:h')) })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%f:%l:%c:%trror: %m,' .
|
\ '%f:%l:%c:%trror: %m,' .
|
||||||
|
|
|
@ -19,8 +19,9 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_go_gotype_GetLocList() dict
|
function! SyntaxCheckers_go_gotype_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args': (expand('%', 1) =~# '\m_test\.go$' ? '-a' : ''),
|
\ 'args': (bufname(buf) =~# '\m_test\.go$' ? '-a' : ''),
|
||||||
\ 'fname': '.' })
|
\ 'fname': '.' })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
|
@ -34,7 +35,7 @@ function! SyntaxCheckers_go_gotype_GetLocList() dict
|
||||||
return SyntasticMake({
|
return SyntasticMake({
|
||||||
\ 'makeprg': makeprg,
|
\ 'makeprg': makeprg,
|
||||||
\ 'errorformat': errorformat,
|
\ 'errorformat': errorformat,
|
||||||
\ 'cwd': expand('%:p:h', 1),
|
\ 'cwd': fnamemodify(bufname(buf), ':p:h'),
|
||||||
\ 'defaults': {'type': 'e'} })
|
\ 'defaults': {'type': 'e'} })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_go_govet_GetLocList() dict
|
function! SyntaxCheckers_go_govet_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.getExecEscaped() . ' vet'
|
let makeprg = self.getExecEscaped() . ' vet'
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
|
@ -33,7 +34,7 @@ function! SyntaxCheckers_go_govet_GetLocList() dict
|
||||||
return SyntasticMake({
|
return SyntasticMake({
|
||||||
\ 'makeprg': makeprg,
|
\ 'makeprg': makeprg,
|
||||||
\ 'errorformat': errorformat,
|
\ 'errorformat': errorformat,
|
||||||
\ 'cwd': expand('%:p:h', 1),
|
\ 'cwd': fnamemodify(bufname(buf), ':p:h'),
|
||||||
\ 'defaults': {'type': 'w'} })
|
\ 'defaults': {'type': 'w'} })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,10 @@ function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict
|
||||||
let g:syntastic_haskell_hdevtools_args = g:hdevtools_options
|
let g:syntastic_haskell_hdevtools_args = g:hdevtools_options
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'exe_after': 'check',
|
\ 'exe_after': 'check',
|
||||||
\ 'fname': syntastic#util#shexpand('%:p') })
|
\ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%-Z %#,'.
|
\ '%-Z %#,'.
|
||||||
|
|
|
@ -14,8 +14,9 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_haskell_hlint_GetLocList() dict
|
function! SyntaxCheckers_haskell_hlint_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'fname': syntastic#util#shexpand('%:p')})
|
\ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%E%f:%l:%v: Error while reading hint file\, %m,' .
|
\ '%E%f:%l:%v: Error while reading hint file\, %m,' .
|
||||||
|
|
|
@ -19,12 +19,10 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_haxe_haxe_GetLocList() dict
|
function! SyntaxCheckers_haxe_haxe_GetLocList() dict
|
||||||
if exists('b:vaxe_hxml')
|
let buf = bufnr('')
|
||||||
let hxml = b:vaxe_hxml
|
let hxml = syntastic#util#bufRawVar(buf, 'vaxe_hxml')
|
||||||
elseif exists('g:vaxe_hxml')
|
if hxml ==# ''
|
||||||
let hxml = g:vaxe_hxml
|
let hxml = syntastic#util#findGlobInParent('*.hxml', fnamemodify(bufname(buf), ':p:h'))
|
||||||
else
|
|
||||||
let hxml = syntastic#util#findGlobInParent('*.hxml', expand('%:p:h', 1))
|
|
||||||
endif
|
endif
|
||||||
let hxml = fnamemodify(hxml, ':p')
|
let hxml = fnamemodify(hxml, ':p')
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_html_validator_GetLocList() dict
|
function! SyntaxCheckers_html_validator_GetLocList() dict
|
||||||
let fname = syntastic#util#shexpand('%')
|
let buf = bufnr('')
|
||||||
|
let fname = syntastic#util#shescape(fnamemodify(bufname(buf), ':p'))
|
||||||
let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' .
|
let makeprg = self.getExecEscaped() . ' -q -L -s --compressed -F out=gnu -F asciiquotes=yes' .
|
||||||
\ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
|
\ (g:syntastic_html_validator_parser !=# '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
|
||||||
\ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
|
\ (g:syntastic_html_validator_nsfilter !=# '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
|
||||||
|
|
|
@ -23,8 +23,9 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_html_w3_GetLocList() dict
|
function! SyntaxCheckers_html_w3_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.getExecEscaped() . ' -q -L -s -F output=json ' .
|
let makeprg = self.getExecEscaped() . ' -q -L -s -F output=json ' .
|
||||||
\ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' .
|
\ '-F uploaded_file=@' . syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) . '\;type=text/html ' .
|
||||||
\ g:syntastic_html_w3_api
|
\ g:syntastic_html_w3_api
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
|
|
|
@ -40,6 +40,8 @@ endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_java_checkstyle_GetLocList() dict
|
function! SyntaxCheckers_java_checkstyle_GetLocList() dict
|
||||||
|
|
||||||
|
let buf = bufnr('')
|
||||||
|
|
||||||
" classpath
|
" classpath
|
||||||
if !exists('s:sep')
|
if !exists('s:sep')
|
||||||
let s:sep = syntastic#util#isRunningWindows() || has('win32unix') ? ';' : ':'
|
let s:sep = syntastic#util#isRunningWindows() || has('win32unix') ? ';' : ':'
|
||||||
|
@ -58,7 +60,7 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() dict
|
||||||
\ '-f', 'xml' ])
|
\ '-f', 'xml' ])
|
||||||
|
|
||||||
" filename
|
" filename
|
||||||
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
|
let fname = syntastic#util#shescape( fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . fnamemodify(bufname(buf), ':t') )
|
||||||
if has('win32unix')
|
if has('win32unix')
|
||||||
let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g')
|
let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g')
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -223,7 +223,7 @@ endfunction " }}}2
|
||||||
function! s:SaveClasspath() " {{{2
|
function! s:SaveClasspath() " {{{2
|
||||||
" build classpath from lines
|
" build classpath from lines
|
||||||
let path = ''
|
let path = ''
|
||||||
let lines = getline(1, line('$'))
|
let lines = getline(1, '$')
|
||||||
for l in lines
|
for l in lines
|
||||||
let path = s:AddToClasspath(path, l)
|
let path = s:AddToClasspath(path, l)
|
||||||
endfor
|
endfor
|
||||||
|
@ -281,7 +281,7 @@ endfunction " }}}2
|
||||||
|
|
||||||
function! s:SaveConfig() " {{{2
|
function! s:SaveConfig() " {{{2
|
||||||
" get lines
|
" get lines
|
||||||
let lines = getline(1, line('$'))
|
let lines = getline(1, '$')
|
||||||
if g:syntastic_java_javac_config_file_enabled
|
if g:syntastic_java_javac_config_file_enabled
|
||||||
" save config file lines
|
" save config file lines
|
||||||
call writefile(lines, expand(g:syntastic_java_javac_config_file, 1))
|
call writefile(lines, expand(g:syntastic_java_javac_config_file, 1))
|
||||||
|
|
|
@ -42,11 +42,12 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict
|
||||||
call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args')
|
call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args')
|
||||||
call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list')
|
call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list')
|
||||||
|
|
||||||
let flist = expand(get(g:, 'syntastic_javascript_closurecompiler_file_list', ''), 1)
|
let buf = bufnr('')
|
||||||
|
let flist = expand(syntastic#util#bufVar(buf, 'javascript_closurecompiler_file_list'), 1)
|
||||||
if filereadable(flist)
|
if filereadable(flist)
|
||||||
let file_list = map( readfile(flist), 'expand(v:var, 1)' )
|
let file_list = map( readfile(flist), 'expand(v:var, 1)' )
|
||||||
else
|
else
|
||||||
let file_list = [expand('%', 1)]
|
let file_list = [bufname(buf)]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
|
|
|
@ -29,7 +29,8 @@ function! SyntaxCheckers_javascript_flow_IsAvailable() dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_javascript_flow_GetLocList() dict
|
function! SyntaxCheckers_javascript_flow_GetLocList() dict
|
||||||
if syntastic#util#findFileInParent('.flowconfig', expand('%:p:h', 1)) ==# ''
|
let buf = bufnr('')
|
||||||
|
if syntastic#util#findFileInParent('.flowconfig', fnamemodify(bufname(buf), ':p:h')) ==# ''
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_limbo_limbo_GetLocList() dict
|
function! SyntaxCheckers_limbo_limbo_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let include = $INFERNO_HOME !=# '' ? '-I$INFERNO_HOME ' : ''
|
let include = $INFERNO_HOME !=# '' ? '-I$INFERNO_HOME ' : ''
|
||||||
" don't generate .dis in current dir while checking syntax,
|
" don't generate .dis in current dir while checking syntax,
|
||||||
" .dis should be generated by `mk`
|
" .dis should be generated by `mk`
|
||||||
|
@ -27,7 +28,7 @@ function! SyntaxCheckers_limbo_limbo_GetLocList() dict
|
||||||
let makeprg = self.makeprgBuild({ 'args_before': include . '-w' . output })
|
let makeprg = self.makeprgBuild({ 'args_before': include . '-w' . output })
|
||||||
|
|
||||||
let errorformat = '%E%f:%l:%m'
|
let errorformat = '%E%f:%l:%m'
|
||||||
if expand('%', 1) =~# '\m\.m$'
|
if bufname(buf) =~# '\m\.m$'
|
||||||
let errorformat = '%-G%f:%l: near ` EOF ` : no implementation module,' . errorformat
|
let errorformat = '%-G%f:%l: near ` EOF ` : no implementation module,' . errorformat
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,10 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_nasm_nasm_GetLocList() dict
|
function! SyntaxCheckers_nasm_nasm_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args_after': '-X gnu' .
|
\ 'args_after': '-X gnu' .
|
||||||
\ ' -I ' . syntastic#util#shescape(expand('%:p:h', 1) . syntastic#util#Slash()) .
|
\ ' -I ' . syntastic#util#shescape(fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash()) .
|
||||||
\ ' ' . syntastic#c#NullOutput() })
|
\ ' ' . syntastic#c#NullOutput() })
|
||||||
|
|
||||||
let errorformat = '%f:%l: %t%*[^:]: %m'
|
let errorformat = '%f:%l: %t%*[^:]: %m'
|
||||||
|
|
|
@ -44,7 +44,8 @@ function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict " {{{1
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1
|
function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1
|
||||||
let makeprg = s:GetMakeprg()
|
let buf = bufnr('')
|
||||||
|
let makeprg = s:GetMakeprg(buf)
|
||||||
if makeprg ==# ''
|
if makeprg ==# ''
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
|
@ -65,7 +66,7 @@ function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict " {{{1
|
||||||
let loclist = SyntasticMake({
|
let loclist = SyntasticMake({
|
||||||
\ 'makeprg': makeprg,
|
\ 'makeprg': makeprg,
|
||||||
\ 'errorformat': errorformat,
|
\ 'errorformat': errorformat,
|
||||||
\ 'defaults': {'bufnr': bufnr('')} })
|
\ 'defaults': {'bufnr': buf} })
|
||||||
|
|
||||||
for e in loclist
|
for e in loclist
|
||||||
if get(e, 'col', 0) && get(e, 'nr', 0)
|
if get(e, 'col', 0) && get(e, 'nr', 0)
|
||||||
|
@ -79,40 +80,41 @@ endfunction " }}}1
|
||||||
|
|
||||||
" Utilities {{{1
|
" Utilities {{{1
|
||||||
|
|
||||||
function! s:GetMakeprg() " {{{2
|
function! s:GetMakeprg(buf) " {{{2
|
||||||
return
|
return
|
||||||
\ g:syntastic_ocaml_use_ocamlc ? g:syntastic_ocaml_use_ocamlc :
|
\ g:syntastic_ocaml_use_ocamlc ? g:syntastic_ocaml_use_ocamlc :
|
||||||
\ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg() :
|
\ (g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build')) ? s:GetOcamlcMakeprg(a:buf) :
|
||||||
\ s:GetOtherMakeprg()
|
\ s:GetOtherMakeprg(a:buf)
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
function! s:GetOcamlcMakeprg() " {{{2
|
function! s:GetOcamlcMakeprg(buf) " {{{2
|
||||||
let build_cmd = g:syntastic_ocaml_use_janestreet_core ?
|
let build_cmd = g:syntastic_ocaml_use_janestreet_core ?
|
||||||
\ 'ocamlc -I ' . syntastic#util#shexpand(g:syntastic_ocaml_janestreet_core_dir) : 'ocamlc'
|
\ 'ocamlc -I ' . syntastic#util#shexpand(g:syntastic_ocaml_janestreet_core_dir) : 'ocamlc'
|
||||||
let build_cmd .= ' -c ' . syntastic#util#shexpand('%')
|
let build_cmd .= ' -c ' . syntastic#util#shescape(bufname(a:buf))
|
||||||
return build_cmd
|
return build_cmd
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
function! s:GetOcamlBuildMakeprg() " {{{2
|
function! s:GetOcamlBuildMakeprg(buf) " {{{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(fnamemodify(bufname(a:buf), ':r')) . '.cmi'
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
function! s:GetOtherMakeprg() " {{{2
|
function! s:GetOtherMakeprg(buf) " {{{2
|
||||||
"TODO: give this function a better name?
|
"TODO: give this function a better name?
|
||||||
"
|
"
|
||||||
"TODO: should use throw/catch instead of returning an empty makeprg
|
"TODO: should use throw/catch instead of returning an empty makeprg
|
||||||
|
|
||||||
let extension = expand('%:e', 1)
|
let fname = bufname(a:buf)
|
||||||
|
let extension = fnamemodify(fname, ':e')
|
||||||
let makeprg = ''
|
let makeprg = ''
|
||||||
|
|
||||||
if stridx(extension, 'mly') >= 0 && executable('menhir')
|
if stridx(extension, 'mly') >= 0 && executable('menhir')
|
||||||
" ocamlyacc output can't be redirected, so use menhir
|
" ocamlyacc output can't be redirected, so use menhir
|
||||||
let makeprg = 'menhir --only-preprocess ' . syntastic#util#shexpand('%') . ' >' . syntastic#util#DevNull()
|
let makeprg = 'menhir --only-preprocess ' . syntastic#util#shescape(fname) . ' >' . syntastic#util#DevNull()
|
||||||
elseif stridx(extension,'mll') >= 0 && executable('ocamllex')
|
elseif stridx(extension,'mll') >= 0 && executable('ocamllex')
|
||||||
let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%')
|
let makeprg = 'ocamllex -q ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname)
|
||||||
else
|
else
|
||||||
let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shexpand('%')
|
let makeprg = 'camlp4o ' . syntastic#c#NullOutput() . ' ' . syntastic#util#shescape(fname)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return makeprg
|
return makeprg
|
||||||
|
|
|
@ -51,13 +51,14 @@ function! SyntaxCheckers_perl_perl_IsAvailable() dict " {{{1
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! SyntaxCheckers_perl_perl_GetLocList() dict " {{{1
|
function! SyntaxCheckers_perl_perl_GetLocList() dict " {{{1
|
||||||
|
let buf = bufnr('')
|
||||||
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, ',')
|
||||||
else
|
else
|
||||||
let includes = copy(syntastic#util#var('perl_lib_path', []))
|
let includes = copy(syntastic#util#bufVar(buf, 'perl_lib_path', []))
|
||||||
endif
|
endif
|
||||||
let shebang = syntastic#util#parseShebang()
|
let shebang = syntastic#util#parseShebang(buf)
|
||||||
let extra = map(includes, '"-I" . v:val') +
|
let extra = map(includes, '"-I" . v:val') +
|
||||||
\ (index(shebang['args'], '-T') >= 0 ? ['-T'] : []) +
|
\ (index(shebang['args'], '-T') >= 0 ? ['-T'] : []) +
|
||||||
\ (index(shebang['args'], '-t') >= 0 ? ['-t'] : [])
|
\ (index(shebang['args'], '-t') >= 0 ? ['-t'] : [])
|
||||||
|
|
|
@ -43,11 +43,13 @@ function! SyntaxCheckers_r_lint_IsAvailable() dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_r_lint_GetLocList() dict
|
function! SyntaxCheckers_r_lint_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
|
|
||||||
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
|
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
|
||||||
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
|
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
|
||||||
\ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' .
|
\ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' .
|
||||||
\ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') .
|
\ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') .
|
||||||
\ ' --args ' . syntastic#util#shexpand('%')
|
\ ' --args ' . syntastic#util#shescape(bufname(buf))
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%t:%f:%l:%v: %m,' .
|
\ '%t:%f:%l:%v: %m,' .
|
||||||
|
|
|
@ -38,7 +38,7 @@ set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_r_lintr_GetHighlightRegex(item)
|
function! SyntaxCheckers_r_lintr_GetHighlightRegex(item)
|
||||||
let term = matchstr(a:item['text'], "\\m'\\zs[^']\\+\\ze'")
|
let term = matchstr(a:item['text'], "\\m'\\zs[^']\\+\\ze'")
|
||||||
return term != '' ? '\V' . escape(term, '\') : ''
|
return term !=# '' ? '\V' . escape(term, '\') : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_r_lintr_IsAvailable() dict
|
function! SyntaxCheckers_r_lintr_IsAvailable() dict
|
||||||
|
@ -50,11 +50,13 @@ function! SyntaxCheckers_r_lintr_IsAvailable() dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_r_lintr_GetLocList() dict
|
function! SyntaxCheckers_r_lintr_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
|
|
||||||
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
|
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
|
||||||
let makeprg = self.getExecEscaped() . ' --slave --no-restore --no-save' .
|
let makeprg = self.getExecEscaped() . ' --slave --no-restore --no-save' .
|
||||||
\ ' -e ' . syntastic#util#shescape(setwd . 'suppressPackageStartupMessages(library(lintr)); ' .
|
\ ' -e ' . syntastic#util#shescape(setwd . 'suppressPackageStartupMessages(library(lintr)); ' .
|
||||||
\ 'lint(cache = ' . g:syntastic_r_lintr_cache . ', commandArgs(TRUE), ' . g:syntastic_r_lintr_linters . ')') .
|
\ 'lint(cache = ' . g:syntastic_r_lintr_cache . ', commandArgs(TRUE), ' . g:syntastic_r_lintr_linters . ')') .
|
||||||
\ ' --args ' . syntastic#util#shexpand('%')
|
\ ' --args ' . syntastic#util#shescape(bufname(buf))
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%W%f:%l:%c: style: %m,' .
|
\ '%W%f:%l:%c: style: %m,' .
|
||||||
|
|
|
@ -46,11 +46,13 @@ function! SyntaxCheckers_r_svtools_IsAvailable() dict
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_r_svtools_GetLocList() dict
|
function! SyntaxCheckers_r_svtools_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
|
|
||||||
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
|
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
|
||||||
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
|
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
|
||||||
\ ' -e ' . syntastic#util#shescape(setwd . 'library(svTools); ' .
|
\ ' -e ' . syntastic#util#shescape(setwd . 'library(svTools); ' .
|
||||||
\ 'try(lint(commandArgs(TRUE), filename = commandArgs(TRUE), type = "flat", sep = ":"))') .
|
\ 'try(lint(commandArgs(TRUE), filename = commandArgs(TRUE), type = "flat", sep = ":"))') .
|
||||||
\ ' --args ' . syntastic#util#shexpand('%')
|
\ ' --args ' . syntastic#util#shescape(bufname(buf))
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%trror:%f:%\s%#%l:%\s%#%v:%m,' .
|
\ '%trror:%f:%\s%#%l:%\s%#%v:%m,' .
|
||||||
|
|
|
@ -26,11 +26,12 @@ augroup syntastic
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
function! SyntaxCheckers_rst_sphinx_GetLocList() dict
|
function! SyntaxCheckers_rst_sphinx_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
|
|
||||||
let srcdir = syntastic#util#var('rst_sphinx_source_dir')
|
let srcdir = syntastic#util#bufVar(buf, 'rst_sphinx_source_dir')
|
||||||
call self.log('g:syntastic_rst_sphinx_source_dir =', srcdir)
|
call self.log('syntastic_rst_sphinx_source_dir =', srcdir)
|
||||||
if srcdir ==# ''
|
if srcdir ==# ''
|
||||||
let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1))
|
let config = syntastic#util#findFileInParent('conf.py', fnamemodify(bufname(buf), ':p:h'))
|
||||||
if config ==# '' || !filereadable(config)
|
if config ==# '' || !filereadable(config)
|
||||||
call self.log('conf.py file not found')
|
call self.log('conf.py file not found')
|
||||||
return []
|
return []
|
||||||
|
@ -38,10 +39,10 @@ function! SyntaxCheckers_rst_sphinx_GetLocList() dict
|
||||||
let srcdir = fnamemodify(config, ':p:h')
|
let srcdir = fnamemodify(config, ':p:h')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let confdir = syntastic#util#var('rst_sphinx_config_dir')
|
let confdir = syntastic#util#bufVar(buf, 'rst_sphinx_config_dir')
|
||||||
call self.log('g:syntastic_rst_sphinx_config_dir =', confdir)
|
call self.log('syntastic_rst_sphinx_config_dir =', confdir)
|
||||||
if confdir ==# ''
|
if confdir ==# ''
|
||||||
let config = syntastic#util#findFileInParent('conf.py', expand('%:p:h', 1))
|
let config = syntastic#util#findFileInParent('conf.py', fnamemodify(bufname(buf), ':p:h'))
|
||||||
let confdir = (config !=# '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir
|
let confdir = (config !=# '' && filereadable(config)) ? fnamemodify(config, ':p:h') : srcdir
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ if exists('g:loaded_syntastic_sass_sass_checker')
|
||||||
endif
|
endif
|
||||||
let g:loaded_syntastic_sass_sass_checker = 1
|
let g:loaded_syntastic_sass_sass_checker = 1
|
||||||
|
|
||||||
"sass caching for large files drastically speeds up the checking, but store it
|
" sass caching for large files drastically speeds up the checking, but store it
|
||||||
"in a temp location otherwise sass puts .sass_cache dirs in the users project
|
" in a temp location otherwise sass puts .sass_cache dirs in the users project
|
||||||
let s:sass_cache_location = syntastic#util#tmpdir()
|
let s:sass_cache_location = syntastic#util#tmpdir()
|
||||||
lockvar s:sass_cache_location
|
lockvar s:sass_cache_location
|
||||||
|
|
||||||
|
@ -24,12 +24,12 @@ augroup syntastic
|
||||||
autocmd VimLeave * call syntastic#util#rmrf(s:sass_cache_location)
|
autocmd VimLeave * call syntastic#util#rmrf(s:sass_cache_location)
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
"By default do not check partials as unknown variables are a syntax error
|
" By default do not check partials as unknown variables are a syntax error
|
||||||
if !exists('g:syntastic_sass_check_partials')
|
if !exists('g:syntastic_sass_check_partials')
|
||||||
let g:syntastic_sass_check_partials = 0
|
let g:syntastic_sass_check_partials = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"use compass imports if available
|
" use compass imports if available
|
||||||
let s:imports = ''
|
let s:imports = ''
|
||||||
if executable('compass')
|
if executable('compass')
|
||||||
let s:imports = '--compass'
|
let s:imports = '--compass'
|
||||||
|
@ -39,7 +39,8 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_sass_sass_GetLocList() dict
|
function! SyntaxCheckers_sass_sass_GetLocList() dict
|
||||||
if !g:syntastic_sass_check_partials && expand('%:t', 1)[0] ==# '_'
|
let buf = bufnr('')
|
||||||
|
if !syntastic#util#bufVar(buf, 'sass_check_partials') && fnamemodify(bufname(buf), ':t')[0] ==# '_'
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,10 @@ function! SyntaxCheckers_scala_fsc_GetLocList() dict
|
||||||
" fsc has some serious problems with the
|
" fsc has some serious problems with the
|
||||||
" working directory changing after being started
|
" working directory changing after being started
|
||||||
" that's why we better pass an absolute path
|
" that's why we better pass an absolute path
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args': '-Ystop-after:parser',
|
\ 'args': '-Ystop-after:parser',
|
||||||
\ 'fname': syntastic#util#shexpand('%:p') })
|
\ 'fname': syntastic#util#shescape(fnamemodify(bufname(buf), ':p')) })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%E%f:%l: %trror: %m,' .
|
\ '%E%f:%l: %trror: %m,' .
|
||||||
|
|
|
@ -19,21 +19,23 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_sh_sh_IsAvailable() dict " {{{1
|
function! SyntaxCheckers_sh_sh_IsAvailable() dict " {{{1
|
||||||
call self.log('shell =', s:GetShell())
|
let buf = bufnr('')
|
||||||
return s:IsShellValid()
|
call self.log('shell =', s:GetShell(buf))
|
||||||
|
return s:IsShellValid(buf)
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! SyntaxCheckers_sh_sh_GetLocList() dict " {{{1
|
function! SyntaxCheckers_sh_sh_GetLocList() dict " {{{1
|
||||||
if s:GetShell() ==# 'zsh'
|
let buf = bufnr('')
|
||||||
|
if s:GetShell(buf) ==# 'zsh'
|
||||||
return s:ForwardToZshChecker()
|
return s:ForwardToZshChecker()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !s:IsShellValid()
|
if !s:IsShellValid(buf)
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'exe': s:GetShell(),
|
\ 'exe': s:GetShell(buf),
|
||||||
\ 'args_after': '-n' })
|
\ 'args_after': '-n' })
|
||||||
|
|
||||||
let errorformat = '%f: line %l: %m'
|
let errorformat = '%f: line %l: %m'
|
||||||
|
@ -45,29 +47,29 @@ endfunction " }}}1
|
||||||
|
|
||||||
" Utilities {{{1
|
" Utilities {{{1
|
||||||
|
|
||||||
function! s:GetShell() " {{{2
|
function! s:GetShell(buf) " {{{2
|
||||||
if !exists('b:shell') || b:shell ==# ''
|
let shell = syntastic#util#getbufvar(a:buf, 'shell')
|
||||||
let b:shell = ''
|
if shell ==# ''
|
||||||
let shebang = syntastic#util#parseShebang()['exe']
|
let shebang = syntastic#util#parseShebang(a:buf)['exe']
|
||||||
if shebang !=# ''
|
if shebang !=# ''
|
||||||
if shebang[-strlen('bash'):-1] ==# 'bash'
|
if shebang[-strlen('bash'):-1] ==# 'bash'
|
||||||
let b:shell = 'bash'
|
let shell = 'bash'
|
||||||
elseif shebang[-strlen('zsh'):-1] ==# 'zsh'
|
elseif shebang[-strlen('zsh'):-1] ==# 'zsh'
|
||||||
let b:shell = 'zsh'
|
let shell = 'zsh'
|
||||||
elseif shebang[-strlen('sh'):-1] ==# 'sh'
|
elseif shebang[-strlen('sh'):-1] ==# 'sh'
|
||||||
let b:shell = 'sh'
|
let shell = 'sh'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
" try to use env variable in case no shebang could be found
|
" try to use env variable in case no shebang could be found
|
||||||
if b:shell ==# ''
|
if shell ==# ''
|
||||||
let b:shell = fnamemodify($SHELL, ':t')
|
let shell = fnamemodify($SHELL, ':t')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return b:shell
|
return shell
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
function! s:IsShellValid() " {{{2
|
function! s:IsShellValid(buf) " {{{2
|
||||||
let shell = s:GetShell()
|
let shell = s:GetShell(a:buf)
|
||||||
return shell !=# '' && executable(shell)
|
return shell !=# '' && executable(shell)
|
||||||
endfunction " }}}2
|
endfunction " }}}2
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_sh_shellcheck_GetLocList() dict " {{{1
|
function! SyntaxCheckers_sh_shellcheck_GetLocList() dict " {{{1
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args': s:GetShell(),
|
\ 'args': s:GetShell(buf),
|
||||||
\ 'args_after': '-f gcc' })
|
\ 'args_after': '-f gcc' })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
|
@ -38,15 +39,15 @@ endfunction " }}}1
|
||||||
|
|
||||||
" Utilities {{{1
|
" Utilities {{{1
|
||||||
|
|
||||||
function! s:GetShell() " {{{2
|
function! s:GetShell(buf) " {{{2
|
||||||
let sh = ''
|
let sh = ''
|
||||||
|
|
||||||
if syntastic#util#parseShebang()['exe'] ==# ''
|
if syntastic#util#parseShebang(a:buf)['exe'] ==# ''
|
||||||
if syntastic#util#rawVar('is_kornshell', 0) || syntastic#util#rawVar('is_posix', 0)
|
if syntastic#util#bufRawVar(a:buf, 'is_kornshell', 0) || syntastic#util#bufRawVar(a:buf, 'is_posix', 0)
|
||||||
let sh = 'ksh'
|
let sh = 'ksh'
|
||||||
elseif syntastic#util#rawVar('is_bash', 0)
|
elseif syntastic#util#bufRawVar(a:buf, 'is_bash', 0)
|
||||||
let sh = 'bash'
|
let sh = 'bash'
|
||||||
elseif syntastic#util#rawVar('is_sh', 0)
|
elseif syntastic#util#bufRawVar(a:buf, 'is_sh', 0)
|
||||||
let sh = 'sh'
|
let sh = 'sh'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -44,19 +44,17 @@ endfunction " }}}1
|
||||||
" Utilities {{{1
|
" Utilities {{{1
|
||||||
|
|
||||||
function! s:GetValaOpts(buf, name, comment, cmd) " {{{2
|
function! s:GetValaOpts(buf, name, comment, cmd) " {{{2
|
||||||
let var = syntastic#util#var('vala_' . a:name)
|
let var = syntastic#util#bufVar(a:buf, 'vala_' . a:name)
|
||||||
if type(var) == type([])
|
if type(var) == type([])
|
||||||
let opts = map(copy(var), 'syntastic#util#shescape(v:val)')
|
let opts = map(copy(var), 'syntastic#util#shescape(v:val)')
|
||||||
elseif type(var) == type('')
|
elseif type(var) == type('')
|
||||||
if var !=# ''
|
if var !=# ''
|
||||||
let opts = split(var, '\s\+')
|
let opts = split(var, '\m\s\+')
|
||||||
else
|
else
|
||||||
let opts = []
|
let opts = []
|
||||||
for line in filter(getbufline(a:buf, 1, 100), 'v:val =~# ' . string('\m^//\s\+' . a:comment . ':\s*'))
|
for line in filter(getbufline(a:buf, 1, 100), 'v:val =~# ' . string('\m^//\s\+' . a:comment . ':\s*'))
|
||||||
call extend(opts, split( matchstr(line, '\m^//\s\+' . a:comment . ':\s*\zs.*'), '\s\+' ))
|
call extend(opts, split( matchstr(line, '\m^//\s\+' . a:comment . ':\s*\zs.*'), '\m\s\+' ))
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
call map( filter(opts, 'v:val !=# ""'), 'syntastic#util#shescape(v:val)' )
|
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
call syntastic#log#error('syntastic_vala_' . a:name . ' must be either a list, or a string')
|
call syntastic#log#error('syntastic_vala_' . a:name . ' must be either a list, or a string')
|
||||||
|
|
|
@ -44,6 +44,8 @@ function! SyntaxCheckers_vim_vimlint_IsAvailable() dict " {{{1
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1
|
function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1
|
||||||
|
let buf = bufnr('')
|
||||||
|
|
||||||
" EVL102: unused variable v
|
" EVL102: unused variable v
|
||||||
" EVL103: unused argument v
|
" EVL103: unused argument v
|
||||||
" EVL104: variable may not be initialized on some execution path: v
|
" EVL104: variable may not be initialized on some execution path: v
|
||||||
|
@ -67,17 +69,15 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict " {{{1
|
||||||
\ 'EVL204': 3,
|
\ 'EVL204': 3,
|
||||||
\ 'EVL205': 3 }
|
\ 'EVL205': 3 }
|
||||||
|
|
||||||
if exists('g:syntastic_vimlint_options') || exists('b:syntastic_vimlint_options')
|
let opts = syntastic#util#bufVar(buf, 'vimlint_options')
|
||||||
let opts = syntastic#util#var('vimlint_options')
|
if type(opts) == type({})
|
||||||
if type(opts) == type({})
|
let options = filter(copy(opts), 'v:key =~# "\\m^EVL"')
|
||||||
let options = filter(copy(opts), 'v:key =~# "\\m^EVL"')
|
call extend(param, options, 'force')
|
||||||
call extend(param, options, 'force')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call self.log('options =', param)
|
call self.log('options =', param)
|
||||||
|
|
||||||
return vimlint#vimlint(expand('%', 1), param)
|
return vimlint#vimlint(bufname(buf), param)
|
||||||
endfunction " }}}1
|
endfunction " }}}1
|
||||||
|
|
||||||
" Utilities {{{1
|
" Utilities {{{1
|
||||||
|
|
|
@ -18,10 +18,11 @@ let s:save_cpo = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|
||||||
function! SyntaxCheckers_xquery_basex_GetLocList() dict
|
function! SyntaxCheckers_xquery_basex_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args_after': '-z',
|
\ 'args_after': '-z',
|
||||||
\ 'fname_before': '-q',
|
\ 'fname_before': '-q',
|
||||||
\ 'fname': syntastic#util#shescape('inspect:module("' . escape(expand('%:p', 1), '"') . '")') })
|
\ 'fname': syntastic#util#shescape('inspect:module("' . escape(fnamemodify(bufname(buf), ':p'), '"') . '")') })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%f:%l:%c:%t:%n:%m,' .
|
\ '%f:%l:%c:%t:%n:%m,' .
|
||||||
|
|
|
@ -29,13 +29,14 @@ function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict
|
||||||
|
|
||||||
" don't call executable() here, to allow things like
|
" don't call executable() here, to allow things like
|
||||||
" 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() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)'))
|
silent! call syntastic#util#system(self.getExecEscaped() . ' ' . s:Modules(bufnr('')) . ' -e ' . syntastic#util#shescape('exit(0)'))
|
||||||
return v:shell_error == 0
|
return v:shell_error == 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict
|
function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict
|
||||||
|
let buf = bufnr('')
|
||||||
let makeprg = self.makeprgBuild({
|
let makeprg = self.makeprgBuild({
|
||||||
\ 'args_before': s:Modules() . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') })
|
\ 'args_before': s:Modules(buf) . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') })
|
||||||
|
|
||||||
let errorformat =
|
let errorformat =
|
||||||
\ '%EYAML::XS::Load Error: The problem:,' .
|
\ '%EYAML::XS::Load Error: The problem:,' .
|
||||||
|
@ -51,12 +52,13 @@ function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict
|
||||||
\ 'defaults': {'bufnr': bufnr('')} })
|
\ 'defaults': {'bufnr': bufnr('')} })
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function s:Modules()
|
function s:Modules(buf)
|
||||||
if type(g:syntastic_perl_lib_path) == type('')
|
let lib_path = syntastic#util#bufVar(a:buf, 'perl_lib_path')
|
||||||
call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list')
|
if type(lib_path) == type('')
|
||||||
let includes = split(g:syntastic_perl_lib_path, ',')
|
call syntastic#log#oneTimeWarn('variable syntastic_perl_lib_path should be a list')
|
||||||
|
let includes = split(lib_path, ',')
|
||||||
else
|
else
|
||||||
let includes = copy(syntastic#util#var('perl_lib_path'))
|
let includes = copy(lib_path)
|
||||||
endif
|
endif
|
||||||
return join(map(includes, '"-I" . v:val') + ['-MYAML::XS'])
|
return join(map(includes, '"-I" . v:val') + ['-MYAML::XS'])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
All files except:
|
||||||
|
|
||||||
|
ftdetect/vim-literate-coffeescript.vim
|
||||||
|
indent/litcoffee.vim
|
||||||
|
syntax/litcoffee.vim
|
||||||
|
test/test.coffee.md
|
||||||
|
test/test.litcoffee
|
||||||
|
test/test.png
|
||||||
|
|
||||||
|
Issued under WTFPL:
|
||||||
|
|
||||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
Version 2, December 2004
|
Version 2, December 2004
|
||||||
|
|
||||||
|
@ -13,3 +24,31 @@
|
||||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||||
|
|
||||||
|
|
||||||
|
These files issed under this license:
|
||||||
|
|
||||||
|
ftdetect/vim-literate-coffeescript.vim
|
||||||
|
indent/litcoffee.vim
|
||||||
|
syntax/litcoffee.vim
|
||||||
|
test/test.coffee.md
|
||||||
|
test/test.litcoffee
|
||||||
|
test/test.png
|
||||||
|
|
||||||
|
Copyright (c) 2013 Michael Smith
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
|
@ -337,23 +337,15 @@ It behaves very similar to `:make`, described [above](#compile-to-javascript).
|
||||||
|
|
||||||
## Literate CoffeeScript
|
## Literate CoffeeScript
|
||||||
|
|
||||||
Literate CoffeeScript syntax and indent support is provided by
|
Literate CoffeeScript syntax and indent support is now built in! The `Coffee`
|
||||||
[vim-literate-coffeescript]. The `Coffee` commands detect when they're running
|
commands detect when they're running on a litcoffee file and pass the
|
||||||
on a litcoffee file and pass the `--literate` flag to their respective tools,
|
`--literate` flag to their respective tools.
|
||||||
but at this time the commands are not automatically loaded when a litcoffee file
|
|
||||||
is opened.
|
|
||||||
|
|
||||||
[vim-literate-coffeescript]: https://github.com/mintplant/vim-literate-coffeescript
|
Literate CoffeeScript syntax and indent support was written by @mintplant
|
||||||
|
(Michael Smith). A standalone repo
|
||||||
To load them, run
|
[exists](https://github.com/jwhitley/vim-literate-coffeescript), but you'll
|
||||||
|
need to copy the `ftplugin/litcoffee.vim` file or set up an autocmd to get the
|
||||||
runtime ftplugin/coffee.vim
|
`Coffee` commands to be automatically loaded for litcoffee files.
|
||||||
|
|
||||||
while inside a litcoffee buffer. To do this automatically, add
|
|
||||||
|
|
||||||
autocmd FileType litcoffee runtime ftplugin/coffee.vim
|
|
||||||
|
|
||||||
to your vimrc.
|
|
||||||
|
|
||||||
## CoffeeScript in HTML
|
## CoffeeScript in HTML
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
" Language: Literate CoffeeScript
|
||||||
|
" Maintainer: Michael Smith <michael@diglumi.com>
|
||||||
|
" URL: https://github.com/mintplant/vim-literate-coffeescript
|
||||||
|
" License: MIT
|
||||||
|
|
||||||
|
autocmd BufNewFile,BufRead *.litcoffee set filetype=litcoffee
|
||||||
|
autocmd BufNewFile,BufRead *.coffee.md set filetype=litcoffee
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
runtime ftplugin/coffee.vim
|
22
sources_non_forked/vim-coffee-script/indent/litcoffee.vim
Normal file
22
sources_non_forked/vim-coffee-script/indent/litcoffee.vim
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
if exists('b:did_indent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! indent/coffee.vim
|
||||||
|
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
setlocal indentexpr=GetLitCoffeeIndent()
|
||||||
|
|
||||||
|
if exists('*GetLitCoffeeIndent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function GetLitCoffeeIndent()
|
||||||
|
if searchpair('^ \|\t', '', '$', 'bWnm') > 0
|
||||||
|
return GetCoffeeIndent(v:lnum)
|
||||||
|
else
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
|
@ -32,7 +32,7 @@ hi def link coffeeConditional Conditional
|
||||||
syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
|
syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
|
||||||
hi def link coffeeException Exception
|
hi def link coffeeException Exception
|
||||||
|
|
||||||
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\)\>/
|
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\|yield\|debugger\|import\|export\|await\)\>/
|
||||||
\ display
|
\ display
|
||||||
" The `own` keyword is only a keyword after `for`.
|
" The `own` keyword is only a keyword after `for`.
|
||||||
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
|
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
|
||||||
|
|
23
sources_non_forked/vim-coffee-script/syntax/litcoffee.vim
Normal file
23
sources_non_forked/vim-coffee-script/syntax/litcoffee.vim
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
" Language: Literate CoffeeScript
|
||||||
|
" Maintainer: Michael Smith <michael@diglumi.com>
|
||||||
|
" URL: https://github.com/mintplant/vim-literate-coffeescript
|
||||||
|
" License: MIT
|
||||||
|
|
||||||
|
if exists('b:current_syntax') && b:current_syntax == 'litcoffee'
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn include @markdown syntax/markdown.vim
|
||||||
|
syn include @coffee syntax/coffee.vim
|
||||||
|
|
||||||
|
" Partition the file into notCoffee and inlineCoffee. Each line will match
|
||||||
|
" exactly one of these regions. notCoffee matches with a zero-width
|
||||||
|
" look-behind.
|
||||||
|
syn region notCoffee start='^\%( \|\t\)\@<!' end='$' contains=@markdown
|
||||||
|
syn region inlineCoffee start='^ \|\t' end='$' contains=@coffee
|
||||||
|
|
||||||
|
" We defined notCoffee as a region so we can highlight every element in it
|
||||||
|
" that doesn't have it's own explicit rule.
|
||||||
|
highlight default link notCoffee Comment
|
||||||
|
|
||||||
|
let b:current_syntax = "litcoffee"
|
117
sources_non_forked/vim-coffee-script/test/test.coffee.md
Normal file
117
sources_non_forked/vim-coffee-script/test/test.coffee.md
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
The **Scope** class regulates lexical scoping within CoffeeScript. As you
|
||||||
|
generate code, you create a tree of scopes in the same shape as the nested
|
||||||
|
function bodies. Each scope knows about the variables declared within it,
|
||||||
|
and has a reference to its parent enclosing scope. In this way, we know which
|
||||||
|
variables are new and need to be declared with `var`, and which are shared
|
||||||
|
with external scopes.
|
||||||
|
|
||||||
|
Import the helpers we plan to use.
|
||||||
|
|
||||||
|
{extend, last} = require './helpers'
|
||||||
|
|
||||||
|
exports.Scope = class Scope
|
||||||
|
|
||||||
|
The `root` is the top-level **Scope** object for a given file.
|
||||||
|
|
||||||
|
@root: null
|
||||||
|
|
||||||
|
Initialize a scope with its parent, for lookups up the chain,
|
||||||
|
as well as a reference to the **Block** node it belongs to, which is
|
||||||
|
where it should declare its variables, and a reference to the function that
|
||||||
|
it belongs to.
|
||||||
|
|
||||||
|
constructor: (@parent, @expressions, @method) ->
|
||||||
|
@variables = [{name: 'arguments', type: 'arguments'}]
|
||||||
|
@positions = {}
|
||||||
|
Scope.root = this unless @parent
|
||||||
|
|
||||||
|
Adds a new variable or overrides an existing one.
|
||||||
|
|
||||||
|
add: (name, type, immediate) ->
|
||||||
|
return @parent.add name, type, immediate if @shared and not immediate
|
||||||
|
if Object::hasOwnProperty.call @positions, name
|
||||||
|
@variables[@positions[name]].type = type
|
||||||
|
else
|
||||||
|
@positions[name] = @variables.push({name, type}) - 1
|
||||||
|
|
||||||
|
When `super` is called, we need to find the name of the current method we're
|
||||||
|
in, so that we know how to invoke the same method of the parent class. This
|
||||||
|
can get complicated if super is being called from an inner function.
|
||||||
|
`namedMethod` will walk up the scope tree until it either finds the first
|
||||||
|
function object that has a name filled in, or bottoms out.
|
||||||
|
|
||||||
|
namedMethod: ->
|
||||||
|
return @method if @method.name or !@parent
|
||||||
|
@parent.namedMethod()
|
||||||
|
|
||||||
|
Look up a variable name in lexical scope, and declare it if it does not
|
||||||
|
already exist.
|
||||||
|
|
||||||
|
find: (name) ->
|
||||||
|
return yes if @check name
|
||||||
|
@add name, 'var'
|
||||||
|
no
|
||||||
|
|
||||||
|
Reserve a variable name as originating from a function parameter for this
|
||||||
|
scope. No `var` required for internal references.
|
||||||
|
|
||||||
|
parameter: (name) ->
|
||||||
|
return if @shared and @parent.check name, yes
|
||||||
|
@add name, 'param'
|
||||||
|
|
||||||
|
Just check to see if a variable has already been declared, without reserving,
|
||||||
|
walks up to the root scope.
|
||||||
|
|
||||||
|
check: (name) ->
|
||||||
|
!!(@type(name) or @parent?.check(name))
|
||||||
|
|
||||||
|
Generate a temporary variable name at the given index.
|
||||||
|
|
||||||
|
temporary: (name, index) ->
|
||||||
|
if name.length > 1
|
||||||
|
'_' + name + if index > 1 then index - 1 else ''
|
||||||
|
else
|
||||||
|
'_' + (index + parseInt name, 36).toString(36).replace /\d/g, 'a'
|
||||||
|
|
||||||
|
Gets the type of a variable.
|
||||||
|
|
||||||
|
type: (name) ->
|
||||||
|
return v.type for v in @variables when v.name is name
|
||||||
|
null
|
||||||
|
|
||||||
|
If we need to store an intermediate result, find an available name for a
|
||||||
|
compiler-generated variable. `_var`, `_var2`, and so on...
|
||||||
|
|
||||||
|
freeVariable: (name, reserve=true) ->
|
||||||
|
index = 0
|
||||||
|
index++ while @check((temp = @temporary name, index))
|
||||||
|
@add temp, 'var', yes if reserve
|
||||||
|
temp
|
||||||
|
|
||||||
|
Ensure that an assignment is made at the top of this scope
|
||||||
|
(or at the top-level scope, if requested).
|
||||||
|
|
||||||
|
assign: (name, value) ->
|
||||||
|
@add name, {value, assigned: yes}, yes
|
||||||
|
@hasAssignments = yes
|
||||||
|
|
||||||
|
Does this scope have any declared variables?
|
||||||
|
|
||||||
|
hasDeclarations: ->
|
||||||
|
!!@declaredVariables().length
|
||||||
|
|
||||||
|
Return the list of variables first declared in this scope.
|
||||||
|
|
||||||
|
declaredVariables: ->
|
||||||
|
realVars = []
|
||||||
|
tempVars = []
|
||||||
|
for v in @variables when v.type is 'var'
|
||||||
|
(if v.name.charAt(0) is '_' then tempVars else realVars).push v.name
|
||||||
|
realVars.sort().concat tempVars.sort()
|
||||||
|
|
||||||
|
Return the list of assignments that are supposed to be made at the top
|
||||||
|
of this scope.
|
||||||
|
|
||||||
|
assignedVariables: ->
|
||||||
|
"#{v.name} = #{v.type.value}" for v in @variables when v.type.assigned
|
||||||
|
|
117
sources_non_forked/vim-coffee-script/test/test.litcoffee
Normal file
117
sources_non_forked/vim-coffee-script/test/test.litcoffee
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
The **Scope** class regulates lexical scoping within CoffeeScript. As you
|
||||||
|
generate code, you create a tree of scopes in the same shape as the nested
|
||||||
|
function bodies. Each scope knows about the variables declared within it,
|
||||||
|
and has a reference to its parent enclosing scope. In this way, we know which
|
||||||
|
variables are new and need to be declared with `var`, and which are shared
|
||||||
|
with external scopes.
|
||||||
|
|
||||||
|
Import the helpers we plan to use.
|
||||||
|
|
||||||
|
{extend, last} = require './helpers'
|
||||||
|
|
||||||
|
exports.Scope = class Scope
|
||||||
|
|
||||||
|
The `root` is the top-level **Scope** object for a given file.
|
||||||
|
|
||||||
|
@root: null
|
||||||
|
|
||||||
|
Initialize a scope with its parent, for lookups up the chain,
|
||||||
|
as well as a reference to the **Block** node it belongs to, which is
|
||||||
|
where it should declare its variables, and a reference to the function that
|
||||||
|
it belongs to.
|
||||||
|
|
||||||
|
constructor: (@parent, @expressions, @method) ->
|
||||||
|
@variables = [{name: 'arguments', type: 'arguments'}]
|
||||||
|
@positions = {}
|
||||||
|
Scope.root = this unless @parent
|
||||||
|
|
||||||
|
Adds a new variable or overrides an existing one.
|
||||||
|
|
||||||
|
add: (name, type, immediate) ->
|
||||||
|
return @parent.add name, type, immediate if @shared and not immediate
|
||||||
|
if Object::hasOwnProperty.call @positions, name
|
||||||
|
@variables[@positions[name]].type = type
|
||||||
|
else
|
||||||
|
@positions[name] = @variables.push({name, type}) - 1
|
||||||
|
|
||||||
|
When `super` is called, we need to find the name of the current method we're
|
||||||
|
in, so that we know how to invoke the same method of the parent class. This
|
||||||
|
can get complicated if super is being called from an inner function.
|
||||||
|
`namedMethod` will walk up the scope tree until it either finds the first
|
||||||
|
function object that has a name filled in, or bottoms out.
|
||||||
|
|
||||||
|
namedMethod: ->
|
||||||
|
return @method if @method.name or !@parent
|
||||||
|
@parent.namedMethod()
|
||||||
|
|
||||||
|
Look up a variable name in lexical scope, and declare it if it does not
|
||||||
|
already exist.
|
||||||
|
|
||||||
|
find: (name) ->
|
||||||
|
return yes if @check name
|
||||||
|
@add name, 'var'
|
||||||
|
no
|
||||||
|
|
||||||
|
Reserve a variable name as originating from a function parameter for this
|
||||||
|
scope. No `var` required for internal references.
|
||||||
|
|
||||||
|
parameter: (name) ->
|
||||||
|
return if @shared and @parent.check name, yes
|
||||||
|
@add name, 'param'
|
||||||
|
|
||||||
|
Just check to see if a variable has already been declared, without reserving,
|
||||||
|
walks up to the root scope.
|
||||||
|
|
||||||
|
check: (name) ->
|
||||||
|
!!(@type(name) or @parent?.check(name))
|
||||||
|
|
||||||
|
Generate a temporary variable name at the given index.
|
||||||
|
|
||||||
|
temporary: (name, index) ->
|
||||||
|
if name.length > 1
|
||||||
|
'_' + name + if index > 1 then index - 1 else ''
|
||||||
|
else
|
||||||
|
'_' + (index + parseInt name, 36).toString(36).replace /\d/g, 'a'
|
||||||
|
|
||||||
|
Gets the type of a variable.
|
||||||
|
|
||||||
|
type: (name) ->
|
||||||
|
return v.type for v in @variables when v.name is name
|
||||||
|
null
|
||||||
|
|
||||||
|
If we need to store an intermediate result, find an available name for a
|
||||||
|
compiler-generated variable. `_var`, `_var2`, and so on...
|
||||||
|
|
||||||
|
freeVariable: (name, reserve=true) ->
|
||||||
|
index = 0
|
||||||
|
index++ while @check((temp = @temporary name, index))
|
||||||
|
@add temp, 'var', yes if reserve
|
||||||
|
temp
|
||||||
|
|
||||||
|
Ensure that an assignment is made at the top of this scope
|
||||||
|
(or at the top-level scope, if requested).
|
||||||
|
|
||||||
|
assign: (name, value) ->
|
||||||
|
@add name, {value, assigned: yes}, yes
|
||||||
|
@hasAssignments = yes
|
||||||
|
|
||||||
|
Does this scope have any declared variables?
|
||||||
|
|
||||||
|
hasDeclarations: ->
|
||||||
|
!!@declaredVariables().length
|
||||||
|
|
||||||
|
Return the list of variables first declared in this scope.
|
||||||
|
|
||||||
|
declaredVariables: ->
|
||||||
|
realVars = []
|
||||||
|
tempVars = []
|
||||||
|
for v in @variables when v.type is 'var'
|
||||||
|
(if v.name.charAt(0) is '_' then tempVars else realVars).push v.name
|
||||||
|
realVars.sort().concat tempVars.sort()
|
||||||
|
|
||||||
|
Return the list of assignments that are supposed to be made at the top
|
||||||
|
of this scope.
|
||||||
|
|
||||||
|
assignedVariables: ->
|
||||||
|
"#{v.name} = #{v.type.value}" for v in @variables when v.type.assigned
|
||||||
|
|
|
@ -1060,13 +1060,14 @@ function! s:Commit(args, ...) abort
|
||||||
else
|
else
|
||||||
noautocmd silent execute '!'.command.' > '.outfile.' 2> '.errorfile
|
noautocmd silent execute '!'.command.' > '.outfile.' 2> '.errorfile
|
||||||
endif
|
endif
|
||||||
|
let error = v:shell_error
|
||||||
finally
|
finally
|
||||||
execute cd.'`=dir`'
|
execute cd.'`=dir`'
|
||||||
endtry
|
endtry
|
||||||
if !has('gui_running')
|
if !has('gui_running')
|
||||||
redraw!
|
redraw!
|
||||||
endif
|
endif
|
||||||
if !v:shell_error
|
if !error
|
||||||
if filereadable(outfile)
|
if filereadable(outfile)
|
||||||
for line in readfile(outfile)
|
for line in readfile(outfile)
|
||||||
echo line
|
echo line
|
||||||
|
|
|
@ -23,4 +23,3 @@ useful, such as:
|
||||||
* vim version:
|
* vim version:
|
||||||
* vim-go version:
|
* vim-go version:
|
||||||
* go version:
|
* go version:
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,3 @@ install: |
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
script: ./scripts/test.sh
|
script: ./scripts/test.sh
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
FEATURES:
|
FEATURES:
|
||||||
|
|
||||||
|
* New `:GoAddTags` and `:GoRemoveTags` command based on the tool [gomodifytags](https://github.com/fatih/gomodifytags). This fixes many old bugs that were due prior regexp based implementation. For the usage please read the docs and checkout the demo at: https://github.com/fatih/vim-go/pull/1204 [gh-1204]
|
||||||
* Add new `errl` snippet that expands to [gh-1185]:
|
* Add new `errl` snippet that expands to [gh-1185]:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -14,6 +15,10 @@ IMPROVEMENTS:
|
||||||
|
|
||||||
* Lowercase `<Leader>` in mappings examples for consisten documentation across the README [gh-1192]
|
* Lowercase `<Leader>` in mappings examples for consisten documentation across the README [gh-1192]
|
||||||
* All of files should be written in utf-8 if the file will be passed to external command. [gh-1184]
|
* All of files should be written in utf-8 if the file will be passed to external command. [gh-1184]
|
||||||
|
* `:GoAddTags` is now able to add options to existing tags with the syntax `:GoAddTags key,option`, i.e: `:GoAddTags json,omitempty` [gh-985]
|
||||||
|
* Document 'noshowmode' requirement for echo_go_info [gh-1197]
|
||||||
|
* Improve godoc view for vertical splits [gh-1195]
|
||||||
|
* Set GOPATH for both possible go guru execution paths (sync and async) [gh-1193]
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
|
@ -22,6 +27,15 @@ BUG FIXES:
|
||||||
* Update statusline before and after `go#jobcontrol#Spawn` command is executed [gh-1176]
|
* Update statusline before and after `go#jobcontrol#Spawn` command is executed [gh-1176]
|
||||||
* Correctly report the value of the 'g:go_guru_tags' variable [gh-1177]
|
* Correctly report the value of the 'g:go_guru_tags' variable [gh-1177]
|
||||||
* Ensure no trailing `:` exist in GOPATH detection if initial GOPATH is not set [gh-1194]
|
* Ensure no trailing `:` exist in GOPATH detection if initial GOPATH is not set [gh-1194]
|
||||||
|
* Fix `:GoAddTags` to allow modifying existing comments [gh-984]
|
||||||
|
* Fix `:GoAddTags` to work with nested structs [gh-990]
|
||||||
|
* Fix `:GoAddTags` adding tags twice for existing tags [gh-1064]
|
||||||
|
* Fix `:GoAddTags` not working for fiels of types `interface{}` [gh-1091]
|
||||||
|
* Fix `:GoAddTags` not working for fields with one line comments [gh-1181]
|
||||||
|
* Fix `:GoAddTags` not working if any field comment would contain `{}` [gh-1189]
|
||||||
|
* Respect go_fmt_options when running goimports [gh-1211]
|
||||||
|
* Set the filename in the location-list when there is an error with :GoFmt [gh-1199]
|
||||||
|
|
||||||
|
|
||||||
## 1.11 - (January 9, 2017)
|
## 1.11 - (January 9, 2017)
|
||||||
|
|
||||||
|
@ -371,4 +385,3 @@ BACKWARDS INCOMPATIBILITIES:
|
||||||
## Previous releases
|
## Previous releases
|
||||||
|
|
||||||
Previous changelogs can be found here: https://github.com/fatih/vim-go/releases
|
Previous changelogs can be found here: https://github.com/fatih/vim-go/releases
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ function! go#coverage#Buffer(bang, ...) abort
|
||||||
try
|
try
|
||||||
execute cd . fnameescape(expand("%:p:h"))
|
execute cd . fnameescape(expand("%:p:h"))
|
||||||
if empty(glob("*_test.go"))
|
if empty(glob("*_test.go"))
|
||||||
call go#util#EchoError("no tests files available")
|
call go#util#EchoError("no test files available")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -92,13 +92,20 @@ function! s:GodocView(newposition, position, content) abort
|
||||||
execute bufwinnr(s:buf_nr) . 'wincmd w'
|
execute bufwinnr(s:buf_nr) . 'wincmd w'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" cap buffer height to 20, but resize it for smaller contents
|
if a:position == "split"
|
||||||
let max_height = 20
|
" cap buffer height to 20, but resize it for smaller contents
|
||||||
let content_height = len(split(a:content, "\n"))
|
let max_height = 20
|
||||||
if content_height > max_height
|
let content_height = len(split(a:content, "\n"))
|
||||||
exe 'resize ' . max_height
|
if content_height > max_height
|
||||||
|
exe 'resize ' . max_height
|
||||||
|
else
|
||||||
|
exe 'resize ' . content_height
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
exe 'resize ' . content_height
|
" set a sane maximum width for vertical splits. In this case the minimum
|
||||||
|
" that fits the godoc for package http without extra linebreaks and line
|
||||||
|
" numbers on
|
||||||
|
exe 'vertical resize 84'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
setlocal filetype=godoc
|
setlocal filetype=godoc
|
||||||
|
|
|
@ -77,7 +77,7 @@ function! go#fmt#Format(withGoimport) abort
|
||||||
if go#util#ShellError() == 0
|
if go#util#ShellError() == 0
|
||||||
call go#fmt#update_file(l:tmpname, expand('%'))
|
call go#fmt#update_file(l:tmpname, expand('%'))
|
||||||
elseif g:go_fmt_fail_silently == 0
|
elseif g:go_fmt_fail_silently == 0
|
||||||
let errors = s:parse_errors(out)
|
let errors = s:parse_errors(expand('%'), out)
|
||||||
call s:show_errors(errors)
|
call s:show_errors(errors)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -168,10 +168,9 @@ function! s:fmt_cmd(bin_name, source, target)
|
||||||
" start constructing the command
|
" start constructing the command
|
||||||
let cmd = [bin_path]
|
let cmd = [bin_path]
|
||||||
call add(cmd, "-w")
|
call add(cmd, "-w")
|
||||||
|
call extend(cmd, split(g:go_fmt_options, " "))
|
||||||
|
|
||||||
if a:bin_name != "goimports"
|
if a:bin_name == "goimports"
|
||||||
call extend(cmd, split(g:go_fmt_options, " "))
|
|
||||||
else
|
|
||||||
" lazy check if goimports support `-srcdir`. We should eventually remove
|
" lazy check if goimports support `-srcdir`. We should eventually remove
|
||||||
" this in the future
|
" this in the future
|
||||||
if !exists('b:goimports_vendor_compatible')
|
if !exists('b:goimports_vendor_compatible')
|
||||||
|
@ -196,7 +195,7 @@ function! s:fmt_cmd(bin_name, source, target)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" parse_errors parses the given errors and returns a list of parsed errors
|
" parse_errors parses the given errors and returns a list of parsed errors
|
||||||
function! s:parse_errors(content) abort
|
function! s:parse_errors(filename, content) abort
|
||||||
let splitted = split(a:content, '\n')
|
let splitted = split(a:content, '\n')
|
||||||
|
|
||||||
" list of errors to be put into location list
|
" list of errors to be put into location list
|
||||||
|
@ -205,6 +204,7 @@ function! s:parse_errors(content) abort
|
||||||
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
|
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
|
||||||
if !empty(tokens)
|
if !empty(tokens)
|
||||||
call add(errors,{
|
call add(errors,{
|
||||||
|
\"filename": a:filename,
|
||||||
\"lnum": tokens[2],
|
\"lnum": tokens[2],
|
||||||
\"col": tokens[3],
|
\"col": tokens[3],
|
||||||
\"text": tokens[4],
|
\"text": tokens[4],
|
||||||
|
|
|
@ -120,8 +120,6 @@ function! s:sync_guru(args) abort
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let old_gopath = $GOPATH
|
|
||||||
let $GOPATH = go#path#Detect()
|
|
||||||
|
|
||||||
" run, forrest run!!!
|
" run, forrest run!!!
|
||||||
let command = join(result.cmd, " ")
|
let command = join(result.cmd, " ")
|
||||||
|
@ -131,8 +129,6 @@ function! s:sync_guru(args) abort
|
||||||
let out = go#util#System(command)
|
let out = go#util#System(command)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let $GOPATH = old_gopath
|
|
||||||
|
|
||||||
if has_key(a:args, 'custom_parse')
|
if has_key(a:args, 'custom_parse')
|
||||||
call a:args.custom_parse(go#util#ShellError(), out)
|
call a:args.custom_parse(go#util#ShellError(), out)
|
||||||
else
|
else
|
||||||
|
@ -217,11 +213,17 @@ endfunc
|
||||||
|
|
||||||
" run_guru runs the given guru argument
|
" run_guru runs the given guru argument
|
||||||
function! s:run_guru(args) abort
|
function! s:run_guru(args) abort
|
||||||
|
let old_gopath = $GOPATH
|
||||||
|
let $GOPATH = go#path#Detect()
|
||||||
if go#util#has_job()
|
if go#util#has_job()
|
||||||
return s:async_guru(a:args)
|
let res = s:async_guru(a:args)
|
||||||
|
else
|
||||||
|
let res = s:sync_guru(a:args)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return s:sync_guru(a:args)
|
let $GOPATH = old_gopath
|
||||||
|
|
||||||
|
return res
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Show 'implements' relation for selected package
|
" Show 'implements' relation for selected package
|
||||||
|
|
206
sources_non_forked/vim-go/autoload/go/tags.vim
Normal file
206
sources_non_forked/vim-go/autoload/go/tags.vim
Normal file
|
@ -0,0 +1,206 @@
|
||||||
|
function! go#tags#Add(start, end, count, ...) abort
|
||||||
|
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
|
||||||
|
if &modified
|
||||||
|
" Write current unsaved buffer to a temp file and use the modified content
|
||||||
|
let l:tmpname = tempname()
|
||||||
|
call writefile(getline(1, '$'), l:tmpname)
|
||||||
|
let fname = l:tmpname
|
||||||
|
endif
|
||||||
|
|
||||||
|
let offset = 0
|
||||||
|
if a:count == -1
|
||||||
|
let offset = go#util#OffsetCursor()
|
||||||
|
endif
|
||||||
|
|
||||||
|
let test_mode = 0
|
||||||
|
call call("go#tags#run", [a:start, a:end, offset, "add", fname, test_mode] + a:000)
|
||||||
|
|
||||||
|
" if exists, delete it as we don't need it anymore
|
||||||
|
if exists("l:tmpname")
|
||||||
|
call delete(l:tmpname)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! go#tags#Remove(start, end, count, ...) abort
|
||||||
|
let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
|
||||||
|
if &modified
|
||||||
|
" Write current unsaved buffer to a temp file and use the modified content
|
||||||
|
let l:tmpname = tempname()
|
||||||
|
call writefile(getline(1, '$'), l:tmpname)
|
||||||
|
let fname = l:tmpname
|
||||||
|
endif
|
||||||
|
|
||||||
|
let offset = 0
|
||||||
|
if a:count == -1
|
||||||
|
let offset = go#util#OffsetCursor()
|
||||||
|
endif
|
||||||
|
|
||||||
|
let test_mode = 0
|
||||||
|
call call("go#tags#run", [a:start, a:end, offset, "remove", fname, test_mode] + a:000)
|
||||||
|
|
||||||
|
" if exists, delete it as we don't need it anymore
|
||||||
|
if exists("l:tmpname")
|
||||||
|
call delete(l:tmpname)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" run runs gomodifytag. This is an internal test so we can test it
|
||||||
|
function! go#tags#run(start, end, offset, mode, fname, test_mode, ...) abort
|
||||||
|
" do not split this into multiple lines, somehow tests fail in that case
|
||||||
|
let args = {'mode': a:mode,'start': a:start,'end': a:end,'offset': a:offset,'fname': a:fname,'cmd_args': a:000}
|
||||||
|
|
||||||
|
let result = s:create_cmd(args)
|
||||||
|
if has_key(result, 'err')
|
||||||
|
call go#util#EchoError(result.err)
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let command = join(result.cmd, " ")
|
||||||
|
|
||||||
|
call go#cmd#autowrite()
|
||||||
|
let out = go#util#System(command)
|
||||||
|
if go#util#ShellError() != 0
|
||||||
|
call go#util#EchoError(out)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:test_mode
|
||||||
|
exe 'edit ' . a:fname
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:write_out(out)
|
||||||
|
|
||||||
|
if a:test_mode
|
||||||
|
exe 'write! ' . a:fname
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
|
" write_out writes back the given output to the current buffer
|
||||||
|
func s:write_out(out) abort
|
||||||
|
" not a json output
|
||||||
|
if a:out[0] !=# '{'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
" nothing to do
|
||||||
|
if empty(a:out) || type(a:out) != type("")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let result = json_decode(a:out)
|
||||||
|
if type(result) != type({})
|
||||||
|
call go#util#EchoError(printf("malformed output from gomodifytags: %s", a:out))
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let lines = result['lines']
|
||||||
|
let start_line = result['start']
|
||||||
|
let end_line = result['end']
|
||||||
|
|
||||||
|
let index = 0
|
||||||
|
for line in range(start_line, end_line)
|
||||||
|
call setline(line, lines[index])
|
||||||
|
let index += 1
|
||||||
|
endfor
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
|
" create_cmd returns a dict that contains the command to execute gomodifytags
|
||||||
|
func s:create_cmd(args) abort
|
||||||
|
if !exists("*json_decode")
|
||||||
|
return {'err': "requires 'json_decode'. Update your Vim/Neovim version."}
|
||||||
|
endif
|
||||||
|
|
||||||
|
let bin_path = go#path#CheckBinPath('gomodifytags')
|
||||||
|
if empty(bin_path)
|
||||||
|
return {'err': "gomodifytags does not exist"}
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:start = a:args.start
|
||||||
|
let l:end = a:args.end
|
||||||
|
let l:offset = a:args.offset
|
||||||
|
let l:mode = a:args.mode
|
||||||
|
let l:cmd_args = a:args.cmd_args
|
||||||
|
|
||||||
|
" start constructing the command
|
||||||
|
let cmd = [bin_path]
|
||||||
|
call extend(cmd, ["-format", "json"])
|
||||||
|
call extend(cmd, ["-file", a:args.fname])
|
||||||
|
|
||||||
|
if l:offset != 0
|
||||||
|
call extend(cmd, ["-offset", l:offset])
|
||||||
|
else
|
||||||
|
let range = printf("%d,%d", l:start, l:end)
|
||||||
|
call extend(cmd, ["-line", range])
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:mode == "add"
|
||||||
|
let l:tags = []
|
||||||
|
let l:options = []
|
||||||
|
|
||||||
|
if !empty(l:cmd_args)
|
||||||
|
for item in l:cmd_args
|
||||||
|
let splitted = split(item, ",")
|
||||||
|
|
||||||
|
" tag only
|
||||||
|
if len(splitted) == 1
|
||||||
|
call add(l:tags, splitted[0])
|
||||||
|
endif
|
||||||
|
|
||||||
|
" options only
|
||||||
|
if len(splitted) == 2
|
||||||
|
call add(l:tags, splitted[0])
|
||||||
|
call add(l:options, printf("%s=%s", splitted[0], splitted[1]))
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
|
" construct options
|
||||||
|
if !empty(l:options)
|
||||||
|
call extend(cmd, ["-add-options", join(l:options, ",")])
|
||||||
|
else
|
||||||
|
" default value
|
||||||
|
if empty(l:tags)
|
||||||
|
let l:tags = ["json"]
|
||||||
|
endif
|
||||||
|
|
||||||
|
" construct tags
|
||||||
|
call extend(cmd, ["-add-tags", join(l:tags, ",")])
|
||||||
|
endif
|
||||||
|
elseif l:mode == "remove"
|
||||||
|
if empty(l:cmd_args)
|
||||||
|
call add(cmd, "-clear-tags")
|
||||||
|
else
|
||||||
|
let l:tags = []
|
||||||
|
let l:options = []
|
||||||
|
for item in l:cmd_args
|
||||||
|
let splitted = split(item, ",")
|
||||||
|
|
||||||
|
" tag only
|
||||||
|
if len(splitted) == 1
|
||||||
|
call add(l:tags, splitted[0])
|
||||||
|
endif
|
||||||
|
|
||||||
|
" options only
|
||||||
|
if len(splitted) == 2
|
||||||
|
call add(l:options, printf("%s=%s", splitted[0], splitted[1]))
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
" construct tags
|
||||||
|
if !empty(l:tags)
|
||||||
|
call extend(cmd, ["-remove-tags", join(l:tags, ",")])
|
||||||
|
endif
|
||||||
|
|
||||||
|
" construct options
|
||||||
|
if !empty(l:options)
|
||||||
|
call extend(cmd, ["-remove-options", join(l:options, ",")])
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
return {'err': printf("unknown mode: %s", l:mode)}
|
||||||
|
endif
|
||||||
|
|
||||||
|
return {'cmd': cmd}
|
||||||
|
endfunc
|
28
sources_non_forked/vim-go/autoload/go/tags_test.vim
Normal file
28
sources_non_forked/vim-go/autoload/go/tags_test.vim
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
func Test_add_tags()
|
||||||
|
let input_file = tempname()
|
||||||
|
call writefile(readfile("test-fixtures/tags/add_all_input.go"), input_file)
|
||||||
|
|
||||||
|
let expected = join(readfile("test-fixtures/tags/add_all_golden.go"), "\n")
|
||||||
|
|
||||||
|
" run for offset 40, which is inside the struct
|
||||||
|
call go#tags#run(0, 0, 40, "add", input_file, 1)
|
||||||
|
|
||||||
|
let actual = join(readfile(input_file), "\n")
|
||||||
|
|
||||||
|
call assert_equal(expected, actual)
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
|
||||||
|
func Test_remove_tags()
|
||||||
|
let input_file = tempname()
|
||||||
|
call writefile(readfile("test-fixtures/tags/remove_all_input.go"), input_file)
|
||||||
|
|
||||||
|
let expected = join(readfile("test-fixtures/tags/remove_all_golden.go"), "\n")
|
||||||
|
|
||||||
|
" run for offset 40, which is inside the struct
|
||||||
|
call go#tags#run(0, 0, 40, "remove", input_file, 1)
|
||||||
|
|
||||||
|
let actual = join(readfile(input_file), "\n")
|
||||||
|
|
||||||
|
call assert_equal(expected, actual)
|
||||||
|
endfunc
|
|
@ -669,12 +669,13 @@ CTRL-t
|
||||||
:GoImpl T io.ReadWriteCloser
|
:GoImpl T io.ReadWriteCloser
|
||||||
<
|
<
|
||||||
*:GoAddTags*
|
*:GoAddTags*
|
||||||
:[range]GoAddTags [key] [key1] ...
|
:[range]GoAddTags [key],[option] [key1],[option] ...
|
||||||
|
|
||||||
Adds field tags for the fields of a struct. If called inside a struct it
|
Adds field tags for the fields of a struct. If called inside a struct it
|
||||||
automatically add field tags with the `json` key and the value
|
automatically add field tags with the `json` key and the value
|
||||||
automatically generated based on the field name. An error message is given
|
automatically generated based on the field name. An error message is given
|
||||||
if it's called outside a struct definition.
|
if it's called outside a struct definition or if the file is not correctly
|
||||||
|
formatted.
|
||||||
|
|
||||||
If [range] is given, only the selected fields will be changed.
|
If [range] is given, only the selected fields will be changed.
|
||||||
|
|
||||||
|
@ -682,6 +683,37 @@ CTRL-t
|
||||||
arguments. An example of adding `xml` and `db` would be:
|
arguments. An example of adding `xml` and `db` would be:
|
||||||
>
|
>
|
||||||
:GoAddTags xml db
|
:GoAddTags xml db
|
||||||
|
<
|
||||||
|
If [option] is passed it'll either add a new tag with an option or will
|
||||||
|
modify exising tags. An example of adding `omitempty` to all `json` fields
|
||||||
|
would be:
|
||||||
|
>
|
||||||
|
:GoAddTags json,omitempty
|
||||||
|
<
|
||||||
|
You can define a constant value instead of the default field based value.
|
||||||
|
For example the following command will add ``valid:"1"`` to all fields.
|
||||||
|
>
|
||||||
|
:GoAddTags valid=1
|
||||||
|
<
|
||||||
|
*:GoRemoveTags*
|
||||||
|
:[range]GoRemoveTags [key],[option] [key1],[option1] ...
|
||||||
|
|
||||||
|
Rmove field tags for the fields of a struct. If called inside a struct it
|
||||||
|
automatically remove all field tags. An error message is given if it's
|
||||||
|
called outside a struct definition or if the file is not correctly
|
||||||
|
formatted
|
||||||
|
|
||||||
|
If [range] is given, only the selected fields will be changed.
|
||||||
|
|
||||||
|
If [key] is given, it will only remove those keys. Example:
|
||||||
|
>
|
||||||
|
:GoRemoveTags json
|
||||||
|
<
|
||||||
|
If [option] is passed with a [key], it will only remove the options.
|
||||||
|
Example, this will only remove `omitempty` options from fields containing
|
||||||
|
`json`:
|
||||||
|
>
|
||||||
|
:GoRemoveTags json,omitempty
|
||||||
<
|
<
|
||||||
*:GoAutoTypeInfoToggle*
|
*:GoAutoTypeInfoToggle*
|
||||||
:GoAutoTypeInfoToggle
|
:GoAutoTypeInfoToggle
|
||||||
|
@ -1488,6 +1520,8 @@ default it's enabled >
|
||||||
|
|
||||||
let g:go_echo_go_info = 1
|
let g:go_echo_go_info = 1
|
||||||
<
|
<
|
||||||
|
Please note that 'noshowmode' must be set for this feature to work correctly.
|
||||||
|
|
||||||
*'g:go_statusline_duration'*
|
*'g:go_statusline_duration'*
|
||||||
|
|
||||||
Specifices the duration of statusline information being showed per package. By
|
Specifices the duration of statusline information being showed per package. By
|
||||||
|
|
|
@ -14,14 +14,15 @@ command! -range=% GoChannelPeers call go#guru#ChannelPeers(<count>)
|
||||||
command! -range=% GoReferrers call go#guru#Referrers(<count>)
|
command! -range=% GoReferrers call go#guru#Referrers(<count>)
|
||||||
command! -nargs=? GoGuruTags call go#guru#Tags(<f-args>)
|
command! -nargs=? GoGuruTags call go#guru#Tags(<f-args>)
|
||||||
|
|
||||||
|
|
||||||
command! -nargs=* -range GoAddTags call go#util#AddTags(<line1>, <line2>, <f-args>)
|
|
||||||
|
|
||||||
command! -range=0 GoSameIds call go#guru#SameIds()
|
command! -range=0 GoSameIds call go#guru#SameIds()
|
||||||
command! -range=0 GoSameIdsClear call go#guru#ClearSameIds()
|
command! -range=0 GoSameIdsClear call go#guru#ClearSameIds()
|
||||||
command! -range=0 GoSameIdsToggle call go#guru#ToggleSameIds()
|
command! -range=0 GoSameIdsToggle call go#guru#ToggleSameIds()
|
||||||
command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToogleSameIds()
|
command! -range=0 GoSameIdsAutoToggle call go#guru#AutoToogleSameIds()
|
||||||
|
|
||||||
|
" -- tags
|
||||||
|
command! -nargs=* -range GoAddTags call go#tags#Add(<line1>, <line2>, <count>, <f-args>)
|
||||||
|
command! -nargs=* -range GoRemoveTags call go#tags#Remove(<line1>, <line2>, <count>, <f-args>)
|
||||||
|
|
||||||
" -- tool
|
" -- 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()
|
||||||
|
|
|
@ -18,6 +18,7 @@ let s:packages = [
|
||||||
\ "github.com/jstemmer/gotags",
|
\ "github.com/jstemmer/gotags",
|
||||||
\ "github.com/klauspost/asmfmt/cmd/asmfmt",
|
\ "github.com/klauspost/asmfmt/cmd/asmfmt",
|
||||||
\ "github.com/fatih/motion",
|
\ "github.com/fatih/motion",
|
||||||
|
\ "github.com/fatih/gomodifytags",
|
||||||
\ "github.com/zmb3/gogetdoc",
|
\ "github.com/zmb3/gogetdoc",
|
||||||
\ "github.com/josharian/impl",
|
\ "github.com/josharian/impl",
|
||||||
\ ]
|
\ ]
|
||||||
|
|
|
@ -4,6 +4,9 @@ set -e
|
||||||
|
|
||||||
cd $(dirname $0)
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
# install dependencies
|
||||||
|
go get github.com/fatih/gomodifytags
|
||||||
|
|
||||||
# cleanup test.log
|
# cleanup test.log
|
||||||
if [ -f "test.log" ]; then
|
if [ -f "test.log" ]; then
|
||||||
rm test.log
|
rm test.log
|
||||||
|
|
|
@ -30,7 +30,7 @@ syn region pugJavascript matchgroup=pugJavascriptOutputChar start="[!&]\==\|\~"
|
||||||
syn region pugJavascript matchgroup=pugJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
|
syn region pugJavascript matchgroup=pugJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
|
||||||
syn cluster pugTop contains=pugBegin,pugComment,pugHtmlComment,pugJavascript
|
syn cluster pugTop contains=pugBegin,pugComment,pugHtmlComment,pugJavascript
|
||||||
syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,pugIdChar,pugPlainChar,pugJavascript,pugScriptConditional,pugScriptStatement,pugPipedText
|
syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,pugIdChar,pugPlainChar,pugJavascript,pugScriptConditional,pugScriptStatement,pugPipedText
|
||||||
syn match pugTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent
|
syn match pugTag "+\?[[:alnum:]_-]\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent
|
||||||
syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText
|
syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText
|
||||||
syntax keyword pugCommentTodo contained TODO FIXME XXX TBD
|
syntax keyword pugCommentTodo contained TODO FIXME XXX TBD
|
||||||
syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo
|
syn match pugComment '\(\s\+\|^\)\/\/.*$' contains=pugCommentTodo
|
||||||
|
|
|
@ -96,4 +96,8 @@ snippet datetime "YYYY-MM-DD hh:mm" w
|
||||||
`!v strftime("%Y-%m-%d %H:%M")`
|
`!v strftime("%Y-%m-%d %H:%M")`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet todo "TODO comment" bw
|
||||||
|
`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
# vim:ft=snippets:
|
# vim:ft=snippets:
|
||||||
|
|
|
@ -4,6 +4,28 @@ extends c
|
||||||
|
|
||||||
# We want to overwrite everything in parent ft.
|
# We want to overwrite everything in parent ft.
|
||||||
priority -49
|
priority -49
|
||||||
|
###########################################################################
|
||||||
|
# Global functions #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
global !p
|
||||||
|
|
||||||
|
def write_docstring_args(arglist, snip):
|
||||||
|
args = str(arglist).split(',')
|
||||||
|
|
||||||
|
if len(args) > 1:
|
||||||
|
c = 0
|
||||||
|
for arg in args:
|
||||||
|
if c == 0:
|
||||||
|
snip.rv += arg
|
||||||
|
c = 1
|
||||||
|
else:
|
||||||
|
snip += '* : %s' % arg.strip()
|
||||||
|
else:
|
||||||
|
snip.rv = args[0]
|
||||||
|
|
||||||
|
|
||||||
|
endglobal
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
|
@ -70,4 +92,19 @@ public:
|
||||||
|
|
||||||
#endif /* $2 */
|
#endif /* $2 */
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
snippet fnc "Basic c++ doxygen function template" b
|
||||||
|
/**
|
||||||
|
* @brief: ${4:brief}
|
||||||
|
*
|
||||||
|
* @param: `!p write_docstring_args(t[3],snip)`
|
||||||
|
*
|
||||||
|
* @return: `!p snip.rv = t[1]`
|
||||||
|
*/
|
||||||
|
${1:ReturnType} ${2:FunctionName}(${3:param})
|
||||||
|
{
|
||||||
|
${0:FunctionBody}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
# vim:ft=snippets:
|
# vim:ft=snippets:
|
||||||
|
|
|
@ -0,0 +1,234 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
|
# JavaScript versions -- from the TextMate bundle + some additions
|
||||||
|
# for jasmine-jquery matchers
|
||||||
|
#
|
||||||
|
|
||||||
|
snippet des "Describe (js)" b
|
||||||
|
describe('${1:description}', () => {
|
||||||
|
$0
|
||||||
|
});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet it "it (js)" b
|
||||||
|
it('${1:description}', () => {
|
||||||
|
$0
|
||||||
|
});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet bef "before each (js)" b
|
||||||
|
beforeEach(() => {
|
||||||
|
$0
|
||||||
|
});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet aft "after each (js)" b
|
||||||
|
afterEach(() => {
|
||||||
|
$0
|
||||||
|
});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet befa "before all (js)" b
|
||||||
|
beforeAll(() => {
|
||||||
|
$0
|
||||||
|
});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet afta "after all (js)" b
|
||||||
|
afterAll(() => {
|
||||||
|
$0
|
||||||
|
});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet any "any (js)" b
|
||||||
|
jasmine.any($1)
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet anyt "anything (js)" b
|
||||||
|
jasmine.anything()
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet objc "object containing (js)" b
|
||||||
|
jasmine.objectContaining({
|
||||||
|
${VISUAL}$0
|
||||||
|
});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet arrc "array containing (js)" b
|
||||||
|
jasmine.arrayContaining([${1:value1}]);
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet strm "string matching (js)" b
|
||||||
|
jasmine.stringMatching("${1:matcher}")
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ru "runs (js)" b
|
||||||
|
runs(() => {
|
||||||
|
$0
|
||||||
|
});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet wa "waits (js)" b
|
||||||
|
waits($1);
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ex "expect (js)" b
|
||||||
|
expect(${1:target})$0;
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ee "expect to equal (js)" b
|
||||||
|
expect(${1:target}).toEqual(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet el "expect to be less than (js)" b
|
||||||
|
expect(${1:target}).toBeLessThan(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet eg "expect to be greater than (js)" b
|
||||||
|
expect(${1:target}).toBeGreaterThan(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet eb "expect to be (js)" b
|
||||||
|
expect(${1:target}).toBe(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet em "expect to match (js)" b
|
||||||
|
expect(${1:target}).toMatch(${2:pattern});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet eha "expect to have attribute (js)" b
|
||||||
|
expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet et "expect to be truthy (js)" b
|
||||||
|
expect(${1:target}).toBeTruthy();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ef "expect to be falsy (js)" b
|
||||||
|
expect(${1:target}).toBeFalsy();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ed "expect to be defined (js)" b
|
||||||
|
expect(${1:target}).toBeDefined();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet eud "expect to be defined (js)" b
|
||||||
|
expect(${1:target}).toBeUndefined();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet en "expect to be null (js)" b
|
||||||
|
expect(${1:target}).toBeNull();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ec "expect to contain (js)" b
|
||||||
|
expect(${1:target}).toContain(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ev "expect to be visible (js)" b
|
||||||
|
expect(${1:target}).toBeVisible();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet eh "expect to be hidden (js)" b
|
||||||
|
expect(${1:target}).toBeHidden();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet eth "expect to throw (js)" b
|
||||||
|
expect(${1:target}).toThrow(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ethe "expect to throw error (js)" b
|
||||||
|
expect(${1:target}).toThrowError(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notx "expect not (js)" b
|
||||||
|
expect(${1:target}).not$0;
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet note "expect not to equal (js)" b
|
||||||
|
expect(${1:target}).not.toEqual(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notl "expect to not be less than (js)" b
|
||||||
|
expect(${1:target}).not.toBeLessThan(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notg "expect to not be greater than (js)" b
|
||||||
|
expect(${1:target}).not.toBeGreaterThan(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notm "expect not to match (js)" b
|
||||||
|
expect(${1:target}).not.toMatch(${2:pattern});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notha "expect to not have attribute (js)" b
|
||||||
|
expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet nott "expect not to be truthy (js)" b
|
||||||
|
expect(${1:target}).not.toBeTruthy();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notf "expect not to be falsy (js)" b
|
||||||
|
expect(${1:target}).not.toBeFalsy();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notd "expect not to be defined (js)" b
|
||||||
|
expect(${1:target}).not.toBeDefined();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notn "expect not to be null (js)" b
|
||||||
|
expect(${1:target}).not.toBeNull();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notc "expect not to contain (js)" b
|
||||||
|
expect(${1:target}).not.toContain(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notv "expect not to be visible (js)" b
|
||||||
|
expect(${1:target}).not.toBeVisible();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet noth "expect not to be hidden (js)" b
|
||||||
|
expect(${1:target}).not.toBeHidden();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notth "expect not to throw (js)" b
|
||||||
|
expect(${1:target}).not.toThrow(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notthe "expect not to throw error (js)" b
|
||||||
|
expect(${1:target}).not.toThrowError(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet s "spy on (js)" b
|
||||||
|
spyOn(${1:object}, '${2:method}')$0;
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet sr "spy on and return (js)" b
|
||||||
|
spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet st "spy on and throw (js)" b
|
||||||
|
spyOn(${1:object}, '${2:method}').and.throwError(${3:exception});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet sct "spy on and call through (js)" b
|
||||||
|
spyOn(${1:object}, '${2:method}').and.callThrough();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet scf "spy on and call fake (js)" b
|
||||||
|
spyOn(${1:object}, '${2:method}').and.callFake(${3:function});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ethbc "expect to have been called (js)" b
|
||||||
|
expect(${1:target}).toHaveBeenCalled();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet nthbc "expect not to have been called (js)" b
|
||||||
|
expect(${1:target}).not.toHaveBeenCalled();
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ethbcw "expect to have been called with (js)" b
|
||||||
|
expect(${1:target}).toHaveBeenCalledWith(${2:arguments});
|
||||||
|
endsnippet
|
||||||
|
|
|
@ -132,6 +132,14 @@ snippet eh "expect to be hidden (js)" b
|
||||||
expect(${1:target}).toBeHidden();
|
expect(${1:target}).toBeHidden();
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet eth "expect to throw (js)" b
|
||||||
|
expect(${1:target}).toThrow(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ethe "expect to throw error (js)" b
|
||||||
|
expect(${1:target}).toThrowError(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet notx "expect not (js)" b
|
snippet notx "expect not (js)" b
|
||||||
expect(${1:target}).not$0;
|
expect(${1:target}).not$0;
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -145,7 +153,7 @@ expect(${1:target}).not.toBeLessThan(${2:value});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet notg "expect to not be greater than (js)" b
|
snippet notg "expect to not be greater than (js)" b
|
||||||
expect(${1:target})..not.toBeGreaterThan(${2:value});
|
expect(${1:target}).not.toBeGreaterThan(${2:value});
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet notm "expect not to match (js)" b
|
snippet notm "expect not to match (js)" b
|
||||||
|
@ -184,6 +192,14 @@ snippet noth "expect not to be hidden (js)" b
|
||||||
expect(${1:target}).not.toBeHidden();
|
expect(${1:target}).not.toBeHidden();
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet notth "expect not to throw (js)" b
|
||||||
|
expect(${1:target}).not.toThrow(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet notthe "expect not to throw error (js)" b
|
||||||
|
expect(${1:target}).not.toThrowError(${2:value});
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet s "spy on (js)" b
|
snippet s "spy on (js)" b
|
||||||
spyOn(${1:object}, '${2:method}')$0;
|
spyOn(${1:object}, '${2:method}')$0;
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
priority -50
|
priority -50
|
||||||
|
|
||||||
|
############
|
||||||
|
# COMMON #
|
||||||
|
############
|
||||||
|
|
||||||
|
# The smart snippets use a global options called
|
||||||
|
# "g:ultisnips_javascript.{option}" which can control the format
|
||||||
|
# of trailing semicolon, space before function paren, etc.
|
||||||
|
|
||||||
|
global !p
|
||||||
|
from javascript_snippets import (
|
||||||
|
semi, space_before_function_paren, keyword_spacing
|
||||||
|
)
|
||||||
|
endglobal
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TextMate Snippets #
|
# TextMate Snippets #
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -8,13 +22,13 @@ getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2')
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet '':f "object method string"
|
snippet '':f "object method string"
|
||||||
'${1:${2:#thing}:${3:click}}': function(element) {
|
'${1:${2:#thing}:${3:click}}': function`!p snip.rv = space_before_function_paren(snip)`(element) {
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
}${10:,}
|
}${10:,}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet :f "Object Method"
|
snippet :f "Object Method"
|
||||||
${1:method_name}: function(${3:attribute}) {
|
${1:method_name}: function`!p snip.rv = space_before_function_paren(snip)`(${3:attribute}) {
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
}${10:,}
|
}${10:,}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -28,48 +42,99 @@ ${1:key}: ${2:"${3:value}"}${4:, }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet proto "Prototype (proto)"
|
snippet proto "Prototype (proto)"
|
||||||
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
|
${1:class_name}.prototype.${2:method_name} = function`!p snip.rv = space_before_function_paren(snip)`(${3:first_argument}) {
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
};
|
}`!p snip.rv = semi(snip)`
|
||||||
|
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fun "function (fun)" w
|
snippet fun "function (fun)" w
|
||||||
function ${1:function_name}(${2:argument}) {
|
function ${1:function_name}`!p snip.rv = space_before_function_paren(snip)`(${2:argument}) {
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet vf "Function assigned to var"
|
snippet vf "Function assigned to var"
|
||||||
${1:var }${2:function_name} = function $2($3) {
|
${1:var }${2:function_name} = function $2`!p snip.rv = space_before_function_paren(snip)`($3) {
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
};
|
}`!p snip.rv = semi(snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet af "Anonymous Function" i
|
snippet af "Anonymous Function" i
|
||||||
function($1) {
|
function`!p snip.rv = space_before_function_paren(snip)`($1) {
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet iife "Immediately-Invoked Function Expression (iife)"
|
snippet iife "Immediately-Invoked Function Expression (iife)"
|
||||||
(function(${1:window}) {
|
(function`!p snip.rv = space_before_function_paren(snip)`(${1:window}) {
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
}(${2:$1}));
|
}(${2:$1}))`!p snip.rv = semi(snip)`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ;fe "Minify safe iife"
|
||||||
|
;(function`!p snip.rv = space_before_function_paren(snip)`(${1}) {
|
||||||
|
${VISUAL}$0
|
||||||
|
}(${2}))
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet timeout "setTimeout function"
|
snippet timeout "setTimeout function"
|
||||||
setTimeout(function() {
|
setTimeout(function`!p snip.rv = space_before_function_paren(snip)`() {
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
}${2:.bind(${3:this})}, ${1:10});
|
}${2:.bind(${3:this})}, ${1:10})`!p snip.rv = semi(snip)`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet fi "for prop in obj using hasOwnProperty" b
|
snippet fi "for prop in obj using hasOwnProperty" b
|
||||||
for (${1:prop} in ${2:obj}){
|
for`!p snip.rv = keyword_spacing(snip)`(${1:prop} in ${2:obj}){
|
||||||
if ($2.hasOwnProperty($1)) {
|
if`!p snip.rv = keyword_spacing(snip)`($2.hasOwnProperty($1)) {
|
||||||
${VISUAL}$0
|
${VISUAL}$0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet if "if (condition) { ... }"
|
||||||
|
if`!p snip.rv = keyword_spacing(snip)`(${1:true}) {
|
||||||
|
${VISUAL}$0
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ife "if (condition) { ... } else { ... }"
|
||||||
|
if`!p snip.rv = keyword_spacing(snip)`(${1:true}) {
|
||||||
|
${VISUAL}$0
|
||||||
|
}`!p snip.rv = keyword_spacing(snip)`else`!p snip.rv = keyword_spacing(snip)`{
|
||||||
|
${2}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet switch
|
||||||
|
switch`!p snip.rv = keyword_spacing(snip)`(${VISUAL}${1:expression}) {
|
||||||
|
case '${VISUAL}${3:case}':
|
||||||
|
${4}
|
||||||
|
break`!p snip.rv = semi(snip)`
|
||||||
|
${0}
|
||||||
|
default:
|
||||||
|
${2}
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet case "case 'xyz': ... break"
|
||||||
|
case`!p snip.rv = keyword_spacing(snip)`'${VISUAL}${1:case}':
|
||||||
|
${VISUAL}$0
|
||||||
|
break`!p snip.rv = semi(snip)`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet do "do { ... } while (condition)"
|
||||||
|
do`!p snip.rv = keyword_spacing(snip)`{
|
||||||
|
${VISUAL}$0
|
||||||
|
}`!p snip.rv = keyword_spacing(snip)`while`!p snip.rv = keyword_spacing(snip)`(${1:/* condition */})`!p snip.rv = semi(snip)`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ret "Return statement"
|
||||||
|
return ${VISUAL}$0`!p snip.rv = semi(snip)`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet us
|
||||||
|
'use strict'`!p snip.rv = semi(snip)`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
# vim:ft=snippets:
|
# vim:ft=snippets:
|
||||||
|
|
24
sources_non_forked/vim-snippets/UltiSnips/matlab.snippets
Normal file
24
sources_non_forked/vim-snippets/UltiSnips/matlab.snippets
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
priority -50
|
||||||
|
|
||||||
|
snippet switch "switch ... otherwise"
|
||||||
|
switch ${1:n}
|
||||||
|
case ${2:0}
|
||||||
|
${3}${4:
|
||||||
|
otherwise
|
||||||
|
${5}}
|
||||||
|
end
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet clc "class with constructor" b
|
||||||
|
classdef ${1:`!p
|
||||||
|
snip.rv = snip.basename or "class_name"`}
|
||||||
|
properties
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
methods
|
||||||
|
function obj = $1(${3})
|
||||||
|
${4}
|
||||||
|
end${0}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
endsnippet
|
|
@ -1,5 +1,26 @@
|
||||||
priority -50
|
priority -50
|
||||||
|
|
||||||
|
#
|
||||||
|
# Global functions
|
||||||
|
#
|
||||||
|
|
||||||
|
global !p
|
||||||
|
|
||||||
|
def write_instance_vars(arglist, snip):
|
||||||
|
args = str(arglist).split(',')
|
||||||
|
for arg in args:
|
||||||
|
name = arg.strip().replace(':', ' ').split(' ', 1)[0]
|
||||||
|
if name:
|
||||||
|
snip += ' @{} = {}'.format(name, name)
|
||||||
|
else:
|
||||||
|
snip += ''
|
||||||
|
|
||||||
|
endglobal
|
||||||
|
|
||||||
|
#
|
||||||
|
# Snippets
|
||||||
|
#
|
||||||
|
|
||||||
snippet "^#!" "#!/usr/bin/env ruby" r
|
snippet "^#!" "#!/usr/bin/env ruby" r
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
$0
|
$0
|
||||||
|
@ -17,8 +38,7 @@ end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet defi "def initialize ..."
|
snippet defi "def initialize ..."
|
||||||
def initialize${1:(${2:*args})}
|
def initialize($1)`!p write_instance_vars(t[1],snip)`$0
|
||||||
$0
|
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
@ -212,32 +232,6 @@ except:
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |<element>,<i>| <block> }" r
|
|
||||||
`!p snip.rv=match.group(1)`.each_with_index { |${1:`!p
|
|
||||||
element_name = match.group(1).lstrip('$@')
|
|
||||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
||||||
try:
|
|
||||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
||||||
snip.rv = wmatch.group(1).lower()
|
|
||||||
except:
|
|
||||||
snip.rv = 'element'
|
|
||||||
`},${2:i}| $0 }
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.each_?w(ith)?_?i(ndex)?" ".each_with_index do |<element>,<i>| <block> end" r
|
|
||||||
`!p snip.rv=match.group(1)`.each_with_index do |${1:`!p
|
|
||||||
element_name = match.group(1).lstrip('$@')
|
|
||||||
ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name)
|
|
||||||
try:
|
|
||||||
wmatch = re.search("([A-Za-z][A-Za-z0-9_]+)$", ematch.group(1))
|
|
||||||
snip.rv = wmatch.group(1).lower()
|
|
||||||
except:
|
|
||||||
snip.rv = 'element'
|
|
||||||
`},${2:i}|
|
|
||||||
$0
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
|
snippet "(\S+)\.Each_?p(air)?" ".each_pair { |<key>,<value>| <block> }" r
|
||||||
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| $0 }
|
`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| $0 }
|
||||||
endsnippet
|
endsnippet
|
||||||
|
@ -298,20 +292,6 @@ rescue
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet begin "begin ... rescue ... else ... ensure ... end"
|
|
||||||
begin
|
|
||||||
${1:# Raise exception}
|
|
||||||
rescue Exception => e
|
|
||||||
puts e.message
|
|
||||||
puts e.backtrace.inspect
|
|
||||||
${2:# Rescue}
|
|
||||||
else
|
|
||||||
${3:# other exception}
|
|
||||||
ensure
|
|
||||||
${0:# always excute}
|
|
||||||
end
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rescue
|
snippet rescue
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts e.message
|
puts e.message
|
||||||
|
@ -326,10 +306,6 @@ $0
|
||||||
end
|
end
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet alias "alias :<new_name> :<old_name>"
|
|
||||||
alias :${1:new_name} :${2:old_name}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet class "class <class_name> def initialize ... end end"
|
snippet class "class <class_name> def initialize ... end end"
|
||||||
class ${1:class_name}
|
class ${1:class_name}
|
||||||
def initialize(${2:*args})
|
def initialize(${2:*args})
|
||||||
|
|
|
@ -2,15 +2,15 @@ priority -50
|
||||||
|
|
||||||
# We use a little hack so that the snippet is expanded
|
# We use a little hack so that the snippet is expanded
|
||||||
# and parsed correctly
|
# and parsed correctly
|
||||||
snippet snip "Snippet definition" b
|
snippet usnip "Ultisnips snippet definition" b
|
||||||
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
|
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
|
||||||
$0
|
${0:${VISUAL}}
|
||||||
`!p snip.rv = "endsnippet"`
|
`!p snip.rv = "endsnippet"`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet global "Global snippet" b
|
snippet global "Global snippet" b
|
||||||
`!p snip.rv = "global"` !p
|
`!p snip.rv = "global"` !p
|
||||||
$0
|
${0:${VISUAL}}
|
||||||
`!p snip.rv = "endglobal"`
|
`!p snip.rv = "endglobal"`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Helper utilities to format javascript snippets.
|
||||||
|
"""
|
||||||
|
|
||||||
|
ALWAYS = 'always'
|
||||||
|
NEVER = 'never'
|
||||||
|
|
||||||
|
|
||||||
|
def get_option(snip, option, default=None):
|
||||||
|
return snip.opt('g:ultisnips_javascript["{}"]'.format(option), default)
|
||||||
|
|
||||||
|
|
||||||
|
def semi(snip):
|
||||||
|
option = get_option(snip, 'semi', ALWAYS)
|
||||||
|
|
||||||
|
if option == NEVER:
|
||||||
|
ret = ''
|
||||||
|
elif option == ALWAYS:
|
||||||
|
ret = ';'
|
||||||
|
else:
|
||||||
|
ret = ';'
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
def space_before_function_paren(snip):
|
||||||
|
option = get_option(snip, 'space-before-function-paren', NEVER)
|
||||||
|
|
||||||
|
if option == NEVER:
|
||||||
|
ret = ''
|
||||||
|
elif option == ALWAYS:
|
||||||
|
ret = ' '
|
||||||
|
else:
|
||||||
|
ret = ''
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
def keyword_spacing(snip):
|
||||||
|
option = get_option(snip, 'keyword-spacing', ALWAYS)
|
||||||
|
|
||||||
|
if option == NEVER:
|
||||||
|
ret = ''
|
||||||
|
elif option == ALWAYS:
|
||||||
|
ret = ' '
|
||||||
|
else:
|
||||||
|
ret = ''
|
||||||
|
return ret
|
|
@ -130,6 +130,84 @@ snippet fun
|
||||||
{
|
{
|
||||||
${4}
|
${4}
|
||||||
}
|
}
|
||||||
|
# function definition with zero parameters
|
||||||
|
snippet fun0
|
||||||
|
${1:void} ${2:function_name}()
|
||||||
|
{
|
||||||
|
${3}
|
||||||
|
}
|
||||||
|
# function definition with Doxygen documentation
|
||||||
|
snippet dfun0
|
||||||
|
/*! \brief ${1:Brief function description here}
|
||||||
|
*
|
||||||
|
* ${2:Detailed description of the function}
|
||||||
|
*
|
||||||
|
* \return ${3:Return parameter description}
|
||||||
|
*/
|
||||||
|
${4:void} ${5:function_name}()
|
||||||
|
{
|
||||||
|
${6}
|
||||||
|
}
|
||||||
|
# function definition with one parameter
|
||||||
|
snippet fun1
|
||||||
|
${1:void} ${2:function_name}(${3:Type} ${4:Parameter})
|
||||||
|
{
|
||||||
|
${5}
|
||||||
|
}
|
||||||
|
# function definition with one parameter with Doxygen documentation
|
||||||
|
snippet dfun1
|
||||||
|
/*! \brief ${1:Brief function description here}
|
||||||
|
*
|
||||||
|
* ${2:Detailed description of the function}
|
||||||
|
*
|
||||||
|
* \param $3 ${4:Parameter description}
|
||||||
|
* \return ${5:Return parameter description}
|
||||||
|
*/
|
||||||
|
${6:void} ${7:function_name}(${8:Type} ${3:Parameter})
|
||||||
|
{
|
||||||
|
${9}
|
||||||
|
}
|
||||||
|
# function definition with two parameters
|
||||||
|
snippet fun2
|
||||||
|
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter})
|
||||||
|
{
|
||||||
|
${7}
|
||||||
|
}
|
||||||
|
# function definition with two parameters with Doxygen documentation
|
||||||
|
snippet dfun2
|
||||||
|
/*! \brief ${1:Brief function description here}
|
||||||
|
*
|
||||||
|
* ${2:Detailed description of the function}
|
||||||
|
*
|
||||||
|
* \param $3 ${4:Parameter description}
|
||||||
|
* \param $5 ${6:Parameter description}
|
||||||
|
* \return ${7:Return parameter description}
|
||||||
|
*/
|
||||||
|
${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter})
|
||||||
|
{
|
||||||
|
${12}
|
||||||
|
}
|
||||||
|
# function definition with two parameters
|
||||||
|
snippet fun3
|
||||||
|
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter})
|
||||||
|
{
|
||||||
|
${9}
|
||||||
|
}
|
||||||
|
# function definition with two parameters with Doxygen documentation
|
||||||
|
snippet dfun3
|
||||||
|
/*! \brief ${1:Brief function description here}
|
||||||
|
*
|
||||||
|
* ${2:Detailed description of the function}
|
||||||
|
*
|
||||||
|
* \param $3 ${4:Parameter description}
|
||||||
|
* \param $5 ${6:Parameter description}
|
||||||
|
* \param $7 ${8:Parameter description}
|
||||||
|
* \return ${9:Return parameter description}
|
||||||
|
*/
|
||||||
|
${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter})
|
||||||
|
{
|
||||||
|
${15}
|
||||||
|
}
|
||||||
# function declaration
|
# function declaration
|
||||||
snippet fund
|
snippet fund
|
||||||
${1:void} ${2:function_name}(${3});
|
${1:void} ${2:function_name}(${3});
|
||||||
|
@ -140,21 +218,39 @@ snippet td
|
||||||
typedef ${1:int} ${2:MyCustomType};
|
typedef ${1:int} ${2:MyCustomType};
|
||||||
# struct
|
# struct
|
||||||
snippet st
|
snippet st
|
||||||
|
/*! \struct $1
|
||||||
|
* \brief ${3:Brief struct description}
|
||||||
|
*
|
||||||
|
* ${4:Detailed description}
|
||||||
|
*/
|
||||||
struct ${1:`vim_snippets#Filename('$1_t', 'name')`} {
|
struct ${1:`vim_snippets#Filename('$1_t', 'name')`} {
|
||||||
${2:/* data */}
|
${2:Data} /*!< ${4:Description} */
|
||||||
}${3: /* optional variable list */};
|
}${5: /* optional variable list */};
|
||||||
# typedef struct
|
# typedef struct
|
||||||
snippet tds
|
snippet tds
|
||||||
|
/*! \struct $2
|
||||||
|
* \brief ${5:Brief struct description}
|
||||||
|
*
|
||||||
|
* ${6:Detailed description}
|
||||||
|
*/
|
||||||
typedef struct ${2:_$1 }{
|
typedef struct ${2:_$1 }{
|
||||||
${3:/* data */}
|
m_${3:Data} /*!< ${4:Description} */
|
||||||
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
|
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
|
||||||
|
|
||||||
snippet enum
|
snippet enum
|
||||||
|
/*! \enum $1
|
||||||
|
*
|
||||||
|
* ${2:Detailed description}
|
||||||
|
*/
|
||||||
enum ${1:name} { ${0} };
|
enum ${1:name} { ${0} };
|
||||||
# typedef enum
|
# typedef enum
|
||||||
snippet tde
|
snippet tde
|
||||||
|
/*! \enum $2
|
||||||
|
*
|
||||||
|
* ${4:Detailed description}
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
${1:/* data */}
|
${1:Data} /*!< ${3:Description} */
|
||||||
} ${2:foo};
|
} ${2:foo};
|
||||||
##
|
##
|
||||||
## Input/Output
|
## Input/Output
|
||||||
|
@ -228,6 +324,11 @@ snippet getopt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
##
|
##
|
||||||
|
# TODO section
|
||||||
|
snippet todo
|
||||||
|
/*! TODO: ${1:Todo description here}
|
||||||
|
* \todo $1
|
||||||
|
*/
|
||||||
## Miscellaneous
|
## Miscellaneous
|
||||||
# This is kind of convenient
|
# This is kind of convenient
|
||||||
snippet .
|
snippet .
|
||||||
|
|
|
@ -78,20 +78,61 @@ snippet mu
|
||||||
## Class
|
## Class
|
||||||
# class
|
# class
|
||||||
snippet cl
|
snippet cl
|
||||||
|
/*! \class $1
|
||||||
|
* \brief ${3:Brief class description}
|
||||||
|
*
|
||||||
|
* ${4:Detailed description}
|
||||||
|
*/
|
||||||
class ${1:`vim_snippets#Filename('$1', 'name')`}
|
class ${1:`vim_snippets#Filename('$1', 'name')`}
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
$1(${2});
|
$1(${2});
|
||||||
~$1();
|
virtual ~$1();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
${0:/* data */}
|
m_${5}; /*!< ${6:Member description} */
|
||||||
};
|
};
|
||||||
# member function implementation
|
# member function implementation
|
||||||
snippet mfun
|
snippet mfun
|
||||||
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
|
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
|
# member function implementation without parameters
|
||||||
|
snippet dmfun0
|
||||||
|
/*! \brief ${4:Brief function description here}
|
||||||
|
*
|
||||||
|
* ${5:Detailed description}
|
||||||
|
*
|
||||||
|
* \return ${6:Return parameter description}
|
||||||
|
*/
|
||||||
|
${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
# member function implementation with one parameter
|
||||||
|
snippet dmfun1
|
||||||
|
/*! \brief ${6:Brief function description here}
|
||||||
|
*
|
||||||
|
* ${7:Detailed description}
|
||||||
|
*
|
||||||
|
* \param $4 ${8:Parameter description}
|
||||||
|
* \return ${9:Return parameter description}
|
||||||
|
*/
|
||||||
|
${5:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter}) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
# member function implementation with two parameter
|
||||||
|
snippet dmfun2
|
||||||
|
/*! \brief ${8:Brief function description here}
|
||||||
|
*
|
||||||
|
* ${9:Detailed description}
|
||||||
|
*
|
||||||
|
* \param $4 ${10:Parameter description}
|
||||||
|
* \param $6 ${11:Parameter description}
|
||||||
|
* \return ${12:Return parameter description}
|
||||||
|
*/
|
||||||
|
${7:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter},${5:Type} ${6:Parameter}) {
|
||||||
|
${0}
|
||||||
|
}
|
||||||
# namespace
|
# namespace
|
||||||
snippet ns
|
snippet ns
|
||||||
namespace ${1:`vim_snippets#Filename('', 'my')`} {
|
namespace ${1:`vim_snippets#Filename('', 'my')`} {
|
||||||
|
@ -152,3 +193,13 @@ snippet lld
|
||||||
[${1}](${2}){
|
[${1}](${2}){
|
||||||
${3}
|
${3}
|
||||||
};
|
};
|
||||||
|
# snippets exception
|
||||||
|
snippet try
|
||||||
|
try {
|
||||||
|
|
||||||
|
}catch(${1}) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,12 @@ snippet doc
|
||||||
$0
|
$0
|
||||||
snippet dox
|
snippet dox
|
||||||
!> @brief ${1}
|
!> @brief ${1}
|
||||||
|
!!
|
||||||
!> ${2}
|
!> ${2}
|
||||||
!> @author `g:snips_author`
|
!> @author `g:snips_author`
|
||||||
${0}
|
${0}
|
||||||
|
snippet doxp
|
||||||
|
!> @param[${1}]${0}
|
||||||
# Variables definitions
|
# Variables definitions
|
||||||
# Boolean
|
# Boolean
|
||||||
snippet bool
|
snippet bool
|
||||||
|
|
|
@ -78,7 +78,7 @@ snippet spaceless
|
||||||
snippet ssi
|
snippet ssi
|
||||||
{% ssi ${0} %}
|
{% ssi ${0} %}
|
||||||
snippet trans
|
snippet trans
|
||||||
{% trans "${0:string}" %}
|
{% trans %}${0}{% endtrans %}
|
||||||
snippet url
|
snippet url
|
||||||
{% url ${1} as ${0} %}
|
{% url ${1} as ${0} %}
|
||||||
snippet widthratio
|
snippet widthratio
|
||||||
|
|
64
sources_non_forked/vim-snippets/snippets/matlab.snippets
Normal file
64
sources_non_forked/vim-snippets/snippets/matlab.snippets
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
snippet if if
|
||||||
|
if ${1}
|
||||||
|
${0}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet ife if ... else
|
||||||
|
if ${1}
|
||||||
|
${2}
|
||||||
|
else
|
||||||
|
${0}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet el else
|
||||||
|
else
|
||||||
|
${0}
|
||||||
|
|
||||||
|
snippet eif elsif
|
||||||
|
elseif ${1}
|
||||||
|
${0}
|
||||||
|
|
||||||
|
snippet wh while
|
||||||
|
while ${1}
|
||||||
|
${0}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet for for
|
||||||
|
for ${1:i} = ${2:1:n}
|
||||||
|
${0}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet parfor parfor
|
||||||
|
parfor ${1:i} = ${2:1:n}
|
||||||
|
${0}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet fun function
|
||||||
|
function [${3:out}] = ${1:`vim_snippets#Filename("$1", "fun_name")`}(${2})
|
||||||
|
${0}
|
||||||
|
|
||||||
|
snippet try try ... catch
|
||||||
|
try
|
||||||
|
${1}
|
||||||
|
catch ${2:err}
|
||||||
|
${0}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet switch switch
|
||||||
|
switch ${1:n}
|
||||||
|
case ${2:0}
|
||||||
|
${0}
|
||||||
|
end
|
||||||
|
|
||||||
|
snippet @ anonymous function
|
||||||
|
@(${1:x}) ${0:x*x}
|
||||||
|
|
||||||
|
snippet cl class
|
||||||
|
classdef ${1:`vim_snippets#Filename("$1", "class_name")`}
|
||||||
|
properties
|
||||||
|
${2}
|
||||||
|
end
|
||||||
|
methods
|
||||||
|
${0}
|
||||||
|
end
|
||||||
|
end
|
|
@ -94,9 +94,9 @@ snippet E
|
||||||
$_ENV['${1:variable}']
|
$_ENV['${1:variable}']
|
||||||
snippet F
|
snippet F
|
||||||
$_FILES['${1:variable}']
|
$_FILES['${1:variable}']
|
||||||
snippet G
|
snippet G "_GET array"
|
||||||
$_GET['${1:variable}']
|
$_GET['${1:variable}']
|
||||||
snippet P
|
snippet P "_POST array"
|
||||||
$_POST['${1:variable}']
|
$_POST['${1:variable}']
|
||||||
snippet R
|
snippet R
|
||||||
$_REQUEST['${1:variable}']
|
$_REQUEST['${1:variable}']
|
||||||
|
|
|
@ -142,21 +142,6 @@ snippet mod module .. end
|
||||||
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||||
${0}
|
${0}
|
||||||
end
|
end
|
||||||
snippet mod module .. ClassMethods .. end
|
|
||||||
module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
|
||||||
module ClassMethods
|
|
||||||
${0}
|
|
||||||
end
|
|
||||||
|
|
||||||
module InstanceMethods
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.included(receiver)
|
|
||||||
receiver.extend ClassMethods
|
|
||||||
receiver.send :include, InstanceMethods
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# attr_reader
|
# attr_reader
|
||||||
snippet r
|
snippet r
|
||||||
attr_reader :${0:attr_names}
|
attr_reader :${0:attr_names}
|
||||||
|
|
|
@ -142,7 +142,7 @@ snippet stn "Struct with new constructor"
|
||||||
}
|
}
|
||||||
|
|
||||||
impl $1 {
|
impl $1 {
|
||||||
pub fn new(${2}) -> $1 {
|
pub fn new(${2}) -> Self {
|
||||||
$1 { ${3} }
|
$1 { ${3} }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
# snippets for making snippets :)
|
# snippets for making snippets :)
|
||||||
snippet snip
|
snippet snip
|
||||||
snippet ${1:trigger}
|
snippet ${1:trigger} "${2:description}"
|
||||||
${0}
|
${0:${VISUAL}}
|
||||||
snippet msnip
|
|
||||||
snippet ${1:trigger} ${2:description}
|
|
||||||
${0}
|
|
||||||
snippet v
|
snippet v
|
||||||
{VISUAL}
|
{VISUAL}
|
||||||
snippet $
|
snippet $
|
||||||
|
|
Loading…
Reference in a new issue