1
0
Fork 0
mirror of synced 2024-12-23 23:33:21 -05:00

Updated plugins

This commit is contained in:
amix 2014-07-02 12:18:18 +01:00
parent 6a16a9393c
commit 1dba960b75
156 changed files with 2657 additions and 1234 deletions

View file

@ -9,7 +9,7 @@ ack from vim, and shows the results in a split window.
### Ack
You will need the ack, of course, to install it follow the
You will need the ack(>= 2.0), of course, to install it follow the
[manual](http://beyondgrep.com/install/)
### The Plugin
@ -75,8 +75,8 @@ check out the docs for the Perl script 'ack', for obvious reasons:
### Gotchas
Some characters have special meaning, and need to be escaped your search
pattern. For instance, '#'. You have to escape it like this :Ack '\\\#define
foo' to search for #define foo. (From blueyed in issue #5.)
pattern. For instance, '#'. You have to escape it like this `:Ack '\\\#define
foo'` to search for '#define foo'. (From blueyed in issue #5.)
## Changelog
@ -91,3 +91,41 @@ foo' to search for #define foo. (From blueyed in issue #5.)
* Add g:ack_mapping
* Add g:ack_default_options
* Add a help toggle `?`(like NERDTree)
### 1.0.1
* Fixes #124. Bug with `g:ack_autofold_results`
### 1.0.2
* Add compatibility with [vim-dispatch](https://github.com/tpope/vim-dispatch)
### 1.0.3
* Fixes #127. Use `&l:hlsearch` instead of `v:hlsearch` to keep compatibility
with versions that does not have this variable.
### 1.0.4
* Fixes #128. Always apply mappings, even when using vim-dispatch.
### 1.0.5
* Fixes #128. Fixes the `errorformat` for ack when using vim-dispatch.
* Do not use vim-dispatch by default. To use vim-dispath must set
`g:ack_use_dispatch`
### 1.0.6
* Fixes highlight function to work when user passes options. Ex.: Ack -i test
Thank's @mannih. (#131, #134)
### 1.0.7
* Fixes highlight function to work when passes more than one option, or options
with double dashes(--option) Thank's to @MiguelLatorre and @mannih
### 1.0.8
* Fixes (again) highlight, now using negative look behind.
* Change mappings `o` and `O` to behave as documented

View file

@ -8,6 +8,7 @@ function! ack#Ack(cmd, args)
else
let l:grepargs = a:args . join(a:000, ' ')
end
echom l:grepargs
let l:ackprg_run = g:ackprg
" Format, used to manage column jump
@ -26,7 +27,14 @@ function! ack#Ack(cmd, args)
try
" NOTE: we escape special chars, but not everything using shellescape to
" allow for passing arguments etc
silent execute a:cmd . " " . escape(l:grepargs, '|#%')
if g:ack_use_dispatch
let &l:errorformat = g:ackformat
let &l:makeprg=g:ackprg." " . escape(l:grepargs, '|#%')
Make
else
silent execute a:cmd . " " . escape(l:grepargs, '|#%')
endif
finally
let &grepprg=grepprg_bak
let &grepformat=grepformat_bak
@ -42,7 +50,12 @@ function! ack#Ack(cmd, args)
let s:close_cmd = ':cclose<CR>'
endif
call ack#show_results()
if !g:ack_use_dispatch
call ack#show_results()
else
copen
endif
call <SID>apply_maps()
call <SID>highlight(l:grepargs)
redraw!
@ -50,7 +63,6 @@ endfunction
function! ack#show_results()
execute s:handler
call <SID>apply_maps()
endfunction
function! s:apply_maps()
@ -100,9 +112,8 @@ function! s:highlight(args)
return
endif
let @/ = matchstr(a:args, "\\v\\w+\>|['\"]\\zs[^\"]+\\ze['\"]")
setlocal hlsearch
call feedkeys(":let v:hlsearch=1 \| echo \<CR>", "n")
let @/ = matchstr(a:args, "\\v(-)\@<!(\<)\@<=\\w+|['\"]\\zs.{-}\\ze['\"]")
call feedkeys(":let &l:hlsearch=1 \| echo \<CR>", "n")
endfunction
function! ack#AckFromSearch(cmd, args)

View file

@ -86,7 +86,7 @@ Example:
let g:ackprg = "other-bin-ack"
<
g:ack_default_options*
*g:ack_default_options*
g:ack_default_options
Default: " -s -H --nocolor --nogroup --column"
@ -94,7 +94,7 @@ Use this option to specify the options used by ack
Example:
>
let g:ackprg =
let g:ack_default_options =
\ " -s -H --nocolor --nogroup --column --smart-case --follow"
<
@ -203,6 +203,18 @@ Example:
let g:ackpreview = 1
<
*g:ack_use_dispatch*
g:ack_use_dispatch
Default: 0
Use this option to use vim-dispatch to search the results in background
Example:
>
let g:ack_use_dispatch = 1
<
==============================================================================
MAPPINGS *ack-mappings*

View file

@ -1,4 +1,4 @@
if g:ack_autofold_results
if exists("g:ack_autofold_results") && g:ack_autofold_results
setlocal foldlevel=0
setlocal foldmethod=expr
setlocal foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')==#matchstr(getline(v:lnum+1),'^[^\|]\\+')?1:'<1'

View file

@ -22,12 +22,16 @@ if !exists("g:ack_apply_lmappings")
let g:ack_apply_lmappings = !exists("g:ack_lhandler")
endif
if !exists("g:ack_use_dispatch")
let g:ack_use_dispatch = 0
end
let s:ack_mappings = {
\ "t": "<C-W><CR><C-W>T",
\ "T": "<C-W><CR><C-W>TgT<C-W>j",
\ "o": "<CR>",
\ "O": "<CR><C-W><C-W>:ccl<CR>",
\ "go": "<CR><C-W>j",
\ "O": "<CR><C-W>p<C-W>c",
\ "go": "<CR><C-W>p",
\ "h": "<C-W><CR><C-W>K",
\ "H": "<C-W><CR><C-W>K<C-W>b",
\ "v": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",

View file

@ -104,13 +104,13 @@ function! s:tranquilize()
\ 'StatusLine', 'StatusLineNC', 'SignColumn']
" -1 on Vim / '' on GVim
if bg == -1 || empty(bg)
call s:set_color(grp, '', 'NONE')
call s:set_color(grp, 'fg', get(g:, 'goyo_bg', 'black'))
call s:set_color(grp, 'bg', 'NONE')
else
call s:set_color(grp, 'fg', bg)
call s:set_color(grp, 'bg', bg)
endif
call s:set_color(grp, '', 'NONE')
endfor
endfunction
@ -244,6 +244,8 @@ function! s:goyo_off()
let goyo_disabled_airline = t:goyo_disabled_airline
let goyo_disabled_powerline = t:goyo_disabled_powerline
let goyo_disabled_lightline = t:goyo_disabled_lightline
let goyo_orig_buffer = t:goyo_master
let [line, col] = [line('.'), col('.')]
if tabpagenr() == 1
tabnew
@ -252,6 +254,9 @@ function! s:goyo_off()
endif
tabclose
execute 'normal! '.s:orig_tab.'gt'
if winbufnr(0) == goyo_orig_buffer
execute printf('normal! %dG%d|', line, col)
endif
let wmh = remove(goyo_revert, 'winminheight')
let wh = remove(goyo_revert, 'winheight')

View file

@ -60,7 +60,7 @@ Installation
cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git
Then reload vim, run `:helptags`, and check out `:help NERD_tree.txt`.
Then reload vim, run `:Helptags`, and check out `:help NERD_tree.txt`.
Faq
@ -80,7 +80,10 @@ A. Stick this in your vimrc: `autocmd vimenter * NERDTree`
__Q. How can I open a NERDTree automatically when vim starts up if no files were specified?__
A. Stick this in your vimrc `autocmd vimenter * if !argc() | NERDTree | endif`
A. Stick this in your vimrc
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if !argc() == 0 && !exists("s:std_in") | NERDTree | endif
__Q. How can I map a specific key or shortcut to open NERDTree?__

View file

@ -513,7 +513,7 @@ function! nerdtree#dumpHelp()
let @h=@h."\" ". g:NERDTreeMapHelp .": toggle help\n"
let @h=@h."\"\n\" ----------------------------\n"
let @h=@h."\" Bookmark commands~\n"
let @h=@h."\" :Bookmark <name>\n"
let @h=@h."\" :Bookmark [<name>]\n"
let @h=@h."\" :BookmarkToRoot <name>\n"
let @h=@h."\" :RevealBookmark <name>\n"
let @h=@h."\" :OpenBookmark <name>\n"
@ -1068,9 +1068,17 @@ function! s:closeCurrentDir(node)
if parent ==# {} || parent.isRoot()
call nerdtree#echo("cannot close tree root")
else
call a:node.parent.close()
while g:NERDTreeCascadeOpenSingleChildDir && !parent.parent.isRoot()
if parent.parent.getVisibleChildCount() == 1
call parent.close()
let parent = parent.parent
else
break
endif
endwhile
call parent.close()
call nerdtree#renderView()
call a:node.parent.putCursorHere(0, 0)
call parent.putCursorHere(0, 0)
endif
endfunction

View file

@ -109,7 +109,7 @@ The following features and functionality are provided by the NERD tree:
<
:NERDTreeFromBookmark <bookmark> *:NERDTreeFromBookmark*
Opens a fresh NERD tree with the root initialized to the dir for
<bookmark>. This only reason to use this command over :NERDTree is for
<bookmark>. The only reason to use this command over :NERDTree is for
the completion (which is for bookmarks rather than directories).
:NERDTreeToggle [<start-directory> | <bookmark>] *:NERDTreeToggle*
@ -160,7 +160,7 @@ click bookmarks or use the |NERDTree-o| mapping to activate them. See also,
Note that the following commands are only available in the NERD tree buffer.
:Bookmark <name>
:Bookmark [<name>]
Bookmark the current node as <name>. If there is already a <name>
bookmark, it is overwritten. <name> must not contain spaces.
If <name> is not provided, it defaults to the file or directory name.
@ -358,7 +358,7 @@ Default key: O
Map option: NERDTreeMapOpenRecursively
Applies to: directories.
Recursively opens the selelected directory.
Recursively opens the selected directory.
All files and directories are cached, but if a directory would not be
displayed due to file filters (see |'NERDTreeIgnore'| |NERDTree-f|) or the
@ -609,17 +609,19 @@ NERD tree. These options should be set in your vimrc.
|'loaded_nerd_tree'| Turns off the script.
|'NERDChristmasTree'| Tells the NERD tree to make itself colourful
and pretty.
|'NERDTreeAutoCenter'| Controls whether the NERD tree window centers
when the cursor moves within a specified
distance to the top/bottom of the window.
|'NERDTreeAutoCenterThreshold'| Controls the sensitivity of autocentering.
|'NERDTreeCaseSensitiveSort'| Tells the NERD tree whether to be case
sensitive or not when sorting nodes.
|'NERDTreeSortHiddenFirst'| Tells the NERD tree whether to take the dot
at the beginning of the hidden file names
into account when sorting nodes.
|'NERDTreeChDirMode'| Tells the NERD tree if/when it should change
vim's current working directory.
@ -631,8 +633,13 @@ NERD tree. These options should be set in your vimrc.
|'NERDTreeIgnore'| Tells the NERD tree which files to ignore.
|'NERDTreeRespectWildIgnore'| Tells the NERD tree to respect |'wildignore'|.
|'NERDTreeBookmarksFile'| Where the bookmarks are stored.
|'NERDTreeBookmarksSort'| Whether the bookmarks list is sorted on
display.
|'NERDTreeMouseMode'| Tells the NERD tree how to handle mouse
clicks.
@ -667,8 +674,8 @@ NERD tree. These options should be set in your vimrc.
|'NERDTreeDirArrows'| Tells the NERD tree to use arrows instead of
+ ~ chars when displaying directories.
|'NERDTreeCasadeOpenSingleChildDir'|
Casade open while selected directory has only
|'NERDTreeCascadeOpenSingleChildDir'|
Cascade open while selected directory has only
one child that also is a directory.
|'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove
@ -686,15 +693,6 @@ If this plugin is making you feel homicidal, it may be a good idea to turn it
off with this line in your vimrc: >
let loaded_nerd_tree=1
<
------------------------------------------------------------------------------
*'NERDChristmasTree'*
Values: 0 or 1.
Default: 1.
If this option is set to 1 then some extra syntax highlighting elements are
added to the nerd tree to make it more colourful.
Set it to 0 for a more vanilla looking tree.
------------------------------------------------------------------------------
*'NERDTreeAutoCenter'*
@ -817,6 +815,13 @@ line: >
The file filters can be turned on and off dynamically with the |NERDTree-f|
mapping.
------------------------------------------------------------------------------
*'NERDTreeRespectWildIgnore'*
Values: 0 or 1.
Default: 0.
If set to 1, the |'wildignore'| setting is respected.
------------------------------------------------------------------------------
*'NERDTreeBookmarksFile'*
Values: a path
@ -824,6 +829,14 @@ Default: $HOME/.NERDTreeBookmarks
This is where bookmarks are saved. See |NERDTreeBookmarkCommands|.
------------------------------------------------------------------------------
*'NERDTreeBookmarksSort'*
Values: 0 or 1
Default: 1
If set to 0 then the bookmarks list is not sorted.
If set to 1 the bookmarks list is sorted.
------------------------------------------------------------------------------
*'NERDTreeMouseMode'*
Values: 1, 2 or 3.
@ -987,16 +1000,17 @@ option: >
<
------------------------------------------------------------------------------
*'NERDTreeCasadeOpenSingleChildDir'*
*'NERDTreeCascadeOpenSingleChildDir'*
Values: 0 or 1
Default: 1.
When opening dir nodes, this option tells NERDTree to recursively open dirs
that have only one child which is also a dir. NERDTree will stop when it finds
a dir that contains anything but another single dir. This option may be useful
for Java projects. Use one of the follow lines to set this option: >
let NERDTreeCasadeOpenSingleChildDir=0
let NERDTreeCasadeOpenSingleChildDir=1
a dir that contains anything but another single dir. This option also causes
the |NERDTree-x| mapping to close dirs in the same manner. This option may be
useful for Java projects. Use one of the follow lines to set this option: >
let NERDTreeCascadeOpenSingleChildDir=0
let NERDTreeCascadeOpenSingleChildDir=1
<
------------------------------------------------------------------------------
@ -1062,8 +1076,8 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()*
call NERDTreeAddKeyMap({
\ 'key': 'foo',
\ 'callback': 'NERDTreeCDHandler',
\ 'quickhelpText': 'echo full path of current node' })
\ 'scope': 'DirNode'
\ 'quickhelpText': 'echo full path of current node',
\ 'scope': 'DirNode' })
function! NERDTreeCDHandler(dirnode)
call a:dirnode.changeToDir()

View file

@ -19,7 +19,9 @@ function! s:Bookmark.AddBookmark(name, path)
endif
endfor
call add(s:Bookmark.Bookmarks(), s:Bookmark.New(a:name, a:path))
call s:Bookmark.Sort()
if g:NERDTreeBookmarksSort ==# 1
call s:Bookmark.Sort()
endif
endfunction
" FUNCTION: Bookmark.Bookmarks() {{{1
@ -101,7 +103,9 @@ function! s:Bookmark.CacheBookmarks(silent)
call nerdtree#echo(invalidBookmarksFound . " invalid bookmarks were read. See :help NERDTreeInvalidBookmarks for info.")
endif
endif
call s:Bookmark.Sort()
if g:NERDTreeBookmarksSort ==# 1
call s:Bookmark.Sort()
endif
endif
endfunction

View file

@ -279,8 +279,8 @@ function! s:Creator._setCommonBufOptions()
let b:NERDTreeShowFiles = g:NERDTreeShowFiles
let b:NERDTreeShowHidden = g:NERDTreeShowHidden
let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks
setfiletype nerdtree
call self._bindMappings()
setlocal filetype=nerdtree
endfunction
"FUNCTION: s:Creator._setupStatusline() {{{1

View file

@ -90,7 +90,7 @@ endfunction
"callback
function! s:MenuItem.execute()
if len(self.children)
let mc = s:MenuController.New(self.children)
let mc = g:NERDTreeMenuController.New(self.children)
call mc.showMenu()
else
if self.callback != -1

View file

@ -103,6 +103,10 @@ function! s:Path.compareTo(path)
elseif thisSS > thatSS
return 1
else
if !g:NERDTreeSortHiddenFirst
let thisPath = substitute(thisPath, '^[._]', '', '')
let thatPath = substitute(thatPath, '^[._]', '', '')
endif
"if the sort sequences are the same then compare the paths
"alphabetically
let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath <? thatPath
@ -141,6 +145,7 @@ function! s:Path.Create(fullpath)
"assume its a file and create
else
call s:Path.createParentDirectories(a:fullpath)
call writefile([], a:fullpath)
endif
catch
@ -161,6 +166,8 @@ function! s:Path.copy(dest)
throw "NERDTree.CopyingNotSupportedError: Copying is not supported on this OS"
endif
call s:Path.createParentDirectories(a:dest)
let dest = s:Path.WinToUnixPath(a:dest)
let cmd = g:NERDTreeCopyCmd . " " . escape(self.str(), nerdtree#escChars()) . " " . escape(dest, nerdtree#escChars())
@ -197,6 +204,20 @@ function! s:Path.copyingWillOverwrite(dest)
endif
endfunction
"FUNCTION: Path.createParentDirectories(path) {{{1
"
"create parent directories for this path if needed
"without throwing any errors is those directories already exist
"
"Args:
"path: full path of the node whose parent directories may need to be created
function! s:Path.createParentDirectories(path)
let dir_path = fnamemodify(a:path, ':h')
if !isdirectory(dir_path)
call mkdir(dir_path, 'p')
endif
endfunction
"FUNCTION: Path.delete() {{{1
"
"Deletes the file represented by this path.

View file

@ -229,7 +229,7 @@ function! s:TreeDirNode._initChildren(silent)
let globDir = dir.str({'format': 'Glob'})
if version >= 703
let filesStr = globpath(globDir, '*', 1) . "\n" . globpath(globDir, '.*', 1)
let filesStr = globpath(globDir, '*', !g:NERDTreeRespectWildIgnore) . "\n" . globpath(globDir, '.*', !g:NERDTreeRespectWildIgnore)
else
let filesStr = globpath(globDir, '*') . "\n" . globpath(globDir, '.*')
endif
@ -500,7 +500,7 @@ function! s:TreeDirNode.toggleOpen(...)
if self.isOpen ==# 1
call self.close()
else
if g:NERDTreeCasadeOpenSingleChildDir == 0
if g:NERDTreeCascadeOpenSingleChildDir == 0
call self.open(opts)
else
call self.openAlong(opts)

View file

@ -82,13 +82,14 @@ endfunction
function! s:promptToRenameBuffer(bufnum, msg, newFileName)
echo a:msg
if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
let quotedFileName = "'" . a:newFileName . "'"
" 1. ensure that a new buffer is loaded
exec "badd " . a:newFileName
exec "badd " . quotedFileName
" 2. ensure that all windows which display the just deleted filename
" display a buffer for a new filename.
let s:originalTabNumber = tabpagenr()
let s:originalWindowNumber = winnr()
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec ':e! " . a:newFileName . "' | endif"
exec "tabdo windo if winbufnr(0) == " . a:bufnum . " | exec \":e! " . quotedFileName . "\" | endif"
exec "tabnext " . s:originalTabNumber
exec s:originalWindowNumber . "wincmd w"
" 3. We don't need a previous buffer anymore
@ -114,7 +115,10 @@ function! NERDTreeAddNode()
let parentNode = b:NERDTreeRoot.findNode(newPath.getParent())
let newTreeNode = g:NERDTreeFileNode.New(newPath)
if parentNode.isOpen || !empty(parentNode.children)
if empty(parentNode)
call b:NERDTreeRoot.refresh()
call nerdtree#renderView()
elseif parentNode.isOpen || !empty(parentNode.children)
call parentNode.addChild(newTreeNode, 1)
call NERDTreeRender()
call newTreeNode.putCursorHere(1, 0)
@ -138,7 +142,7 @@ function! NERDTreeMoveNode()
endif
try
let bufnum = bufnr(curNode.path.str())
let bufnum = bufnr("^".curNode.path.str()."$")
call curNode.rename(newNodePath)
call NERDTreeRender()
@ -186,7 +190,7 @@ function! NERDTreeDeleteNode()
"if the node is open in a buffer, ask the user if they want to
"close that buffer
let bufnum = bufnr(currentNode.path.str())
let bufnum = bufnr("^".currentNode.path.str()."$")
if buflisted(bufnum)
let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
call s:promptToDelBuffer(bufnum, prompt)
@ -224,7 +228,10 @@ function! NERDTreeCopyNode()
if confirmed
try
let newNode = currentNode.copy(newNodePath)
if !empty(newNode)
if empty(newNode)
call b:NERDTreeRoot.refresh()
call nerdtree#renderView()
else
call NERDTreeRender()
call newNode.putCursorHere(0, 0)
endif

View file

@ -45,28 +45,30 @@ function! s:initVariable(var, value)
endfunction
"SECTION: Init variable calls and other random constants {{{2
call s:initVariable("g:NERDChristmasTree", 1)
call s:initVariable("g:NERDTreeAutoCenter", 1)
call s:initVariable("g:NERDTreeAutoCenterThreshold", 3)
call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
call s:initVariable("g:NERDTreeChDirMode", 0)
call s:initVariable("g:NERDTreeMinimalUI", 0)
if !exists("g:NERDTreeIgnore")
let g:NERDTreeIgnore = ['\~$']
endif
call s:initVariable("g:NERDTreeBookmarksFile", expand('$HOME') . '/.NERDTreeBookmarks')
call s:initVariable("g:NERDTreeBookmarksSort", 1)
call s:initVariable("g:NERDTreeHighlightCursorline", 1)
call s:initVariable("g:NERDTreeHijackNetrw", 1)
call s:initVariable("g:NERDTreeMouseMode", 1)
call s:initVariable("g:NERDTreeNotificationThreshold", 100)
call s:initVariable("g:NERDTreeQuitOnOpen", 0)
call s:initVariable("g:NERDTreeRespectWildIgnore", 0)
call s:initVariable("g:NERDTreeShowBookmarks", 0)
call s:initVariable("g:NERDTreeShowFiles", 1)
call s:initVariable("g:NERDTreeShowHidden", 0)
call s:initVariable("g:NERDTreeShowLineNumbers", 0)
call s:initVariable("g:NERDTreeSortDirs", 1)
call s:initVariable("g:NERDTreeDirArrows", !nerdtree#runningWindows())
call s:initVariable("g:NERDTreeCasadeOpenSingleChildDir", 1)
call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1)
if !exists("g:NERDTreeSortOrder")
let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']

View file

@ -7,38 +7,54 @@ syn match NERDTreeFlag #\[RO\]#
"highlighting for the .. (up dir) line at the top of the tree
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
"highlighting for the ~/+ symbols for the directory nodes
syn match NERDTreeClosable #\~\<#
syn match NERDTreeClosable #\~\.#
syn match NERDTreeOpenable #+\<#
syn match NERDTreeOpenable #+\.#he=e-1
"highlighting for the tree structural parts
syn match NERDTreePart #|#
syn match NERDTreePart #`#
syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
"quickhelp syntax elements
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#ms=s+2,me=e-1
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#ms=s+2,me=e-1
syn match NERDTreeHelpTitle #" .*\~#ms=s+2,me=e-1
syn match NERDTreeToggleOn #(on)#ms=s+1,he=e-1
syn match NERDTreeToggleOff #(off)#ms=e-3,me=e-1
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
"highlighting for readonly files
syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
"highlighting for sym links
syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
syn match NERDTreeLinkTarget #->.*# containedin=NERDTreeDir,NERDTreeFile
syn match NERDTreeLinkFile #.* ->#me=e-3 containedin=NERDTreeFile
syn match NERDTreeLinkDir #.*/ ->#me=e-3 containedin=NERDTreeDir
"highlighing for directory nodes and file nodes
syn match NERDTreeDirSlash #/#
syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
if g:NERDTreeDirArrows
syn match NERDTreeClosable #▾# containedin=NERDTreeDir,NERDTreeFile
syn match NERDTreeOpenable #▸# containedin=NERDTreeDir,NERDTreeFile
syn match NERDTreeDir #[^▾▸ ].*/#
syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark
syn match NERDTreeFile #^[^"\.▾▸] *[^▾▸]*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile
"highlighting for readonly files
syn match NERDTreeRO # *\zs.*\ze \[RO\]# contains=NERDTreeFlag,NERDTreeBookmark,NERDTreeFile
else
"highlighting for the ~/+ symbols for the directory nodes
syn match NERDTreeClosable #\~\<#
syn match NERDTreeClosable #\~\.#
syn match NERDTreeOpenable #+\<#
syn match NERDTreeOpenable #+\.#he=e-1
"highlighting for the tree structural parts
syn match NERDTreePart #|#
syn match NERDTreePart #`#
syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeOpenable,NERDTreeClosable
syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreePartFile,NERDTreeBookmark
syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
"highlighting for readonly files
syn match NERDTreeRO #|-.*\[RO\]#he=e-5 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
endif
syn match NERDTreeCWD #^[</].*$#
"highlighting for bookmarks
@ -50,19 +66,10 @@ syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmark
syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
if exists("g:NERDChristmasTree") && g:NERDChristmasTree
hi def link NERDTreePart Special
hi def link NERDTreePartFile Type
hi def link NERDTreeFile Normal
hi def link NERDTreeExecFile Title
hi def link NERDTreeDirSlash Identifier
hi def link NERDTreeClosable Type
else
hi def link NERDTreePart Normal
hi def link NERDTreePartFile Normal
hi def link NERDTreeFile Normal
hi def link NERDTreeClosable Title
endif
hi def link NERDTreePart Special
hi def link NERDTreePartFile Type
hi def link NERDTreeExecFile Title
hi def link NERDTreeDirSlash Identifier
hi def link NERDTreeBookmarksHeader statement
hi def link NERDTreeBookmarksLeader ignore
@ -76,11 +83,16 @@ hi def link NERDTreeHelpTitle Macro
hi def link NERDTreeToggleOn Question
hi def link NERDTreeToggleOff WarningMsg
hi def link NERDTreeLinkTarget Type
hi def link NERDTreeLinkFile Macro
hi def link NERDTreeLinkDir Macro
hi def link NERDTreeDir Directory
hi def link NERDTreeUp Directory
hi def link NERDTreeFile Normal
hi def link NERDTreeCWD Statement
hi def link NERDTreeLink Macro
hi def link NERDTreeOpenable Title
hi def link NERDTreeClosable Title
hi def link NERDTreeFlag ignore
hi def link NERDTreeRO WarningMsg
hi def link NERDTreeBookmark Statement

View file

@ -1,49 +1,105 @@
# Bug reports / Github issues
# CONTRIBUTING
- - -
1\. [Bug reports / GitHub issues](#bugreps)
2\. [Submitting a patch](#patches)
3\. [General style notes](#generalstyle)
4\. [Syntax checker notes](#checkerstyle)
- - -
When reporting a bug make sure you search the existing github issues for the
same/similar issues. If you find one, feel free to add a `+1` comment with any
additional information that may help us solve the issue.
<a name="bugreps"></a>
## 1. Bug reports / GitHub issues
Please note that the preferred channel for posting bug reports is the
[issue tracker at GitHub][0]. Reports posted elsewhere are less likely
to be seen by the core team.
When reporting a bug make sure you search the existing GitHub issues
for the same/similar issues. If you find one, feel free to add a `+1`
comment with any additional information that may help us solve the
issue.
When creating a new issue be sure to state the following:
* Steps to reproduce the bug.
* The version of vim you are using.
* The version of syntastic you are using.
* steps to reproduce the bug;
* the version of Vim you are using (run `:ver` to find out);
* the version of syntastic you are using (see `:SyntasticInfo`).
For syntax checker bugs also state the version of the checker executable that you are using.
For syntax checker bugs also state the version of the checker executable
that you are using. Adding debugging information is typically useful
too:
# Submitting a patch
* open a file handled by your checker;
* set `g:syntastic_debug` to 1 or 3;
* run the checker;
* copy the output of `:mes`.
* Fork the repo on github
* Make a [topic branch](https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches) and start hacking
* Submit a pull request based off your topic branch
<a name="patches"></a>
Small focused patches are preferred.
## 2. Submitting a patch
Large changes to the code should be discussed with the core team first. Create an issue and explain your plan and see what we say.
Before you consider adding features to syntastic, _please_ spend a few
minutes (re-)reading the latest version of the [manual][1]. Syntastic
is changing rapidly at times, and it's quite possible that some of the
features you want to add exist already.
# General style notes
To submit a patch:
Following the coding conventions/styles used in the syntastic core:
* fork the [repo][2] on GitHub;
* make a [topic branch][3] and start hacking;
* submit a pull request based off your topic branch.
* Use 4 space indents.
* Don't use abbreviated keywords - e.g. use `endfunction`, not `endfun` (there's always room for more fun!).
* Don't use `l:` prefixes for variables unless actually required (i.e. almost never).
* Code for maintainability. We would rather a function be a couple of lines longer and have (for example) some [explaining variables](http://www.refactoring.com/catalog/extractVariable.html) to aid readability.
Small, focused patches are preferred.
# Syntax checker style notes
Large changes to the code should be discussed with the core team first.
Create an issue and explain your plan and see what we say.
The preferred style for error format strings is one "clause" per line. E.g.
(from the coffeelint checker):
Also make sure to update the manual whenever applicable. Nobody can use
features that aren't documented.
```viml
let errorformat = '%E%f:%l:%c: %trror: %m,' .
\ 'Syntax%trror: In %f\, %m on line %l,' .
\ '%EError: In %f\, Parse error on line %l: %m,' .
\ '%EError: In %f\, %m on line %l,' .
\ '%W%f(%l): lint warning: %m,' .
\ '%W%f(%l): warning: %m,' .
\ '%E%f(%l): SyntaxError: %m,' .
\ '%-Z%p^,' .
\ '%-G%.%#'
<a name="generalstyle"></a>
## 3. General style notes
Follow the coding conventions/styles used in the syntastic core:
* use 4 space indents;
* don't use abbreviated keywords - e.g. use `endfunction`, not `endfun`
(there's always room for more fun!);
* don't use `l:` prefixes for variables unless actually required (i.e.
almost never);
* code for maintainability; we would rather a function be a couple of
lines longer and have (for example) some [explaining variables][4] to
aid readability.
<a name="checkerstyle"></a>
## 4. Syntax checker notes
Make sure to read the [guide][5] if you plan to add new syntax checkers.
Use the existing checkers as templates, rather than writing everything
from scratch.
The preferred style for error format strings is one "clause" per line.
E.g. (from the `coffee` checker):
```vim
let errorformat =
\ '%E%f:%l:%c: %trror: %m,' .
\ 'Syntax%trror: In %f\, %m on line %l,' .
\ '%EError: In %f\, Parse error on line %l: %m,' .
\ '%EError: In %f\, %m on line %l,' .
\ '%W%f(%l): lint warning: %m,' .
\ '%W%f(%l): warning: %m,' .
\ '%E%f(%l): SyntaxError: %m,' .
\ '%-Z%p^,' .
\ '%-G%.%#'
```
[0]: https://github.com/scrooloose/syntastic/issues
[1]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt
[2]: https://github.com/scrooloose/syntastic
[3]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches
[4]: http://www.refactoring.com/catalog/extractVariable.html
[5]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide

View file

@ -35,16 +35,16 @@ the user is notified and is happy because they didn't have to compile their
code or execute their script to find them.
At the time of this writing, syntax checking plugins exist for ActionScript,
Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bourne shell, C, C++, C#, Chef,
CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir,
Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe,
Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal,
Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust,
Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe,
Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP,
LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++,
OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and iOS property
lists, Puppet, Python, Racket, R, reStructuredText, Ruby, Rust, SASS/SCSS,
Scala, Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL,
xHtml, XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh. See the
[wiki][3] for details about the corresponding supported checkers.
lists, Puppet, Python, Racket, R, reStructuredText, Ruby, SASS/SCSS, Scala,
Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml,
XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3]
for details about the corresponding supported checkers.
Below is a screenshot showing the methods that Syntastic uses to display syntax
errors. Note that, in practise, you will only have a subset of these methods
@ -76,9 +76,8 @@ First I'll show you how to install Tim Pope's [pathogen][1] so that it's easy to
install syntastic. Do this in your terminal so that you get the `pathogen.vim`
file and the directories it needs:
```sh
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -so ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
```
Next you *need* to add this to your `~/.vimrc`:
```vim
@ -92,7 +91,7 @@ execute pathogen#infect()
You now have pathogen installed and can put syntastic into `~/.vim/bundle` like
this:
```sh
cd ~/.vim/bundle
cd ~/.vim/bundle && \
git clone https://github.com/scrooloose/syntastic.git
```
Quit vim and start it back up to reload it, then type:
@ -143,6 +142,14 @@ still producing useful results, the checker is now disabled by default. To
let g:syntastic_enable_perl_checker = 1
```
<a name="faqrust"></a>
__Q. What happened to the `rustc` checker?__
A. It has been included in the [Rust compiler package][12]. If you have
a recent version of the Rust compiler, the checker should be picked up
automatically by syntastic.
<a name="faqloclist"></a>
__Q. I run a checker and the location list is not updated...__
@ -272,8 +279,10 @@ cabbrev <silent> bd lclose\|bdelete
## 4\. Other resources
The preferred place for posting suggestions, reporting bugs, and general
discussions related to syntastic is the [issue tracker at GitHub][4]. There
are also a [google group][5], and a [syntastic tag at StackOverflow][6].
discussions related to syntastic is the [issue tracker at GitHub][4].
A guide for writing syntax checkers can be found in the [wiki][11].
There are also a dedicated [google group][5], and a
[syntastic tag at StackOverflow][6].
Syntastic aims to provide a common interface to syntax checkers for as many
languages as possible. For particular languages, there are, of course, other
@ -291,3 +300,5 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9].
[8]: https://github.com/klen/python-mode
[9]: http://valloric.github.io/YouCompleteMe/
[10]: http://perldoc.perl.org/perlrun.html#*-c*
[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide
[12]: https://github.com/rust-lang/rust/

View file

@ -180,7 +180,7 @@ endfunction " }}}2
function! s:getIncludeDirs(filetype) " {{{2
let include_dirs = []
if a:filetype =~# '\v^%(c|cpp|d|objc|objcpp)$' &&
if a:filetype =~# '\v^%(c|cpp|objc|objcpp)$' &&
\ (!exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') ||
\ !g:syntastic_{a:filetype}_no_default_include_dirs)
let include_dirs = copy(s:default_includes)

View file

@ -6,7 +6,7 @@ let g:loaded_syntastic_log_autoload = 1
let s:save_cpo = &cpo
set cpo&vim
let s:deprecation_notices_issued = []
let s:one_time_notices_issued = []
" Public functions {{{1
@ -27,15 +27,39 @@ function! syntastic#log#error(msg) " {{{2
echohl None
endfunction " }}}2
function! syntastic#log#deprecationWarn(msg) " {{{2
if index(s:deprecation_notices_issued, a:msg) >= 0
function! syntastic#log#oneTimeWarn(msg) " {{{2
if index(s:one_time_notices_issued, a:msg) >= 0
return
endif
call add(s:deprecation_notices_issued, a:msg)
call add(s:one_time_notices_issued, a:msg)
call syntastic#log#warn(a:msg)
endfunction " }}}2
" @vimlint(EVL102, 1, l:OLD_VAR)
function! syntastic#log#deprecationWarn(old, new, ...) " {{{2
if exists('g:syntastic_' . a:old) && !exists('g:syntastic_' . a:new)
let msg = 'variable g:syntastic_' . a:old . ' is deprecated, please use '
if a:0
let OLD_VAR = g:syntastic_{a:old}
try
let NEW_VAR = eval(a:1)
let msg .= 'in its stead: let g:syntastic_' . a:new . ' = ' . string(NEW_VAR)
let g:syntastic_{a:new} = NEW_VAR
catch
let msg .= 'g:syntastic_' . a:new . ' instead'
endtry
else
let msg .= 'g:syntastic_' . a:new . ' instead'
let g:syntastic_{a:new} = g:syntastic_{a:old}
endif
call syntastic#log#oneTimeWarn(msg)
endif
endfunction " }}}2
" @vimlint(EVL102, 0, l:OLD_VAR)
function! syntastic#log#debug(level, msg, ...) " {{{2
if !s:isDebugEnabled(a:level)
return
@ -113,6 +137,7 @@ function! s:isDebugEnabled_dumb(level) " {{{2
endfunction " }}}2
let s:isDebugEnabled = function(exists('*and') ? 's:isDebugEnabled_smart' : 's:isDebugEnabled_dumb')
lockvar s:isDebugEnabled
function! s:logRedirect(on) " {{{2
if exists("g:syntastic_debug_file")
@ -138,6 +163,7 @@ function! s:logTimestamp_dumb() " {{{2
endfunction " }}}2
let s:logTimestamp = function(has('reltime') ? 's:logTimestamp_smart' : 's:logTimestamp_dumb')
lockvar s:logTimestamp
function! s:formatVariable(name) " {{{2
let vals = []

View file

@ -14,6 +14,8 @@ function! syntastic#postprocess#compressWhitespace(errors) " {{{2
let e['text'] = substitute(e['text'], "\001", '', 'g')
let e['text'] = substitute(e['text'], '\n', ' ', 'g')
let e['text'] = substitute(e['text'], '\m\s\{2,}', ' ', 'g')
let e['text'] = substitute(e['text'], '\m^\s\+', '', '')
let e['text'] = substitute(e['text'], '\m\s\+$', '', '')
endfor
return a:errors

View file

@ -8,6 +8,26 @@ set cpo&vim
" Public functions {{{1
function! syntastic#preprocess#cabal(errors) " {{{2
let out = []
let star = 0
for err in a:errors
if star
if err == ''
let star = 0
else
let out[-1] .= ' ' . err
endif
else
call add(out, err)
if err =~ '\m^*\s'
let star = 1
endif
endif
endfor
return out
endfunction " }}}2
function! syntastic#preprocess#checkstyle(errors) " {{{2
let out = []
let fname = expand('%')
@ -95,6 +115,10 @@ function! syntastic#preprocess#rparse(errors) " {{{2
return out
endfunction " }}}2
function! syntastic#preprocess#tslint(errors) " {{{2
return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")')
endfunction " }}}2
function! syntastic#preprocess#validator(errors) " {{{2
let out = []
for e in a:errors

View file

@ -88,6 +88,7 @@ endfunction " }}}2
" strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen()
" and hope for the best :)
let s:width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
lockvar s:width
"print as much of a:msg as possible without "Press Enter" prompt appearing
function! syntastic#util#wideMsg(msg) " {{{2

View file

@ -38,9 +38,10 @@ CONTENTS *syntastic-contents*
6.1.Handling of composite filetypes........|syntastic-composite|
6.2.Interaction with python-mode...........|syntastic-pymode|
6.3.Interaction with the fish shell........|syntastic-fish|
6.4.Using syntastic with the fizsh shell...|syntastic-fizsh|
6.5.Interaction with Eclim.................|syntastic-eclim|
6.6.Interaction with vim-virtualenv........|syntastic-vim-virtualenv|
6.4.Interaction with PowerShell............|syntastic-powershell|
6.5.Using syntastic with the fizsh shell...|syntastic-fizsh|
6.6.Interaction with Eclim.................|syntastic-eclim|
6.7.Interaction with vim-virtualenv........|syntastic-vim-virtualenv|
7.About........................................|syntastic-about|
8.License......................................|syntastic-license|
@ -83,7 +84,7 @@ see |syntastic-checker-options| for details. You can also change the arguments
passed to a specific checker as well.
Use |:SyntasticCheck| to manually check right now. Use |:SyntasticToggleMode|
to switch between active (checking on writting the buffer) and passive (manual)
to switch between active (checking on writing the buffer) and passive (manual)
checking.
==============================================================================
@ -93,7 +94,7 @@ Syntax checking can be done automatically or on demand (see
|'syntastic_mode_map'| and |:SyntasticToggleMode| for configuring this).
When syntax checking is done, the features below can be used to notify the
user of errors. See |syntastic-options| for how to configure and
user of errors. See |syntastic-global-options| for how to configure and
activate/deactivate these features.
* A statusline flag
@ -169,6 +170,8 @@ and the SpellCap group is used for warnings. If you wish to customize the
colors for highlighting you can use the following groups:
SyntasticError - Links to 'SpellBad' by default
SyntasticWarning - Links to 'SpellCap' by default
SyntasticStyleError - Links to SyntasticError by default
SyntasticStyleWarning - Links to SyntasticWarning by default
Example: >
highlight SyntasticError guibg=#2f0000
@ -288,10 +291,12 @@ to label error messages with the names of the checkers that created them. >
<
*'syntastic_sort_aggregated_errors'*
Default: 1
By default, when |syntastic_aggregate_errors| is enabled, errors are grouped
by file, then sorted by line number, then grouped by type (namely, errors take
precedence over warnings), then they are sorted by column number. If you want
to leave messages grouped by checker output, set this variable to 0. >
By default, when results from multiple checkers are aggregated in a single
error list (that is either when |syntastic_aggregate_errors| is enabled, or
when checking a file with a composite filetype), errors are grouped by file,
then sorted by line number, then grouped by type (namely errors take precedence
over warnings), then they are sorted by column number. If you want to leave
messages grouped by checker output, set this variable to 0. >
let g:syntastic_sort_aggregated_errors = 0
<
*'syntastic_echo_current_error'*
@ -593,7 +598,7 @@ Checkers that use 'makeprgBuild()' construct a 'makeprg' like this: >
\ 'tail': '> /tmp/output' })
<
The result is a 'makeprg' of the form: >
<exe> <args> <filename> <post_args> <tail>
<exe> <args> <fname> <post_args> <tail>
<
*'syntastic_<filetype>_<checker>_exe'*
All arguments above are optional, and can be overridden by setting global
@ -666,7 +671,16 @@ traditional shell, such as 'zsh', 'bash', 'ksh', or even the original Bourne
set shell=bash
<
------------------------------------------------------------------------------
6.4. Using syntastic with the fizsh shell *syntastic-fizsh*
6.4. Interaction with PowerShell *syntastic-powershell*
At the time of this writing, syntastic is not compatible with using 'Windows
PowerShell' (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's
'shell'. You may still run Vim from 'PowerShell', but you do have to point
Vim's 'shell' to a more traditional program, such as 'cmd.exe': >
set shell=cmd.exe
<
------------------------------------------------------------------------------
6.5. Using syntastic with the fizsh shell *syntastic-fizsh*
Using syntastic with the 'fizsh' shell (see https://github.com/zsh-users/fizsh)
is possible, but potentially problematic. In order to do it you'll need to set
@ -679,7 +693,7 @@ interactive features of 'fizsh'. Using a more traditional shell such as 'zsh',
set shell=zsh
<
------------------------------------------------------------------------------
6.5. Interaction with Eclim *syntastic-eclim*
6.6. Interaction with Eclim *syntastic-eclim*
As far as syntastic is concerned there shouldn't be any compatibility problems
with the 'Eclim' Vim plugin (see http://eclim.org/). However, at the time of
@ -688,7 +702,7 @@ makes syntastic forget some of its configuration parameters. No solutions or
workarounds are known for now.
------------------------------------------------------------------------------
6.6. Interaction with vim-virtualenv *syntastic-vim-virtualenv*
6.7. Interaction with vim-virtualenv *syntastic-vim-virtualenv*
At the time of this writing, syntastic can't run checkers installed
in Python virtual environments activated by 'vim-virtualenv' (see

View file

@ -16,9 +16,11 @@ let g:loaded_syntastic_plugin = 1
if has('reltime')
let g:syntastic_start = reltime()
lockvar! g:syntastic_start
endif
let g:syntastic_version = '3.4.0-34'
let g:syntastic_version = '3.4.0-90'
lockvar g:syntastic_version
" Sanity checks {{{1
@ -30,6 +32,8 @@ for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands'
endfor
let s:running_windows = syntastic#util#isRunningWindows()
lockvar s:running_windows
if !s:running_windows && executable('uname')
try
let s:uname = system('uname')
@ -37,6 +41,7 @@ if !s:running_windows && executable('uname')
call syntastic#log#error("your shell " . &shell . " doesn't use traditional UNIX syntax for redirections")
finish
endtry
lockvar s:uname
endif
" }}}1
@ -70,6 +75,7 @@ let g:syntastic_defaults = {
\ 'style_warning_symbol': 'S>',
\ 'warning_symbol': '>>'
\ }
lockvar! g:syntastic_defaults
for s:key in keys(g:syntastic_defaults)
if !exists('g:syntastic_' . s:key)
@ -78,7 +84,7 @@ for s:key in keys(g:syntastic_defaults)
endfor
if exists("g:syntastic_quiet_warnings")
call syntastic#log#deprecationWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead")
call syntastic#log#oneTimeWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead")
if g:syntastic_quiet_warnings
let s:quiet_warnings = get(g:syntastic_quiet_messages, 'type', [])
if type(s:quiet_warnings) != type([])
@ -106,13 +112,19 @@ let s:debug_dump_options = [
if v:version > 703 || (v:version == 703 && has('patch446'))
call add(s:debug_dump_options, 'shellxescape')
endif
lockvar! s:debug_dump_options
" debug constants
let g:SyntasticDebugTrace = 1
let g:SyntasticDebugLoclist = 2
let g:SyntasticDebugNotifications = 4
let g:SyntasticDebugAutocommands = 8
let g:SyntasticDebugVariables = 16
let g:SyntasticDebugTrace = 1
lockvar g:SyntasticDebugTrace
let g:SyntasticDebugLoclist = 2
lockvar g:SyntasticDebugLoclist
let g:SyntasticDebugNotifications = 4
lockvar g:SyntasticDebugNotifications
let g:SyntasticDebugAutocommands = 8
lockvar g:SyntasticDebugAutocommands
let g:SyntasticDebugVariables = 16
lockvar g:SyntasticDebugVariables
" }}}1
@ -130,7 +142,7 @@ let s:modemap = g:SyntasticModeMap.Instance()
function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) " {{{2
let checker_names = []
for ft in s:resolveFiletypes()
call extend(checker_names, keys(s:registry.getCheckersMap(ft)))
call extend(checker_names, s:registry.getNamesOfAvailableCheckers(ft))
endfor
return join(checker_names, "\n")
endfunction " }}}2
@ -169,11 +181,6 @@ command! SyntasticSetLoclist call g:SyntasticLoclist.current().setloclist()
augroup syntastic
autocmd BufReadPost * call s:BufReadPostHook()
autocmd BufWritePost * call s:BufWritePostHook()
autocmd BufWinEnter * call s:BufWinEnterHook()
" TODO: the next autocmd should be "autocmd BufWinLeave * if &buftype == '' | lclose | endif"
" but in recent versions of Vim lclose can no longer be called from BufWinLeave
autocmd BufEnter * call s:BufEnterHook()
augroup END
@ -198,24 +205,22 @@ function! s:BufWritePostHook() " {{{2
call s:UpdateErrors(1)
endfunction " }}}2
function! s:BufWinEnterHook() " {{{2
call syntastic#log#debug(g:SyntasticDebugAutocommands,
\ 'autocmd: BufWinEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) .
\ ', &buftype = ' . string(&buftype))
if &buftype == ''
call s:notifiers.refresh(g:SyntasticLoclist.current())
endif
endfunction " }}}2
function! s:BufEnterHook() " {{{2
call syntastic#log#debug(g:SyntasticDebugAutocommands,
\ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) .
\ ', &buftype = ' . string(&buftype))
" TODO: at this point there is no b:syntastic_loclist
let loclist = filter(getloclist(0), 'v:val["valid"] == 1')
let buffers = syntastic#util#unique(map( loclist, 'v:val["bufnr"]' ))
if &buftype == 'quickfix' && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
call g:SyntasticLoclistHide()
if &buftype == ''
call s:notifiers.refresh(g:SyntasticLoclist.current())
elseif &buftype == 'quickfix'
" TODO: this is needed because in recent versions of Vim lclose
" can no longer be called from BufWinLeave
" TODO: at this point there is no b:syntastic_loclist
let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1')
let owner = str2nr(getbufvar(bufnr(""), 'syntastic_owner_buffer'))
let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : []))
if !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
call SyntasticLoclistHide()
endif
endif
endfunction " }}}2
@ -223,7 +228,7 @@ function! s:QuitPreHook() " {{{2
call syntastic#log#debug(g:SyntasticDebugAutocommands,
\ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
let b:syntastic_skip_checks = !g:syntastic_check_on_wq
call g:SyntasticLoclistHide()
call SyntasticLoclistHide()
endfunction " }}}2
" }}}1
@ -278,7 +283,7 @@ endfunction " }}}2
"clear the loc list for the buffer
function! s:ClearCache() " {{{2
call s:notifiers.reset(g:SyntasticLoclist.current())
unlet! b:syntastic_loclist
call b:syntastic_loclist.destroy()
endfunction " }}}2
"detect and cache all syntax errors in this buffer
@ -296,8 +301,8 @@ function! s:CacheErrors(checker_names) " {{{2
" }}}3
let filetypes = s:resolveFiletypes()
let aggregate_errors = syntastic#util#var('aggregate_errors')
let decorate_errors = (aggregate_errors || len(filetypes) > 1) && syntastic#util#var('id_checkers')
let aggregate_errors = syntastic#util#var('aggregate_errors') || len(filetypes) > 1
let decorate_errors = aggregate_errors && syntastic#util#var('id_checkers')
let sort_aggregated_errors = aggregate_errors && syntastic#util#var('sort_aggregated_errors')
let clist = []
@ -306,8 +311,15 @@ function! s:CacheErrors(checker_names) " {{{2
endfor
let names = []
let unavailable_checkers = 0
for checker in clist
let cname = checker.getFiletype() . '/' . checker.getName()
if !checker.isAvailable()
call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Checker ' . cname . ' is not available')
let unavailable_checkers += 1
continue
endif
call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Invoking checker: ' . cname)
let loclist = checker.getLocList()
@ -317,6 +329,10 @@ function! s:CacheErrors(checker_names) " {{{2
call loclist.decorate(cname)
endif
call add(names, cname)
if checker.getWantSort() && !sort_aggregated_errors
call loclist.sort()
call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', loclist)
endif
let newLoclist = newLoclist.extend(loclist)
@ -340,7 +356,7 @@ function! s:CacheErrors(checker_names) " {{{2
" }}}3
" issue warning about no active checkers {{{3
if empty(clist)
if len(clist) == unavailable_checkers
if !empty(a:checker_names)
if len(a:checker_names) == 1
call syntastic#log#warn('checker ' . a:checker_names[0] . ' is not available')
@ -360,7 +376,8 @@ function! s:CacheErrors(checker_names) " {{{2
endif
endif
let b:syntastic_loclist = newLoclist
call newLoclist.setOwner(bufnr(''))
call newLoclist.deploy()
endfunction " }}}2
function! s:ToggleMode() " {{{2
@ -550,6 +567,7 @@ endfunction " }}}2
function! s:uname() " {{{2
if !exists('s:uname')
let s:uname = system('uname')
lockvar s:uname
endif
return s:uname
endfunction " }}}2

View file

@ -69,7 +69,6 @@ function! g:SyntasticChecker.getLocListRaw() " {{{2
call self._populateHighlightRegexes(list)
call syntastic#log#debug(g:SyntasticDebugLoclist, name . ' raw:', list)
call self._quietMessages(list)
call self._sortMessages(list)
return list
endfunction " }}}2
@ -99,7 +98,10 @@ function! g:SyntasticChecker.makeprgBuild(opts) " {{{2
endfunction " }}}2
function! g:SyntasticChecker.isAvailable() " {{{2
return self._isAvailableFunc()
if !has_key(self, '_available')
let self._available = self._isAvailableFunc()
endif
return self._available
endfunction " }}}2
" }}}1
@ -131,20 +133,12 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2
endif
endfunction " }}}2
function! g:SyntasticChecker._sortMessages(errors) " {{{2
" don't sort now if we're going to sort the aggregated list later
if self._sort && !(syntastic#util#var('aggregate_errors') && syntastic#util#var('sort_aggregated_errors'))
call syntastic#util#sortLoclist(a:errors)
call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', a:errors)
endif
endfunction " }}}2
function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2
if has_key(self, '_highlightRegexFunc')
for e in a:errors
if e['valid']
let term = self._highlightRegexFunc(e)
if len(term) > 0
if term != ''
let e['hl'] = term
endif
endif

View file

@ -22,7 +22,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
let b:syntastic_messages = copy(a:loclist.messages(bufnr('')))
let b:oldLine = -1
autocmd! syntastic CursorMoved
autocmd syntastic CursorMoved * call g:SyntasticRefreshCursor()
autocmd syntastic CursorMoved * call SyntasticRefreshCursor()
endif
endfunction " }}}2
@ -40,7 +40,7 @@ endfunction " }}}2
" Private methods {{{1
" The following defensive nonsense is needed because of the nature of autocmd
function! g:SyntasticRefreshCursor() " {{{2
function! SyntasticRefreshCursor() " {{{2
if !exists('b:syntastic_messages') || empty(b:syntastic_messages)
" file not checked
return

View file

@ -5,6 +5,7 @@ let g:loaded_syntastic_notifier_highlighting = 1
" Highlighting requires getmatches introduced in 7.1.040
let s:has_highlighting = v:version > 701 || (v:version == 701 && has('patch040'))
lockvar s:has_highlighting
let g:SyntasticHighlightingNotifier = {}
@ -18,6 +19,7 @@ function! g:SyntasticHighlightingNotifier.New() " {{{2
if !s:setup_done
call self._setup()
let s:setup_done = 1
lockvar s:setup_done
endif
return newObj
@ -35,7 +37,7 @@ function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2
let buf = bufnr('')
let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf')
for item in issues
let group = item['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
let group = 'Syntastic' . get(item, 'subtype', '') . ( item['type'] ==? 'E' ? 'Error' : 'Warning' )
" The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is
" used to override default highlighting.
@ -80,11 +82,16 @@ function! g:SyntasticHighlightingNotifier._setup() " {{{2
if s:has_highlighting
if !hlexists('SyntasticError')
highlight link SyntasticError SpellBad
endif
if !hlexists('SyntasticWarning')
highlight link SyntasticWarning SpellCap
endif
if !hlexists('SyntasticStyleError')
highlight link SyntasticStyleError SyntasticError
endif
if !hlexists('SyntasticStyleWarning')
highlight link SyntasticStyleWarning SyntasticWarning
endif
endif
endfunction " }}}2

View file

@ -20,12 +20,13 @@ function! g:SyntasticLoclist.New(rawLoclist) " {{{2
let newObj._rawLoclist = llist
let newObj._name = ''
let newObj._owner = bufnr('')
return newObj
endfunction " }}}2
function! g:SyntasticLoclist.current() " {{{2
if !exists("b:syntastic_loclist")
if !exists("b:syntastic_loclist") || empty(b:syntastic_loclist)
let b:syntastic_loclist = g:SyntasticLoclist.New([])
endif
return b:syntastic_loclist
@ -53,6 +54,10 @@ function! g:SyntasticLoclist.getRaw() " {{{2
return self._rawLoclist
endfunction " }}}2
function! g:SyntasticLoclist.getBuffers() " {{{2
return syntastic#util#unique(map(copy(self._rawLoclist), 'str2nr(v:val["bufnr"])') + [self._owner])
endfunction " }}}2
function! g:SyntasticLoclist.getStatuslineFlag() " {{{2
if !exists("self._stl_format")
let self._stl_format = ''
@ -118,6 +123,26 @@ function! g:SyntasticLoclist.setName(name) " {{{2
let self._name = a:name
endfunction " }}}2
function! g:SyntasticLoclist.getOwner() " {{{2
return self._owner
endfunction " }}}2
function! g:SyntasticLoclist.setOwner(buffer) " {{{2
let self._owner = type(a:buffer) == type(0) ? a:buffer : str2nr(a:buffer)
endfunction " }}}2
function! g:SyntasticLoclist.deploy() " {{{2
for buf in self.getBuffers()
call setbufvar(buf, 'syntastic_loclist', self)
endfor
endfunction " }}}2
function! g:SyntasticLoclist.destroy() " {{{2
for buf in self.getBuffers()
call setbufvar(buf, 'syntastic_loclist', {})
endfor
endfunction " }}}2
function! g:SyntasticLoclist.decorate(tag) " {{{2
for e in self._rawLoclist
let e['text'] .= ' [' . a:tag . ']'
@ -216,6 +241,7 @@ function! g:SyntasticLoclist.show() " {{{2
if strpart(title, 0, 16) ==# ':SyntasticCheck ' ||
\ ( (title == '' || title ==# ':setloclist()') && errors == getloclist(0) )
call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name)
call setbufvar(buf, 'syntastic_owner_buffer', self._owner)
endif
endif
endfor
@ -226,7 +252,7 @@ endfunction " }}}2
" Non-method functions {{{1
function! g:SyntasticLoclistHide() " {{{2
function! SyntasticLoclistHide() " {{{2
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: hide')
silent! lclose
endfunction " }}}2

View file

@ -6,6 +6,7 @@ let g:loaded_syntastic_notifiers = 1
let g:SyntasticNotifiers = {}
let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist']
lockvar! s:notifier_types
" Public methods {{{1

View file

@ -11,8 +11,10 @@ let s:defaultCheckers = {
\ 'applescript': ['osacompile'],
\ 'asciidoc': ['asciidoc'],
\ 'asm': ['gcc'],
\ 'bro': ['bro'],
\ 'bemhtml': ['bemhtmllint'],
\ 'c': ['gcc'],
\ 'cabal': ['cabal'],
\ 'chef': ['foodcritic'],
\ 'co': ['coco'],
\ 'cobol': ['cobc'],
@ -64,7 +66,6 @@ let s:defaultCheckers = {
\ 'racket': ['racket'],
\ 'rst': ['rst2pseudoxml'],
\ 'ruby': ['mri'],
\ 'rust': ['rustc'],
\ 'sass': ['sass'],
\ 'scala': ['fsc', 'scalac'],
\ 'scss': ['sass', 'scss_lint'],
@ -89,12 +90,14 @@ let s:defaultCheckers = {
\ 'zpt': ['zptlint'],
\ 'zsh': ['zsh', 'shellcheck']
\ }
lockvar! s:defaultCheckers
let s:defaultFiletypeMap = {
\ 'gentoo-metadata': 'xml',
\ 'lhaskell': 'haskell',
\ 'litcoffee': 'coffee'
\ }
lockvar! s:defaultFiletypeMap
let g:SyntasticRegistry = {}
@ -102,14 +105,13 @@ let g:SyntasticRegistry = {}
" Public methods {{{1
" TODO: Handling of filetype aliases: all public methods take aliases as
" Note: Handling of filetype aliases: all public methods take aliases as
" parameters, all private methods take normalized filetypes. Public methods
" are thus supposed to normalize filetypes before calling private methods.
function! g:SyntasticRegistry.Instance() " {{{2
if !exists('s:SyntasticRegistryInstance')
let s:SyntasticRegistryInstance = copy(self)
let s:SyntasticRegistryInstance._checkerRaw = {}
let s:SyntasticRegistryInstance._checkerMap = {}
endif
@ -122,29 +124,23 @@ function! g:SyntasticRegistry.CreateAndRegisterChecker(args) " {{{2
call registry._registerChecker(checker)
endfunction " }}}2
function! g:SyntasticRegistry.isCheckable(ftalias) " {{{2
" Given a list of checker names hints_list, return a map name --> checker.
" If hints_list is empty, user settings are are used instead. Checkers are
" not checked for availability (that is, the corresponding IsAvailable() are
" not run).
function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2
let ft = s:normaliseFiletype(a:ftalias)
call self._loadCheckers(ft)
return !empty(self._checkerMap[ft])
endfunction " }}}2
call self._loadCheckersFor(ft)
function! g:SyntasticRegistry.getCheckersMap(ftalias) " {{{2
let ft = s:normaliseFiletype(a:ftalias)
call self._loadCheckers(ft)
return self._checkerMap[ft]
endfunction " }}}2
function! g:SyntasticRegistry.getCheckers(ftalias, list) " {{{2
let checkers_map = self.getCheckersMap(a:ftalias)
let checkers_map = self._checkerMap[ft]
if empty(checkers_map)
return []
endif
let ft = s:normaliseFiletype(a:ftalias)
call self._checkDeprecation(ft)
let names =
\ !empty(a:list) ? a:list :
\ !empty(a:hints_list) ? syntastic#util#unique(a:hints_list) :
\ exists('b:syntastic_checkers') ? b:syntastic_checkers :
\ exists('g:syntastic_' . ft . '_checkers') ? g:syntastic_{ft}_checkers :
\ get(s:defaultCheckers, ft, 0)
@ -153,6 +149,12 @@ function! g:SyntasticRegistry.getCheckers(ftalias, list) " {{{2
\ self._filterCheckersByName(checkers_map, names) : [checkers_map[keys(checkers_map)[0]]]
endfunction " }}}2
" Same as getCheckers(), but keep only the checkers available. This runs the
" corresponding IsAvailable() functions for all checkers.
function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) " {{{2
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()')
endfunction " }}}2
function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
let types = keys(s:defaultCheckers)
@ -169,8 +171,15 @@ function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
return syntastic#util#unique(types)
endfunction " }}}2
function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2
let ft = s:normaliseFiletype(a:ftalias)
call self._loadCheckersFor(ft)
return keys(filter( copy(self._checkerMap[ft]), 'v:val.isAvailable()' ))
endfunction " }}}2
function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2
echomsg "Syntastic info for filetype: " . join(a:ftalias_list, '.')
echomsg "Syntastic version: " . g:syntastic_version
echomsg "Info for filetype: " . join(a:ftalias_list, '.')
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:normaliseFiletype(v:val)' ))
if len(ft_list) != 1
@ -178,13 +187,13 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2
let active = []
for ft in ft_list
call extend(available, map( keys(self.getCheckersMap(ft)), 'ft . "/" . v:val' ))
call extend(active, map( self.getCheckers(ft, []), 'ft . "/" . v:val.getName()' ))
call extend(available, map( self.getNamesOfAvailableCheckers(ft), 'ft . "/" . v:val' ))
call extend(active, map( self.getCheckersAvailable(ft, []), 'ft . "/" . v:val.getName()' ))
endfor
else
let ft = ft_list[0]
let available = keys(self.getCheckersMap(ft))
let active = map(self.getCheckers(ft, []), 'v:val.getName()')
let available = self.getNamesOfAvailableCheckers(ft)
let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()')
endif
echomsg "Available checker(s): " . join(sort(available))
@ -197,52 +206,39 @@ endfunction " }}}2
function! g:SyntasticRegistry._registerChecker(checker) abort " {{{2
let ft = a:checker.getFiletype()
if !has_key(self._checkerRaw, ft)
let self._checkerRaw[ft] = []
if !has_key(self._checkerMap, ft)
let self._checkerMap[ft] = {}
endif
call self._validateUniqueName(a:checker)
let name = a:checker.getName()
call add(self._checkerRaw[ft], name)
if a:checker.isAvailable()
let self._checkerMap[ft][name] = a:checker
if has_key(self._checkerMap[ft], name)
throw 'Syntastic: Duplicate syntax checker name: ' . ft . '/' . name
endif
let self._checkerMap[ft][name] = a:checker
endfunction " }}}2
function! g:SyntasticRegistry._filterCheckersByName(checkers_map, list) " {{{2
return filter( map(copy(a:list), 'get(a:checkers_map, v:val, {})'), '!empty(v:val)' )
endfunction " }}}2
function! g:SyntasticRegistry._loadCheckers(filetype) " {{{2
if has_key(self._checkerRaw, a:filetype)
function! g:SyntasticRegistry._loadCheckersFor(filetype) " {{{2
if has_key(self._checkerMap, a:filetype)
return
endif
execute "runtime! syntax_checkers/" . a:filetype . "/*.vim"
if !has_key(self._checkerRaw, a:filetype)
let self._checkerRaw[a:filetype] = []
if !has_key(self._checkerMap, a:filetype)
let self._checkerMap[a:filetype] = {}
endif
endfunction " }}}2
function! g:SyntasticRegistry._validateUniqueName(checker) abort " {{{2
let ft = a:checker.getFiletype()
let name = a:checker.getName()
if index(self._checkerRaw[ft], name) > -1
throw 'Syntastic: Duplicate syntax checker name: ' . ft . '/' . name
endif
endfunction " }}}2
" Check for obsolete variable g:syntastic_<filetype>_checker
function! g:SyntasticRegistry._checkDeprecation(filetype) " {{{2
if exists('g:syntastic_' . a:filetype . '_checker') && !exists('g:syntastic_' . a:filetype . '_checkers')
let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker]
call syntastic#log#deprecationWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated')
call syntastic#log#oneTimeWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated')
endif
endfunction " }}}2

View file

@ -25,6 +25,7 @@ function! g:SyntasticSignsNotifier.New() " {{{2
if !s:setup_done
call self._setup()
let s:setup_done = 1
lockvar s:setup_done
endif
return newObj
@ -41,7 +42,7 @@ function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2
call self._signErrors(a:loclist)
endif
call self._removeSigns(old_signs)
let s:first_sign_id = s:next_sign_id
let s:first_sign_id = exists('s:next_sign_id') ? s:next_sign_id : 5000
endfunction " }}}2
" }}}1
@ -98,13 +99,15 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
if !has_key(seen, i['lnum'])
let seen[i['lnum']] = 1
let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error'
let sign_subtype = get(i, 'subtype', '')
let sign_type = 'Syntastic' . sign_subtype . sign_severity
if i['lnum'] > 0
let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error'
let sign_subtype = get(i, 'subtype', '')
let sign_type = 'Syntastic' . sign_subtype . sign_severity
execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr']
call add(self._bufSignIds(), s:next_sign_id)
let s:next_sign_id += 1
execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr']
call add(self._bufSignIds(), s:next_sign_id)
let s:next_sign_id += 1
endif
endif
endfor
endif
@ -113,9 +116,9 @@ endfunction " }}}2
" Remove the signs with the given ids from this buffer
function! g:SyntasticSignsNotifier._removeSigns(ids) " {{{2
if has('signs')
for i in a:ids
execute "sign unplace " . i
call remove(self._bufSignIds(), index(self._bufSignIds(), i))
for s in reverse(copy(a:ids))
execute "sign unplace " . s
call remove(self._bufSignIds(), index(self._bufSignIds(), s))
endfor
endif
endfunction " }}}2

View file

@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_actionscript_mxmlc_checker')
endif
let g:loaded_syntastic_actionscript_mxmlc_checker = 1
if !exists('g:syntastic_actionscript_mxmlc_conf')
let g:syntastic_actionscript_mxmlc_conf = ''
endif
let s:save_cpo = &cpo
set cpo&vim
@ -45,10 +41,10 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
endfunction
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_before': (g:syntastic_actionscript_mxmlc_conf != '' ?
\ ' -load-config+=' . syntastic#util#shexpand(g:syntastic_actionscript_mxmlc_conf) : ''),
\ 'args_after': '-output=' . syntastic#util#DevNull() })
call syntastic#log#deprecationWarn('actionscript_mxmlc_conf', 'actionscript_mxmlc_args',
\ "'-load-config+=' . syntastic#util#shexpand(OLD_VAR)")
let makeprg = self.makeprgBuild({ 'args_after': '-output=' . syntastic#util#DevNull() })
let errorformat =
\ '%f(%l): col: %c %trror: %m,' .

View file

@ -8,7 +8,7 @@
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
if exists("g:loaded_syntastic_bemhtml_bemhtmllint_checker")
finish
endif
@ -29,6 +29,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'name': 'bemhtmllint',
\ 'exec': 'bemhtml-lint' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -0,0 +1,45 @@
"============================================================================
"File: bro.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Justin Azoff <justin.azoff@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_bro_bro_checker")
finish
endif
let g:loaded_syntastic_bro_bro_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_bro_bro_IsAvailable() dict
return system(self.getExecEscaped() . ' --help') =~# '--parse-only'
endfunction
function! SyntaxCheckers_bro_bro_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_before': '--parse-only' })
"example: error in ./foo.bro, line 3: unknown identifier banana, at or "near "banana"
let errorformat =
\ '%trror in %f\, line %l: %m,' .
\ '%tarning in %f\, line %l: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'bro',
\ 'name': 'bro'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -14,24 +14,27 @@ if exists("g:loaded_syntastic_c_checkpatch_checker")
endif
let g:loaded_syntastic_c_checkpatch_checker = 1
" Bail if the user doesn't have `checkpatch.pl` or ./scripts/checkpatch.pl installed.
if executable("checkpatch.pl")
let g:syntastic_c_checker_checkpatch_location = 'checkpatch.pl'
elseif executable("./scripts/checkpatch.pl")
let g:syntastic_c_checker_checkpatch_location = './scripts/checkpatch.pl'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_checkpatch_IsAvailable() dict
return exists("g:syntastic_c_checker_checkpatch_location")
call syntastic#log#deprecationWarn('c_checker_checkpatch_location', 'c_checkpatch_exe')
if !exists('g:syntastic_c_checkpatch_exe') && !executable(self.getExec())
if executable('checkpatch')
let g:syntastic_c_checkpatch_exe = 'checkpatch'
elseif executable('./scripts/checkpatch.pl')
let g:syntastic_c_checkpatch_exe = fnamemodify('./scripts/checkpatch.pl', ':p')
elseif executable('./scripts/checkpatch')
let g:syntastic_c_checkpatch_exe = fnamemodify('./scripts/checkpatch', ':p')
endif
endif
return executable(self.getExec())
endfunction
function! SyntaxCheckers_c_checkpatch_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'exe': g:syntastic_c_checker_checkpatch_location,
\ 'args_after': '--no-summary --no-tree --terse --file' })
let makeprg = self.makeprgBuild({ 'args_after': '--no-summary --no-tree --terse --file' })
let errorformat =
\ '%f:%l: %tARNING: %m,' .

View file

@ -19,7 +19,7 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_make_GetLocList() dict
let makeprg = self.getExecEscaped() . ' -sk'
let makeprg = self.makeprgBuild({ 'args': '-sk', 'fname': '' })
let errorformat =
\ '%-G%f:%s:,' .

View file

@ -0,0 +1,55 @@
"============================================================================
"File: cabal.vim
"Description: Haskell package description (.cabal file) linting and syntax
" validation via 'cabal check'
"Maintainer: Ian D. Bollinger <ian.bollinger@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists('g:loaded_syntastic_cabal_cabal_checker')
finish
endif
let g:loaded_syntastic_cabal_cabal_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item)
let field = matchstr(a:item['text'], "\\vParse of field '\\zs[^']+")
if field != ''
return '\v\c^\s*' . field . '\s*:\s*\zs.*$'
endif
let field = matchstr(a:item['text'], "\\v(^|\\s)'\\zs[^']+\\ze'")
if field != ''
return '\V\c\<' . escape(field, '\') . '\>'
endif
return ''
endfunction
function! SyntaxCheckers_cabal_cabal_GetLocList() dict
let makeprg = self.getExecEscaped() . ' check'
let errorformat =
\ '%Ecabal: %f:%l: %m,' .
\ '%W* %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'cwd': expand('%:p:h'),
\ 'preprocess': 'cabal',
\ 'defaults': {'bufnr': bufnr('')} })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cabal',
\ 'name': 'cabal'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -19,7 +19,8 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_co_coco_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-c -o /tmp' })
let tmpdir = $TMPDIR != '' ? $TMPDIR : $TMP != '' ? $TMP : '/tmp'
let makeprg = self.makeprgBuild({ 'args_after': '-c -o ' . tmpdir })
let errorformat =
\ '%EFailed at: %f,' .

View file

@ -19,7 +19,11 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--csv' })
if !exists('s:coffeelint_new')
let s:coffeelint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion(
\ self.getExecEscaped() . ' --version'), [1, 4])
endif
let makeprg = self.makeprgBuild({ 'args_after': (s:coffeelint_new ? '--reporter csv' : '--csv') })
let errorformat =
\ '%f\,%l\,%\d%#\,%trror\,%m,' .

View file

@ -19,17 +19,13 @@ if exists('g:loaded_syntastic_css_csslint_checker')
endif
let g:loaded_syntastic_css_csslint_checker = 1
if !exists('g:syntastic_csslint_options')
let g:syntastic_csslint_options = ''
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_css_csslint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': g:syntastic_csslint_options,
\ 'args_after': '--format=compact' })
call syntastic#log#deprecationWarn('csslint_options', 'css_csslint_args')
let makeprg = self.makeprgBuild({ 'args_after': '--format=compact' })
" Print CSS Lint's error/warning messages from compact format. Ignores blank lines.
let errorformat =

View file

@ -0,0 +1,26 @@
"============================================================================
"File: recess.vim
"Description: Syntax checking plugin for syntastic.vim using `recess`
" (http://twitter.github.io/recess/).
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_css_recess_checker")
finish
endif
let g:loaded_syntastic_css_recess_checker = 1
runtime! syntax_checkers/less/*.vim
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'css',
\ 'name': 'recess',
\ 'redirect': 'less/recess'})
" vim: set et sts=4 sw=4:

View file

@ -35,6 +35,12 @@ function! SyntaxCheckers_d_dmd_IsAvailable() dict
endfunction
function! SyntaxCheckers_d_dmd_GetLocList() dict
if !exists('g:syntastic_d_include_dirs')
let g:syntastic_d_include_dirs = filter(glob($HOME . '/.dub/packages/*', 1, 1), 'isdirectory(v:val)')
call map(g:syntastic_d_include_dirs, 'isdirectory(v:val . "/source") ? v:val . "/source" : v:val')
call add(g:syntastic_d_include_dirs, './source')
endif
return syntastic#c#GetLocList('d', 'dmd', {
\ 'errorformat':
\ '%-G%f:%s:,%f(%l): %m,' .

View file

@ -19,22 +19,27 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_eruby_ruby_IsAvailable() dict
if !exists("g:syntastic_ruby_exec")
let g:syntastic_ruby_exec = self.getExec()
if !exists('g:syntastic_eruby_ruby_exec') && exists('g:syntastic_ruby_exec')
let g:syntastic_eruby_ruby_exec = g:syntastic_ruby_exec
endif
return executable(expand(g:syntastic_ruby_exec))
let s:exe = self.getExec()
if executable(s:exe)
let s:exe = syntastic#util#shescape(s:exe)
if !syntastic#util#isRunningWindows()
let s:exe = 'RUBYOPT= ' . s:exe
endif
return 1
endif
return 0
endfunction
function! SyntaxCheckers_eruby_ruby_GetLocList() dict
let exe = syntastic#util#shexpand(g:syntastic_ruby_exec)
if !syntastic#util#isRunningWindows()
let exe = 'RUBYOPT= ' . exe
endif
let fname = "'" . escape(expand('%'), "\\'") . "'"
" TODO: encodings became useful in ruby 1.9 :)
if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [1, 9])
if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(s:exe . ' --version'), [1, 9])
let enc = &fileencoding != '' ? &fileencoding : &encoding
let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"'
else
@ -43,11 +48,11 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict
"gsub fixes issue #7, rails has it's own eruby syntax
let makeprg =
\ exe . ' -rerb -e ' .
\ s:exe . ' -rerb -e ' .
\ syntastic#util#shescape('puts ERB.new(File.read(' .
\ fname . encoding_spec .
\ ').gsub(''<%='',''<%''), nil, ''-'').src') .
\ ' | ' . exe . ' -c'
\ ' | ' . s:exe . ' -c'
let errorformat =
\ '%-GSyntax OK,'.

View file

@ -19,16 +19,12 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_haml_haml_IsAvailable() dict
if !exists('g:syntastic_haml_interpreter')
let g:syntastic_haml_interpreter = self.getExec()
endif
return executable(expand(g:syntastic_haml_interpreter))
call syntastic#log#deprecationWarn('haml_interpreter', 'haml_haml_exec')
return executable(self.getExec())
endfunction
function! SyntaxCheckers_haml_haml_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'exe': syntastic#util#shexpand(g:syntastic_haml_interpreter),
\ 'args_after': '-c' })
let makeprg = self.makeprgBuild({ 'args_after': '-c' })
let errorformat =
\ 'Haml error on line %l: %m,' .

View file

@ -19,7 +19,9 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict
if exists('g:hdevtools_options')
if !exists('g:syntastic_haskell_hdevtools_args') && exists('g:hdevtools_options')
call syntastic#log#oneTimeWarn('variable g:hdevtools_options is deprecated, ' .
\ 'please use g:syntastic_haskell_hdevtools_args instead')
let g:syntastic_haskell_hdevtools_args = g:hdevtools_options
endif

View file

@ -14,29 +14,20 @@ if exists('g:loaded_syntastic_html_jshint_checker')
endif
let g:loaded_syntastic_html_jshint_checker = 1
if !exists('g:syntastic_jshint_exec')
let g:syntastic_jshint_exec = 'jshint'
endif
if !exists('g:syntastic_html_jshint_conf')
let g:syntastic_html_jshint_conf = ''
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_html_jshint_IsAvailable() dict
let exe = expand(g:syntastic_jshint_exec)
return executable(exe) &&
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [2,4])
call syntastic#log#deprecationWarn('jshint_exec', 'html_jshint_exec')
return executable(self.getExec()) &&
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2,4])
endfunction
function! SyntaxCheckers_html_jshint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'exe': expand(g:syntastic_jshint_exec),
\ 'args': (g:syntastic_html_jshint_conf != '' ?
\ '--config ' . syntastic#util#shexpand(g:syntastic_html_jshint_conf) : ''),
\ 'args_after': '--verbose --extract always' })
call syntastic#log#deprecationWarn('html_jshint_conf', 'html_jshint_args',
\ "'--config ' . syntastic#util#shexpand(OLD_VAR)")
let makeprg = self.makeprgBuild({ 'args_after': '--verbose --extract always' })
let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)'

View file

@ -123,6 +123,7 @@ let s:ignore_errors = [
\ "proprietary attribute \"aria-valuenow\"",
\ "proprietary attribute \"aria-valuetext\""
\ ]
lockvar! s:ignore_errors
let s:blocklevel_tags = [
\ "main",
@ -135,6 +136,7 @@ let s:blocklevel_tags = [
\ "figure",
\ "figcaption"
\ ]
lockvar! s:blocklevel_tags
let s:inline_tags = [
\ "video",
@ -153,11 +155,13 @@ let s:inline_tags = [
\ "details",
\ "datalist"
\ ]
lockvar! s:inline_tags
let s:empty_tags = [
\ "wbr",
\ "keygen"
\ ]
lockvar! s:empty_tags
function! s:IgnoreError(text)
for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors

View file

@ -10,32 +10,36 @@
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
if exists("g:loaded_syntastic_java_javac_checker")
if exists('g:loaded_syntastic_java_javac_checker')
finish
endif
let g:loaded_syntastic_java_javac_checker = 1
let g:syntastic_java_javac_maven_pom_tags = ["build", "properties"]
let g:syntastic_java_javac_maven_pom_tags = ['build', 'properties']
let g:syntastic_java_javac_maven_pom_properties = {}
let s:has_maven = 0
" Global Options
if !exists("g:syntastic_java_javac_executable")
if !exists('g:syntastic_java_javac_executable')
let g:syntastic_java_javac_executable = 'javac'
endif
if !exists("g:syntastic_java_maven_executable")
if !exists('g:syntastic_java_maven_executable')
let g:syntastic_java_maven_executable = 'mvn'
endif
if !exists("g:syntastic_java_javac_options")
if !exists('g:syntastic_java_javac_options')
let g:syntastic_java_javac_options = '-Xlint'
endif
if !exists("g:syntastic_java_javac_classpath")
if !exists('g:syntastic_java_maven_options')
let g:syntastic_java_maven_options = ''
endif
if !exists('g:syntastic_java_javac_classpath')
let g:syntastic_java_javac_classpath = ''
endif
if !exists("g:syntastic_java_javac_delete_output")
if !exists('g:syntastic_java_javac_delete_output')
let g:syntastic_java_javac_delete_output = 1
endif
@ -43,20 +47,22 @@ let s:save_cpo = &cpo
set cpo&vim
function! s:CygwinPath(path)
return substitute(system("cygpath -m " . syntastic#util#shescape(a:path)), '\n', '', 'g')
return substitute(system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g')
endfunction
if !exists("g:syntastic_java_javac_temp_dir")
if !exists('g:syntastic_java_javac_temp_dir')
if has('win32') || has('win64')
let g:syntastic_java_javac_temp_dir = $TEMP."\\vim-syntastic-javac"
let g:syntastic_java_javac_temp_dir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-javac'
elseif has('win32unix')
let g:syntastic_java_javac_temp_dir = s:CygwinPath('/tmp/vim-syntastic-javac')
elseif $TMPDIR != ''
let g:syntastic_java_javac_temp_dir = $TMPDIR . '/vim-syntastic-javac'
else
let g:syntastic_java_javac_temp_dir = '/tmp/vim-syntastic-javac'
endif
endif
if !exists("g:syntastic_java_javac_autoload_maven_classpath")
if !exists('g:syntastic_java_javac_autoload_maven_classpath')
let g:syntastic_java_javac_autoload_maven_classpath = 1
endif
@ -72,16 +78,16 @@ if !exists('g:syntastic_java_javac_custom_classpath_command')
let g:syntastic_java_javac_custom_classpath_command = ''
endif
if !exists("g:syntastic_java_javac_maven_pom_ftime")
if !exists('g:syntastic_java_javac_maven_pom_ftime')
let g:syntastic_java_javac_maven_pom_ftime = {}
endif
if !exists("g:syntastic_java_javac_maven_pom_classpath")
if !exists('g:syntastic_java_javac_maven_pom_classpath')
let g:syntastic_java_javac_maven_pom_classpath = {}
endif
function! s:RemoveCarriageReturn(line)
return substitute(a:line, '\r', '', 'g')
return substitute(a:line, "\r", '', 'g')
endfunction
" recursively remove directory and all it's sub-directories
@ -90,36 +96,25 @@ function! s:RemoveDir(dir)
for f in split(globpath(a:dir, '*'), "\n")
call s:RemoveDir(f)
endfor
silent! call system('rmdir ' . a:dir)
silent! call system('rmdir ' . syntastic#util#shescape(a:dir))
else
silent! call delete(a:dir)
endif
endfunction
function! s:ClassSep()
return (syntastic#util#isRunningWindows() || has('win32unix')) ? ';' : ':'
endfunction
function! s:AddToClasspath(classpath, path)
if a:path == ''
return a:classpath
endif
if a:classpath != '' && a:path != ''
if has('win32') || has('win32unix') || has('win64')
return a:classpath . ";" . a:path
else
return a:classpath . ":" . a:path
endif
else
return a:path
endif
return (a:classpath != '') ? a:classpath . s:ClassSep() . a:path : a:path
endfunction
function! s:SplitClasspath(classpath)
if a:classpath == ''
return []
endif
if has('win32') || has('win32unix') || has('win64')
return split(a:classpath, ";")
else
return split(a:classpath, ":")
endif
return split(a:classpath, s:ClassSep())
endfunction
function! s:LoadConfigFile()
@ -145,15 +140,15 @@ function! s:SaveClasspath()
while i < len(lines)
if match(lines[i], 'g:syntastic_java_javac_classpath') != -1
call remove(lines, i)
let i -= 1
else
let i += 1
endif
let i += 1
endwhile
else
let lines = []
endif
" add new g:syntastic_java_javac_classpath option to config
call add(lines, 'let g:syntastic_java_javac_classpath = "'.path.'"')
call add(lines, 'let g:syntastic_java_javac_classpath = ' . string(path))
" save config file lines
call writefile(lines, expand(g:syntastic_java_javac_config_file))
endif
@ -169,7 +164,7 @@ function! s:EditClasspath()
let path = []
let pathlines = split(g:syntastic_java_javac_classpath, "\n")
for p in pathlines
let path += s:SplitClasspath(p)
call extend(path, s:SplitClasspath(p))
endfor
execute (len(path) + 5) . 'sp ' . fnameescape(command)
@ -223,10 +218,12 @@ endfunction
function! s:GetMavenProperties()
let mvn_properties = {}
let pom = findfile("pom.xml", ".;")
let pom = findfile('pom.xml', '.;')
if s:has_maven && filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_properties, pom)
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
\ ' -f ' . syntastic#util#shescape(pom) .
\ ' ' . g:syntastic_java_maven_options
let mvn_is_managed_tag = 1
let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n")
let current_path = 'project'
@ -239,7 +236,7 @@ function! s:GetMavenProperties()
let matches = matchlist(line, '\m^\s*</\([a-zA-Z0-9\-\.]\+\)>\s*$')
if !empty(matches)
let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) < 0
let current_path = substitute(current_path, '\m\.' . matches[1] . "$", '', '')
let current_path = substitute(current_path, '\m\.' . matches[1] . '$', '', '')
else
let matches = matchlist(line, '\m^\s*<\([a-zA-Z0-9\-\.]\+\)>\(.\+\)</[a-zA-Z0-9\-\.]\+>\s*$')
if mvn_is_managed_tag && !empty(matches)
@ -262,10 +259,12 @@ if g:syntastic_java_javac_config_file_enabled
endif
function! s:GetMavenClasspath()
let pom = findfile("pom.xml", ".;")
let pom = findfile('pom.xml', '.;')
if s:has_maven && filereadable(pom)
if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom)
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
\ ' -f ' . syntastic#util#shescape(pom) .
\ ' ' . g:syntastic_java_maven_options
let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n")
let mvn_classpath = ''
let class_path_next = 0
@ -308,20 +307,20 @@ function! SyntaxCheckers_java_javac_IsAvailable() dict
endfunction
function! s:MavenOutputDirectory()
let pom = findfile("pom.xml", ".;")
let pom = findfile('pom.xml', '.;')
if s:has_maven && filereadable(pom)
let mvn_properties = s:GetMavenProperties()
let output_dir = getcwd()
if has_key(mvn_properties, 'project.properties.build.dir')
let output_dir = mvn_properties['project.properties.build.dir']
endif
if stridx(expand( '%:p:h' ), "src.main.java") >= 0
if stridx(expand( '%:p:h' ), 'src.main.java') >= 0
let output_dir .= '/target/classes'
if has_key(mvn_properties, 'project.build.outputDirectory')
let output_dir = mvn_properties['project.build.outputDirectory']
endif
endif
if stridx(expand( '%:p:h' ), "src.test.java") >= 0
if stridx(expand( '%:p:h' ), 'src.test.java') >= 0
let output_dir .= '/target/test-classes'
if has_key(mvn_properties, 'project.build.testOutputDirectory')
let output_dir = mvn_properties['project.build.testOutputDirectory']
@ -337,13 +336,12 @@ function! s:MavenOutputDirectory()
endfunction
function! SyntaxCheckers_java_javac_GetLocList() dict
let javac_opts = g:syntastic_java_javac_options
let output_dir = ""
let output_dir = ''
if g:syntastic_java_javac_delete_output
let output_dir = g:syntastic_java_javac_temp_dir
let javac_opts .= ' -d ' . output_dir
let javac_opts .= ' -d ' . syntastic#util#shescape(output_dir)
endif
" load classpath from config file
@ -354,12 +352,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict
let javac_classpath = ''
" add classpathes to javac_classpath
if has('win32') || has('win32unix') || has('win64')
let javac_classpath_split = ';'
else
let javac_classpath_split = ':'
endif
for path in split(g:syntastic_java_javac_classpath, javac_classpath_split)
for path in split(g:syntastic_java_javac_classpath, s:ClassSep())
if path != ''
try
let ps = glob(path, 0, 1)
@ -378,7 +371,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict
if s:has_maven && g:syntastic_java_javac_autoload_maven_classpath
if !g:syntastic_java_javac_delete_output
let javac_opts .= ' -d ' . s:MavenOutputDirectory()
let javac_opts .= ' -d ' . syntastic#util#shescape(s:MavenOutputDirectory())
endif
let javac_classpath = s:AddToClasspath(javac_classpath, s:GetMavenClasspath())
endif
@ -386,7 +379,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict
" load custom classpath
if g:syntastic_java_javac_custom_classpath_command != ''
let lines = system(g:syntastic_java_javac_custom_classpath_command)
if has('win32') || has('win32unix') || has('win64')
if syntastic#util#isRunningWindows() || has('win32unix')
let lines = substitute(lines, "\r\n", "\n", 'g')
endif
for l in split(lines, "\n")
@ -395,17 +388,10 @@ function! SyntaxCheckers_java_javac_GetLocList() dict
endif
if javac_classpath != ''
let javac_opts .= ' -cp "' . fnameescape(javac_classpath) . '"'
let javac_opts .= ' -cp ' . syntastic#util#shexpand(javac_classpath)
endif
" path seperator
if has('win32') || has('win32unix') || has('win64')
let sep = "\\"
else
let sep = '/'
endif
let fname = fnameescape(expand ( '%:p:h' ) . sep . expand ( '%:t' ))
let fname = expand('%:p:h') . syntastic#util#Slash() . expand ('%:t')
if has('win32unix')
let fname = s:CygwinPath(fname)
@ -413,7 +399,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': javac_opts,
\ 'fname': fname,
\ 'fname': syntastic#util#shescape(fname),
\ 'tail': '2>&1' })
" unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types

View file

@ -8,48 +8,36 @@
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"============================================================================
"
" To enable this plugin, edit the .vimrc like this:
"
" let g:syntastic_javascript_checker = "closurecompiler"
"
" and set the path to the Google Closure Compiler:
"
" let g:syntastic_javascript_closure_compiler_path = '/path/to/google-closure-compiler.jar'
"
" It takes additional options for Google Closure Compiler with the variable
" g:syntastic_javascript_closure_compiler_options.
"
if exists("g:loaded_syntastic_javascript_closurecompiler_checker")
finish
endif
let g:loaded_syntastic_javascript_closurecompiler_checker = 1
if !exists("g:syntastic_javascript_closure_compiler_options")
let g:syntastic_javascript_closure_compiler_options = ""
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict
call syntastic#log#deprecationWarn('javascript_closure_compiler_path', 'javascript_closurecompiler_path')
return
\ executable("java") &&
\ exists("g:syntastic_javascript_closure_compiler_path") &&
\ filereadable(g:syntastic_javascript_closure_compiler_path)
\ exists("g:syntastic_javascript_closurecompiler_path") &&
\ filereadable(g:syntastic_javascript_closurecompiler_path)
endfunction
function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict
if exists("g:syntastic_javascript_closure_compiler_file_list")
let file_list = join(readfile(g:syntastic_javascript_closure_compiler_file_list))
call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args')
call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list')
if exists("g:syntastic_javascript_closurecompiler_file_list")
let file_list = join(readfile(g:syntastic_javascript_closurecompiler_file_list))
else
let file_list = syntastic#util#shexpand('%')
endif
let makeprg = self.makeprgBuild({
\ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path,
\ 'args': g:syntastic_javascript_closure_compiler_options,
\ 'exe_after': '-jar ' . g:syntastic_javascript_closurecompiler_path,
\ 'args_after': '--js' ,
\ 'fname': file_list })

View file

@ -14,27 +14,24 @@ if exists('g:loaded_syntastic_javascript_eslint_checker')
endif
let g:loaded_syntastic_javascript_eslint_checker = 1
if !exists('g:syntastic_javascript_eslint_conf')
let g:syntastic_javascript_eslint_conf = ''
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_eslint_IsAvailable() dict
return
\ executable('eslint') &&
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('eslint --version'), [0, 1])
\ executable(self.getExec()) &&
\ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [0, 1])
endfunction
function! SyntaxCheckers_javascript_eslint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_before': '-f compact',
\ 'args': (g:syntastic_javascript_eslint_conf != '' ?
\ '--config ' . syntastic#util#shexpand(g:syntastic_javascript_eslint_conf) : '') })
call syntastic#log#deprecationWarn('javascript_eslint_conf', 'javascript_eslint_args',
\ "'--config ' . syntastic#util#shexpand(OLD_VAR)")
let makeprg = self.makeprgBuild({ 'args_before': '-f compact' })
let errorformat =
\ '%E%f: line %l\, col %c\, Error - %m'
\ '%E%f: line %l\, col %c\, Error - %m,' .
\ '%W%f: line %l\, col %c\, Warning - %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,

View file

@ -14,16 +14,13 @@ if exists("g:loaded_syntastic_javascript_gjslint_checker")
endif
let g:loaded_syntastic_javascript_gjslint_checker = 1
if !exists("g:syntastic_javascript_gjslint_conf")
let g:syntastic_javascript_gjslint_conf = ""
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_gjslint_GetLocList() dict
call syntastic#log#deprecationWarn('javascript_gjslint_conf', 'javascript_gjslint_args')
let makeprg = self.makeprgBuild({
\ 'args': g:syntastic_javascript_gjslint_conf,
\ 'args_after': '--nosummary --unix_mode --nodebug_indentation --nobeep' })
let errorformat =

View file

@ -14,34 +14,27 @@ if exists('g:loaded_syntastic_javascript_jshint_checker')
endif
let g:loaded_syntastic_javascript_jshint_checker = 1
if !exists('g:syntastic_javascript_jshint_conf')
let g:syntastic_javascript_jshint_conf = ''
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jshint_IsAvailable() dict
if !exists('g:syntastic_jshint_exec')
let g:syntastic_jshint_exec = self.getExec()
endif
if !executable(expand(g:syntastic_jshint_exec))
call syntastic#log#deprecationWarn('jshint_exec', 'javascript_jshint_exec')
if !executable(self.getExec())
return 0
endif
let s:jshint_version = syntastic#util#getVersion(syntastic#util#shexpand(g:syntastic_jshint_exec) . ' --version')
let s:jshint_version = syntastic#util#getVersion(self.getExecEscaped() . ' --version')
return syntastic#util#versionIsAtLeast(s:jshint_version, [1])
endfunction
function! SyntaxCheckers_javascript_jshint_GetLocList() dict
call syntastic#log#deprecationWarn('javascript_jshint_conf', 'javascript_jshint_args',
\ "'--config ' . syntastic#util#shexpand(OLD_VAR)")
if !exists('s:jshint_new')
let s:jshint_new = syntastic#util#versionIsAtLeast(s:jshint_version, [1, 1])
endif
let makeprg = self.makeprgBuild({
\ 'exe': syntastic#util#shexpand(g:syntastic_jshint_exec),
\ 'args': (g:syntastic_javascript_jshint_conf != '' ?
\ '--config ' . syntastic#util#shexpand(g:syntastic_javascript_jshint_conf) : ''),
\ 'args_after': (s:jshint_new ? '--verbose ' : '') })
let makeprg = self.makeprgBuild({ 'args_after': (s:jshint_new ? '--verbose ' : '') })
let errorformat = s:jshint_new ?
\ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' :

View file

@ -14,17 +14,14 @@ if exists("g:loaded_syntastic_javascript_jsl_checker")
endif
let g:loaded_syntastic_javascript_jsl_checker = 1
if !exists("g:syntastic_javascript_jsl_conf")
let g:syntastic_javascript_jsl_conf = ""
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jsl_GetLocList() dict
call syntastic#log#deprecationWarn('javascript_jsl_conf', 'javascript_jsl_args',
\ "'-conf ' . syntastic#util#shexpand(OLD_VAR)")
let makeprg = self.makeprgBuild({
\ 'args': (g:syntastic_javascript_jsl_conf != '' ?
\ '-conf ' . syntastic#util#shexpand(g:syntastic_javascript_jsl_conf) : ''),
\ 'args_after': '-nologo -nofilelisting -nosummary -nocontext -process' })
let errorformat =

View file

@ -22,7 +22,7 @@ set cpo&vim
function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''')
if term != ''
let term = '\V' . escape(term, '\')
let term = '\V\<' . escape(term, '\') . '\>'
endif
return term
endfunction

View file

@ -0,0 +1,44 @@
"============================================================================
"File: recess.vim
"Description: Syntax checking plugin for syntastic.vim using `recess`
" (http://twitter.github.io/recess/).
"Maintainer: Tim Carry <tim at pixelastic dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_less_recess_checker')
finish
endif
let g:loaded_syntastic_less_recess_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_less_recess_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'post_args_after': '--format=compact --stripColors' })
let errorformat =
\ '%E%m in %f,' .
\ '%Z %#%l.%.%#,' .
\ '%f:%l:%m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'less',
\ 'name': 'recess'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -20,13 +20,14 @@ set cpo&vim
function! SyntaxCheckers_lisp_clisp_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '-q -c ' . syntastic#c#NullOutput() })
\ 'args_after': '-q',
\ 'fname_before': '-c' })
let errorformat =
\ '%-G;%.%#,' .
\ '%W%>WARNING:%.%#line %l : %m,' .
\ '%W%>WARNING:%.%# line %l : %m,' .
\ '%Z %#%m,' .
\ '%W%>WARNING:%.%#lines %l..%\d\# : %m,' .
\ '%W%>WARNING:%.%# lines %l%\%.%\%.%\d%\+ : %m,' .
\ '%Z %#%m,' .
\ '%E%>The following functions were %m,' .
\ '%Z %m,' .

View file

@ -50,25 +50,25 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_perl_perl_IsAvailable() dict
if !exists('g:syntastic_perl_interpreter')
let g:syntastic_perl_interpreter = self.getExec()
if !exists('g:syntastic_perl_perl_exec') && exists('g:syntastic_perl_interpreter')
let g:syntastic_perl_perl_exec = g:syntastic_perl_interpreter
endif
" don't call executable() here, to allow things like
" let g:syntastic_perl_interpreter='/usr/bin/env perl'
silent! call system(syntastic#util#shexpand(g:syntastic_perl_interpreter) . ' -e ' . syntastic#util#shescape('exit(0)'))
silent! call system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('exit(0)'))
return v:shell_error == 0
endfunction
function! SyntaxCheckers_perl_perl_GetLocList() dict
if !exists('g:syntastic_enable_perl_checker') || !g:syntastic_enable_perl_checker
call syntastic#log#error('checker perl/perl: checks disabled for security reasons; set g:syntastic_enable_perl_checker to 1 to override')
call syntastic#log#error('checker perl/perl: checks disabled for security reasons; ' .
\ 'set g:syntastic_enable_perl_checker to 1 to override')
return []
endif
let exe = expand(g:syntastic_perl_interpreter)
if type(g:syntastic_perl_lib_path) == type('')
call syntastic#log#deprecationWarn('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, ',')
else
let includes = copy(syntastic#util#var('perl_lib_path'))
@ -79,9 +79,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict
\ (index(shebang['args'], '-t') >= 0 ? ' -t' : '')
let errorformat = '%f:%l:%m'
let makeprg = self.makeprgBuild({
\ 'exe': exe,
\ 'args_before': '-c -X ' . extra })
let makeprg = self.makeprgBuild({ 'args_before': '-c -X ' . extra })
let errors = SyntasticMake({
\ 'makeprg': makeprg,
@ -92,9 +90,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict
return errors
endif
let makeprg = self.makeprgBuild({
\ 'exe': exe,
\ 'args_before': '-c -Mwarnings ' . extra })
let makeprg = self.makeprgBuild({ 'args_before': '-c -Mwarnings ' . extra })
return SyntasticMake({
\ 'makeprg': makeprg,

View file

@ -27,8 +27,8 @@ function! SyntaxCheckers_php_phpcs_GetLocList() dict
\ 'args_after': '--report=csv' })
let errorformat =
\ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'.
\ '"%f"\,%l\,%v\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]'
\ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity%.%#,'.
\ '"%f"\,%l\,%v\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,

View file

@ -18,11 +18,6 @@ let g:loaded_syntastic_puppet_puppetlint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
if exists("g:syntastic_puppet_lint_arguments")
let g:syntastic_puppet_puppetlint_args = g:syntastic_puppet_lint_arguments
call syntastic#log#deprecationWarn("variable g:syntastic_puppet_lint_arguments is deprecated, please use g:syntastic_puppet_puppetlint_args instead")
endif
function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict
return
\ executable("puppet") &&
@ -32,6 +27,8 @@ function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict
endfunction
function! SyntaxCheckers_puppet_puppetlint_GetLocList() dict
call syntastic#log#deprecationWarn('puppet_lint_arguments', 'puppet_puppetlint_args')
let makeprg = self.makeprgBuild({
\ 'args_after': '--log-format "%{KIND} [%{check}] %{message} at %{fullpath}:%{linenumber}"' })

View file

@ -19,7 +19,8 @@ function! SyntaxCheckers_python_flake8_GetHighlightRegex(item)
endfunction
function! SyntaxCheckers_python_flake8_GetLocList() dict
let makeprg = self.makeprgBuild({})
let makeprg = self.makeprgBuild({
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
let errorformat =
\ '%E%f:%l: could not compile,%-Z%p^,' .

View file

@ -19,7 +19,9 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_python_frosted_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-vb' })
let makeprg = self.makeprgBuild({
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'),
\ 'args_after': '-vb' })
let errorformat =
\ '%f:%l:%c:%m,' .

View file

@ -5,7 +5,7 @@
"
" For details about pep257 see: https://github.com/GreenSteam/pep257
if exists("g:loaded_syntastic_python_pep257_checker")
if exists('g:loaded_syntastic_python_pep257_checker')
finish
endif
let g:loaded_syntastic_python_pep257_checker = 1
@ -14,12 +14,24 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_python_pep257_GetLocList() dict
let makeprg = self.makeprgBuild({})
if !exists('s:pep257_new')
let s:pep257_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion(
\ self.getExecEscaped() . ' --version'), [0, 3])
endif
let errorformat =
\ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' .
\ '%E%f:%l:%c: %m,' .
\ '%+C %m'
let makeprg = self.makeprgBuild({
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
if s:pep257_new
let errorformat =
\ '%E%f:%l %.%#:,' .
\ '%+C %m'
else
let errorformat =
\ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' .
\ '%E%f:%l:%c: %m,' .
\ '%+C %m'
endif
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
@ -28,10 +40,12 @@ function! SyntaxCheckers_python_pep257_GetLocList() dict
\ 'preprocess': 'killEmpty',
\ 'postprocess': ['compressWhitespace'] })
" pep257 outputs byte offsets rather than column numbers
for e in loclist
let e['col'] = get(e, 'col', 0) + 1
endfor
if s:pep257_new == 0
" byte offsets rather than column numbers
for e in loclist
let e['col'] = get(e, 'col', 0) + 1
endfor
endif
return loclist
endfunction

View file

@ -21,7 +21,8 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_python_pep8_GetLocList() dict
let makeprg = self.makeprgBuild({})
let makeprg = self.makeprgBuild({
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
let errorformat = '%f:%l:%c: %m'

View file

@ -14,7 +14,8 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_python_py3kwarn_GetLocList() dict
let makeprg = self.makeprgBuild({})
let makeprg = self.makeprgBuild({
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
let errorformat = '%W%f:%l:%c: %m'

View file

@ -26,21 +26,22 @@ function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i)
\ || stridx(a:i['text'], 'shadowed by loop variable') >= 0
" fun with Python's %r: try "..." first, then '...'
let terms = split(a:i['text'], '"', 1)
if len(terms) > 2
return terms[1]
let term = matchstr(a:i['text'], '\m^.\{-}"\zs.\{-1,}\ze"')
if term != ''
return '\V\<' . escape(term, '\') . '\>'
endif
let terms = split(a:i['text'], "'", 1)
if len(terms) > 2
return terms[1]
let term = matchstr(a:i['text'], '\m^.\{-}''\zs.\{-1,}\ze''')
if term != ''
return '\V\<' . escape(term, '\') . '\>'
endif
endif
return ''
endfunction
function! SyntaxCheckers_python_pyflakes_GetLocList() dict
let makeprg = self.makeprgBuild({})
let makeprg = self.makeprgBuild({
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') })
let errorformat =
\ '%E%f:%l: could not compile,'.

View file

@ -23,7 +23,9 @@ function! SyntaxCheckers_python_pylama_GetHighlightRegex(item)
endfunction
function! SyntaxCheckers_python_pylama_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-f pep8' })
let makeprg = self.makeprgBuild({
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'),
\ 'args_after': '-f pep8' })
" TODO: "WARNING:pylama:..." messages are probably a logging bug
let errorformat =

View file

@ -23,6 +23,7 @@ endfunction
function! SyntaxCheckers_python_pylint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'),
\ 'args_after': (s:pylint_new ? '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' : '-f parseable -r n -i y') })
let errorformat =

View file

@ -26,7 +26,9 @@ function! SyntaxCheckers_python_python_IsAvailable() dict
endfunction
function! SyntaxCheckers_python_python_GetLocList() dict
let makeprg = self.makeprgBuild({ 'exe': [self.getExec(), s:compiler] })
let makeprg = self.makeprgBuild({
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'),
\ 'exe': [self.getExec(), s:compiler] })
let errorformat = '%E%f:%l:%c: %m'

View file

@ -39,8 +39,11 @@ function! SyntaxCheckers_r_lint_IsAvailable() dict
endfunction
function! SyntaxCheckers_r_lint_GetLocList() dict
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
let setwd = 'setwd("' . escape(getcwd(), '"\') . '"); '
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
\ ' -e ' . syntastic#util#shescape('library(lint); try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') .
\ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' .
\ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') .
\ ' --args ' . syntastic#util#shexpand('%')
let errorformat =

View file

@ -51,8 +51,9 @@ function! SyntaxCheckers_r_svtools_GetLocList() dict
return []
endif
let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : ''
let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' .
\ ' -e ' . syntastic#util#shescape('library(svTools); ' .
\ ' -e ' . syntastic#util#shescape(setwd . 'library(svTools); ' .
\ 'try(lint(commandArgs(TRUE), filename = commandArgs(TRUE), type = "flat", sep = ":"))') .
\ ' --args ' . syntastic#util#shexpand('%')

View file

@ -19,17 +19,9 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_ruby_jruby_GetLocList() dict
if syntastic#util#isRunningWindows()
let exe = self.getExecEscaped()
let args = '-T1'
else
let exe = 'RUBYOPT= ' . self.getExecEscaped()
let args = ''
endif
let makeprg = self.makeprgBuild({
\ 'exe': exe,
\ 'args': args,
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='),
\ 'args': (syntastic#util#isRunningWindows() ? '-T1' : ''),
\ 'args_after': '-W1 -c' })
let errorformat =

View file

@ -19,7 +19,7 @@ set cpo&vim
function! SyntaxCheckers_ruby_macruby_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'exe': 'RUBYOPT= ' . self.getExecEscaped(),
\ 'exe_before': 'RUBYOPT=',
\ 'args_after': '-W1 -c' })
let errorformat =

View file

@ -18,6 +18,13 @@ let g:loaded_syntastic_ruby_mri_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_ruby_mri_IsAvailable() dict
if !exists('g:syntastic_ruby_mri_exec') && exists('g:syntastic_ruby_exec')
let g:syntastic_ruby_mri_exec = g:syntastic_ruby_exec
endif
return executable(self.getExec())
endfunction
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
if stridx(a:i['text'], 'assigned but unused variable') >= 0
let term = split(a:i['text'], ' - ')[1]
@ -28,17 +35,8 @@ function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
endfunction
function! SyntaxCheckers_ruby_mri_GetLocList() dict
if !exists('g:syntastic_ruby_exec')
let g:syntastic_ruby_exec = self.getExec()
endif
let exe = syntastic#util#shexpand(g:syntastic_ruby_exec)
if !syntastic#util#isRunningWindows()
let exe = 'RUBYOPT= ' . exe
endif
let makeprg = self.makeprgBuild({
\ 'exe': exe,
\ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='),
\ 'args_after': '-w -T1 -c' })
"this is a hack to filter out a repeated useless warning in rspec files

View file

@ -20,7 +20,11 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_ruby_rubylint_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args': 'analyze --presenter=syntastic' })
if !exists('s:rubylint_new')
let s:rubylint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion(
\ self.getExecEscaped() . ' --version'), [2])
endif
let makeprg = self.makeprgBuild({ 'args': (s:rubylint_new ? '' : 'analyze ') . '--presenter=syntastic' })
let errorformat = '%f:%t:%l:%c: %m'

View file

@ -18,6 +18,7 @@ let g:loaded_syntastic_sass_sass_checker = 1
"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
let s:sass_cache_location = tempname()
lockvar s:sass_cache_location
"By default do not check partials as unknown variables are a syntax error
if !exists("g:syntastic_sass_check_partials")

View file

@ -1,7 +1,7 @@
"============================================================================
"File: rust.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Chad Jablonski <chad.jablonski at gmail dot com>
"File: sassc.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
@ -10,22 +10,18 @@
"
"============================================================================
if exists("g:loaded_syntastic_rust_rustc_checker")
if exists("g:loaded_syntastic_sass_sassc_checker")
finish
endif
let g:loaded_syntastic_rust_rustc_checker = 1
let g:loaded_syntastic_sass_sassc_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_rust_rustc_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--no-trans' })
function! SyntaxCheckers_sass_sassc_GetLocList() dict
let makeprg = self.makeprgBuild({ 'fname_after': syntastic#util#DevNull() })
let errorformat =
\ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,' .
\ '%W%f:%l:%c: %\d%#:%\d%# %.%\{-}warning:%.%\{-} %m,' .
\ '%C%f:%l %m,' .
\ '%-Z%.%#'
let errorformat = '%f:%l: %trror: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
@ -33,8 +29,8 @@ function! SyntaxCheckers_rust_rustc_GetLocList() dict
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'rust',
\ 'name': 'rustc'})
\ 'filetype': 'sass',
\ 'name': 'sassc'})
let &cpo = s:save_cpo
unlet s:save_cpo

View file

@ -15,19 +15,16 @@ if exists('g:loaded_syntastic_scala_fsc_checker')
endif
let g:loaded_syntastic_scala_fsc_checker = 1
if !exists('g:syntastic_scala_options')
let g:syntastic_scala_options = ''
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_scala_fsc_GetLocList() dict
call syntastic#log#deprecationWarn('scala_options', 'scala_fsc_args')
" fsc has some serious problems with the
" working directory changing after being started
" that's why we better pass an absolute path
let makeprg = self.makeprgBuild({
\ 'args': g:syntastic_scala_options,
\ 'args_after': '-Ystop-after:parser',
\ 'fname': syntastic#util#shexpand('%:p') })

View file

@ -15,17 +15,13 @@ if exists("g:loaded_syntastic_scala_scalac_checker")
endif
let g:loaded_syntastic_scala_scalac_checker = 1
if !exists('g:syntastic_scala_options')
let g:syntastic_scala_options = ''
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_scala_scalac_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': g:syntastic_scala_options,
\ 'args_after': '-Ystop-after:parser' })
call syntastic#log#deprecationWarn('scala_options', 'scala_scalac_args')
let makeprg = self.makeprgBuild({ 'args_after': '-Ystop-after:parser' })
let errorformat =
\ '%E%f:%l: %trror: %m,' .

View file

@ -1,4 +1,3 @@
"============================================================================
"File: scss.vim
"Description: scss syntax checking plugin for syntastic

View file

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

View file

@ -18,41 +18,6 @@ let g:loaded_syntastic_sh_sh_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! s:GetShell()
if !exists('b:shell') || b:shell == ''
let b:shell = ''
let shebang = getbufline(bufnr('%'), 1)[0]
if shebang != ''
if stridx(shebang, 'bash') >= 0
let b:shell = 'bash'
elseif stridx(shebang, 'zsh') >= 0
let b:shell = 'zsh'
elseif stridx(shebang, 'sh') >= 0
let b:shell = 'sh'
endif
endif
" try to use env variable in case no shebang could be found
if b:shell == ''
let b:shell = fnamemodify(expand('$SHELL'), ':t')
endif
endif
return b:shell
endfunction
function! s:ForwardToZshChecker()
let registry = g:SyntasticRegistry.Instance()
if registry.isCheckable('zsh')
return registry.getCheckers('zsh', ['zsh'])[0].getLocListRaw()
else
return []
endif
endfunction
function! s:IsShellValid()
return len(s:GetShell()) > 0 && executable(s:GetShell())
endfunction
function! SyntaxCheckers_sh_sh_IsAvailable() dict
return s:IsShellValid()
endfunction
@ -77,6 +42,42 @@ function! SyntaxCheckers_sh_sh_GetLocList() dict
\ 'errorformat': errorformat })
endfunction
function! s:GetShell()
if !exists('b:shell') || b:shell == ''
let b:shell = ''
let shebang = syntastic#util#parseShebang()['exe']
if shebang != ''
if shebang[-strlen('bash'):-1] ==# 'bash'
let b:shell = 'bash'
elseif shebang[-strlen('zsh'):-1] ==# 'zsh'
let b:shell = 'zsh'
elseif shebang[-strlen('sh'):-1] ==# 'sh'
let b:shell = 'sh'
endif
endif
" try to use env variable in case no shebang could be found
if b:shell == ''
let b:shell = fnamemodify(expand('$SHELL'), ':t')
endif
endif
return b:shell
endfunction
function! s:IsShellValid()
let shell = s:GetShell()
return shell != '' && executable(shell)
endfunction
function! s:ForwardToZshChecker()
let registry = g:SyntasticRegistry.Instance()
let zsh_checkers = registry.getCheckersAvailable('zsh', ['zsh'])
if !empty(zsh_checkers)
return zsh_checkers[0].getLocListRaw()
else
return []
endif
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'sh',
\ 'name': 'sh' })

View file

@ -0,0 +1,46 @@
"============================================================================
"File: typescript/tslint.vim
"Description: TypeScript linter
"Maintainer: Seon-Wook Park <seon.wook@swook.net>
"============================================================================
if exists("g:loaded_syntastic_typescript_tslint_checker")
finish
endif
let g:loaded_syntastic_typescript_tslint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_typescript_tslint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], "\\m\\s'\\zs.\\{-}\\ze'\\s")
return term != '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_typescript_tslint_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args_after': '--format verbose',
\ 'fname_before': '-f' })
" (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter
let errorformat = '%f[%l\, %c]: %m'
let loclist = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'tslint',
\ 'returns': [0, 2] })
call self.setWantSort(1)
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'typescript',
\ 'name': 'tslint'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View file

@ -37,7 +37,7 @@ set cpo&vim
function! SyntaxCheckers_vala_valac_GetHighlightRegex(pos)
let length = strlen(matchstr(a:pos['text'], '\m\^\+$'))
return '\%>' . (a:pos['col'] - 1) . 'c.*\%<' . (a:pos['col'] + length + 1) . 'c'
return '\%>' . (a:pos['col'] - 1) . 'c\%<' . (a:pos['col'] + length) . 'c'
endfunction
function! s:GetValaModules()

View file

@ -19,7 +19,7 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_vhdl_ghdl_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '-s' })
let makeprg = self.makeprgBuild({ 'args_before': '-s' })
let errorformat = '%f:%l:%c: %m'

View file

@ -29,7 +29,7 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item)
endif
endif
return '\V' . (col ? '\%' . col . 'c' : '') . escape(term, '\')
return col ? '\%>' . (col - 1) . 'c\%<' . (col + strlen(term)) . 'c' : '\V' . escape(term, '\')
endif
return ''
@ -81,7 +81,8 @@ endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'vim',
\ 'name': 'vimlint'})
\ 'name': 'vimlint',
\ 'exec': 'vim' })
let &cpo = s:save_cpo
unlet s:save_cpo

View file

@ -24,19 +24,18 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict
if !exists('g:syntastic_perl_interpreter')
let g:syntastic_perl_interpreter = self.getExec()
if !exists('g:syntastic_yaml_yamlxs_exec') && exists('g:syntastic_perl_interpreter')
let g:syntastic_yaml_yamlxs_exec = g:syntastic_perl_interpreter
endif
" don't call executable() here, to allow things like
" let g:syntastic_perl_interpreter='/usr/bin/env perl'
silent! call system(s:Exe() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)'))
silent! call system(self.getExecEscaped() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)'))
return v:shell_error == 0
endfunction
function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'exe': s:Exe(),
\ 'args_before': s:Modules() . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') })
let errorformat =
@ -53,13 +52,9 @@ function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict
\ 'defaults': {'bufnr': bufnr("")} })
endfunction
function! s:Exe()
return syntastic#util#shexpand(g:syntastic_perl_interpreter)
endfunction
function s:Modules()
if type(g:syntastic_perl_lib_path) == type('')
call syntastic#log#deprecationWarn('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, ',')
else
let includes = copy(syntastic#util#var('perl_lib_path'))

View file

@ -14,7 +14,7 @@
" - Install this python package:
" https://github.com/rgiot/pycpcdemotools
" - Copy/paste this script in your search path:
" https://raw.github.com/rgiot/pycpcdemotools/master/cpcdemotools/source_checker/z80_syntax_checker.py
" https://raw.githubusercontent.com/rgiot/pycpcdemotools/master/cpcdemotools/source_checker/z80_syntax_checker.py
if exists("g:loaded_syntastic_z80_z80syntaxchecker_checker")
finish

View file

@ -3,8 +3,8 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2008-11-25.
" @Last Change: 2014-01-23.
" @Revision: 0.0.108
" @Last Change: 2014-06-02.
" @Revision: 0.0.109
let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2
let s:prototype.highlight = g:tlib#input#higroup
@ -57,28 +57,6 @@ function! s:prototype.AssessName(world, name) dict "{{{3
elseif a:name =~ '\A'. flt .'\|'. flt .'\A'
let xa += 1
endif
" if a:name =~ '\^'. flt .'\|'. flt .'\$'
" let xa += 4
" elseif a:name =~ '\<'. flt .'\|'. flt .'\>'
" let xa += 3
" " elseif a:name =~ flt .'\>'
" " let xa += 2
" elseif a:name =~ '\A'. flt .'\|'. flt .'\A'
" let xa += 1
" endif
" if flt[0] =~# '\u' && matchstr(a:name, '\V\.\ze'. flt) =~# '\U'
" let xa += 1
" endif
" if flt[0] =~# '\U' && matchstr(a:name, '\V\.\ze'. flt) =~# '\u'
" let xa += 1
" endif
" if flt[-1] =~# '\u' && matchstr(a:name, '\V'. flt .'\zs\.') =~# '\U'
" let xa += 1
" endif
" if flt[-1] =~# '\U' && matchstr(a:name, '\V'. flt .'\zs\.') =~# '\u'
" let xa += 1
" endif
endfor
" TLogVAR a:name, xa
return xa

View file

@ -1,7 +1,7 @@
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 1391
" @Revision: 1393
" :filedoc:
" A prototype used by |tlib#input#List|.
@ -500,6 +500,7 @@ function! s:prototype.SetPrefIdx() dict "{{{3
let pref_idx = -1
let pref_weight = -1
" TLogVAR self.filter_pos, self.filter_neg
" let t0 = localtime() " DBG
for idx in range(1, self.llen)
let item = self.GetItem(idx)
let weight = self.matcher.AssessName(self, item)
@ -509,6 +510,7 @@ function! s:prototype.SetPrefIdx() dict "{{{3
let pref_weight = weight
endif
endfor
" TLogVAR localtime() - t0
" TLogVAR pref_idx
" TLogDBG self.GetItem(pref_idx)
if pref_idx == -1

View file

@ -4,7 +4,7 @@
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-06-30.
" @Last Change: 2009-02-15.
" @Revision: 0.0.110
" @Revision: 0.0.115
if &cp || exists("loaded_tlib_string_autoload")
finish
@ -23,8 +23,10 @@ function! tlib#string#RemoveBackslashes(text, ...) "{{{3
endf
function! tlib#string#Chomp(string) "{{{3
return substitute(a:string, '[[:cntrl:][:space:]]*$', '', '')
" :display: tlib#string#Chomp(string, ?max=0)
function! tlib#string#Chomp(string, ...) "{{{3
let quant = a:0 >= 1 ? '\{,'. a:1 .'}' : '\+'
return substitute(a:string, '[[:cntrl:][:space:]]'. quant .'$', '', '')
endf

View file

@ -2066,7 +2066,7 @@ tlib#string#RemoveBackslashes(text, ?chars=' ')
chars).
*tlib#string#Chomp()*
tlib#string#Chomp(string)
tlib#string#Chomp(string, ?max=0)
*tlib#string#Format()*
tlib#string#Format(template, dict)
@ -2092,4 +2092,4 @@ tlib#string#Count(string, rx)
vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl:
vim:tw=78:fo=w2croql:isk=!-~,^*,^|,^":ts=8:ft=help:norl:

View file

@ -2,7 +2,7 @@
" @Created: 2007-04-10.
" @Last Change: 2013-09-25.
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Revision: 750
" @Revision: 751
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" GetLatestVimScripts: 1863 1 tlib.vim
" tlib.vim -- Some utility functions
@ -14,7 +14,7 @@ if v:version < 700 "{{{2
echoerr "tlib requires Vim >= 7"
finish
endif
let loaded_tlib = 109
let loaded_tlib = 110
let s:save_cpo = &cpo
set cpo&vim

View file

@ -121,7 +121,7 @@ This plugin follows the standard runtime path structure, and as such it can be i
* [NeoBundle][12]
* `NeoBundle 'bling/vim-airline'`
* [Vundle][13]
* `Bundle 'bling/vim-airline'`
* `Plugin 'bling/vim-airline'`
* [VAM][22]
* `call vam#ActivateAddons([ 'vim-airline' ])`
* manual

View file

@ -148,16 +148,18 @@ function! airline#check_mode(winnr)
let w:airline_current_mode = get(g:airline_mode_map, '__')
endif
if g:airline_detect_modified
if &modified
call add(l:mode, 'modified')
endif
if g:airline_detect_modified && &modified
call add(l:mode, 'modified')
endif
if g:airline_detect_paste && &paste
call add(l:mode, 'paste')
endif
if &readonly
call add(l:mode, 'readonly')
endif
let mode_string = join(l:mode)
if get(w:, 'airline_lastmode', '') != mode_string
call airline#highlighter#highlight_modified_inactive(context.bufnr)

View file

@ -148,7 +148,7 @@ function! airline#extensions#load()
endif
if (get(g:, 'airline#extensions#hunks#enabled', 1) && get(g:, 'airline_enable_hunks', 1))
\ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter'))
\ && (exists('g:loaded_signify') || exists('g:loaded_gitgutter') || exists('g:loaded_changes'))
call airline#extensions#hunks#init(s:ext)
endif
@ -207,22 +207,28 @@ function! airline#extensions#load()
call airline#extensions#promptline#init(s:ext)
endif
" Load all other extensions, which are not part of the default distribution.
" (autoload/airline/extensions/*.vim outside of our s:script_path).
for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
" we have to check both resolved and unresolved paths, since it's possible
" that they might not get resolved properly (see #187)
if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0
\ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0
let name = fnamemodify(file, ':t:r')
if !get(g:, 'airline#extensions#'.name.'#enabled', 1)
continue
if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2
call airline#extensions#nrrwrgn#init(s:ext)
endif
if !get(g:, 'airline#extensions#disable_rtp_load', 0)
" load all other extensions, which are not part of the default distribution.
" (autoload/airline/extensions/*.vim outside of our s:script_path).
for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
" we have to check both resolved and unresolved paths, since it's possible
" that they might not get resolved properly (see #187)
if stridx(tolower(resolve(fnamemodify(file, ':p'))), s:script_path) < 0
\ && stridx(tolower(fnamemodify(file, ':p')), s:script_path) < 0
let name = fnamemodify(file, ':t:r')
if !get(g:, 'airline#extensions#'.name.'#enabled', 1)
continue
endif
try
call airline#extensions#{name}#init(s:ext)
catch
endtry
endif
try
call airline#extensions#{name}#init(s:ext)
catch
endtry
endif
endfor
endfor
endif
endfunction

View file

@ -42,7 +42,7 @@ function! airline#extensions#branch#head()
let b:airline_head = fugitive#head()
if empty(b:airline_head) && !exists('b:git_dir')
let b:airline_head = s:get_git_branch(getcwd())
let b:airline_head = s:get_git_branch(expand("%:p:h"))
endif
endif
@ -65,6 +65,13 @@ function! airline#extensions#branch#head()
let b:airline_head = ''
endif
if exists("g:airline#extensions#branch#displayed_head_limit")
let w:displayed_head_limit = g:airline#extensions#branch#displayed_head_limit
if len(b:airline_head) > w:displayed_head_limit - 1
let b:airline_head = b:airline_head[0:w:displayed_head_limit - 1].'…'
endif
endif
return b:airline_head
endfunction

View file

@ -1,7 +1,7 @@
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0)
if !get(g:, 'loaded_signify', 0) && !get(g:, 'loaded_gitgutter', 0) && !get(g:, 'loaded_changes', 0)
finish
endif
@ -27,6 +27,19 @@ function! s:get_hunks_gitgutter()
return GitGutterGetHunkSummary()
endfunction
function! s:get_hunks_changes()
if !get(b:, 'changes_view_enabled', 0) || s:is_branch_empty()
return []
endif
let hunks = changes#GetStats()
for i in hunks
if i > 0
return hunks
endif
endfor
return []
endfunction
function! s:get_hunks_empty()
return ''
endfunction
@ -38,6 +51,8 @@ function! s:get_hunks()
let s:source_func = 's:get_hunks_signify'
elseif exists('*GitGutterGetHunkSummary')
let s:source_func = 's:get_hunks_gitgutter'
elseif exists('*changes#GetStats')
let s:source_func = 's:get_hunks_changes'
else
let s:source_func = 's:get_hunks_empty'
endif

View file

@ -0,0 +1,54 @@
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
if !get(g:, 'loaded_nrrw_rgn', 0)
finish
endif
function! airline#extensions#nrrwrgn#apply(...)
if exists(":WidenRegion") == 2
let spc = g:airline_symbols.space
if !exists("*nrrwrgn#NrrwRgnStatus()") || empty(nrrwrgn#NrrwRgnStatus())
call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn))
let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), ''))
call a:1.add_section('airline_c', spc.bufname.spc)
call a:1.split()
else
let dict=nrrwrgn#NrrwRgnStatus()
let vmode = { 'v': 'Char ', 'V': 'Line ', '': 'Block '}
let mode = dict.visual ? vmode[dict.visual] : vmode['V']
let winwidth = winwidth(0)
if winwidth < 80
let mode = mode[0]
endif
let title = (winwidth < 80 ? "Nrrw" : "Narrowed ")
let multi = (winwidth < 80 ? 'M' : 'Multi')
call a:1.add_section('airline_a', printf('[%s%s%s#%d]%s', (dict.multi ? multi : ""),
\ title, mode, b:nrrw_instn, spc))
let name = dict.fullname
if name !=# '[No Name]'
if winwidth > 100
" need some space
let name = fnamemodify(dict.fullname, ':~')
if strlen(name) > 8
" shorten name
let name = substitute(name, '\(.\)[^/\\]*\([/\\]\)', '\1\2', 'g')
endif
else
let name = fnamemodify(dict.fullname, ':t')
endif
endif
let range=(dict.multi ? '' : printf("[%d-%d]", dict.start[1], dict.end[1]))
call a:1.add_section('airline_c', printf("%s %s %s", name, range, dict.enabled ? "\u2713" : '!'))
call a:1.split()
call a:1.add_section('airline_x', get(g:, 'airline_section_x').spc)
call a:1.add_section('airline_y', spc.get(g:, 'airline_section_y').spc)
call a:1.add_section('airline_z', spc.get(g:, 'airline_section_z'))
endif
return 1
endif
endfunction
function! airline#extensions#nrrwrgn#init(ext)
call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply')
endfunction

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