diff --git a/.gitignore b/.gitignore index 5fb7daf6..6524f395 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ sources_non_forked/ack.vim/.netrwhist temp_dirs/yankring_history_v2.txt sources_forked/yankring/doc/tags sources_non_forked/tlib/doc/tags +my_configs.vim +tags diff --git a/README.md b/README.md index 5a6f068c..71b36a48 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ The awesome version includes a lot of great plugins, configurations and color sc git clone git://github.com/amix/vimrc.git ~/.vim_runtime sh ~/.vim_runtime/install_awesome_vimrc.sh +I also recommend using [Source Code Pro font from Adobe](http://store1.adobe.com/cfusion/store/html/index.cfm?event=displayFontPackage&code=1960) (it's free and awesome font for writing and programming). The Awesome vimrc is already setup to try to use it ## How to install on Windows? @@ -55,8 +56,11 @@ Opening recently opened files [mru.vim](https://github.com/vim-scripts/mru.vim): This vimrc even works on Windows! ![Screenshot 4](http://files1.wedoist.com/4e85163d97b81422240c822c82022f2f/as/screenshot_4.png) +Distraction free mode (using goyo.vim and vim-zenroom2): +![Screenshot 5](https://d2dq6e731uoz0t.cloudfront.net/a5182977c3d6c2a6cd3f9e97398ca8ca/as/zen_mode.jpg) -## What plugins are included? + +## Included Plugins I recommend reading the docs of these plugins to understand them better. Each of them provide a much better Vim experience! @@ -69,16 +73,20 @@ I recommend reading the docs of these plugins to understand them better. Each of * [ctrlp.vim](https://github.com/kien/ctrlp.vim): Fuzzy file, buffer, mru and tag finder. In my config it's mapped to ``, because `` is used by YankRing * [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. Includes my own fork which adds syntax highlighting to MRU. This plugin can be opened with `` * [open_file_under_cursor.vim](https://github.com/amix/open_file_under_cursor.vim): Open file under cursor when pressing `gf` -* [zencoding](https://github.com/mattn/zencoding-vim): Expanding abbreviation like zen-coding, very useful for editing XML, HTML. +* [zencoding](https://github.com/mattn/emmet-vim): Expanding abbreviation like zen-coding, very useful for editing XML, HTML. * [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object): Defines a new text object representing lines of code at the same indent level. Useful for python/vim scripts * [taglist.vim](https://github.com/vim-scripts/taglist.vim): Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc) * [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors): Sublime Text style multiple selections for Vim, CTRL+N is remapped to CTRL+S (due to YankRing) * [vim-expand-region](https://github.com/terryma/vim-expand-region): Allows you to visually select increasingly larger regions of text using the same key combination. * [vim-airline](https://github.com/bling/vim-airline): Lean & mean status/tabline for vim that's light as air (replacing powerline) * [vim-fugitive](https://github.com/tpope/vim-fugitive): A Git wrapper so awesome, it should be illegal +* [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2): +Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room [Read more here](http://amix.dk/blog/post/19744) +* [vim-commentary](https://github.com/tpope/vim-commentary): Comment stuff out. Use `gcc` to comment out a line (takes a count), `gc` to comment out the target of a motion. `gcu` uncomments a set of adjacent commented lines. +* [syntastic](https://github.com/scrooloose/syntastic): Syntax checking hacks for vim -## What color schemes are included? +## Included color schemes * [peaksea](https://github.com/vim-scripts/peaksea): My favorite! * [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized) @@ -87,13 +95,14 @@ I recommend reading the docs of these plugins to understand them better. Each of * [vim-pyte](https://github.com/therubymug/vim-pyte) -## What modes are included? +## Included modes * [vim-coffee-script](https://github.com/kchmck/vim-coffee-script) * [vim-less](https://github.com/groenewege/vim-less) * [vim-bundle-mako](https://github.com/sophacles/vim-bundle-mako) * [vim-markdown](https://github.com/tpope/vim-markdown) * [nginx.vim](https://github.com/vim-scripts/nginx.vim): Highlights configuration files for nginx +* [vim-golang](https://github.com/jnwhiteh/vim-golang) ## How to include your own stuff? @@ -138,6 +147,10 @@ Managing the [NERD Tree](https://github.com/scrooloose/nerdtree) plugin: map nb :NERDTreeFromBookmark map nf :NERDTreeFind +[goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2) lets you only focus on one thing at a time. It removes all the distractions and centers the content. It has a special look when editing Markdown, reStructuredText and textfiles. It only has one mapping. + + map z :Goyo + ### Normal mode mappings Fast saving of a buffer: @@ -303,7 +316,6 @@ Vimscript mappings: map n :cn map p :cp - ## Useful blog tips regarding my Vim setup * [Vim: Annotate strings with gettext (the macro way)](http://amix.dk/blog/post/19678#Vim-Annotate-strings-with-gettext-the-macro-way) @@ -313,3 +325,5 @@ Vimscript mappings: * [Vim 7.3: Persistent undo and encryption!](http://amix.dk/blog/post/19548#Vim-7-3-Persistent-undo-and-encryption) * [Vim tips: Visual Search](http://amix.dk/blog/post/19334#Vim-tips-Visual-Search) * [Folding in Vim](http://amix.dk/blog/post/19132#Folding-in-Vim) +* [ +Zen room for Vim: Focusing only on the essential](http://amix.dk/blog/post/19744#zenroom-for-Vim-Focsuing-only-on-the-essential) diff --git a/autoload/.svn/entries b/autoload/.svn/entries deleted file mode 100644 index b5d86893..00000000 --- a/autoload/.svn/entries +++ /dev/null @@ -1,99 +0,0 @@ -10 - -dir -24 -svn://orangoo.com/vim/autoload -svn://orangoo.com/vim - - - -2010-01-15T19:53:13.037300Z -2 -amix - - - - - - - - - - - - - - -f0bd9f4a-2ac3-40fc-bab3-7711922a5bd5 - -fuf -dir - -fuf.vim -file - - - - -2009-12-03T15:37:36.000000Z -cd795290ec0c8e87d61563c8553f6a5a -2010-01-15T19:52:41.083563Z -1 -amix - - - - - - - - - - - - - - - - - - - - - -34950 - -snipMate.vim -file - - - - -2010-01-15T16:14:44.000000Z -935ed920e29eeb56885cba09798db5ce -2010-01-15T19:52:41.083563Z -1 -amix - - - - - - - - - - - - - - - - - - - - - -14083 - diff --git a/autoload/.svn/text-base/fuf.vim.svn-base b/autoload/.svn/text-base/fuf.vim.svn-base deleted file mode 100644 index 0a91d3a5..00000000 --- a/autoload/.svn/text-base/fuf.vim.svn-base +++ /dev/null @@ -1,1155 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2009 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if exists('g:loaded_autoload_fuf') || v:version < 702 - finish -endif -let g:loaded_autoload_fuf = 1 - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - - - -function fuf#getPathSeparator() - return (!&shellslash && (has('win32') || has('win64')) ? '\' : '/') -endfunction - -" Removes duplicates -" this function doesn't change list of argument. -function fuf#unique(items) - let sorted = sort(a:items) - if len(sorted) < 2 - return sorted - endif - let last = remove(sorted, 0) - let result = [last] - for item in sorted - if item != last - call add(result, item) - let last = item - endif - endfor - return result -endfunction - -" [ [0], [1,2], [3] ] -> [ 0, 1, 2, 3 ] -" this function doesn't change list of argument. -function fuf#concat(items) - let result = [] - for l in a:items - let result += l - endfor - return result -endfunction - -" filter() with the maximum number of items -" this function doesn't change list of argument. -function fuf#filterWithLimit(items, expr, limit) - if a:limit <= 0 - return filter(copy(a:items), a:expr) - endif - let result = [] - let stride = a:limit * 3 / 2 " x1.5 - for i in range(0, len(a:items) - 1, stride) - let result += filter(a:items[i : i + stride - 1], a:expr) - if len(result) >= a:limit - return remove(result, 0, a:limit - 1) - endif - endfor - return result -endfunction - -" -function fuf#countModifiedFiles(files, time) - return len(filter(copy(a:files), 'getftime(v:val) > a:time')) -endfunction - -" -function fuf#getCurrentTagFiles() - return sort(filter(map(tagfiles(), 'fnamemodify(v:val, '':p'')'), 'filereadable(v:val)')) -endfunction - -" -function fuf#mapToSetSerialIndex(in, offset) - for i in range(len(a:in)) - let a:in[i].index = i + a:offset - endfor - return a:in -endfunction - -" -function fuf#updateMruList(mrulist, newItem, maxItem, exclude) - let result = copy(a:mrulist) - let result = filter(result,'v:val.word != a:newItem.word') - let result = insert(result, a:newItem) - let result = filter(result, 'v:val.word !~ a:exclude') - return result[0 : a:maxItem - 1] -endfunction - -" takes suffix number. if no digits, returns -1 -function fuf#suffixNumber(str) - let s = matchstr(a:str, '\d\+$') - return (len(s) ? str2nr(s) : -1) -endfunction - -" "foo/bar/buz/hoge" -> { head: "foo/bar/buz/", tail: "hoge" } -function fuf#splitPath(path) - let head = matchstr(a:path, '^.*[/\\]') - return { - \ 'head' : head, - \ 'tail' : a:path[strlen(head):] - \ } -endfunction - -" "foo/.../bar/...hoge" -> "foo/.../bar/../../hoge" -function fuf#expandTailDotSequenceToParentDir(pattern) - return substitute(a:pattern, '^\(.*[/\\]\)\?\zs\.\(\.\+\)\ze[^/\\]*$', - \ '\=repeat(".." . fuf#getPathSeparator(), len(submatch(2)))', '') -endfunction - -" -function fuf#hash224(str) - let a = 0x00000800 " shift 11 bit - let b = 0x001fffff " extract 11 bit - let nHash = 7 - let hashes = repeat([0], nHash) - for i in range(len(a:str)) - let iHash = i % nHash - let hashes[iHash] = hashes[iHash] * a + hashes[iHash] / b - let hashes[iHash] += char2nr(a:str[i]) - endfor - return join(map(hashes, 'printf("%08x", v:val)'), '') -endfunction - -" -function fuf#formatPrompt(prompt, partialMatching) - let indicator = (a:partialMatching ? '!' : '') - return substitute(a:prompt, '[]', indicator, 'g') -endfunction - -" -function fuf#getFileLines(file) - let bufnr = (type(a:file) ==# type(0) ? a:file : bufnr('^' . a:file . '$')) - let lines = getbufline(bufnr, 1, '$') - if !empty(lines) - return lines - endif - try - return readfile(expand(a:file)) - catch /.*/ - endtry - return [] -endfunction - -" -function fuf#makePreviewLinesAround(lines, indices, page, maxHeight) - let index = ((empty(a:indices) ? 0 : a:indices[0]) - \ + a:page * a:maxHeight) % len(a:lines) - if empty(a:lines) || a:maxHeight <= 0 - return [] - endif - let beg = max([0, index - a:maxHeight / 2]) - let end = min([beg + a:maxHeight, len(a:lines)]) - let beg = max([0, end - a:maxHeight]) - let lines = [] - for i in range(beg, end - 1) - let mark = (count(a:indices, i) ? '>' : ' ') - call add(lines, printf('%s%4d ', mark, i + 1) . a:lines[i]) - endfor - return lines -endfunction - -" a:file: a path string or a buffer number -function fuf#makePreviewLinesForFile(file, count, maxHeight) - let lines = fuf#getFileLines(a:file) - if empty(lines) - return [] - endif - let bufnr = (type(a:file) ==# type(0) ? a:file : bufnr('^' . a:file . '$')) - if exists('s:bufferCursorPosMap[bufnr]') - let indices = [s:bufferCursorPosMap[bufnr][1] - 1] - else - let indices = [] - endif - return fuf#makePreviewLinesAround( - \ lines, indices, a:count, a:maxHeight) -endfunction - -" -function fuf#echoWithHl(msg, hl) - execute "echohl " . a:hl - echo a:msg - echohl None -endfunction - -" -function fuf#inputHl(prompt, text, hl) - execute "echohl " . a:hl - let s = input(a:prompt, a:text) - echohl None - return s -endfunction - -" -function fuf#openBuffer(bufNr, mode, reuse) - if a:reuse && ((a:mode == s:OPEN_TYPE_SPLIT && - \ s:moveToWindowOfBufferInCurrentTabPage(a:bufNr)) || - \ (a:mode == s:OPEN_TYPE_VSPLIT && - \ s:moveToWindowOfBufferInCurrentTabPage(a:bufNr)) || - \ (a:mode == s:OPEN_TYPE_TAB && - \ s:moveToWindowOfBufferInOtherTabPage(a:bufNr))) - return - endif - execute printf({ - \ s:OPEN_TYPE_CURRENT : '%sbuffer' , - \ s:OPEN_TYPE_SPLIT : '%ssbuffer' , - \ s:OPEN_TYPE_VSPLIT : 'vertical %ssbuffer', - \ s:OPEN_TYPE_TAB : 'tab %ssbuffer' , - \ }[a:mode], a:bufNr) -endfunction - -" -function fuf#openFile(path, mode, reuse) - let bufNr = bufnr('^' . a:path . '$') - if bufNr > -1 - call fuf#openBuffer(bufNr, a:mode, a:reuse) - else - execute { - \ s:OPEN_TYPE_CURRENT : 'edit ' , - \ s:OPEN_TYPE_SPLIT : 'split ' , - \ s:OPEN_TYPE_VSPLIT : 'vsplit ' , - \ s:OPEN_TYPE_TAB : 'tabedit ', - \ }[a:mode] . fnameescape(fnamemodify(a:path, ':~:.')) - endif -endfunction - -" -function fuf#openTag(tag, mode) - execute { - \ s:OPEN_TYPE_CURRENT : 'tjump ' , - \ s:OPEN_TYPE_SPLIT : 'stjump ' , - \ s:OPEN_TYPE_VSPLIT : 'vertical stjump ', - \ s:OPEN_TYPE_TAB : 'tab stjump ' , - \ }[a:mode] . a:tag -endfunction - -" -function fuf#openHelp(tag, mode) - execute { - \ s:OPEN_TYPE_CURRENT : 'help ' , - \ s:OPEN_TYPE_SPLIT : 'help ' , - \ s:OPEN_TYPE_VSPLIT : 'vertical help ', - \ s:OPEN_TYPE_TAB : 'tab help ' , - \ }[a:mode] . a:tag -endfunction - -" -function fuf#prejump(mode) - execute { - \ s:OPEN_TYPE_CURRENT : '' , - \ s:OPEN_TYPE_SPLIT : 'split' , - \ s:OPEN_TYPE_VSPLIT : 'vsplit' , - \ s:OPEN_TYPE_TAB : 'tab split', - \ }[a:mode] -endfunction - -" -function fuf#compareRanks(i1, i2) - if exists('a:i1.ranks') && exists('a:i2.ranks') - for i in range(min([len(a:i1.ranks), len(a:i2.ranks)])) - if a:i1.ranks[i] > a:i2.ranks[i] - return +1 - elseif a:i1.ranks[i] < a:i2.ranks[i] - return -1 - endif - endfor - endif - return 0 -endfunction - -" -function fuf#makePathItem(fname, menu, appendsDirSuffix) - let pathPair = fuf#splitPath(a:fname) - let dirSuffix = (a:appendsDirSuffix && isdirectory(a:fname) - \ ? fuf#getPathSeparator() - \ : '') - return { - \ 'word' : a:fname . dirSuffix, - \ 'wordForPrimaryHead': s:toLowerForIgnoringCase(pathPair.head), - \ 'wordForPrimaryTail': s:toLowerForIgnoringCase(pathPair.tail), - \ 'wordForBoundary' : s:toLowerForIgnoringCase(s:getWordBoundaries(pathPair.tail)), - \ 'wordForRefining' : s:toLowerForIgnoringCase(a:fname . dirSuffix), - \ 'wordForRank' : s:toLowerForIgnoringCase(pathPair.tail), - \ 'menu' : a:menu, - \ } -endfunction - -" -function fuf#makeNonPathItem(word, menu) - let wordL = s:toLowerForIgnoringCase(a:word) - return { - \ 'word' : a:word, - \ 'wordForPrimary' : wordL, - \ 'wordForBoundary': s:toLowerForIgnoringCase(s:getWordBoundaries(a:word)), - \ 'wordForRefining': wordL, - \ 'wordForRank' : wordL, - \ 'menu' : a:menu, - \ } -endfunction - -" -function s:interpretPrimaryPatternForPathTail(pattern) - let pattern = fuf#expandTailDotSequenceToParentDir(a:pattern) - let pairL = fuf#splitPath(s:toLowerForIgnoringCase(pattern)) - return { - \ 'primary' : pattern, - \ 'primaryForRank': pairL.tail, - \ 'matchingPairs' : [['v:val.wordForPrimaryTail', pairL.tail],], - \ } -endfunction - -" -function s:interpretPrimaryPatternForPath(pattern) - let pattern = fuf#expandTailDotSequenceToParentDir(a:pattern) - let patternL = s:toLowerForIgnoringCase(pattern) - let pairL = fuf#splitPath(patternL) - if g:fuf_splitPathMatching - let matches = [ - \ ['v:val.wordForPrimaryHead', pairL.head], - \ ['v:val.wordForPrimaryTail', pairL.tail], - \ ] - else - let matches = [ - \ ['v:val.wordForPrimaryHead . v:val.wordForPrimaryTail', patternL], - \ ] - endif - return { - \ 'primary' : pattern, - \ 'primaryForRank': pairL.tail, - \ 'matchingPairs' : matches, - \ } -endfunction - -" -function s:interpretPrimaryPatternForNonPath(pattern) - let patternL = s:toLowerForIgnoringCase(a:pattern) - return { - \ 'primary' : a:pattern, - \ 'primaryForRank': patternL, - \ 'matchingPairs' : [['v:val.wordForPrimary', patternL],], - \ } -endfunction - -" -function fuf#makePatternSet(patternBase, interpreter, partialMatching) - let MakeMatchingExpr = function(a:partialMatching - \ ? 's:makePartialMatchingExpr' - \ : 's:makeFuzzyMatchingExpr') - let [primary; refinings] = split(a:patternBase, g:fuf_patternSeparator, 1) - let elements = call(a:interpreter, [primary]) - let primaryExprs = map(elements.matchingPairs, 'MakeMatchingExpr(v:val[0], v:val[1])') - let refiningExprs = map(refinings, 's:makeRefiningExpr(v:val)') - return { - \ 'primary' : elements.primary, - \ 'primaryForRank': elements.primaryForRank, - \ 'filteringExpr' : join(primaryExprs + refiningExprs, ' && '), - \ } -endfunction - -" -function fuf#enumExpandedDirsEntries(dir, exclude) - " Substitutes "\" because on Windows, "**\" doesn't include ".\", - " but "**/" include "./". I don't know why. - let dirNormalized = substitute(a:dir, '\', '/', 'g') - let entries = split(glob(dirNormalized . "*" ), "\n") + - \ split(glob(dirNormalized . ".*"), "\n") - " removes "*/." and "*/.." - call filter(entries, 'v:val !~ ''\v(^|[/\\])\.\.?$''') - call map(entries, 'fuf#makePathItem(v:val, "", 1)') - if len(a:exclude) - call filter(entries, 'v:val.word !~ a:exclude') - endif - return entries -endfunction - -" -function fuf#mapToSetAbbrWithSnippedWordAsPath(items) - let maxLenStats = {} - call map(a:items, 's:makeFileAbbrInfo(v:val, maxLenStats)') - let snippedHeads = - \ map(maxLenStats, 's:getSnippedHead(v:key[: -2], v:val)') - return map(a:items, 's:setAbbrWithFileAbbrData(v:val, snippedHeads)') -endfunction - -" -function fuf#setAbbrWithFormattedWord(item, abbrIndex) - let lenMenu = (exists('a:item.menu') ? len(a:item.menu) + 2 : 0) - let abbrPrefix = (exists('a:item.abbrPrefix') ? a:item.abbrPrefix : '') - let a:item.abbr = abbrPrefix . a:item.word - if a:abbrIndex - let a:item.abbr = printf('%4d: ', a:item.index) . a:item.abbr - endif - let a:item.abbr = s:snipTail(a:item.abbr, g:fuf_maxMenuWidth - lenMenu, s:ABBR_SNIP_MASK) - return a:item -endfunction - -" -function fuf#defineLaunchCommand(CmdName, modeName, prefixInitialPattern) - execute printf('command! -bang -narg=? %s call fuf#launch(%s, %s . , len())', - \ a:CmdName, string(a:modeName), a:prefixInitialPattern) -endfunction - -" -function fuf#defineKeyMappingInHandler(key, func) - " hacks to be able to use feedkeys(). - execute printf( - \ 'inoremap %s =fuf#getRunningHandler().%s ? "" : ""', - \ a:key, a:func) -endfunction - -" -function fuf#launch(modeName, initialPattern, partialMatching) - if exists('s:runningHandler') - call fuf#echoWithHl('FuzzyFinder is running.', 'WarningMsg') - endif - if count(g:fuf_modes, a:modeName) == 0 - echoerr 'This mode is not available: ' . a:modeName - return - endif - let s:runningHandler = fuf#{a:modeName}#createHandler(copy(s:handlerBase)) - let s:runningHandler.info = fuf#loadInfoFile(s:runningHandler.getModeName()) - let s:runningHandler.partialMatching = a:partialMatching - let s:runningHandler.bufNrPrev = bufnr('%') - let s:runningHandler.lastCol = -1 - call s:runningHandler.onModeEnterPre() - call s:setTemporaryGlobalOption('completeopt', 'menuone') - call s:setTemporaryGlobalOption('ignorecase', 0) - if s:runningHandler.getPreviewHeight() > 0 - call s:setTemporaryGlobalOption( - \ 'cmdheight', s:runningHandler.getPreviewHeight() + 1) - endif - call s:activateFufBuffer() - augroup FufLocal - autocmd! - autocmd CursorMovedI call s:runningHandler.onCursorMovedI() - autocmd InsertLeave nested call s:runningHandler.onInsertLeave() - augroup END - for [key, func] in [ - \ [ g:fuf_keyOpen , 'onCr(' . s:OPEN_TYPE_CURRENT . ', 0)' ], - \ [ g:fuf_keyOpenSplit , 'onCr(' . s:OPEN_TYPE_SPLIT . ', 0)' ], - \ [ g:fuf_keyOpenVsplit , 'onCr(' . s:OPEN_TYPE_VSPLIT . ', 0)' ], - \ [ g:fuf_keyOpenTabpage , 'onCr(' . s:OPEN_TYPE_TAB . ', 0)' ], - \ [ '' , 'onBs()' ], - \ [ '' , 'onBs()' ], - \ [ g:fuf_keyPreview , 'onPreviewBase()' ], - \ [ g:fuf_keyNextMode , 'onSwitchMode(+1)' ], - \ [ g:fuf_keyPrevMode , 'onSwitchMode(-1)' ], - \ [ g:fuf_keySwitchMatching, 'onSwitchMatching()' ], - \ [ g:fuf_keyPrevPattern , 'onRecallPattern(+1)' ], - \ [ g:fuf_keyNextPattern , 'onRecallPattern(-1)' ], - \ ] - call fuf#defineKeyMappingInHandler(key, func) - endfor - " Starts Insert mode and makes CursorMovedI event now. Command prompt is - " needed to forces a completion menu to update every typing. - call setline(1, s:runningHandler.getPrompt() . a:initialPattern) - call s:runningHandler.onModeEnterPost() - call feedkeys("A", 'n') " startinsert! does not work in InsertLeave event handler - redraw -endfunction - -" -function fuf#loadInfoFile(modeName) - try - let lines = readfile(expand(g:fuf_infoFile)) - " compatibility check - if count(lines, s:INFO_FILE_VERSION_LINE) == 0 - call s:warnOldInfoFile() - let g:fuf_infoFile = '' - throw 1 - endif - catch /.*/ - let lines = [] - endtry - let s:lastInfoMap = s:deserializeInfoMap(lines) - if !exists('s:lastInfoMap[a:modeName]') - let s:lastInfoMap[a:modeName] = {} - endif - return extend(s:lastInfoMap[a:modeName], { 'data': [], 'stats': [] }, 'keep') -endfunction - -" if a:modeName is empty, a:info is treated as a map of information -function fuf#saveInfoFile(modeName, info) - if empty(a:modeName) - let s:lastInfoMap = a:info - else - let s:lastInfoMap[a:modeName] = a:info - endif - let lines = [ s:INFO_FILE_VERSION_LINE ] + s:serializeInfoMap(s:lastInfoMap) - try - call writefile(lines, expand(g:fuf_infoFile)) - catch /.*/ - endtry -endfunction - -" -function fuf#editInfoFile() - new - silent file `='[fuf-info]'` - let s:bufNrInfo = bufnr('%') - setlocal filetype=vim - setlocal bufhidden=delete - setlocal buftype=acwrite - setlocal noswapfile - augroup FufInfo - autocmd! - autocmd BufWriteCmd call s:onBufWriteCmdInfoFile() - augroup END - execute '0read ' . expand(g:fuf_infoFile) - setlocal nomodified -endfunction - -" -function fuf#getRunningHandler() - return s:runningHandler -endfunction - -" -function fuf#onComplete(findstart, base) - return s:runningHandler.onComplete(a:findstart, a:base) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:INFO_FILE_VERSION_LINE = "VERSION\t300" -let s:ABBR_SNIP_MASK = '...' -let s:OPEN_TYPE_CURRENT = 1 -let s:OPEN_TYPE_SPLIT = 2 -let s:OPEN_TYPE_VSPLIT = 3 -let s:OPEN_TYPE_TAB = 4 - -" wildcard -> regexp -function s:convertWildcardToRegexp(expr) - let re = escape(a:expr, '\') - for [pat, sub] in [ [ '*', '\\.\\*' ], [ '?', '\\.' ], [ '[', '\\[' ], ] - let re = substitute(re, pat, sub, 'g') - endfor - return '\V' . re -endfunction - -" a:pattern: 'str' -> '\V\.\*s\.\*t\.\*r\.\*' -function s:makeFuzzyMatchingExpr(target, pattern) - let wi = '' - for c in split(a:pattern, '\zs') - if wi =~# '[^*?]$' && c !~ '[*?]' - let wi .= '*' - endif - let wi .= c - endfor - return s:makePartialMatchingExpr(a:target, wi) -endfunction - -" a:pattern: 'str' -> '\Vstr' -" 'st*r' -> '\Vst\.\*r' -function s:makePartialMatchingExpr(target, pattern) - let patternMigemo = s:makeAdditionalMigemoPattern(a:pattern) - if a:pattern !~ '[*?]' && empty(patternMigemo) - " NOTE: stridx is faster than regexp matching - return 'stridx(' . a:target . ', ' . string(a:pattern) . ') >= 0' - endif - return a:target . ' =~# ' . - \ string(s:convertWildcardToRegexp(a:pattern)) . patternMigemo -endfunction - -" -function s:makeRefiningExpr(pattern) - let expr = s:makePartialMatchingExpr('v:val.wordForRefining', a:pattern) - if a:pattern =~# '\D' - return expr - else - return '(' . expr . ' || v:val.index == ' . string(a:pattern) . ')' - endif -endfunction - -" -function s:makeAdditionalMigemoPattern(pattern) - if !g:fuf_useMigemo || a:pattern =~# '[^\x01-\x7e]' - return '' - endif - return '\|\m' . substitute(migemo(a:pattern), '\\_s\*', '.*', 'g') -endfunction - -" Snips a:str and add a:mask if the length of a:str is more than a:len -function s:snipHead(str, len, mask) - if a:len >= len(a:str) - return a:str - elseif a:len <= len(a:mask) - return a:mask - endif - return a:mask . a:str[-a:len + len(a:mask):] -endfunction - -" Snips a:str and add a:mask if the length of a:str is more than a:len -function s:snipTail(str, len, mask) - if a:len >= len(a:str) - return a:str - elseif a:len <= len(a:mask) - return a:mask - endif - return a:str[:a:len - 1 - len(a:mask)] . a:mask -endfunction - -" Snips a:str and add a:mask if the length of a:str is more than a:len -function s:snipMid(str, len, mask) - if a:len >= len(a:str) - return a:str - elseif a:len <= len(a:mask) - return a:mask - endif - let len_head = (a:len - len(a:mask)) / 2 - let len_tail = a:len - len(a:mask) - len_head - return (len_head > 0 ? a:str[: len_head - 1] : '') . a:mask . - \ (len_tail > 0 ? a:str[-len_tail :] : '') -endfunction - -" -function s:getWordBoundaries(word) - return substitute(a:word, '\a\zs\l\+\|\zs\A', '', 'g') -endfunction - -" -function s:toLowerForIgnoringCase(str) - return (g:fuf_ignoreCase ? tolower(a:str) : a:str) -endfunction - -" -function s:setRanks(item, pattern, exprBoundary, stats) - "let word2 = substitute(a:eval_word, '\a\zs\l\+\|\zs\A', '', 'g') - let a:item.ranks = [ - \ s:evaluateLearningRank(a:item.word, a:stats), - \ -s:scoreSequentialMatching(a:item.wordForRank, a:pattern), - \ -s:scoreBoundaryMatching(a:item.wordForBoundary, - \ a:pattern, a:exprBoundary), - \ a:item.index, - \ ] - return a:item -endfunction - -" -function s:evaluateLearningRank(word, stats) - for i in range(len(a:stats)) - if a:stats[i].word ==# a:word - return i - endif - endfor - return len(a:stats) -endfunction - -let g:s = "" -" range of return value is [0.0, 1.0] -function s:scoreSequentialMatching(word, pattern) - if empty(a:pattern) - return 0.0 - endif - let pos = stridx(a:word, a:pattern) - if pos < 0 - return 0.0 - endif - let lenRest = len(a:word) - len(a:pattern) - pos - return (pos == 0 ? 0.5 : 0.0) + 0.5 / (lenRest + 1) -endfunction - -" range of return value is [0.0, 1.0] -function s:scoreBoundaryMatching(wordForBoundary, pattern, exprBoundary) - if empty(a:pattern) - return 0.0 - endif - if !eval(a:exprBoundary) - return 0 - endif - return 0.5 + 0.5 * s:scoreSequentialMatching(a:wordForBoundary, a:pattern) -endfunction - -" -function s:highlightPrompt(prompt) - syntax clear - execute printf('syntax match %s /^\V%s/', g:fuf_promptHighlight, escape(a:prompt, '\')) -endfunction - -" -function s:highlightError() - syntax clear - syntax match Error /^.*$/ -endfunction - -" returns 0 if the buffer is not found. -function s:moveToWindowOfBufferInCurrentTabPage(bufNr) - if count(tabpagebuflist(), a:bufNr) == 0 - return 0 - endif - execute bufwinnr(a:bufNr) . 'wincmd w' - return 1 -endfunction - -" returns 0 if the buffer is not found. -function s:moveToOtherTabPageOpeningBuffer(bufNr) - for tabNr in range(1, tabpagenr('$')) - if tabNr != tabpagenr() && count(tabpagebuflist(tabNr), a:bufNr) > 0 - execute 'tabnext ' . tabNr - return 1 - endif - endfor - return 0 -endfunction - -" returns 0 if the buffer is not found. -function s:moveToWindowOfBufferInOtherTabPage(bufNr) - if !s:moveToOtherTabPageOpeningBuffer(a:bufNr) - return 0 - endif - return s:moveToWindowOfBufferInCurrentTabPage(a:bufNr) -endfunction - -" -function s:expandAbbrevMap(pattern, abbrevMap) - let result = [a:pattern] - for [pattern, subs] in items(a:abbrevMap) - let exprs = result - let result = [] - for expr in exprs - let result += map(copy(subs), 'substitute(expr, pattern, escape(v:val, ''\''), "g")') - endfor - endfor - return fuf#unique(result) -endfunction - -" -function s:makeFileAbbrInfo(item, maxLenStats) - let head = matchstr(a:item.word, '^.*[/\\]\ze.') - let a:item.abbr = { 'head' : head, - \ 'tail' : a:item.word[strlen(head):], - \ 'key' : head . '.', - \ 'prefix' : printf('%4d: ', a:item.index), } - if exists('a:item.abbrPrefix') - let a:item.abbr.prefix .= a:item.abbrPrefix - endif - let len = len(a:item.abbr.prefix) + len(a:item.word) + - \ (exists('a:item.menu') ? len(a:item.menu) + 2 : 0) - if !exists('a:maxLenStats[a:item.abbr.key]') || len > a:maxLenStats[a:item.abbr.key] - let a:maxLenStats[a:item.abbr.key] = len - endif - return a:item -endfunction - -" -function s:getSnippedHead(head, baseLen) - return s:snipMid(a:head, len(a:head) + g:fuf_maxMenuWidth - a:baseLen, s:ABBR_SNIP_MASK) -endfunction - -" -function s:setAbbrWithFileAbbrData(item, snippedHeads) - let lenMenu = (exists('a:item.menu') ? len(a:item.menu) + 2 : 0) - let abbr = a:item.abbr.prefix . a:snippedHeads[a:item.abbr.key] . a:item.abbr.tail - let a:item.abbr = s:snipTail(abbr, g:fuf_maxMenuWidth - lenMenu, s:ABBR_SNIP_MASK) - return a:item -endfunction - -let s:bufNrFuf = -1 - -" -function s:openFufBuffer() - if !bufexists(s:bufNrFuf) - topleft 1new - silent file `='[fuf]'` - let s:bufNrFuf = bufnr('%') - elseif bufwinnr(s:bufNrFuf) == -1 - topleft 1split - execute 'silent ' . s:bufNrFuf . 'buffer' - delete _ - elseif bufwinnr(s:bufNrFuf) != bufwinnr('%') - execute bufwinnr(s:bufNrFuf) . 'wincmd w' - endif -endfunction - -function s:setLocalOptionsForFufBuffer() - setlocal filetype=fuf - setlocal bufhidden=delete - setlocal buftype=nofile - setlocal noswapfile - setlocal nobuflisted - setlocal modifiable - setlocal nocursorline " for highlighting - setlocal nocursorcolumn " for highlighting - setlocal omnifunc=fuf#onComplete -endfunction - -" -function s:activateFufBuffer() - " lcd . : To avoid the strange behavior that unnamed buffer changes its cwd - " if 'autochdir' was set on. - lcd . - let cwd = getcwd() - call s:openFufBuffer() - " lcd ... : countermeasure against auto-cd script - lcd `=cwd` - call s:setLocalOptionsForFufBuffer() - redraw " for 'lazyredraw' - if exists(':AcpLock') - AcpLock - elseif exists(':AutoComplPopLock') - AutoComplPopLock - endif -endfunction - -" -function s:deactivateFufBuffer() - if exists(':AcpUnlock') - AcpUnlock - elseif exists(':AutoComplPopUnlock') - AutoComplPopUnlock - endif - " must close after returning to previous window - wincmd p - execute s:bufNrFuf . 'bdelete' -endfunction - -let s:originalGlobalOptions = {} - -" -function s:setTemporaryGlobalOption(name, value) - call extend(s:originalGlobalOptions, { a:name : eval('&' . a:name) }, 'keep') - execute printf('let &%s = a:value', a:name) -endfunction - -" -function s:restoreTemporaryGlobalOptions() - for [name, value] in items(s:originalGlobalOptions) - execute printf('let &%s = value', name) - endfor - let s:originalGlobalOptions = {} -endfunction - -" -function s:warnOldInfoFile() - call fuf#echoWithHl(printf("=================================================================\n" . - \ " Sorry, but your information file for FuzzyFinder is no longer \n" . - \ " compatible with this version of FuzzyFinder. Please remove \n" . - \ " %-63s\n" . - \ "=================================================================\n" , - \ '"' . expand(g:fuf_infoFile) . '".'), - \ 'WarningMsg') - echohl Question - call input('Press Enter') - echohl None -endfunction - -" -function s:serializeInfoMap(infoMap) - let lines = [] - for [m, info] in items(a:infoMap) - for [key, value] in items(info) - let lines += map(copy(value), 'm . "\t" . key . "\t" . string(v:val)') - endfor - endfor - return lines -endfunction - -" -function s:deserializeInfoMap(lines) - let infoMap = {} - for e in filter(map(a:lines, 'matchlist(v:val, ''^\v(\S+)\s+(\S+)\s+(.+)$'')'), '!empty(v:val)') - if !exists('infoMap[e[1]]') - let infoMap[e[1]] = {} - endif - if !exists('infoMap[e[1]][e[2]]') - let infoMap[e[1]][e[2]] = [] - endif - call add(infoMap[e[1]][e[2]], eval(e[3])) - endfor - return infoMap -endfunction - -" -function s:onBufWriteCmdInfoFile() - call fuf#saveInfoFile('', s:deserializeInfoMap(getline(1, '$'))) - setlocal nomodified - execute printf('%dbdelete! ', s:bufNrInfo) - echo "Information file updated" -endfunction - -" }}}1 -"============================================================================= -" s:handlerBase {{{1 - -let s:handlerBase = {} - -"----------------------------------------------------------------------------- -" PURE VIRTUAL FUNCTIONS {{{2 -" -" " -" s:handler.getModeName() -" -" " -" s:handler.getPrompt() -" -" " returns true if the mode deals with file paths. -" s:handler.targetsPath() -" -" " -" s:handler.getCompleteItems(patternSet) -" -" " -" s:handler.onOpen(word, mode) -" -" " Before entering FuzzyFinder buffer. This function should return in a short time. -" s:handler.onModeEnterPre() -" -" " After entering FuzzyFinder buffer. -" s:handler.onModeEnterPost() -" -" " After leaving FuzzyFinder buffer. -" s:handler.onModeLeavePost(opened) -" -" }}}2 -"----------------------------------------------------------------------------- - -" -function s:handlerBase.concretize(deriv) - call extend(self, a:deriv, 'error') - return self -endfunction - -" -function s:handlerBase.addStat(pattern, word) - let stat = { 'pattern' : a:pattern, 'word' : a:word } - call filter(self.info.stats, 'v:val !=# stat') - call insert(self.info.stats, stat) - let self.info.stats = self.info.stats[0 : g:fuf_learningLimit - 1] -endfunction - -" -function s:handlerBase.getMatchingCompleteItems(patternBase) - let MakeMatchingExpr = function(self.partialMatching - \ ? 's:makePartialMatchingExpr' - \ : 's:makeFuzzyMatchingExpr') - let patternSet = self.makePatternSet(a:patternBase) - let exprBoundary = s:makeFuzzyMatchingExpr('a:wordForBoundary', patternSet.primaryForRank) - let stats = filter( - \ copy(self.info.stats), 'v:val.pattern ==# patternSet.primaryForRank') - let items = self.getCompleteItems(patternSet.primary) - " NOTE: In order to know an excess, plus 1 to limit number - let items = fuf#filterWithLimit( - \ items, patternSet.filteringExpr, g:fuf_enumeratingLimit + 1) - return map(items, - \ 's:setRanks(v:val, patternSet.primaryForRank, exprBoundary, stats)') -endfunction - -" -function s:handlerBase.onComplete(findstart, base) - if a:findstart - return 0 - elseif !self.existsPrompt(a:base) - return [] - endif - call s:highlightPrompt(self.getPrompt()) - let items = [] - for patternBase in s:expandAbbrevMap(self.removePrompt(a:base), g:fuf_abbrevMap) - let items += self.getMatchingCompleteItems(patternBase) - if len(items) > g:fuf_enumeratingLimit - let items = items[ : g:fuf_enumeratingLimit - 1] - call s:highlightError() - break - endif - endfor - if empty(items) - call s:highlightError() - else - call sort(items, 'fuf#compareRanks') - call feedkeys("\\", 'n') - let self.lastFirstWord = items[0].word - endif - return items -endfunction - -" -function s:handlerBase.existsPrompt(line) - return strlen(a:line) >= strlen(self.getPrompt()) && - \ a:line[:strlen(self.getPrompt()) -1] ==# self.getPrompt() -endfunction - -" -function s:handlerBase.removePrompt(line) - return a:line[(self.existsPrompt(a:line) ? strlen(self.getPrompt()) : 0):] -endfunction - -" -function s:handlerBase.restorePrompt(line) - let i = 0 - while i < len(self.getPrompt()) && i < len(a:line) && self.getPrompt()[i] ==# a:line[i] - let i += 1 - endwhile - return self.getPrompt() . a:line[i : ] -endfunction - -" -function s:handlerBase.onCursorMovedI() - if !self.existsPrompt(getline('.')) - call setline('.', self.restorePrompt(getline('.'))) - call feedkeys("\", 'n') - elseif col('.') <= len(self.getPrompt()) - " if the cursor is moved before command prompt - call feedkeys(repeat("\", len(self.getPrompt()) - col('.') + 1), 'n') - elseif col('.') > strlen(getline('.')) && col('.') != self.lastCol - " if the cursor is placed on the end of the line and has been actually moved. - let self.lastCol = col('.') - let self.lastPattern = self.removePrompt(getline('.')) - call feedkeys("\\", 'n') - endif -endfunction - -" -function s:handlerBase.onInsertLeave() - unlet s:runningHandler - let lastPattern = self.removePrompt(getline('.')) - call s:restoreTemporaryGlobalOptions() - call s:deactivateFufBuffer() - call fuf#saveInfoFile(self.getModeName(), self.info) - let fOpen = exists('s:reservedCommand') - if fOpen - call self.onOpen(s:reservedCommand[0], s:reservedCommand[1]) - unlet s:reservedCommand - endif - call self.onModeLeavePost(fOpen) - if exists('s:reservedMode') - call fuf#launch(s:reservedMode, lastPattern, self.partialMatching) - unlet s:reservedMode - endif -endfunction - -" -function s:handlerBase.onCr(openType, fCheckDir) - if pumvisible() - call feedkeys(printf("\\=fuf#getRunningHandler().onCr(%d, %d) ? '' : ''\", - \ a:openType, self.targetsPath()), 'n') - return - endif - if !empty(self.lastPattern) - call self.addStat(self.lastPattern, self.removePrompt(getline('.'))) - endif - if a:fCheckDir && getline('.') =~# '[/\\]$' - " To clear i_ expression (fuf#getRunningHandler().onCr...) - echo '' - return - endif - let s:reservedCommand = [self.removePrompt(getline('.')), a:openType] - call feedkeys("\", 'n') " stopinsert behavior is strange... -endfunction - -" -function s:handlerBase.onBs() - let pattern = self.removePrompt(getline('.')[ : col('.') - 2]) - if empty(pattern) - let numBs = 0 - elseif !g:fuf_smartBs - let numBs = 1 - elseif pattern[-len(g:fuf_patternSeparator) : ] ==# g:fuf_patternSeparator - let numBs = len(split(pattern, g:fuf_patternSeparator, 1)[-2]) - \ + len(g:fuf_patternSeparator) - elseif self.targetsPath() && pattern[-1 : ] =~# '[/\\]' - let numBs = len(matchstr(pattern, '[^/\\]*.$')) - else - let numBs = 1 - endif - call feedkeys((pumvisible() ? "\" : "") . repeat("\", numBs), 'n') -endfunction - -" -function s:handlerBase.onPreviewBase() - if self.getPreviewHeight() <= 0 - return - elseif !pumvisible() - return - elseif !self.existsPrompt(getline('.')) - let word = self.removePrompt(getline('.')) - elseif !exists('self.lastFirstWord') - return - else - let word = self.lastFirstWord - endif - redraw - if exists('self.lastPreviewInfo') && self.lastPreviewInfo.word ==# word - let self.lastPreviewInfo.count += 1 - else - let self.lastPreviewInfo = {'word': word, 'count': 0} - endif - let lines = self.makePreviewLines(word, self.lastPreviewInfo.count) - let lines = lines[: self.getPreviewHeight() - 1] - call map(lines, 'substitute(v:val, "\t", repeat(" ", &tabstop), "g")') - call map(lines, 's:snipTail(v:val, &columns - 1, s:ABBR_SNIP_MASK)') - echo join(lines, "\n") -endfunction - -" -function s:handlerBase.onSwitchMode(shift) - let modes = copy(g:fuf_modes) - call map(modes, '{ "ranks": [ fuf#{v:val}#getSwitchOrder(), v:val ] }') - call filter(modes, 'v:val.ranks[0] >= 0') - call sort(modes, 'fuf#compareRanks') - let s:reservedMode = self.getModeName() - for i in range(len(modes)) - if modes[i].ranks[1] ==# self.getModeName() - let s:reservedMode = modes[(i + a:shift) % len(modes)].ranks[1] - break - endif - endfor - call feedkeys("\", 'n') " stopinsert doesn't work. -endfunction - -" -function s:handlerBase.onSwitchMatching() - let self.partialMatching = !self.partialMatching - let self.lastCol = -1 - call setline('.', self.restorePrompt(self.lastPattern)) - call feedkeys("\", 'n') - "call self.onCursorMovedI() -endfunction - -" -function s:handlerBase.onRecallPattern(shift) - let patterns = map(copy(self.info.stats), 'v:val.pattern') - if !exists('self.indexRecall') - let self.indexRecall = -1 - endif - let self.indexRecall += a:shift - if self.indexRecall < 0 - let self.indexRecall = -1 - elseif self.indexRecall >= len(patterns) - let self.indexRecall = len(patterns) - 1 - else - call setline('.', self.getPrompt() . patterns[self.indexRecall]) - call feedkeys("\", 'n') - endif -endfunction - -" }}}1 -"============================================================================= -" INITIALIZATION {{{1 - -augroup FufGlobal - autocmd! - autocmd BufLeave * let s:bufferCursorPosMap[bufnr('')] = getpos('.') -augroup END - -let s:bufferCursorPosMap = {} - -" }}}1 -"============================================================================= -" vim: set fdm=marker: - diff --git a/autoload/.svn/text-base/snipMate.vim.svn-base b/autoload/.svn/text-base/snipMate.vim.svn-base deleted file mode 100644 index dcd28f66..00000000 --- a/autoload/.svn/text-base/snipMate.vim.svn-base +++ /dev/null @@ -1,433 +0,0 @@ -fun! Filename(...) - let filename = expand('%:t:r') - if filename == '' | return a:0 == 2 ? a:2 : '' | endif - return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g') -endf - -fun s:RemoveSnippet() - unl! g:snipPos s:curPos s:snipLen s:endCol s:endLine s:prevLen - \ s:lastBuf s:oldWord - if exists('s:update') - unl s:startCol s:origWordLen s:update - if exists('s:oldVars') | unl s:oldVars s:oldEndCol | endif - endif - aug! snipMateAutocmds -endf - -fun snipMate#expandSnip(snip, col) - let lnum = line('.') | let col = a:col - - let snippet = s:ProcessSnippet(a:snip) - " Avoid error if eval evaluates to nothing - if snippet == '' | return '' | endif - - " Expand snippet onto current position with the tab stops removed - let snipLines = split(substitute(snippet, '$\d\+\|${\d\+.\{-}}', '', 'g'), "\n", 1) - - let line = getline(lnum) - let afterCursor = strpart(line, col - 1) - " Keep text after the cursor - if afterCursor != "\t" && afterCursor != ' ' - let line = strpart(line, 0, col - 1) - let snipLines[-1] .= afterCursor - else - let afterCursor = '' - " For some reason the cursor needs to move one right after this - if line != '' && col == 1 && &ve != 'all' && &ve != 'onemore' - let col += 1 - endif - endif - - call setline(lnum, line.snipLines[0]) - - " Autoindent snippet according to previous indentation - let indent = matchend(line, '^.\{-}\ze\(\S\|$\)') + 1 - call append(lnum, map(snipLines[1:], "'".strpart(line, 0, indent - 1)."'.v:val")) - - " Open any folds snippet expands into - if &fen | sil! exe lnum.','.(lnum + len(snipLines) - 1).'foldopen' | endif - - let [g:snipPos, s:snipLen] = s:BuildTabStops(snippet, lnum, col - indent, indent) - - if s:snipLen - aug snipMateAutocmds - au CursorMovedI * call s:UpdateChangedSnip(0) - au InsertEnter * call s:UpdateChangedSnip(1) - aug END - let s:lastBuf = bufnr(0) " Only expand snippet while in current buffer - let s:curPos = 0 - let s:endCol = g:snipPos[s:curPos][1] - let s:endLine = g:snipPos[s:curPos][0] - - call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1]) - let s:prevLen = [line('$'), col('$')] - if g:snipPos[s:curPos][2] != -1 | return s:SelectWord() | endif - else - unl g:snipPos s:snipLen - " Place cursor at end of snippet if no tab stop is given - let newlines = len(snipLines) - 1 - call cursor(lnum + newlines, indent + len(snipLines[-1]) - len(afterCursor) - \ + (newlines ? 0: col - 1)) - endif - return '' -endf - -" Prepare snippet to be processed by s:BuildTabStops -fun s:ProcessSnippet(snip) - let snippet = a:snip - " Evaluate eval (`...`) expressions. - " Using a loop here instead of a regex fixes a bug with nested "\=". - if stridx(snippet, '`') != -1 - while match(snippet, '`.\{-}`') != -1 - let snippet = substitute(snippet, '`.\{-}`', - \ substitute(eval(matchstr(snippet, '`\zs.\{-}\ze`')), - \ "\n\\%$", '', ''), '') - endw - let snippet = substitute(snippet, "\r", "\n", 'g') - endif - - " Place all text after a colon in a tab stop after the tab stop - " (e.g. "${#:foo}" becomes "${:foo}foo"). - " This helps tell the position of the tab stops later. - let snippet = substitute(snippet, '${\d\+:\(.\{-}\)}', '&\1', 'g') - - " Update the a:snip so that all the $# become the text after - " the colon in their associated ${#}. - " (e.g. "${1:foo}" turns all "$1"'s into "foo") - let i = 1 - while stridx(snippet, '${'.i) != -1 - let s = matchstr(snippet, '${'.i.':\zs.\{-}\ze}') - if s != '' - let snippet = substitute(snippet, '$'.i, s.'&', 'g') - endif - let i += 1 - endw - - if &et " Expand tabs to spaces if 'expandtab' is set. - return substitute(snippet, '\t', repeat(' ', &sts ? &sts : &sw), 'g') - endif - return snippet -endf - -" Counts occurences of haystack in needle -fun s:Count(haystack, needle) - let counter = 0 - let index = stridx(a:haystack, a:needle) - while index != -1 - let index = stridx(a:haystack, a:needle, index+1) - let counter += 1 - endw - return counter -endf - -" Builds a list of a list of each tab stop in the snippet containing: -" 1.) The tab stop's line number. -" 2.) The tab stop's column number -" (by getting the length of the string between the last "\n" and the -" tab stop). -" 3.) The length of the text after the colon for the current tab stop -" (e.g. "${1:foo}" would return 3). If there is no text, -1 is returned. -" 4.) If the "${#:}" construct is given, another list containing all -" the matches of "$#", to be replaced with the placeholder. This list is -" composed the same way as the parent; the first item is the line number, -" and the second is the column. -fun s:BuildTabStops(snip, lnum, col, indent) - let snipPos = [] - let i = 1 - let withoutVars = substitute(a:snip, '$\d\+', '', 'g') - while stridx(a:snip, '${'.i) != -1 - let beforeTabStop = matchstr(withoutVars, '^.*\ze${'.i.'\D') - let withoutOthers = substitute(withoutVars, '${\('.i.'\D\)\@!\d\+.\{-}}', '', 'g') - - let j = i - 1 - call add(snipPos, [0, 0, -1]) - let snipPos[j][0] = a:lnum + s:Count(beforeTabStop, "\n") - let snipPos[j][1] = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze${'.i.'\D')) - if snipPos[j][0] == a:lnum | let snipPos[j][1] += a:col | endif - - " Get all $# matches in another list, if ${#:name} is given - if stridx(withoutVars, '${'.i.':') != -1 - let snipPos[j][2] = len(matchstr(withoutVars, '${'.i.':\zs.\{-}\ze}')) - let dots = repeat('.', snipPos[j][2]) - call add(snipPos[j], []) - let withoutOthers = substitute(a:snip, '${\d\+.\{-}}\|$'.i.'\@!\d\+', '', 'g') - while match(withoutOthers, '$'.i.'\(\D\|$\)') != -1 - let beforeMark = matchstr(withoutOthers, '^.\{-}\ze'.dots.'$'.i.'\(\D\|$\)') - call add(snipPos[j][3], [0, 0]) - let snipPos[j][3][-1][0] = a:lnum + s:Count(beforeMark, "\n") - let snipPos[j][3][-1][1] = a:indent + (snipPos[j][3][-1][0] > a:lnum - \ ? len(matchstr(beforeMark, '.*\n\zs.*')) - \ : a:col + len(beforeMark)) - let withoutOthers = substitute(withoutOthers, '$'.i.'\ze\(\D\|$\)', '', '') - endw - endif - let i += 1 - endw - return [snipPos, i - 1] -endf - -fun snipMate#jumpTabStop(backwards) - let leftPlaceholder = exists('s:origWordLen') - \ && s:origWordLen != g:snipPos[s:curPos][2] - if leftPlaceholder && exists('s:oldEndCol') - let startPlaceholder = s:oldEndCol + 1 - endif - - if exists('s:update') - call s:UpdatePlaceholderTabStops() - else - call s:UpdateTabStops() - endif - - " Don't reselect placeholder if it has been modified - if leftPlaceholder && g:snipPos[s:curPos][2] != -1 - if exists('startPlaceholder') - let g:snipPos[s:curPos][1] = startPlaceholder - else - let g:snipPos[s:curPos][1] = col('.') - let g:snipPos[s:curPos][2] = 0 - endif - endif - - let s:curPos += a:backwards ? -1 : 1 - " Loop over the snippet when going backwards from the beginning - if s:curPos < 0 | let s:curPos = s:snipLen - 1 | endif - - if s:curPos == s:snipLen - let sMode = s:endCol == g:snipPos[s:curPos-1][1]+g:snipPos[s:curPos-1][2] - call s:RemoveSnippet() - return sMode ? "\" : TriggerSnippet() - endif - - call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1]) - - let s:endLine = g:snipPos[s:curPos][0] - let s:endCol = g:snipPos[s:curPos][1] - let s:prevLen = [line('$'), col('$')] - - return g:snipPos[s:curPos][2] == -1 ? '' : s:SelectWord() -endf - -fun s:UpdatePlaceholderTabStops() - let changeLen = s:origWordLen - g:snipPos[s:curPos][2] - unl s:startCol s:origWordLen s:update - if !exists('s:oldVars') | return | endif - " Update tab stops in snippet if text has been added via "$#" - " (e.g., in "${1:foo}bar$1${2}"). - if changeLen != 0 - let curLine = line('.') - - for pos in g:snipPos - if pos == g:snipPos[s:curPos] | continue | endif - let changed = pos[0] == curLine && pos[1] > s:oldEndCol - let changedVars = 0 - let endPlaceholder = pos[2] - 1 + pos[1] - " Subtract changeLen from each tab stop that was after any of - " the current tab stop's placeholders. - for [lnum, col] in s:oldVars - if lnum > pos[0] | break | endif - if pos[0] == lnum - if pos[1] > col || (pos[2] == -1 && pos[1] == col) - let changed += 1 - elseif col < endPlaceholder - let changedVars += 1 - endif - endif - endfor - let pos[1] -= changeLen * changed - let pos[2] -= changeLen * changedVars " Parse variables within placeholders - " e.g., "${1:foo} ${2:$1bar}" - - if pos[2] == -1 | continue | endif - " Do the same to any placeholders in the other tab stops. - for nPos in pos[3] - let changed = nPos[0] == curLine && nPos[1] > s:oldEndCol - for [lnum, col] in s:oldVars - if lnum > nPos[0] | break | endif - if nPos[0] == lnum && nPos[1] > col - let changed += 1 - endif - endfor - let nPos[1] -= changeLen * changed - endfor - endfor - endif - unl s:endCol s:oldVars s:oldEndCol -endf - -fun s:UpdateTabStops() - let changeLine = s:endLine - g:snipPos[s:curPos][0] - let changeCol = s:endCol - g:snipPos[s:curPos][1] - if exists('s:origWordLen') - let changeCol -= s:origWordLen - unl s:origWordLen - endif - let lnum = g:snipPos[s:curPos][0] - let col = g:snipPos[s:curPos][1] - " Update the line number of all proceeding tab stops if has - " been inserted. - if changeLine != 0 - let changeLine -= 1 - for pos in g:snipPos - if pos[0] >= lnum - if pos[0] == lnum | let pos[1] += changeCol | endif - let pos[0] += changeLine - endif - if pos[2] == -1 | continue | endif - for nPos in pos[3] - if nPos[0] >= lnum - if nPos[0] == lnum | let nPos[1] += changeCol | endif - let nPos[0] += changeLine - endif - endfor - endfor - elseif changeCol != 0 - " Update the column of all proceeding tab stops if text has - " been inserted/deleted in the current line. - for pos in g:snipPos - if pos[1] >= col && pos[0] == lnum - let pos[1] += changeCol - endif - if pos[2] == -1 | continue | endif - for nPos in pos[3] - if nPos[0] > lnum | break | endif - if nPos[0] == lnum && nPos[1] >= col - let nPos[1] += changeCol - endif - endfor - endfor - endif -endf - -fun s:SelectWord() - let s:origWordLen = g:snipPos[s:curPos][2] - let s:oldWord = strpart(getline('.'), g:snipPos[s:curPos][1] - 1, - \ s:origWordLen) - let s:prevLen[1] -= s:origWordLen - if !empty(g:snipPos[s:curPos][3]) - let s:update = 1 - let s:endCol = -1 - let s:startCol = g:snipPos[s:curPos][1] - 1 - endif - if !s:origWordLen | return '' | endif - let l = col('.') != 1 ? 'l' : '' - if &sel == 'exclusive' - return "\".l.'v'.s:origWordLen."l\" - endif - return s:origWordLen == 1 ? "\".l.'gh' - \ : "\".l.'v'.(s:origWordLen - 1)."l\" -endf - -" This updates the snippet as you type when text needs to be inserted -" into multiple places (e.g. in "${1:default text}foo$1bar$1", -" "default text" would be highlighted, and if the user types something, -" UpdateChangedSnip() would be called so that the text after "foo" & "bar" -" are updated accordingly) -" -" It also automatically quits the snippet if the cursor is moved out of it -" while in insert mode. -fun s:UpdateChangedSnip(entering) - if exists('g:snipPos') && bufnr(0) != s:lastBuf - call s:RemoveSnippet() - elseif exists('s:update') " If modifying a placeholder - if !exists('s:oldVars') && s:curPos + 1 < s:snipLen - " Save the old snippet & word length before it's updated - " s:startCol must be saved too, in case text is added - " before the snippet (e.g. in "foo$1${2}bar${1:foo}"). - let s:oldEndCol = s:startCol - let s:oldVars = deepcopy(g:snipPos[s:curPos][3]) - endif - let col = col('.') - 1 - - if s:endCol != -1 - let changeLen = col('$') - s:prevLen[1] - let s:endCol += changeLen - else " When being updated the first time, after leaving select mode - if a:entering | return | endif - let s:endCol = col - 1 - endif - - " If the cursor moves outside the snippet, quit it - if line('.') != g:snipPos[s:curPos][0] || col < s:startCol || - \ col - 1 > s:endCol - unl! s:startCol s:origWordLen s:oldVars s:update - return s:RemoveSnippet() - endif - - call s:UpdateVars() - let s:prevLen[1] = col('$') - elseif exists('g:snipPos') - if !a:entering && g:snipPos[s:curPos][2] != -1 - let g:snipPos[s:curPos][2] = -2 - endif - - let col = col('.') - let lnum = line('.') - let changeLine = line('$') - s:prevLen[0] - - if lnum == s:endLine - let s:endCol += col('$') - s:prevLen[1] - let s:prevLen = [line('$'), col('$')] - endif - if changeLine != 0 - let s:endLine += changeLine - let s:endCol = col - endif - - " Delete snippet if cursor moves out of it in insert mode - if (lnum == s:endLine && (col > s:endCol || col < g:snipPos[s:curPos][1])) - \ || lnum > s:endLine || lnum < g:snipPos[s:curPos][0] - call s:RemoveSnippet() - endif - endif -endf - -" This updates the variables in a snippet when a placeholder has been edited. -" (e.g., each "$1" in "${1:foo} $1bar $1bar") -fun s:UpdateVars() - let newWordLen = s:endCol - s:startCol + 1 - let newWord = strpart(getline('.'), s:startCol, newWordLen) - if newWord == s:oldWord || empty(g:snipPos[s:curPos][3]) - return - endif - - let changeLen = g:snipPos[s:curPos][2] - newWordLen - let curLine = line('.') - let startCol = col('.') - let oldStartSnip = s:startCol - let updateTabStops = changeLen != 0 - let i = 0 - - for [lnum, col] in g:snipPos[s:curPos][3] - if updateTabStops - let start = s:startCol - if lnum == curLine && col <= start - let s:startCol -= changeLen - let s:endCol -= changeLen - endif - for nPos in g:snipPos[s:curPos][3][(i):] - " This list is in ascending order, so quit if we've gone too far. - if nPos[0] > lnum | break | endif - if nPos[0] == lnum && nPos[1] > col - let nPos[1] -= changeLen - endif - endfor - if lnum == curLine && col > start - let col -= changeLen - let g:snipPos[s:curPos][3][i][1] = col - endif - let i += 1 - endif - - " "Very nomagic" is used here to allow special characters. - call setline(lnum, substitute(getline(lnum), '\%'.col.'c\V'. - \ escape(s:oldWord, '\'), escape(newWord, '\&'), '')) - endfor - if oldStartSnip != s:startCol - call cursor(0, startCol + s:startCol - oldStartSnip) - endif - - let s:oldWord = newWord - let g:snipPos[s:curPos][2] = newWordLen -endf -" vim:noet:sw=4:ts=4:ft=vim diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim old mode 100644 new mode 100755 index 3accbe6d..7b89ccaf --- a/autoload/pathogen.vim +++ b/autoload/pathogen.vim @@ -1,12 +1,12 @@ " pathogen.vim - path option manipulation " Maintainer: Tim Pope -" Version: 2.0 +" Version: 2.2 " Install in ~/.vim/autoload (or ~\vimfiles\autoload). " " For management of individually installed plugins in ~/.vim/bundle (or -" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc -" prior to `filetype plugin indent on` is the only other setup necessary. +" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your +" .vimrc is the only other setup necessary. " " The API is documented inline below. For maximum ease of reading, " :set foldmethod=marker @@ -16,18 +16,33 @@ if exists("g:loaded_pathogen") || &cp endif let g:loaded_pathogen = 1 -" Point of entry for basic default usage. Give a directory name to invoke -" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path -" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards, -" pathogen#cycle_filetype() is invoked. +function! s:warn(msg) + echohl WarningMsg + echomsg a:msg + echohl NONE +endfunction + +" Point of entry for basic default usage. Give a relative path to invoke +" pathogen#incubate() (defaults to "bundle/{}"), or an absolute path to invoke +" pathogen#surround(). For backwards compatibility purposes, a full path that +" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories() +" instead. function! pathogen#infect(...) abort " {{{1 - let source_path = a:0 ? a:1 : 'bundle' - if source_path =~# '[\\/]' - call pathogen#runtime_prepend_subdirectories(source_path) - else - call pathogen#runtime_append_all_bundles(source_path) - endif + for path in a:0 ? reverse(copy(a:000)) : ['bundle/{}'] + if path =~# '^[^\\/]\+$' + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#incubate(path . '/{}') + elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$' + call pathogen#incubate(path) + elseif path =~# '[\\/]\%({}\|\*\)$' + call pathogen#surround(path) + else + call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') + call pathogen#surround(path . '/{}') + endif + endfor call pathogen#cycle_filetype() + return '' endfunction " }}}1 " Split a path into a list. @@ -111,8 +126,9 @@ function! pathogen#cycle_filetype() " {{{1 endif endfunction " }}}1 -" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if -" its 'basename()' is included in g:pathogen_disabled[]' or ends in a tilde. +" Check if a bundle is disabled. A bundle is considered disabled if it ends +" in a tilde or its basename or full name is included in the list +" g:pathogen_disabled. function! pathogen#is_disabled(path) " {{{1 if a:path =~# '\~$' return 1 @@ -120,29 +136,48 @@ function! pathogen#is_disabled(path) " {{{1 return 0 endif let sep = pathogen#separator() - return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1 + let blacklist = g:pathogen_disabled + return index(blacklist, strpart(a:path, strridx(a:path, sep)+1)) != -1 && index(blacklist, a:path) != 1 endfunction "}}}1 -" Prepend all subdirectories of path to the rtp, and append all 'after' -" directories in those subdirectories. -function! pathogen#runtime_prepend_subdirectories(path) " {{{1 - let sep = pathogen#separator() - let before = filter(pathogen#glob_directories(a:path.sep."*"), '!pathogen#is_disabled(v:val)') - let after = filter(pathogen#glob_directories(a:path.sep."*".sep."after"), '!pathogen#is_disabled(v:val[0:-7])') +" Prepend the given directory to the runtime path and append its corresponding +" after directory. If the directory is already included, move it to the +" outermost position. Wildcards are added as is. Ending a path in /{} causes +" all subdirectories to be added (except those in g:pathogen_disabled). +function! pathogen#surround(path) abort " {{{1 + let sep = pathogen#separator() let rtp = pathogen#split(&rtp) - let path = expand(a:path) - call filter(rtp,'v:val[0:strlen(path)-1] !=# path') - let &rtp = pathogen#join(pathogen#uniq(before + rtp + after)) + if a:path =~# '[\\/]{}$' + let path = fnamemodify(a:path[0:-4], ':p:s?[\\/]\=$??') + let before = filter(pathogen#glob_directories(path.sep.'*'), '!pathogen#is_disabled(v:val)') + let after = filter(reverse(pathogen#glob_directories(path.sep."*".sep."after")), '!pathogen#is_disabled(v:val[0:-7])') + call filter(rtp,'v:val[0:strlen(path)-1] !=# path') + else + let path = fnamemodify(a:path, ':p:s?[\\/]\=$??') + let before = [path] + let after = [path . sep . 'after'] + call filter(rtp, 'index(before + after, v:val) == -1') + endif + let &rtp = pathogen#join(before, rtp, after) return &rtp endfunction " }}}1 -" For each directory in rtp, check for a subdirectory named dir. If it -" exists, add all subdirectories of that subdirectory to the rtp, immediately -" after the original directory. If no argument is given, 'bundle' is used. -" Repeated calls with the same arguments are ignored. -function! pathogen#runtime_append_all_bundles(...) " {{{1 +" Prepend all subdirectories of path to the rtp, and append all 'after' +" directories in those subdirectories. Deprecated. +function! pathogen#runtime_prepend_subdirectories(path) " {{{1 + call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#surround('.string(a:path.'/{}').')') + return pathogen#surround(a:path . pathogen#separator() . '{}') +endfunction " }}}1 + +" For each directory in the runtime path, add a second entry with the given +" argument appended. If the argument ends in '/{}', add a separate entry for +" each subdirectory. The default argument is 'bundle/{}', which means that +" .vim/bundle/*, $VIM/vimfiles/bundle/*, $VIMRUNTIME/bundle/*, +" $VIM/vim/files/bundle/*/after, and .vim/bundle/*/after will be added (on +" UNIX). +function! pathogen#incubate(...) abort " {{{1 let sep = pathogen#separator() - let name = a:0 ? a:1 : 'bundle' + let name = a:0 ? a:1 : 'bundle/{}' if "\n".s:done_bundles =~# "\\M\n".name."\n" return "" endif @@ -150,38 +185,71 @@ function! pathogen#runtime_append_all_bundles(...) " {{{1 let list = [] for dir in pathogen#split(&rtp) if dir =~# '\"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags')) - helptags `=dir.'/doc'` - endif + for glob in pathogen#split(&rtp) + for dir in split(glob(glob), "\n") + if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.sep.'doc') == 2 && !empty(filter(split(glob(dir.sep.'doc'.sep.'*'),"\n>"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags')) + silent! execute 'helptags' pathogen#fnameescape(dir.'/doc') + endif + endfor endfor endfunction " }}}1 command! -bar Helptags :call pathogen#helptags() +" Execute the given command. This is basically a backdoor for --remote-expr. +function! pathogen#execute(...) abort " {{{1 + for command in a:000 + execute command + endfor + return '' +endfunction " }}}1 + " Like findfile(), but hardcoded to use the runtimepath. -function! pathogen#runtime_findfile(file,count) "{{{1 +function! pathogen#runtime_findfile(file,count) abort "{{{1 let rtp = pathogen#join(1,pathogen#split(&rtp)) - return fnamemodify(findfile(a:file,rtp,a:count),':p') + let file = findfile(a:file,rtp,a:count) + if file ==# '' + return '' + else + return fnamemodify(file,':p') + endif endfunction " }}}1 " Backport of fnameescape(). -function! pathogen#fnameescape(string) " {{{1 +function! pathogen#fnameescape(string) abort " {{{1 if exists('*fnameescape') return fnameescape(a:string) elseif a:string ==# '-' @@ -191,17 +259,30 @@ function! pathogen#fnameescape(string) " {{{1 endif endfunction " }}}1 +if exists(':Vedit') + finish +endif + +let s:vopen_warning = 0 + function! s:find(count,cmd,file,lcd) " {{{1 let rtp = pathogen#join(1,pathogen#split(&runtimepath)) let file = pathogen#runtime_findfile(a:file,a:count) if file ==# '' return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" - elseif a:lcd + endif + if !s:vopen_warning + let s:vopen_warning = 1 + let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE' + else + let warning = '' + endif + if a:lcd let path = file[0:-strlen(a:file)-2] execute 'lcd `=path`' - return a:cmd.' '.pathogen#fnameescape(a:file) + return a:cmd.' '.pathogen#fnameescape(a:file) . warning else - return a:cmd.' '.pathogen#fnameescape(file) + return a:cmd.' '.pathogen#fnameescape(file) . warning endif endfunction " }}}1 @@ -219,7 +300,7 @@ function! s:Findcomplete(A,L,P) " {{{1 else let request = a:A endif - let pattern = substitute(request,'\'.sep,'*'.sep,'g').'*' + let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' let found = {} for path in pathogen#split(&runtimepath) let path = expand(path, ':p') @@ -242,4 +323,4 @@ command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabed command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) -" vim:set ft=vim ts=8 sw=2 sts=2: +" vim:set et sw=2: diff --git a/sources_forked/peaksea/colors/peaksea.vim b/sources_forked/peaksea/colors/peaksea.vim index 7b95aadd..78481e0f 100644 --- a/sources_forked/peaksea/colors/peaksea.vim +++ b/sources_forked/peaksea/colors/peaksea.vim @@ -36,7 +36,7 @@ if exists("syntax_on") syntax reset endif -let g:colors_name = expand(":t:r") +let g:colors_name = "peaksea" " I don't want to abuse folding, but here folding is used to avoid confusion. if &background=='light' @@ -281,7 +281,7 @@ elseif &background=='dark' hi ModeMsg guifg=fg guibg=#000080 gui=NONE hi VisualNOS guifg=fg guibg=#000080 gui=NONE hi SpecialKey guifg=#b0d0f0 guibg=NONE gui=NONE - hi NonText guifg=#6080f0 guibg=#101010 gui=NONE + hi NonText guifg=#202020 guibg=#202020 gui=NONE hi Directory guifg=#80c0e0 guibg=NONE gui=NONE hi ErrorMsg guifg=#d0d090 guibg=#800000 gui=NONE hi MoreMsg guifg=#c0e080 guibg=NONE gui=NONE @@ -294,7 +294,7 @@ elseif &background=='dark' hi DiffChange guifg=NONE guibg=#800080 gui=NONE hi DiffDelete guifg=#6080f0 guibg=#202020 gui=NONE hi DiffText guifg=#000000 guibg=#c0e080 gui=NONE - hi SignColumn guifg=#e0e0e0 guibg=#008000 gui=NONE + hi SignColumn guifg=#e0e0e0 guibg=#202020 gui=NONE hi IncSearch guifg=White guibg=DarkRed gui=NONE hi StatusLineNC guifg=#000000 guibg=#c0c0c0 gui=NONE hi VertSplit guifg=#000000 guibg=#c0c0c0 gui=NONE diff --git a/sources_non_forked/ack.vim/README.md b/sources_non_forked/ack.vim/README.md index e7182452..008fb3dd 100644 --- a/sources_non_forked/ack.vim/README.md +++ b/sources_non_forked/ack.vim/README.md @@ -1,101 +1,60 @@ -# ack.vim # +# ack.vim This plugin is a front for the Perl module [App::Ack](http://search.cpan.org/~petdance/ack/ack). Ack can be used as a replacement for 99% of the uses of _grep_. This plugin will allow you to run ack from vim, and shows the results in a split window. -The *Official Version* of this plugin is available at [vim.org](http://www.vim.org/scripts/script.php?script_id=2572). - -## Installation ## - +## Installation ### Ack -You have to install [ack](http://betterthangrep.com/), of course. - -Install on Debian / Ubuntu with: - - sudo apt-get install ack-grep - -Install on Fedora with: - - su -l -c 'yum install ack' - -Install on openSUSE with: - - sudo zypper install ack - -Install on Gentoo with: - - sudo emerge ack - -Install with Homebrew: - - brew install ack - -Install with MacPorts: - - sudo port install p5-app-ack - -Install with Gentoo Prefix: - - emerge ack - -Install on FreeBSD with: - - cd /usr/ports/textproc/p5-ack/ && make install clean - -You can specify a custom ack name and path in your .vimrc like so: - - let g:ackprg=" -H --nocolor --nogroup --column" - -Otherwise, you are on your own. +You will need the ack(>= 2.0), of course, to install it follow the +[manual](http://beyondgrep.com/install/) ### The Plugin -If you have [Rake](http://rake.rubyforge.org/) installed, you can just run: `rake install`. +To install it is recommended to use one of the popular package managers for Vim, +rather than installing by drag and drop all required files into your `.vim` folder. -Otherwise, the file ack.vim goes in ~/.vim/plugin, and the ack.txt file belongs in ~/.vim/doc. Be sure to run +#### Manual (not recommended) - :helptags ~/.vim/doc +Just +[download](https://github.com/mileszs/ack.vim/archive/kb-improve-readme.zip) the +plugin and put it in your `~/.vim/`(or `%PROGRAMFILES%/Vim/vimfiles` on windows) -afterwards. +#### Vundle + Bundle 'mileszs/ack.vim' -## Usage ## +#### NeoBundle - :Ack [options] {pattern} [{directory}] + NeoBundle 'mileszs/ack.vim' -Search recursively in {directory} (which defaults to the current directory) for the {pattern}. +## Usage + + :Ack [options] {pattern} [{directories}] + +Search recursively in {directory} (which defaults to the current directory) for +the {pattern}. Files containing the search term will be listed in the split window, along with the line number of the occurrence, once for each occurrence. [Enter] on a line in this window will open the file, and place the cursor on the matching line. -Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use `:Ack`, `:AckAdd`, `:LAck`, and `:LAckAdd` respectively. (See `doc/ack.txt`, or install and `:h Ack` for more information.) +Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use +`:Ack`, `:AckAdd`, `:LAck`, and `:LAckAdd` respectively. +(See `doc/ack.txt`, or install and `:h Ack` for more information.) -**From the [ack docs](http://betterthangrep.com/)** (my favorite feature): +For more ack options see +[ack documentation](http://beyondgrep.com/documentation/) - --type=TYPE, --type=noTYPE - - Specify the types of files to include or exclude from a search. TYPE is a filetype, like perl or xml. --type=perl can also be specified as --perl, and --type=noperl can be done as --noperl. - - If a file is of both type "foo" and "bar", specifying --foo and --nobar will exclude the file, because an exclusion takes precedence over an inclusion. - - Type specifications can be repeated and are ORed together. - - See ack --help=types for a list of valid types. - -### 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](https://github.com/mileszs/ack.vim/issues/5).) - -### Keyboard Shortcuts ### +### Keyboard Shortcuts In the quickfix window, you can use: o to open (same as enter) + O to open and close quickfix window go to preview file (open but maintain focus on ack.vim results) t to open in new tab T to open in new tab silently @@ -106,9 +65,67 @@ In the quickfix window, you can use: q to close the quickfix window This Vim plugin is derived (and by derived, I mean copied, essentially) from -Antoine Imbert's blog post [Ack and Vim -Integration](http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html) (in -particular, the function at the bottom of the post). I added a help file that +Antoine Imbert's blog post +[Ack and Vim Integration](http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html) +(in particular, the function at the bottom of the post). I added a help file that provides just enough reference to get you going. I also highly recommend you -check out the docs for the Perl script 'ack', for obvious reasons: [ack - -grep-like text finder](http://betterthangrep.com/). +check out the docs for the Perl script 'ack', for obvious reasons: +[ack - grep-like text finder](http://beyondgrep.com/). + +### 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.) + +## Changelog + +### 1.0 + +* Remove support to ack 1.x +* Start to use a Changelog +* Use `autoload` directory to define functions, instead of `plugin`. +* Add option to auto fold the results(`g:ack_autofold_results`) +* Improve documentation, list all options and shortcuts +* Improve highlight option to work when passes directories or use quotes. +* 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 diff --git a/sources_non_forked/ack.vim/Rakefile b/sources_non_forked/ack.vim/Rakefile deleted file mode 100644 index af5a8695..00000000 --- a/sources_non_forked/ack.vim/Rakefile +++ /dev/null @@ -1,23 +0,0 @@ -# Added by Josh Nichols, a.k.a. technicalpickles -require 'rake' - -files = ['doc/ack.txt', 'plugin/ack.vim'] - -desc 'Install plugin and documentation' -task :install do - vimfiles = if ENV['VIMFILES'] - ENV['VIMFILES'] - elsif RUBY_PLATFORM =~ /(win|w)32$/ - File.expand_path("~/vimfiles") - else - File.expand_path("~/.vim") - end - files.each do |file| - target_file = File.join(vimfiles, file) - FileUtils.mkdir_p File.dirname(target_file) - FileUtils.cp file, target_file - - puts " Copied #{file} to #{target_file}" - end - -end diff --git a/sources_non_forked/ack.vim/autoload/ack.vim b/sources_non_forked/ack.vim/autoload/ack.vim new file mode 100644 index 00000000..fae73b1f --- /dev/null +++ b/sources_non_forked/ack.vim/autoload/ack.vim @@ -0,0 +1,154 @@ +function! ack#Ack(cmd, args) + redraw + echo "Searching ..." + + " If no pattern is provided, search for the word under the cursor + if empty(a:args) + let l:grepargs = expand("") + 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 + if a:cmd =~# '-g$' + let g:ackformat="%f" + let l:ackprg_run = substitute(l:ackprg_run, '-H\|--column', '', 'g') + else + let g:ackformat="%f:%l:%c:%m,%f:%l:%m" + endif + + let grepprg_bak = &grepprg + let grepformat_bak = &grepformat + let &grepprg=l:ackprg_run + let &grepformat=g:ackformat + + try + " NOTE: we escape special chars, but not everything using shellescape to + " allow for passing arguments etc + 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 + endtry + + if a:cmd =~# '^l' + let s:handler = g:ack_lhandler + let s:apply_mappings = g:ack_apply_lmappings + let s:close_cmd = ':lclose' + else + let s:handler = g:ack_qhandler + let s:apply_mappings = g:ack_apply_qmappings + let s:close_cmd = ':cclose' + endif + + if !g:ack_use_dispatch + call ack#show_results() + else + copen + endif + call apply_maps() + call highlight(l:grepargs) + + redraw! +endfunction + +function! ack#show_results() + execute s:handler +endfunction + +function! s:apply_maps() + let g:ack_mappings.q = s:close_cmd + + execute "nnoremap ? :call ack#quick_help()" + + if s:apply_mappings && &ft == "qf" + if g:ack_autoclose + for key_map in items(g:ack_mappings) + execute printf("nnoremap %s %s", get(key_map, 0), get(key_map, 1) . s:close_cmd) + endfor + execute "nnoremap " . s:close_cmd + else + for key_map in items(g:ack_mappings) + execute printf("nnoremap %s %s", get(key_map, 0), get(key_map, 1)) + endfor + endif + + if exists("g:ackpreview") " if auto preview in on, remap j and k keys + execute "nnoremap j j" + execute "nnoremap k k" + endif + endif +endfunction + +function! ack#quick_help() + execute "edit " . globpath(&rtp, "doc/ack_quick_help.txt") + + silent normal gg + setlocal buftype=nofile + setlocal bufhidden=hide + setlocal noswapfile + setlocal nobuflisted + setlocal nomodifiable + setlocal filetype=help + setlocal nonumber + setlocal norelativenumber + setlocal nowrap + setlocal foldlevel=20 + setlocal foldmethod=diff + nnoremap ? :q!:call ack#show_results() +endfunction + +function! s:highlight(args) + if !g:ackhighlight + return + endif + + let @/ = matchstr(a:args, "\\v(-)\@", "n") +endfunction + +function! ack#AckFromSearch(cmd, args) + let search = getreg('/') + " translate vim regular expression to perl regular expression. + let search = substitute(search, '\(\\<\|\\>\)', '\\b', 'g') + call ack#Ack(a:cmd, '"' . search . '" ' . a:args) +endfunction + +function! s:GetDocLocations() + let dp = '' + for p in split(&rtp, ',') + let p = p . '/doc/' + if isdirectory(p) + let dp = p . '*.txt ' . dp + endif + endfor + + return dp +endfunction + +function! ack#AckHelp(cmd, args) + let args = a:args . ' ' . s:GetDocLocations() + call ack#Ack(a:cmd, args) +endfunction + +function! ack#AckWindow(cmd, args) + let files = tabpagebuflist() + " remove duplicated filenames (files appearing in more than one window) + let files = filter(copy(sort(files)), 'index(files,v:val,v:key+1)==-1') + call map(files, "bufname(v:val)") + " remove unnamed buffers as quickfix (empty strings before shellescape) + call filter(files, 'v:val != ""') + " expand to full path (avoid problems with cd/lcd in au QuickFixCmdPre) + let files = map(files, "shellescape(fnamemodify(v:val, ':p'))") + let args = a:args . ' ' . join(files) + call ack#Ack(a:cmd, args) +endfunction diff --git a/sources_non_forked/ack.vim/doc/ack.txt b/sources_non_forked/ack.vim/doc/ack.txt index ec06da3a..6b1be331 100644 --- a/sources_non_forked/ack.vim/doc/ack.txt +++ b/sources_non_forked/ack.vim/doc/ack.txt @@ -16,7 +16,7 @@ shows the results in a split window. Search recursively in {directory} (which defaults to the current directory) for the {pattern}. Behaves just like the |:grep| command, but will open the |Quickfix| window for you. If [!] is not given the first - error is jumped to. + occurence is jumped to. :AckAdd [options] {pattern} [{directory}] *:AckAdd* @@ -45,7 +45,7 @@ shows the results in a split window. :AckHelp[!] [options] {pattern} *:AckHelp* - Search vim documentation files for the {pattern}. Behaves just like the + Search vim documentation files for the {pattern}. Behaves just like the |:Ack| command, but searches only vim documentation .txt files :LAckHelp [options] {pattern} *:LAckHelp* @@ -53,6 +53,16 @@ shows the results in a split window. Just like |:AckHelp| but instead of the |quickfix| list, matches are placed in the current |location-list|. +:AckWindow[!] [options] {pattern} *:AckWindow* + + Search all buffers visible in the screen (current tab page only) files for + the {pattern}. + +:LAckWindow [options] {pattern} *:LAckWindow* + + Just like |:AckWindow| but instead of the |quickfix| list, matches are + placed in the current |location-list|. + Files containing the search term will be listed in the split window, along with the line number of the occurrence, once for each occurrence. on a line in this window will open the file, and place the cursor on the matching @@ -60,6 +70,151 @@ line. See http://betterthangrep.com/ for more information. + +============================================================================== +CONFIGURATION *ack-configuration* + + *g:ackprg* +g:ackprg +Default for ubuntu: "ack-grep" +Default for other systems: "ack" + +Use this option to specify the ack command and its options + +Example: +> + let g:ackprg = "other-bin-ack" +< + + *g:ack_default_options* +g:ack_default_options +Default: " -s -H --nocolor --nogroup --column" + +Use this option to specify the options used by ack + +Example: +> + let g:ack_default_options = + \ " -s -H --nocolor --nogroup --column --smart-case --follow" +< + + *g:ack_apply_qmappings* +g:ack_apply_qmappings +Default: 1 + +This option enable mappings on quickview window. + + *g:ack_apply_lmappings* +g:ack_apply_lmappings +Default: 1 + +This option enable mappings on Location list window. + + *g:ack_mappings* +g:ack_mappings +Default: { + \ "t": "T", + \ "T": "TgTj", + \ "o": "", + \ "O": ":ccl", + \ "go": "j", + \ "h": "K", + \ "H": "Kb", + \ "v": "HbJt", + \ "gv": "HbJ" } + +This option list all maps create on quickfix/Location list window. + +Example, if you want to open the result in the middle of the screen: +> + let g:ack_mappings = { "o": "zz" } +< + + *g:ack_qhandler* +g:ack_qhandler +Default: "botright copen" + +Command to open the quickview window. + +If you want to open a quickview window with 30 lines you can do: +> + let g:ack_qhandler = "botright copen 30" +< + + *g:ack_lhandler* +g:ack_lhandler +Default: "botright lopen" + +Command to open the Location list window. + +If you want to open a Location list window with 30 lines you can do: +> + let g:ack_lhandler = "botright lopen 30" +< + + *g:ackhighlight* + +g:ackhighlight +Default: 0 + +Use this option to highlight the searched term. + +Example: +> + let g:ackhighlight = 1 +< + + *g:ack_autoclose* +g:ack_autoclose +Default: 0 + +Use this option to specify whether to close the quickfix window after +using any of the shortcuts. + +Example: +> + let g:ack_autoclose = 1 +< + + *g:ack_autofold_results* + +g:ack_autofold_results +Default: 0 + +Use this option to fold the results in quickfix by file name. Only the current +fold will be open by default and while you press 'j' and 'k' to move between the +results if you hit other fold the last one will be closed and the current will +be open. + +Example: +> + let g:ack_autofold_results = 1 +< + + *g:ackpreview* + +g:ackpreview +Default: 0 + +Use this option to automagically open the file with 'j' or 'k'. + +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* @@ -67,6 +222,8 @@ The following keyboard shortcuts are available in the quickfix window: o open file (same as enter). +O open file and close quickfix window. + go preview file (open but maintain focus on ack.vim results). t open in a new tab. diff --git a/sources_non_forked/ack.vim/doc/ack_quick_help.txt b/sources_non_forked/ack.vim/doc/ack_quick_help.txt new file mode 100644 index 00000000..5c52f6cb --- /dev/null +++ b/sources_non_forked/ack.vim/doc/ack_quick_help.txt @@ -0,0 +1,14 @@ +==== ack.vim quick help =============== + + *?:* Show this help + *t:* Open in a new tab + *T:* Open in a new tab silently + *o:* Open + *O:* Open and close result window + *go:* Preview + *h:* Horizontal open + *H:* Horizontal open silently + *v:* Vertical open + *gv:* Vertical open silently + +======================================== diff --git a/sources_non_forked/ack.vim/ftplugin/qf.vim b/sources_non_forked/ack.vim/ftplugin/qf.vim new file mode 100644 index 00000000..27564fa7 --- /dev/null +++ b/sources_non_forked/ack.vim/ftplugin/qf.vim @@ -0,0 +1,9 @@ +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' + setlocal foldenable + setlocal foldclose=all + setlocal foldopen=all + nnoremap j jzz +endif diff --git a/sources_non_forked/ack.vim/plugin/ack.vim b/sources_non_forked/ack.vim/plugin/ack.vim index ccd46861..6d6c55bc 100644 --- a/sources_non_forked/ack.vim/plugin/ack.vim +++ b/sources_non_forked/ack.vim/plugin/ack.vim @@ -1,16 +1,17 @@ -" NOTE: You must, of course, install the ack script -" in your path. -" On Debian / Ubuntu: -" sudo apt-get install ack-grep -" With MacPorts: -" sudo port install p5-app-ack -" With Homebrew: -" brew install ack +if !exists("g:ack_default_options") + let g:ack_default_options = " -s -H --nocolor --nogroup --column" +endif " Location of the ack utility if !exists("g:ackprg") - let s:ackcommand = executable('ack-grep') ? 'ack-grep' : 'ack' - let g:ackprg=s:ackcommand." -H --nocolor --nogroup --column" + if executable('ack') + let g:ackprg = "ack" + elseif executable('ack-grep') + let g:ackprg = "ack-grep" + else + finish + endif + let g:ackprg .= g:ack_default_options endif if !exists("g:ack_apply_qmappings") @@ -21,100 +22,54 @@ 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": "T", + \ "T": "TgTj", + \ "o": "", + \ "O": "pc", + \ "go": "p", + \ "h": "K", + \ "H": "Kb", + \ "v": "HbJt", + \ "gv": "HbJ" } + +if exists("g:ack_mappings") + let g:ack_mappings = extend(s:ack_mappings, g:ack_mappings) +else + let g:ack_mappings = s:ack_mappings +endif + if !exists("g:ack_qhandler") - let g:ack_qhandler="botright copen" + let g:ack_qhandler = "botright copen" endif if !exists("g:ack_lhandler") - let g:ack_lhandler="botright lopen" + let g:ack_lhandler = "botright lopen" endif -function! s:Ack(cmd, args) - redraw - echo "Searching ..." +if !exists("g:ackhighlight") + let g:ackhighlight = 0 +endif - " If no pattern is provided, search for the word under the cursor - if empty(a:args) - let l:grepargs = expand("") - else - let l:grepargs = a:args . join(a:000, ' ') - end +if !exists("g:ack_autoclose") + let g:ack_autoclose = 0 +endif - " Format, used to manage column jump - if a:cmd =~# '-g$' - let g:ackformat="%f" - else - let g:ackformat="%f:%l:%c:%m" - end +if !exists("g:ack_autofold_results") + let g:ack_autofold_results = 0 +endif - let grepprg_bak=&grepprg - let grepformat_bak=&grepformat - try - let &grepprg=g:ackprg - let &grepformat=g:ackformat - silent execute a:cmd . " " . escape(l:grepargs, '|') - finally - let &grepprg=grepprg_bak - let &grepformat=grepformat_bak - endtry - - if a:cmd =~# '^l' - exe g:ack_lhandler - let l:apply_mappings = g:ack_apply_lmappings - else - exe g:ack_qhandler - let l:apply_mappings = g:ack_apply_qmappings - endif - - if l:apply_mappings - exec "nnoremap q :ccl" - exec "nnoremap t T" - exec "nnoremap T TgT" - exec "nnoremap o " - exec "nnoremap go " - exec "nnoremap h K" - exec "nnoremap H Kb" - exec "nnoremap v HbJt" - exec "nnoremap gv HbJ" - endif - - " If highlighting is on, highlight the search keyword. - if exists("g:ackhighlight") - let @/=a:args - set hlsearch - end - - redraw! -endfunction - -function! s:AckFromSearch(cmd, args) - let search = getreg('/') - " translate vim regular expression to perl regular expression. - let search = substitute(search,'\(\\<\|\\>\)','\\b','g') - call s:Ack(a:cmd, '"' . search .'" '. a:args) -endfunction - -function! s:GetDocLocations() - let dp = '' - for p in split(&rtp,',') - let p = p.'/doc/' - if isdirectory(p) - let dp = p.'*.txt '.dp - endif - endfor - return dp -endfunction - -function! s:AckHelp(cmd,args) - let args = a:args.' '.s:GetDocLocations() - call s:Ack(a:cmd,args) -endfunction - -command! -bang -nargs=* -complete=file Ack call s:Ack('grep',) -command! -bang -nargs=* -complete=file AckAdd call s:Ack('grepadd', ) -command! -bang -nargs=* -complete=file AckFromSearch call s:AckFromSearch('grep', ) -command! -bang -nargs=* -complete=file LAck call s:Ack('lgrep', ) -command! -bang -nargs=* -complete=file LAckAdd call s:Ack('lgrepadd', ) -command! -bang -nargs=* -complete=file AckFile call s:Ack('grep -g', ) -command! -bang -nargs=* -complete=help AckHelp call s:AckHelp('grep',) -command! -bang -nargs=* -complete=help LAckHelp call s:AckHelp('lgrep',) +command! -bang -nargs=* -complete=file Ack call ack#Ack('grep', ) +command! -bang -nargs=* -complete=file AckAdd call ack#Ack('grepadd', ) +command! -bang -nargs=* -complete=file AckFromSearch call ack#AckFromSearch('grep', ) +command! -bang -nargs=* -complete=file LAck call ack#Ack('lgrep', ) +command! -bang -nargs=* -complete=file LAckAdd call ack#Ack('lgrepadd', ) +command! -bang -nargs=* -complete=file AckFile call ack#Ack('grep -g', ) +command! -bang -nargs=* -complete=help AckHelp call ack#AckHelp('grep', ) +command! -bang -nargs=* -complete=help LAckHelp call ack#AckHelp('lgrep', ) +command! -bang -nargs=* -complete=help AckWindow call ack#AckWindow('grep', ) +command! -bang -nargs=* -complete=help LAckWindow call ack#AckWindow('lgrep', ) diff --git a/sources_non_forked/bufexplorer/doc/tags b/sources_non_forked/bufexplorer/doc/tags deleted file mode 100644 index 5432bc98..00000000 --- a/sources_non_forked/bufexplorer/doc/tags +++ /dev/null @@ -1,24 +0,0 @@ -bufexplorer bufexplorer.txt /*bufexplorer* -bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog* -bufexplorer-credits bufexplorer.txt /*bufexplorer-credits* -bufexplorer-customization bufexplorer.txt /*bufexplorer-customization* -bufexplorer-installation bufexplorer.txt /*bufexplorer-installation* -bufexplorer-todo bufexplorer.txt /*bufexplorer-todo* -bufexplorer-usage bufexplorer.txt /*bufexplorer-usage* -bufexplorer-windowlayout bufexplorer.txt /*bufexplorer-windowlayout* -bufexplorer.txt bufexplorer.txt /*bufexplorer.txt* -buffer-explorer bufexplorer.txt /*buffer-explorer* -g:bufExplorerChgWin bufexplorer.txt /*g:bufExplorerChgWin* -g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp* -g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp* -g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive* -g:bufExplorerFuncRef bufexplorer.txt /*g:bufExplorerFuncRef* -g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort* -g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories* -g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath* -g:bufExplorerShowTabBuffer bufexplorer.txt /*g:bufExplorerShowTabBuffer* -g:bufExplorerShowUnlisted bufexplorer.txt /*g:bufExplorerShowUnlisted* -g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy* -g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow* -g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName* -g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight* diff --git a/sources_non_forked/goyo.vim/plugin/goyo.vim b/sources_non_forked/goyo.vim/plugin/goyo.vim new file mode 100644 index 00000000..5308326a --- /dev/null +++ b/sources_non_forked/goyo.vim/plugin/goyo.vim @@ -0,0 +1,340 @@ +" Copyright (c) 2013 Junegunn Choi +" +" MIT License +" +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be +" included in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +let s:cpo_save = &cpo +set cpo&vim + +function! s:get_color(group, attr) + return synIDattr(synIDtrans(hlID(a:group)), a:attr) +endfunction + +function! s:set_color(group, attr, color) + let gui = has('gui_running') + execute printf("hi %s %s%s=%s", a:group, gui ? 'gui' : 'cterm', a:attr, a:color) +endfunction + +function! s:blank() + let main = bufwinnr(t:goyo_master) + if main != -1 + execute main . 'wincmd w' + else + call s:goyo_off() + endif +endfunction + +function! s:init_pad(command) + execute a:command + + setlocal buftype=nofile bufhidden=wipe nomodifiable nobuflisted noswapfile + \ nonu nocursorline nocursorcolumn winfixwidth winfixheight statusline=\ + if exists('&rnu') + setlocal nornu + endif + if exists('&colorcolumn') + setlocal colorcolumn= + endif + let bufnr = winbufnr(0) + + execute winnr('#') . 'wincmd w' + return bufnr +endfunction + +function! s:setup_pad(bufnr, vert, size) + let win = bufwinnr(a:bufnr) + execute win . 'wincmd w' + execute (a:vert ? 'vertical ' : '') . 'resize ' . max([0, a:size]) + augroup goyop + autocmd WinEnter,CursorMoved call s:blank() + augroup END + + " To hide scrollbars of pad windows in GVim + let diff = winheight(0) - line('$') - (has('gui_running') ? 2 : 0) + if diff > 0 + setlocal modifiable + call append(0, map(range(1, diff), '""')) + normal! gg + setlocal nomodifiable + endif + execute winnr('#') . 'wincmd w' +endfunction + +function! s:hmargin() + let nwidth = max([len(string(line('$'))) + 1, &numberwidth]) + let width = t:goyo_width + (&number ? nwidth : 0) + return (&columns - width) +endfunction + +function! s:resize_pads() + let hmargin = s:hmargin() + let tmargin = get(g:, 'goyo_margin_top', 4) + let bmargin = get(g:, 'goyo_margin_bottom', 4) + + augroup goyop + autocmd! + augroup END + call s:setup_pad(t:goyo_pads.t, 0, tmargin - 1) + call s:setup_pad(t:goyo_pads.b, 0, bmargin - 2) + call s:setup_pad(t:goyo_pads.l, 1, hmargin / 2 - 1) + call s:setup_pad(t:goyo_pads.r, 1, hmargin / 2 - 1) +endfunction + +function! s:tranquilize() + let bg = s:get_color('Normal', 'bg') + for grp in ['NonText', 'FoldColumn', 'ColorColumn', 'VertSplit', + \ 'StatusLine', 'StatusLineNC', 'SignColumn'] + " -1 on Vim / '' on GVim + if bg == -1 || empty(bg) + 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 + +function! s:goyo_on(width) + let s:orig_tab = tabpagenr() + + " New tab + tab split + + let t:goyo_master = winbufnr(0) + let t:goyo_width = a:width + let t:goyo_pads = {} + let t:goyo_revert = + \ { 'laststatus': &laststatus, + \ 'showtabline': &showtabline, + \ 'fillchars': &fillchars, + \ 'winminwidth': &winminwidth, + \ 'winwidth': &winwidth, + \ 'winminheight': &winminheight, + \ 'winheight': &winheight, + \ 'statusline': &statusline, + \ 'ruler': &ruler, + \ 'sidescroll': &sidescroll, + \ 'sidescrolloff': &sidescrolloff + \ } + if has('gui_running') + let t:goyo_revert.guioptions = &guioptions + endif + + " vim-gitgutter + let t:goyo_disabled_gitgutter = get(g:, 'gitgutter_enabled', 0) + if t:goyo_disabled_gitgutter + silent! GitGutterDisable + endif + + " vim-signify + let t:goyo_disabled_signify = exists('b:sy') && b:sy.active + if t:goyo_disabled_signify + SignifyToggle + endif + + " vim-airline + let t:goyo_disabled_airline = exists("#airline") + if t:goyo_disabled_airline + AirlineToggle + endif + + " vim-powerline + let t:goyo_disabled_powerline = exists("#PowerlineMain") + if t:goyo_disabled_powerline + augroup PowerlineMain + autocmd! + augroup END + augroup! PowerlineMain + endif + + " lightline.vim + let t:goyo_disabled_lightline = exists('#LightLine') + if t:goyo_disabled_lightline + silent! call lightline#disable() + endif + + if !get(g:, 'goyo_linenr', 0) + setlocal nonu + if exists('&rnu') + setlocal nornu + endif + endif + if exists('&colorcolumn') + setlocal colorcolumn= + endif + + " Global options + let &winheight = max([&winminheight, 1]) + set winminheight=1 + set winheight=1 + set winminwidth=1 winwidth=1 + set laststatus=0 + set showtabline=0 + set noruler + set fillchars+=vert:\ + set fillchars+=stl:. + set fillchars+=stlnc:\ + set sidescroll=1 + set sidescrolloff=0 + + " Hide left-hand scrollbars + if has('gui_running') + set guioptions-=l + set guioptions-=L + endif + + let t:goyo_pads.l = s:init_pad('vertical topleft new') + let t:goyo_pads.r = s:init_pad('vertical botright new') + let t:goyo_pads.t = s:init_pad('topleft new') + let t:goyo_pads.b = s:init_pad('botright new') + + call s:resize_pads() + call s:tranquilize() + + let &statusline = repeat(' ', winwidth(0)) + + augroup goyo + autocmd! + autocmd BufWinLeave call s:goyo_off() + autocmd TabLeave * call s:goyo_off() + autocmd VimResized * call s:resize_pads() + autocmd ColorScheme * call s:tranquilize() + augroup END + + if exists('g:goyo_callbacks[0]') + call g:goyo_callbacks[0]() + endif +endfunction + +function! s:goyo_off() + if !exists('#goyo') + return + endif + + " Oops, not this tab + if !exists('t:goyo_revert') + return + endif + + " Clear auto commands + augroup goyo + autocmd! + augroup END + augroup! goyo + augroup goyop + autocmd! + augroup END + augroup! goyop + + let goyo_revert = t:goyo_revert + let goyo_disabled_gitgutter = t:goyo_disabled_gitgutter + let goyo_disabled_signify = t:goyo_disabled_signify + 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 + normal! gt + bd + endif + tabclose + execute 'normal! '.s:orig_tab.'gt' + if winbufnr(0) == goyo_orig_buffer + execute printf('normal! %dG%d|', line, col) + endif + + let wmw = remove(goyo_revert, 'winminwidth') + let ww = remove(goyo_revert, 'winwidth') + let &winwidth = ww + let &winminwidth = wmw + let wmh = remove(goyo_revert, 'winminheight') + let wh = remove(goyo_revert, 'winheight') + let &winheight = max([wmh, 1]) + let &winminheight = wmh + let &winheight = wh + + for [k, v] in items(goyo_revert) + execute printf("let &%s = %s", k, string(v)) + endfor + execute 'colo '. get(g:, 'colors_name', 'default') + + if goyo_disabled_gitgutter + silent! GitGutterEnable + endif + + if goyo_disabled_signify + silent! if !b:sy.active + SignifyToggle + endif + endif + + if goyo_disabled_airline && !exists("#airline") + AirlineToggle + silent! AirlineRefresh + endif + + if goyo_disabled_powerline && !exists("#PowerlineMain") + doautocmd PowerlineStartup VimEnter + silent! PowerlineReloadColorscheme + endif + + if goyo_disabled_lightline + silent! call lightline#enable() + endif + + if exists('#Powerline') + doautocmd Powerline ColorScheme + endif + + if exists('g:goyo_callbacks[1]') + call g:goyo_callbacks[1]() + endif +endfunction + +function! s:goyo(bang, ...) + let width = a:0 > 0 ? a:1 : get(g:, 'goyo_width', 80) + + if a:bang + if exists('#goyo') + call s:goyo_off() + endif + else + if exists('#goyo') == 0 + call s:goyo_on(width) + elseif a:0 > 0 + let t:goyo_width = width + call s:resize_pads() + else + call s:goyo_off() + end + end +endfunction + +command! -nargs=? -bar -bang Goyo call s:goyo('' == '!', ) + +let &cpo = s:cpo_save +unlet s:cpo_save + diff --git a/sources_non_forked/nerdtree/README.markdown b/sources_non_forked/nerdtree/README.markdown index e6178091..9dacf682 100644 --- a/sources_non_forked/nerdtree/README.markdown +++ b/sources_non_forked/nerdtree/README.markdown @@ -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?__ diff --git a/sources_non_forked/nerdtree/autoload/nerdtree.vim b/sources_non_forked/nerdtree/autoload/nerdtree.vim index 3a2d71a6..539e7838 100644 --- a/sources_non_forked/nerdtree/autoload/nerdtree.vim +++ b/sources_non_forked/nerdtree/autoload/nerdtree.vim @@ -9,29 +9,6 @@ endfunction " SECTION: General Functions {{{1 "============================================================ -"FUNCTION: nerdtree#bufInWindows(bnum){{{2 -"[[STOLEN FROM VTREEEXPLORER.VIM]] -"Determine the number of windows open to this buffer number. -"Care of Yegappan Lakshman. Thanks! -" -"Args: -"bnum: the subject buffers buffer number -function! nerdtree#bufInWindows(bnum) - let cnt = 0 - let winnum = 1 - while 1 - let bufnum = winbufnr(winnum) - if bufnum < 0 - break - endif - if bufnum ==# a:bnum - let cnt = cnt + 1 - endif - let winnum = winnum + 1 - endwhile - - return cnt -endfunction "FUNCTION: nerdtree#checkForBrowse(dir) {{{2 "inits a secondary nerd tree in the current buffer if appropriate @@ -57,81 +34,6 @@ function! nerdtree#compareNodes(n1, n2) return a:n1.path.compareTo(a:n2.path) endfunction -" FUNCTION: nerdtree#createDefaultBindings() {{{2 -function! nerdtree#createDefaultBindings() - let s = '' . s:SID() . '_' - - call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleMiddleMouse" }) - call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleLeftClick" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" }) - call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" }) - - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "Bookmark", 'callback': s."activateBookmark" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "all", 'callback': s."activateAll" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Node", 'callback': s."openHSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Node", 'callback': s."openVSplit" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Bookmark", 'callback': s."openHSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Bookmark", 'callback': s."openVSplit" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Node", 'callback': s."previewNodeCurrent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Node", 'callback': s."previewNodeVSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Node", 'callback': s."previewNodeHSplit" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Bookmark", 'callback': s."previewNodeCurrent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Bookmark", 'callback': s."previewNodeVSplit" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Bookmark", 'callback': s."previewNodeHSplit" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': "DirNode", 'callback': s."openNodeRecursively" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdir, 'scope': "all", 'callback': s."upDirCurrentRootClosed" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdirKeepOpen, 'scope': "all", 'callback': s."upDirCurrentRootOpen" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChangeRoot, 'scope': "Node", 'callback': s."chRoot" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': "Node", 'callback': s."chCwd" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': "all", 'callback': s."closeTreeWindow" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': "all", 'callback': "nerdtree#chRootCwd" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': "all", 'callback': s."refreshRoot" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': "Node", 'callback': s."refreshCurrent" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': "all", 'callback': s."displayHelp" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': "all", 'callback': s."toggleZoom" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': "all", 'callback': s."toggleShowHidden" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': "all", 'callback': s."toggleIgnoreFilter" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': "all", 'callback': s."toggleShowFiles" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': "all", 'callback': s."toggleShowBookmarks" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': "Node", 'callback': s."closeCurrentDir" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': "DirNode", 'callback': s."closeChildren" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': "Node", 'callback': s."showMenu" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': "Node", 'callback': s."jumpToParent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': "Node", 'callback': s."jumpToFirstChild" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': "Node", 'callback': s."jumpToLastChild" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': "all", 'callback': s."jumpToRoot" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': "Node", 'callback': s."jumpToNextSibling" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': "Node", 'callback': s."jumpToPrevSibling" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Node", 'callback': s."openInNewTab" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Node", 'callback': s."openInNewTabSilent" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Bookmark", 'callback': s."openInNewTab" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Bookmark", 'callback': s."openInNewTabSilent" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" }) - - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" }) -endfunction - " FUNCTION: nerdtree#deprecated(func, [msg]) {{{2 " Issue a deprecation warning for a:func. If a second arg is given, use this " as the deprecation message @@ -147,15 +49,6 @@ function! nerdtree#deprecated(func, ...) endif endfunction -"FUNCTION: nerdtree#escChars(dir) {{{2 -function! nerdtree#escChars() - if nerdtree#runningWindows() - return " `\|\"#%&,?()\*^<>" - endif - - return " \\`\|\"#%&,?()\*^<>[]" -endfunction - " FUNCTION: nerdtree#exec(cmd) {{{2 " same as :exec cmd but eventignore=all is set for the duration function! nerdtree#exec(cmd) @@ -165,68 +58,11 @@ function! nerdtree#exec(cmd) let &ei = old_ei endfunction -" FUNCTION: nerdtree#findAndRevealPath() {{{2 -function! nerdtree#findAndRevealPath() - try - let p = g:NERDTreePath.New(expand("%:p")) - catch /^NERDTree.InvalidArgumentsError/ - call nerdtree#echo("no file for the current buffer") - return - endtry - - if p.isUnixHiddenPath() - let showhidden=g:NERDTreeShowHidden - let g:NERDTreeShowHidden = 1 - endif - - if !nerdtree#treeExistsForTab() - try - let cwd = g:NERDTreePath.New(getcwd()) - catch /^NERDTree.InvalidArgumentsError/ - call nerdtree#echo("current directory does not exist.") - let cwd = p.getParent() - endtry - - if p.isUnder(cwd) - call g:NERDTreeCreator.CreatePrimary(cwd.str()) - else - call g:NERDTreeCreator.CreatePrimary(p.getParent().str()) - endif - else - if !p.isUnder(g:NERDTreeFileNode.GetRootForTab().path) - if !nerdtree#isTreeOpen() - call g:NERDTreeCreator.TogglePrimary('') - else - call nerdtree#putCursorInTreeWin() - endif - let b:NERDTreeShowHidden = g:NERDTreeShowHidden - call nerdtree#chRoot(g:NERDTreeDirNode.New(p.getParent())) - else - if !nerdtree#isTreeOpen() - call g:NERDTreeCreator.TogglePrimary("") - endif - endif - endif - call nerdtree#putCursorInTreeWin() - call b:NERDTreeRoot.reveal(p) - - if p.isUnixHiddenFile() - let g:NERDTreeShowHidden = showhidden - endif -endfunction - " FUNCTION: nerdtree#has_opt(options, name) {{{2 function! nerdtree#has_opt(options, name) return has_key(a:options, a:name) && a:options[a:name] == 1 endfunction -" FUNCTION: nerdtree#invokeKeyMap(key) {{{2 -"this is needed since I cant figure out how to invoke dict functions from a -"key map -function! nerdtree#invokeKeyMap(key) - call g:NERDTreeKeyMap.Invoke(a:key) -endfunction - " FUNCTION: nerdtree#loadClassFiles() {{{2 function! nerdtree#loadClassFiles() runtime lib/nerdtree/path.vim @@ -238,12 +74,17 @@ function! nerdtree#loadClassFiles() runtime lib/nerdtree/tree_dir_node.vim runtime lib/nerdtree/opener.vim runtime lib/nerdtree/creator.vim + runtime lib/nerdtree/flag_set.vim + runtime lib/nerdtree/nerdtree.vim + runtime lib/nerdtree/ui.vim + runtime lib/nerdtree/event.vim + runtime lib/nerdtree/notifier.vim endfunction " FUNCTION: nerdtree#postSourceActions() {{{2 function! nerdtree#postSourceActions() call g:NERDTreeBookmark.CacheBookmarks(0) - call nerdtree#createDefaultBindings() + call nerdtree#ui_glue#createDefaultBindings() "load all nerdtree plugins runtime! nerdtree_plugin/**/*.vim @@ -254,44 +95,6 @@ function! nerdtree#runningWindows() return has("win16") || has("win32") || has("win64") endfunction -" Function: s:SID() {{{2 -function s:SID() - if !exists("s:sid") - let s:sid = matchstr(expand(''), '\zs\d\+\ze_SID$') - endif - return s:sid -endfun - -" FUNCTION: nerdtree#tabpagevar(tabnr, var) {{{2 -function! nerdtree#tabpagevar(tabnr, var) - let currentTab = tabpagenr() - let old_ei = &ei - set ei=all - - exec "tabnext " . a:tabnr - let v = -1 - if exists('t:' . a:var) - exec 'let v = t:' . a:var - endif - exec "tabnext " . currentTab - - let &ei = old_ei - - return v -endfunction - -" Function: nerdtree#treeExistsForBuffer() {{{2 -" Returns 1 if a nerd tree root exists in the current buffer -function! nerdtree#treeExistsForBuf() - return exists("b:NERDTreeRoot") -endfunction - -" Function: nerdtree#treeExistsForTab() {{{2 -" Returns 1 if a nerd tree root exists in the current tab -function! nerdtree#treeExistsForTab() - return exists("t:NERDTreeBufName") -endfunction - "FUNCTION: nerdtree#treeMarkupReg(dir) {{{2 function! nerdtree#treeMarkupReg() if g:NERDTreeDirArrows @@ -311,76 +114,9 @@ function! nerdtree#treeWid() return 2 endfunction -"FUNCTION: nerdtree#upDir(keepState) {{{2 -"moves the tree up a level -" -"Args: -"keepState: 1 if the current root should be left open when the tree is -"re-rendered -function! nerdtree#upDir(keepState) - let cwd = b:NERDTreeRoot.path.str({'format': 'UI'}) - if cwd ==# "/" || cwd =~# '^[^/]..$' - call nerdtree#echo("already at top dir") - else - if !a:keepState - call b:NERDTreeRoot.close() - endif - - let oldRoot = b:NERDTreeRoot - - if empty(b:NERDTreeRoot.parent) - let path = b:NERDTreeRoot.path.getParent() - let newRoot = g:NERDTreeDirNode.New(path) - call newRoot.open() - call newRoot.transplantChild(b:NERDTreeRoot) - let b:NERDTreeRoot = newRoot - else - let b:NERDTreeRoot = b:NERDTreeRoot.parent - endif - - if g:NERDTreeChDirMode ==# 2 - call b:NERDTreeRoot.path.changeToDir() - endif - - call nerdtree#renderView() - call oldRoot.putCursorHere(0, 0) - endif -endfunction - -" Function: nerdtree#unique(list) {{{2 -" returns a:list without duplicates -function! nerdtree#unique(list) - let uniqlist = [] - for elem in a:list - if index(uniqlist, elem) ==# -1 - let uniqlist += [elem] - endif - endfor - return uniqlist -endfunction - " SECTION: View Functions {{{1 "============================================================ -" -"FUNCTION: nerdtree#centerView() {{{2 -"centers the nerd tree window around the cursor (provided the nerd tree -"options permit) -function! nerdtree#centerView() - if g:NERDTreeAutoCenter - let current_line = winline() - let lines_to_top = current_line - let lines_to_bottom = winheight(nerdtree#getTreeWinNum()) - current_line - if lines_to_top < g:NERDTreeAutoCenterThreshold || lines_to_bottom < g:NERDTreeAutoCenterThreshold - normal! zz - endif - endif -endfunction -" FUNCTION: nerdtree#chRoot(node) {{{2 -" changes the current root to the selected one -function! nerdtree#chRoot(node) - call s:chRoot(a:node) -endfunction "FUNCTION: nerdtree#closeTree() {{{2 "Closes the primary NERD tree window for this tab function! nerdtree#closeTree() @@ -513,7 +249,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 \n" + let @h=@h."\" :Bookmark []\n" let @h=@h."\" :BookmarkToRoot \n" let @h=@h."\" :RevealBookmark \n" let @h=@h."\" :OpenBookmark \n" @@ -558,92 +294,6 @@ function! nerdtree#echoWarning(msg) echohl normal endfunction -"FUNCTION: nerdtree#firstUsableWindow(){{{2 -"find the window number of the first normal window -function! nerdtree#firstUsableWindow() - let i = 1 - while i <= winnr("$") - let bnum = winbufnr(i) - if bnum != -1 && getbufvar(bnum, '&buftype') ==# '' - \ && !getwinvar(i, '&previewwindow') - \ && (!getbufvar(bnum, '&modified') || &hidden) - return i - endif - - let i += 1 - endwhile - return -1 -endfunction - -"FUNCTION: nerdtree#getPath(ln) {{{2 -"Gets the full path to the node that is rendered on the given line number -" -"Args: -"ln: the line number to get the path for -" -"Return: -"A path if a node was selected, {} if nothing is selected. -"If the 'up a dir' line was selected then the path to the parent of the -"current root is returned -function! nerdtree#getPath(ln) - let line = getline(a:ln) - - let rootLine = g:NERDTreeFileNode.GetRootLineNum() - - "check to see if we have the root node - if a:ln == rootLine - return b:NERDTreeRoot.path - endif - - if !g:NERDTreeDirArrows - " in case called from outside the tree - if line !~# '^ *[|`▸▾ ]' || line =~# '^$' - return {} - endif - endif - - if line ==# nerdtree#treeUpDirLine() - return b:NERDTreeRoot.path.getParent() - endif - - let indent = nerdtree#indentLevelFor(line) - - "remove the tree parts and the leading space - let curFile = nerdtree#stripMarkupFromLine(line, 0) - - let wasdir = 0 - if curFile =~# '/$' - let wasdir = 1 - let curFile = substitute(curFile, '/\?$', '/', "") - endif - - let dir = "" - let lnum = a:ln - while lnum > 0 - let lnum = lnum - 1 - let curLine = getline(lnum) - let curLineStripped = nerdtree#stripMarkupFromLine(curLine, 1) - - "have we reached the top of the tree? - if lnum == rootLine - let dir = b:NERDTreeRoot.path.str({'format': 'UI'}) . dir - break - endif - if curLineStripped =~# '/$' - let lpindent = nerdtree#indentLevelFor(curLine) - if lpindent < indent - let indent = indent - 1 - - let dir = substitute (curLineStripped,'^\\', "", "") . dir - continue - endif - endif - endwhile - let curFile = b:NERDTreeRoot.path.drive . dir . curFile - let toReturn = g:NERDTreePath.New(curFile) - return toReturn -endfunction - "FUNCTION: nerdtree#getTreeWinNum() {{{2 "gets the nerd tree window number for this tab function! nerdtree#getTreeWinNum() @@ -654,111 +304,11 @@ function! nerdtree#getTreeWinNum() endif endfunction -"FUNCTION: nerdtree#indentLevelFor(line) {{{2 -function! nerdtree#indentLevelFor(line) - let level = match(a:line, '[^ \-+~▸▾`|]') / nerdtree#treeWid() - " check if line includes arrows - if match(a:line, '[▸▾]') > -1 - " decrement level as arrow uses 3 ascii chars - let level = level - 1 - endif - return level -endfunction - "FUNCTION: nerdtree#isTreeOpen() {{{2 function! nerdtree#isTreeOpen() return nerdtree#getTreeWinNum() != -1 endfunction -"FUNCTION: nerdtree#isWindowUsable(winnumber) {{{2 -"Returns 0 if opening a file from the tree in the given window requires it to -"be split, 1 otherwise -" -"Args: -"winnumber: the number of the window in question -function! nerdtree#isWindowUsable(winnumber) - "gotta split if theres only one window (i.e. the NERD tree) - if winnr("$") ==# 1 - return 0 - endif - - let oldwinnr = winnr() - call nerdtree#exec(a:winnumber . "wincmd p") - let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow') - let modified = &modified - call nerdtree#exec(oldwinnr . "wincmd p") - - "if its a special window e.g. quickfix or another explorer plugin then we - "have to split - if specialWindow - return 0 - endif - - if &hidden - return 1 - endif - - return !modified || nerdtree#bufInWindows(winbufnr(a:winnumber)) >= 2 -endfunction - -" FUNCTION: nerdtree#jumpToChild(direction) {{{2 -" Args: -" direction: 0 if going to first child, 1 if going to last -function! nerdtree#jumpToChild(currentNode, direction) - if a:currentNode.isRoot() - return nerdtree#echo("cannot jump to " . (a:direction ? "last" : "first") . " child") - end - let dirNode = a:currentNode.parent - let childNodes = dirNode.getVisibleChildren() - - let targetNode = childNodes[0] - if a:direction - let targetNode = childNodes[len(childNodes) - 1] - endif - - if targetNode.equals(a:currentNode) - let siblingDir = a:currentNode.parent.findOpenDirSiblingWithVisibleChildren(a:direction) - if siblingDir != {} - let indx = a:direction ? siblingDir.getVisibleChildCount()-1 : 0 - let targetNode = siblingDir.getChildByIndex(indx, 1) - endif - endif - - call targetNode.putCursorHere(1, 0) - - call nerdtree#centerView() -endfunction - -" FUNCTION: nerdtree#jumpToSibling(currentNode, forward) {{{2 -" moves the cursor to the sibling of the current node in the given direction -" -" Args: -" forward: 1 if the cursor should move to the next sibling, 0 if it should -" move back to the previous sibling -function! nerdtree#jumpToSibling(currentNode, forward) - let sibling = a:currentNode.findSibling(a:forward) - - if !empty(sibling) - call sibling.putCursorHere(1, 0) - call nerdtree#centerView() - endif -endfunction - -"FUNCTION: nerdtree#promptToDelBuffer(bufnum, msg){{{2 -"prints out the given msg and, if the user responds by pushing 'y' then the -"buffer with the given bufnum is deleted -" -"Args: -"bufnum: the buffer that may be deleted -"msg: a message that will be echoed to the user asking them if they wish to -" del the buffer -function! nerdtree#promptToDelBuffer(bufnum, msg) - echo a:msg - if nr2char(getchar()) ==# 'y' - exec "silent bdelete! " . a:bufnum - endif -endfunction - "FUNCTION: nerdtree#putCursorOnBookmarkTable(){{{2 "Places the cursor at the top of the bookmarks table function! nerdtree#putCursorOnBookmarkTable() @@ -770,7 +320,7 @@ function! nerdtree#putCursorOnBookmarkTable() return cursor(1, 2) endif - let rootNodeLine = g:NERDTreeFileNode.GetRootLineNum() + let rootNodeLine = b:NERDTree.ui.getRootLineNum() let line = 1 while getline(line) !~# '^>-\+Bookmarks-\+$' @@ -810,116 +360,10 @@ function! nerdtree#renderBookmarks() endfunction "FUNCTION: nerdtree#renderView {{{2 -"The entry function for rendering the tree function! nerdtree#renderView() - setlocal modifiable - - "remember the top line of the buffer and the current line so we can - "restore the view exactly how it was - let curLine = line(".") - let curCol = col(".") - let topLine = line("w0") - - "delete all lines in the buffer (being careful not to clobber a register) - silent 1,$delete _ - - call nerdtree#dumpHelp() - - "delete the blank line before the help and add one after it - if g:NERDTreeMinimalUI == 0 - call setline(line(".")+1, "") - call cursor(line(".")+1, col(".")) - endif - - if b:NERDTreeShowBookmarks - call nerdtree#renderBookmarks() - endif - - "add the 'up a dir' line - if !g:NERDTreeMinimalUI - call setline(line(".")+1, nerdtree#treeUpDirLine()) - call cursor(line(".")+1, col(".")) - endif - - "draw the header line - let header = b:NERDTreeRoot.path.str({'format': 'UI', 'truncateTo': winwidth(0)}) - call setline(line(".")+1, header) - call cursor(line(".")+1, col(".")) - - "draw the tree - let old_o = @o - let @o = b:NERDTreeRoot.renderToString() - silent put o - let @o = old_o - - "delete the blank line at the top of the buffer - silent 1,1delete _ - - "restore the view - let old_scrolloff=&scrolloff - let &scrolloff=0 - call cursor(topLine, 1) - normal! zt - call cursor(curLine, curCol) - let &scrolloff = old_scrolloff - - setlocal nomodifiable -endfunction - -"FUNCTION: nerdtree#renderViewSavingPosition {{{2 -"Renders the tree and ensures the cursor stays on the current node or the -"current nodes parent if it is no longer available upon re-rendering -function! nerdtree#renderViewSavingPosition() - let currentNode = g:NERDTreeFileNode.GetSelected() - - "go up the tree till we find a node that will be visible or till we run - "out of nodes - while currentNode != {} && !currentNode.isVisible() && !currentNode.isRoot() - let currentNode = currentNode.parent - endwhile - - call nerdtree#renderView() - - if currentNode != {} - call currentNode.putCursorHere(0, 0) - endif + call b:NERDTree.render() endfunction " -"FUNCTION: nerdtree#restoreScreenState() {{{2 -" -"Sets the screen state back to what it was when nerdtree#saveScreenState was last -"called. -" -"Assumes the cursor is in the NERDTree window -function! nerdtree#restoreScreenState() - if !exists("b:NERDTreeOldTopLine") || !exists("b:NERDTreeOldPos") || !exists("b:NERDTreeOldWindowSize") - return - endif - exec("silent vertical resize ".b:NERDTreeOldWindowSize) - - let old_scrolloff=&scrolloff - let &scrolloff=0 - call cursor(b:NERDTreeOldTopLine, 0) - normal! zt - call setpos(".", b:NERDTreeOldPos) - let &scrolloff=old_scrolloff -endfunction - -"FUNCTION: nerdtree#saveScreenState() {{{2 -"Saves the current cursor position in the current buffer and the window -"scroll position -function! nerdtree#saveScreenState() - let win = winnr() - try - call nerdtree#putCursorInTreeWin() - let b:NERDTreeOldPos = getpos(".") - let b:NERDTreeOldTopLine = line("w0") - let b:NERDTreeOldWindowSize = winwidth("") - call nerdtree#exec(win . "wincmd w") - catch /^NERDTree.InvalidOperationError/ - endtry -endfunction - "FUNCTION: nerdtree#stripMarkupFromLine(line, removeLeadingSpaces){{{2 "returns the given line with all the tree parts stripped off " @@ -941,6 +385,9 @@ function! nerdtree#stripMarkupFromLine(line, removeLeadingSpaces) "strip off any executable flags let line = substitute (line, '*\ze\($\| \)', "","") + "strip off any generic flags + let line = substitute (line, '\[[^]]*\]', "","") + let wasdir = 0 if line =~# '/$' let wasdir = 1 @@ -957,424 +404,4 @@ function! nerdtree#stripMarkupFromLine(line, removeLeadingSpaces) return line endfunction -"SECTION: Interface bindings {{{1 -"============================================================ - -"FUNCTION: s:activateAll() {{{2 -"handle the user activating the updir line -function! s:activateAll() - if getline(".") ==# nerdtree#treeUpDirLine() - return nerdtree#upDir(0) - endif -endfunction -"FUNCTION: s:activateDirNode() {{{2 -"handle the user activating a tree node -function! s:activateDirNode(node) - call a:node.activate({'reuse': 1}) -endfunction - -"FUNCTION: s:activateFileNode() {{{2 -"handle the user activating a tree node -function! s:activateFileNode(node) - call a:node.activate({'reuse': 1, 'where': 'p'}) -endfunction - -"FUNCTION: s:activateBookmark() {{{2 -"handle the user activating a bookmark -function! s:activateBookmark(bm) - call a:bm.activate(!a:bm.path.isDirectory ? {'where': 'p'} : {}) -endfunction - -" FUNCTION: nerdtree#bookmarkNode(name) {{{2 -" Associate the current node with the given name -function! nerdtree#bookmarkNode(...) - let currentNode = g:NERDTreeFileNode.GetSelected() - if currentNode != {} - let name = a:1 - if empty(name) - let name = currentNode.path.getLastPathComponent(0) - endif - try - call currentNode.bookmark(name) - call nerdtree#renderView() - catch /^NERDTree.IllegalBookmarkNameError/ - call nerdtree#echo("bookmark names must not contain spaces") - endtry - else - call nerdtree#echo("select a node first") - endif -endfunction - -" FUNCTION: s:chCwd(node) {{{2 -function! s:chCwd(node) - try - call a:node.path.changeToDir() - catch /^NERDTree.PathChangeError/ - call nerdtree#echoWarning("could not change cwd") - endtry -endfunction - -" FUNCTION: s:chRoot(node) {{{2 -" changes the current root to the selected one -function! s:chRoot(node) - call a:node.makeRoot() - call nerdtree#renderView() - call b:NERDTreeRoot.putCursorHere(0, 0) -endfunction - -" FUNCTION: s:chRootCwd() {{{2 -" changes the current root to CWD -function! nerdtree#chRootCwd() - try - let cwd = g:NERDTreePath.New(getcwd()) - catch /^NERDTree.InvalidArgumentsError/ - call nerdtree#echo("current directory does not exist.") - return - endtry - if cwd.str() == g:NERDTreeFileNode.GetRootForTab().path.str() - return - endif - call nerdtree#chRoot(g:NERDTreeDirNode.New(cwd)) -endfunction - -" FUNCTION: nerdtree#clearBookmarks(bookmarks) {{{2 -function! nerdtree#clearBookmarks(bookmarks) - if a:bookmarks ==# '' - let currentNode = g:NERDTreeFileNode.GetSelected() - if currentNode != {} - call currentNode.clearBookmarks() - endif - else - for name in split(a:bookmarks, ' ') - let bookmark = g:NERDTreeBookmark.BookmarkFor(name) - call bookmark.delete() - endfor - endif - call nerdtree#renderView() -endfunction - -" FUNCTION: s:closeChildren(node) {{{2 -" closes all childnodes of the current node -function! s:closeChildren(node) - call a:node.closeChildren() - call nerdtree#renderView() - call a:node.putCursorHere(0, 0) -endfunction - -" FUNCTION: s:closeCurrentDir(node) {{{2 -" closes the parent dir of the current node -function! s:closeCurrentDir(node) - let parent = a:node.parent - if parent ==# {} || parent.isRoot() - call nerdtree#echo("cannot close tree root") - else - call a:node.parent.close() - call nerdtree#renderView() - call a:node.parent.putCursorHere(0, 0) - endif -endfunction - -" FUNCTION: s:closeTreeWindow() {{{2 -" close the tree window -function! s:closeTreeWindow() - if b:NERDTreeType ==# "secondary" && b:NERDTreePreviousBuf != -1 - exec "buffer " . b:NERDTreePreviousBuf - else - if winnr("$") > 1 - call nerdtree#closeTree() - else - call nerdtree#echo("Cannot close last window") - endif - endif -endfunction - -" FUNCTION: s:deleteBookmark(bm) {{{2 -" if the cursor is on a bookmark, prompt to delete -function! s:deleteBookmark(bm) - echo "Are you sure you wish to delete the bookmark:\n\"" . a:bm.name . "\" (yN):" - - if nr2char(getchar()) ==# 'y' - try - call a:bm.delete() - call nerdtree#renderView() - redraw - catch /^NERDTree/ - call nerdtree#echoWarning("Could not remove bookmark") - endtry - else - call nerdtree#echo("delete aborted" ) - endif - -endfunction - -" FUNCTION: s:displayHelp() {{{2 -" toggles the help display -function! s:displayHelp() - let b:treeShowHelp = b:treeShowHelp ? 0 : 1 - call nerdtree#renderView() - call nerdtree#centerView() -endfunction - -"FUNCTION: s:handleLeftClick() {{{2 -"Checks if the click should open the current node -function! s:handleLeftClick() - let currentNode = g:NERDTreeFileNode.GetSelected() - if currentNode != {} - - "the dir arrows are multibyte chars, and vim's string functions only - "deal with single bytes - so split the line up with the hack below and - "take the line substring manually - let line = split(getline(line(".")), '\zs') - let startToCur = "" - for i in range(0,len(line)-1) - let startToCur .= line[i] - endfor - - if currentNode.path.isDirectory - if startToCur =~# nerdtree#treeMarkupReg() && startToCur =~# '[+~▾▸] \?$' - call currentNode.activate() - return - endif - endif - - if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3 - let char = strpart(startToCur, strlen(startToCur)-1, 1) - if char !~# nerdtree#treeMarkupReg() - if currentNode.path.isDirectory - call currentNode.activate() - else - call currentNode.activate({'reuse': 1, 'where': 'p'}) - endif - return - endif - endif - endif -endfunction - -" FUNCTION: s:handleMiddleMouse() {{{2 -function! s:handleMiddleMouse() - let curNode = g:NERDTreeFileNode.GetSelected() - if curNode ==# {} - call nerdtree#echo("Put the cursor on a node first" ) - return - endif - - if curNode.path.isDirectory - call nerdtree#openExplorer(curNode) - else - call curNode.open({'where': 'h'}) - endif -endfunction - -" FUNCTION: s:jumpToFirstChild() {{{2 -" wrapper for the jump to child method -function! s:jumpToFirstChild(node) - call nerdtree#jumpToChild(a:node, 0) -endfunction - -" FUNCTION: s:jumpToLastChild() {{{2 -" wrapper for the jump to child method -function! s:jumpToLastChild(node) - call nerdtree#jumpToChild(a:node, 1) -endfunction - -" FUNCTION: s:jumpToParent(node) {{{2 -" moves the cursor to the parent of the current node -function! s:jumpToParent(node) - if !empty(a:node.parent) - call a:node.parent.putCursorHere(1, 0) - call nerdtree#centerView() - else - call nerdtree#echo("cannot jump to parent") - endif -endfunction - -" FUNCTION: s:jumpToRoot() {{{2 -" moves the cursor to the root node -function! s:jumpToRoot() - call b:NERDTreeRoot.putCursorHere(1, 0) - call nerdtree#centerView() -endfunction - -" FUNCTION: s:jumpToNextSibling(node) {{{2 -function! s:jumpToNextSibling(node) - call nerdtree#jumpToSibling(a:node, 1) -endfunction - -" FUNCTION: s:jumpToPrevSibling(node) {{{2 -function! s:jumpToPrevSibling(node) - call nerdtree#jumpToSibling(a:node, 0) -endfunction - -" FUNCTION: nerdtree#openBookmark(name) {{{2 -" put the cursor on the given bookmark and, if its a file, open it -function! nerdtree#openBookmark(name) - try - let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0) - call targetNode.putCursorHere(0, 1) - redraw! - catch /^NERDTree.BookmarkedNodeNotFoundError/ - call nerdtree#echo("note - target node is not cached") - let bookmark = g:NERDTreeBookmark.BookmarkFor(a:name) - let targetNode = g:NERDTreeFileNode.New(bookmark.path) - endtry - if targetNode.path.isDirectory - call targetNode.openExplorer() - else - call targetNode.open({'where': 'p'}) - endif -endfunction - -" FUNCTION: s:openHSplit(target) {{{2 -function! s:openHSplit(target) - call a:target.activate({'where': 'h'}) -endfunction - -" FUNCTION: s:openVSplit(target) {{{2 -function! s:openVSplit(target) - call a:target.activate({'where': 'v'}) -endfunction - -" FUNCTION: s:openExplorer(node) {{{2 -function! s:openExplorer(node) - call a:node.openExplorer() -endfunction - -" FUNCTION: s:openInNewTab(target) {{{2 -function! s:openInNewTab(target) - call a:target.activate({'where': 't'}) -endfunction - -" FUNCTION: s:openInNewTabSilent(target) {{{2 -function! s:openInNewTabSilent(target) - call a:target.activate({'where': 't', 'stay': 1}) -endfunction - -" FUNCTION: s:openNodeRecursively(node) {{{2 -function! s:openNodeRecursively(node) - call nerdtree#echo("Recursively opening node. Please wait...") - call a:node.openRecursively() - call nerdtree#renderView() - redraw - call nerdtree#echo("Recursively opening node. Please wait... DONE") -endfunction - -"FUNCTION: s:previewNodeCurrent(node) {{{2 -function! s:previewNodeCurrent(node) - call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1}) -endfunction - -"FUNCTION: s:previewNodeHSplit(node) {{{2 -function! s:previewNodeHSplit(node) - call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1}) -endfunction - -"FUNCTION: s:previewNodeVSplit(node) {{{2 -function! s:previewNodeVSplit(node) - call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1}) -endfunction - -" FUNCTION: nerdtree#revealBookmark(name) {{{2 -" put the cursor on the node associate with the given name -function! nerdtree#revealBookmark(name) - try - let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0) - call targetNode.putCursorHere(0, 1) - catch /^NERDTree.BookmarkNotFoundError/ - call nerdtree#echo("Bookmark isnt cached under the current root") - endtry -endfunction - -" FUNCTION: s:refreshRoot() {{{2 -" Reloads the current root. All nodes below this will be lost and the root dir -" will be reloaded. -function! s:refreshRoot() - call nerdtree#echo("Refreshing the root node. This could take a while...") - call b:NERDTreeRoot.refresh() - call nerdtree#renderView() - redraw - call nerdtree#echo("Refreshing the root node. This could take a while... DONE") -endfunction - -" FUNCTION: s:refreshCurrent(node) {{{2 -" refreshes the root for the current node -function! s:refreshCurrent(node) - let node = a:node - if !node.path.isDirectory - let node = node.parent - endif - - call nerdtree#echo("Refreshing node. This could take a while...") - call node.refresh() - call nerdtree#renderView() - redraw - call nerdtree#echo("Refreshing node. This could take a while... DONE") -endfunction - -" FUNCTION: s:showMenu(node) {{{2 -function! s:showMenu(node) - let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled()) - call mc.showMenu() -endfunction - -" FUNCTION: s:toggleIgnoreFilter() {{{2 -" toggles the use of the NERDTreeIgnore option -function! s:toggleIgnoreFilter() - let b:NERDTreeIgnoreEnabled = !b:NERDTreeIgnoreEnabled - call nerdtree#renderViewSavingPosition() - call nerdtree#centerView() -endfunction - -" FUNCTION: s:toggleShowBookmarks() {{{2 -" toggles the display of bookmarks -function! s:toggleShowBookmarks() - let b:NERDTreeShowBookmarks = !b:NERDTreeShowBookmarks - if b:NERDTreeShowBookmarks - call nerdtree#renderView() - call nerdtree#putCursorOnBookmarkTable() - else - call nerdtree#renderViewSavingPosition() - endif - call nerdtree#centerView() -endfunction - -" FUNCTION: s:toggleShowFiles() {{{2 -" toggles the display of hidden files -function! s:toggleShowFiles() - let b:NERDTreeShowFiles = !b:NERDTreeShowFiles - call nerdtree#renderViewSavingPosition() - call nerdtree#centerView() -endfunction - -" FUNCTION: s:toggleShowHidden() {{{2 -" toggles the display of hidden files -function! s:toggleShowHidden() - let b:NERDTreeShowHidden = !b:NERDTreeShowHidden - call nerdtree#renderViewSavingPosition() - call nerdtree#centerView() -endfunction - -" FUNCTION: s:toggleZoom() {{{2 -" zoom (maximize/minimize) the NERDTree window -function! s:toggleZoom() - if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed - let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize - exec "silent vertical resize ". size - let b:NERDTreeZoomed = 0 - else - exec "vertical resize" - let b:NERDTreeZoomed = 1 - endif -endfunction - -" FUNCTION: s:upDirCurrentRootOpen() {{{2 -function! s:upDirCurrentRootOpen() - call nerdtree#upDir(1) -endfunction - -" FUNCTION: s:upDirCurrentRootClosed() {{{2 -function! s:upDirCurrentRootClosed() - call nerdtree#upDir(0) -endfunction - " vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim new file mode 100644 index 00000000..8607389d --- /dev/null +++ b/sources_non_forked/nerdtree/autoload/nerdtree/ui_glue.vim @@ -0,0 +1,644 @@ +if exists("g:loaded_nerdtree_ui_glue_autoload") + finish +endif +let g:loaded_nerdtree_ui_glue_autoload = 1 + +" FUNCTION: nerdtree#ui_glue#createDefaultBindings() {{{1 +function! nerdtree#ui_glue#createDefaultBindings() + let s = '' . s:SID() . '_' + + call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleMiddleMouse" }) + call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleLeftClick" }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" }) + call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" }) + + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "DirNode", 'callback': s."activateDirNode" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "FileNode", 'callback': s."activateFileNode" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "Bookmark", 'callback': s."activateBookmark" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': "all", 'callback': s."activateAll" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Node", 'callback': s."openHSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Node", 'callback': s."openVSplit" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': "Bookmark", 'callback': s."openHSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': "Bookmark", 'callback': s."openVSplit" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Node", 'callback': s."previewNodeCurrent" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Node", 'callback': s."previewNodeVSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Node", 'callback': s."previewNodeHSplit" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': "Bookmark", 'callback': s."previewNodeCurrent" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': "Bookmark", 'callback': s."previewNodeVSplit" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': "Bookmark", 'callback': s."previewNodeHSplit" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': "DirNode", 'callback': s."openNodeRecursively" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdir, 'scope': "all", 'callback': s."upDirCurrentRootClosed" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapUpdirKeepOpen, 'scope': "all", 'callback': s."upDirCurrentRootOpen" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChangeRoot, 'scope': "Node", 'callback': s."chRoot" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapChdir, 'scope': "Node", 'callback': s."chCwd" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': "all", 'callback': s."closeTreeWindow" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': "all", 'callback': "nerdtree#ui_glue#chRootCwd" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': "all", 'callback': s."refreshRoot" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': "Node", 'callback': s."refreshCurrent" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapHelp, 'scope': "all", 'callback': s."displayHelp" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleZoom, 'scope': "all", 'callback': s."toggleZoom" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleHidden, 'scope': "all", 'callback': s."toggleShowHidden" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFilters, 'scope': "all", 'callback': s."toggleIgnoreFilter" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleFiles, 'scope': "all", 'callback': s."toggleShowFiles" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapToggleBookmarks, 'scope': "all", 'callback': s."toggleShowBookmarks" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseDir, 'scope': "Node", 'callback': s."closeCurrentDir" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCloseChildren, 'scope': "DirNode", 'callback': s."closeChildren" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapMenu, 'scope': "Node", 'callback': s."showMenu" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpParent, 'scope': "Node", 'callback': s."jumpToParent" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpFirstChild, 'scope': "Node", 'callback': s."jumpToFirstChild" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpLastChild, 'scope': "Node", 'callback': s."jumpToLastChild" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': "all", 'callback': s."jumpToRoot" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': "Node", 'callback': s."jumpToNextSibling" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': "Node", 'callback': s."jumpToPrevSibling" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Node", 'callback': s."openInNewTab" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Node", 'callback': s."openInNewTabSilent" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "Bookmark", 'callback': s."openInNewTab" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': "Bookmark", 'callback': s."openInNewTabSilent" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenExpl, 'scope': "DirNode", 'callback': s."openExplorer" }) + + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapDeleteBookmark, 'scope': "Bookmark", 'callback': s."deleteBookmark" }) +endfunction + + +"SECTION: Interface bindings {{{1 +"============================================================ + +"FUNCTION: s:activateAll() {{{1 +"handle the user activating the updir line +function! s:activateAll() + if getline(".") ==# nerdtree#treeUpDirLine() + return nerdtree#ui_glue#upDir(0) + endif +endfunction + +"FUNCTION: s:activateDirNode() {{{1 +"handle the user activating a tree node +function! s:activateDirNode(node) + call a:node.activate({'reuse': 1}) +endfunction + +"FUNCTION: s:activateFileNode() {{{1 +"handle the user activating a tree node +function! s:activateFileNode(node) + call a:node.activate({'reuse': 1, 'where': 'p'}) +endfunction + +"FUNCTION: s:activateBookmark() {{{1 +"handle the user activating a bookmark +function! s:activateBookmark(bm) + call a:bm.activate(!a:bm.path.isDirectory ? {'where': 'p'} : {}) +endfunction + +" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1 +" Associate the current node with the given name +function! nerdtree#ui_glue#bookmarkNode(...) + let currentNode = g:NERDTreeFileNode.GetSelected() + if currentNode != {} + let name = a:1 + if empty(name) + let name = currentNode.path.getLastPathComponent(0) + endif + try + call currentNode.bookmark(name) + call b:NERDTree.render() + catch /^NERDTree.IllegalBookmarkNameError/ + call nerdtree#echo("bookmark names must not contain spaces") + endtry + else + call nerdtree#echo("select a node first") + endif +endfunction + +" FUNCTION: s:chCwd(node) {{{1 +function! s:chCwd(node) + try + call a:node.path.changeToDir() + catch /^NERDTree.PathChangeError/ + call nerdtree#echoWarning("could not change cwd") + endtry +endfunction + +" FUNCTION: s:chRoot(node) {{{1 +" changes the current root to the selected one +function! s:chRoot(node) + call a:node.makeRoot() + call b:NERDTree.render() + call b:NERDTreeRoot.putCursorHere(0, 0) +endfunction + +" FUNCTION: s:nerdtree#ui_glue#chRootCwd() {{{1 +" changes the current root to CWD +function! nerdtree#ui_glue#chRootCwd() + try + let cwd = g:NERDTreePath.New(getcwd()) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echo("current directory does not exist.") + return + endtry + if cwd.str() == g:NERDTreeFileNode.GetRootForTab().path.str() + return + endif + call s:chRoot(g:NERDTreeDirNode.New(cwd)) +endfunction + +" FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1 +function! nerdtree#ui_glue#clearBookmarks(bookmarks) + if a:bookmarks ==# '' + let currentNode = g:NERDTreeFileNode.GetSelected() + if currentNode != {} + call currentNode.clearBookmarks() + endif + else + for name in split(a:bookmarks, ' ') + let bookmark = g:NERDTreeBookmark.BookmarkFor(name) + call bookmark.delete() + endfor + endif + call b:NERDTree.render() +endfunction + +" FUNCTION: s:closeChildren(node) {{{1 +" closes all childnodes of the current node +function! s:closeChildren(node) + call a:node.closeChildren() + call b:NERDTree.render() + call a:node.putCursorHere(0, 0) +endfunction + +" FUNCTION: s:closeCurrentDir(node) {{{1 +" closes the parent dir of the current node +function! s:closeCurrentDir(node) + let parent = a:node.parent + if parent ==# {} || parent.isRoot() + call nerdtree#echo("cannot close tree root") + else + 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 b:NERDTree.render() + call parent.putCursorHere(0, 0) + endif +endfunction + +" FUNCTION: s:closeTreeWindow() {{{1 +" close the tree window +function! s:closeTreeWindow() + if b:NERDTreeType ==# "secondary" && b:NERDTreePreviousBuf != -1 + exec "buffer " . b:NERDTreePreviousBuf + else + if winnr("$") > 1 + call nerdtree#closeTree() + else + call nerdtree#echo("Cannot close last window") + endif + endif +endfunction + +" FUNCTION: s:deleteBookmark(bm) {{{1 +" if the cursor is on a bookmark, prompt to delete +function! s:deleteBookmark(bm) + echo "Are you sure you wish to delete the bookmark:\n\"" . a:bm.name . "\" (yN):" + + if nr2char(getchar()) ==# 'y' + try + call a:bm.delete() + call b:NERDTree.render() + redraw + catch /^NERDTree/ + call nerdtree#echoWarning("Could not remove bookmark") + endtry + else + call nerdtree#echo("delete aborted" ) + endif + +endfunction + +" FUNCTION: s:displayHelp() {{{1 +" toggles the help display +function! s:displayHelp() + let b:treeShowHelp = b:treeShowHelp ? 0 : 1 + call b:NERDTree.render() + call b:NERDTree.ui.centerView() +endfunction + +" FUNCTION: s:findAndRevealPath() {{{1 +function! s:findAndRevealPath() + try + let p = g:NERDTreePath.New(expand("%:p")) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echo("no file for the current buffer") + return + endtry + + if p.isUnixHiddenPath() + let showhidden=g:NERDTreeShowHidden + let g:NERDTreeShowHidden = 1 + endif + + if !g:NERDTree.ExistsForTab() + try + let cwd = g:NERDTreePath.New(getcwd()) + catch /^NERDTree.InvalidArgumentsError/ + call nerdtree#echo("current directory does not exist.") + let cwd = p.getParent() + endtry + + if p.isUnder(cwd) + call g:NERDTreeCreator.CreatePrimary(cwd.str()) + else + call g:NERDTreeCreator.CreatePrimary(p.getParent().str()) + endif + else + if !p.isUnder(g:NERDTreeFileNode.GetRootForTab().path) + if !nerdtree#isTreeOpen() + call g:NERDTreeCreator.TogglePrimary('') + else + call nerdtree#putCursorInTreeWin() + endif + let b:NERDTreeShowHidden = g:NERDTreeShowHidden + call s:chRoot(g:NERDTreeDirNode.New(p.getParent())) + else + if !nerdtree#isTreeOpen() + call g:NERDTreeCreator.TogglePrimary("") + endif + endif + endif + call nerdtree#putCursorInTreeWin() + call b:NERDTreeRoot.reveal(p) + + if p.isUnixHiddenFile() + let g:NERDTreeShowHidden = showhidden + endif +endfunction + +"FUNCTION: s:handleLeftClick() {{{1 +"Checks if the click should open the current node +function! s:handleLeftClick() + let currentNode = g:NERDTreeFileNode.GetSelected() + if currentNode != {} + + "the dir arrows are multibyte chars, and vim's string functions only + "deal with single bytes - so split the line up with the hack below and + "take the line substring manually + let line = split(getline(line(".")), '\zs') + let startToCur = "" + for i in range(0,len(line)-1) + let startToCur .= line[i] + endfor + + if currentNode.path.isDirectory + if startToCur =~# nerdtree#treeMarkupReg() && startToCur =~# '[+~▾▸] \?$' + call currentNode.activate() + return + endif + endif + + if (g:NERDTreeMouseMode ==# 2 && currentNode.path.isDirectory) || g:NERDTreeMouseMode ==# 3 + let char = strpart(startToCur, strlen(startToCur)-1, 1) + if char !~# nerdtree#treeMarkupReg() + if currentNode.path.isDirectory + call currentNode.activate() + else + call currentNode.activate({'reuse': 1, 'where': 'p'}) + endif + return + endif + endif + endif +endfunction + +" FUNCTION: s:handleMiddleMouse() {{{1 +function! s:handleMiddleMouse() + let curNode = g:NERDTreeFileNode.GetSelected() + if curNode ==# {} + call nerdtree#echo("Put the cursor on a node first" ) + return + endif + + if curNode.path.isDirectory + call nerdtree#openExplorer(curNode) + else + call curNode.open({'where': 'h'}) + endif +endfunction + +" FUNCTION: s:jumpToChild(direction) {{{2 +" Args: +" direction: 0 if going to first child, 1 if going to last +function! s:jumpToChild(currentNode, direction) + if a:currentNode.isRoot() + return nerdtree#echo("cannot jump to " . (a:direction ? "last" : "first") . " child") + end + let dirNode = a:currentNode.parent + let childNodes = dirNode.getVisibleChildren() + + let targetNode = childNodes[0] + if a:direction + let targetNode = childNodes[len(childNodes) - 1] + endif + + if targetNode.equals(a:currentNode) + let siblingDir = a:currentNode.parent.findOpenDirSiblingWithVisibleChildren(a:direction) + if siblingDir != {} + let indx = a:direction ? siblingDir.getVisibleChildCount()-1 : 0 + let targetNode = siblingDir.getChildByIndex(indx, 1) + endif + endif + + call targetNode.putCursorHere(1, 0) + + call b:NERDTree.ui.centerView() +endfunction + + +" FUNCTION: nerdtree#ui_glue#invokeKeyMap(key) {{{1 +"this is needed since I cant figure out how to invoke dict functions from a +"key map +function! nerdtree#ui_glue#invokeKeyMap(key) + call g:NERDTreeKeyMap.Invoke(a:key) +endfunction + +" FUNCTION: s:jumpToFirstChild() {{{1 +" wrapper for the jump to child method +function! s:jumpToFirstChild(node) + call s:jumpToChild(a:node, 0) +endfunction + +" FUNCTION: s:jumpToLastChild() {{{1 +" wrapper for the jump to child method +function! s:jumpToLastChild(node) + call s:jumpToChild(a:node, 1) +endfunction + +" FUNCTION: s:jumpToParent(node) {{{1 +" moves the cursor to the parent of the current node +function! s:jumpToParent(node) + if !empty(a:node.parent) + call a:node.parent.putCursorHere(1, 0) + call b:NERDTree.ui.centerView() + else + call nerdtree#echo("cannot jump to parent") + endif +endfunction + +" FUNCTION: s:jumpToRoot() {{{1 +" moves the cursor to the root node +function! s:jumpToRoot() + call b:NERDTreeRoot.putCursorHere(1, 0) + call b:NERDTree.ui.centerView() +endfunction + +" FUNCTION: s:jumpToNextSibling(node) {{{1 +function! s:jumpToNextSibling(node) + call s:jumpToSibling(a:node, 1) +endfunction + +" FUNCTION: s:jumpToPrevSibling(node) {{{1 +function! s:jumpToPrevSibling(node) + call s:jumpToSibling(a:node, 0) +endfunction + +" FUNCTION: s:jumpToSibling(currentNode, forward) {{{2 +" moves the cursor to the sibling of the current node in the given direction +" +" Args: +" forward: 1 if the cursor should move to the next sibling, 0 if it should +" move back to the previous sibling +function! s:jumpToSibling(currentNode, forward) + let sibling = a:currentNode.findSibling(a:forward) + + if !empty(sibling) + call sibling.putCursorHere(1, 0) + call b:NERDTree.ui.centerView() + endif +endfunction + +" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1 +" put the cursor on the given bookmark and, if its a file, open it +function! nerdtree#ui_glue#openBookmark(name) + try + let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0) + call targetNode.putCursorHere(0, 1) + redraw! + catch /^NERDTree.BookmarkedNodeNotFoundError/ + call nerdtree#echo("note - target node is not cached") + let bookmark = g:NERDTreeBookmark.BookmarkFor(a:name) + let targetNode = g:NERDTreeFileNode.New(bookmark.path) + endtry + if targetNode.path.isDirectory + call targetNode.openExplorer() + else + call targetNode.open({'where': 'p'}) + endif +endfunction + +" FUNCTION: s:openHSplit(target) {{{1 +function! s:openHSplit(target) + call a:target.activate({'where': 'h'}) +endfunction + +" FUNCTION: s:openVSplit(target) {{{1 +function! s:openVSplit(target) + call a:target.activate({'where': 'v'}) +endfunction + +" FUNCTION: s:openExplorer(node) {{{1 +function! s:openExplorer(node) + call a:node.openExplorer() +endfunction + +" FUNCTION: s:openInNewTab(target) {{{1 +function! s:openInNewTab(target) + call a:target.activate({'where': 't'}) +endfunction + +" FUNCTION: s:openInNewTabSilent(target) {{{1 +function! s:openInNewTabSilent(target) + call a:target.activate({'where': 't', 'stay': 1}) +endfunction + +" FUNCTION: s:openNodeRecursively(node) {{{1 +function! s:openNodeRecursively(node) + call nerdtree#echo("Recursively opening node. Please wait...") + call a:node.openRecursively() + call b:NERDTree.render() + redraw + call nerdtree#echo("Recursively opening node. Please wait... DONE") +endfunction + +"FUNCTION: s:previewNodeCurrent(node) {{{1 +function! s:previewNodeCurrent(node) + call a:node.open({'stay': 1, 'where': 'p', 'keepopen': 1}) +endfunction + +"FUNCTION: s:previewNodeHSplit(node) {{{1 +function! s:previewNodeHSplit(node) + call a:node.open({'stay': 1, 'where': 'h', 'keepopen': 1}) +endfunction + +"FUNCTION: s:previewNodeVSplit(node) {{{1 +function! s:previewNodeVSplit(node) + call a:node.open({'stay': 1, 'where': 'v', 'keepopen': 1}) +endfunction + +" FUNCTION: nerdtree#ui_glue#revealBookmark(name) {{{1 +" put the cursor on the node associate with the given name +function! nerdtree#ui_glue#revealBookmark(name) + try + let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0) + call targetNode.putCursorHere(0, 1) + catch /^NERDTree.BookmarkNotFoundError/ + call nerdtree#echo("Bookmark isnt cached under the current root") + endtry +endfunction + +" FUNCTION: s:refreshRoot() {{{1 +" Reloads the current root. All nodes below this will be lost and the root dir +" will be reloaded. +function! s:refreshRoot() + call nerdtree#echo("Refreshing the root node. This could take a while...") + call b:NERDTreeRoot.refresh() + call b:NERDTree.render() + redraw + call nerdtree#echo("Refreshing the root node. This could take a while... DONE") +endfunction + +" FUNCTION: s:refreshCurrent(node) {{{1 +" refreshes the root for the current node +function! s:refreshCurrent(node) + let node = a:node + if !node.path.isDirectory + let node = node.parent + endif + + call nerdtree#echo("Refreshing node. This could take a while...") + call node.refresh() + call b:NERDTree.render() + redraw + call nerdtree#echo("Refreshing node. This could take a while... DONE") +endfunction + +" FUNCTION: nerdtree#ui_glue#setupCommands() {{{1 +function! nerdtree#ui_glue#setupCommands() + command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreatePrimary('') + command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.TogglePrimary('') + command! -n=0 -bar NERDTreeClose :call nerdtree#closeTreeIfOpen() + command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreatePrimary('') + command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror() + command! -n=0 -bar NERDTreeFind call s:findAndRevealPath() + command! -n=0 -bar NERDTreeFocus call NERDTreeFocus() + command! -n=0 -bar NERDTreeCWD call NERDTreeCWD() +endfunction + +" Function: s:SID() {{{1 +function s:SID() + if !exists("s:sid") + let s:sid = matchstr(expand(''), '\zs\d\+\ze_SID$') + endif + return s:sid +endfun + +" FUNCTION: s:showMenu(node) {{{1 +function! s:showMenu(node) + let mc = g:NERDTreeMenuController.New(g:NERDTreeMenuItem.AllEnabled()) + call mc.showMenu() +endfunction + +" FUNCTION: s:toggleIgnoreFilter() {{{1 +function! s:toggleIgnoreFilter() + call b:NERDTree.ui.toggleIgnoreFilter() +endfunction + +" FUNCTION: s:toggleShowBookmarks() {{{1 +function! s:toggleShowBookmarks() + call b:NERDTree.ui.toggleShowBookmarks() +endfunction + +" FUNCTION: s:toggleShowFiles() {{{1 +function! s:toggleShowFiles() + call b:NERDTree.ui.toggleShowFiles() +endfunction + +" FUNCTION: s:toggleShowHidden() {{{1 +" toggles the display of hidden files +function! s:toggleShowHidden() + call b:NERDTree.ui.toggleShowHidden() +endfunction + +" FUNCTION: s:toggleZoom() {{{1 +function! s:toggleZoom() + call b:NERDTree.ui.toggleZoom() +endfunction + +"FUNCTION: nerdtree#ui_glue#upDir(keepState) {{{1 +"moves the tree up a level +" +"Args: +"keepState: 1 if the current root should be left open when the tree is +"re-rendered +function! nerdtree#ui_glue#upDir(keepState) + let cwd = b:NERDTreeRoot.path.str({'format': 'UI'}) + if cwd ==# "/" || cwd =~# '^[^/]..$' + call nerdtree#echo("already at top dir") + else + if !a:keepState + call b:NERDTreeRoot.close() + endif + + let oldRoot = b:NERDTreeRoot + + if empty(b:NERDTreeRoot.parent) + let path = b:NERDTreeRoot.path.getParent() + let newRoot = g:NERDTreeDirNode.New(path) + call newRoot.open() + call newRoot.transplantChild(b:NERDTreeRoot) + let b:NERDTreeRoot = newRoot + else + let b:NERDTreeRoot = b:NERDTreeRoot.parent + endif + + if g:NERDTreeChDirMode ==# 2 + call b:NERDTreeRoot.path.changeToDir() + endif + + call b:NERDTree.render() + call oldRoot.putCursorHere(0, 0) + endif +endfunction + +" FUNCTION: s:upDirCurrentRootOpen() {{{1 +function! s:upDirCurrentRootOpen() + call nerdtree#ui_glue#upDir(1) +endfunction + +" FUNCTION: s:upDirCurrentRootClosed() {{{1 +function! s:upDirCurrentRootClosed() + call nerdtree#ui_glue#upDir(0) +endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/doc/NERD_tree.txt b/sources_non_forked/nerdtree/doc/NERD_tree.txt index bf038962..79b649ff 100644 --- a/sources_non_forked/nerdtree/doc/NERD_tree.txt +++ b/sources_non_forked/nerdtree/doc/NERD_tree.txt @@ -109,7 +109,7 @@ The following features and functionality are provided by the NERD tree: < :NERDTreeFromBookmark *:NERDTreeFromBookmark* Opens a fresh NERD tree with the root initialized to the dir for - . This only reason to use this command over :NERDTree is for + . The only reason to use this command over :NERDTree is for the completion (which is for bookmarks rather than directories). :NERDTreeToggle [ | ] *: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 +:Bookmark [] Bookmark the current node as . If there is already a bookmark, it is overwritten. must not contain spaces. If 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 < ------------------------------------------------------------------------------ @@ -1046,6 +1060,9 @@ NERDTreeAddKeyMap({options}) *NERDTreeAddKeyMap()* "callback" - the function the new mapping will be bound to "quickhelpText" - the text that will appear in the quickhelp (see |NERDTree-?|) + "override" - if 1 then this new mapping will override whatever previous + mapping was defined for the key/scope combo. Useful for overriding the + default mappings. Additionally, a "scope" argument may be supplied. This constrains the mapping so that it is only activated if the cursor is on a certain object. @@ -1062,8 +1079,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() diff --git a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim index 5b845d81..6de9be4c 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/bookmark.vim @@ -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 @@ -271,7 +275,7 @@ function! s:Bookmark.toRoot() let targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path) endtry call targetNode.makeRoot() - call nerdtree#renderView() + call b:NERDTree.render() call targetNode.putCursorHere(0, 0) endif endfunction @@ -289,7 +293,7 @@ function! s:Bookmark.validate() return 1 else call s:Bookmark.CacheBookmarks(1) - call nerdtree#renderView() + call b:NERDTree.render() call nerdtree#echo(self.name . "now points to an invalid location. See :help NERDTreeInvalidBookmarks for info.") return 0 endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim index 7f0721f0..86f951ae 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/creator.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/creator.vim @@ -7,18 +7,18 @@ let g:NERDTreeCreator = s:Creator "FUNCTION: s:Creator._bindMappings() {{{1 function! s:Creator._bindMappings() - "make do the same as the default 'o' mapping - exec "nnoremap :call nerdtree#invokeKeyMap('". g:NERDTreeMapActivateNode ."')" + "make do the same as the activate node mapping + nnoremap :call nerdtree#ui_glue#invokeKeyMap(g:NERDTreeMapActivateNode) call g:NERDTreeKeyMap.BindAll() - command! -buffer -nargs=? Bookmark :call nerdtree#bookmarkNode('') - command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 RevealBookmark :call nerdtree#revealBookmark('') - command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark :call nerdtree#openBookmark('') - command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=* ClearBookmarks call nerdtree#clearBookmarks('') + command! -buffer -nargs=? Bookmark :call nerdtree#ui_glue#bookmarkNode('') + command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 RevealBookmark :call nerdtree#ui_glue#revealBookmark('') + command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark :call nerdtree#ui_glue#openBookmark('') + command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=* ClearBookmarks call nerdtree#ui_glue#clearBookmarks('') command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=+ BookmarkToRoot call g:NERDTreeBookmark.ToRoot('') - command! -buffer -nargs=0 ClearAllBookmarks call g:NERDTreeBookmark.ClearAll() call nerdtree#renderView() - command! -buffer -nargs=0 ReadBookmarks call g:NERDTreeBookmark.CacheBookmarks(0) call nerdtree#renderView() + command! -buffer -nargs=0 ClearAllBookmarks call g:NERDTreeBookmark.ClearAll() call b:NERDTree.render() + command! -buffer -nargs=0 ReadBookmarks call g:NERDTreeBookmark.CacheBookmarks(0) call b:NERDTree.render() command! -buffer -nargs=0 WriteBookmarks call g:NERDTreeBookmark.Write() endfunction @@ -49,26 +49,23 @@ function! s:Creator.createPrimary(name) call path.changeToDir() endif - if nerdtree#treeExistsForTab() + if g:NERDTree.ExistsForTab() if nerdtree#isTreeOpen() call nerdtree#closeTree() endif unlet t:NERDTreeBufName endif - let newRoot = g:NERDTreeDirNode.New(path) - call newRoot.open() - call self._createTreeWin() + call self._createNERDTree(path) + let b:NERDTreeType = "primary" let b:treeShowHelp = 0 let b:NERDTreeIgnoreEnabled = 1 let b:NERDTreeShowFiles = g:NERDTreeShowFiles let b:NERDTreeShowHidden = g:NERDTreeShowHidden let b:NERDTreeShowBookmarks = g:NERDTreeShowBookmarks - let b:NERDTreeRoot = newRoot - let b:NERDTreeType = "primary" - call nerdtree#renderView() + call b:NERDTree.render() call b:NERDTreeRoot.putCursorHere(0, 0) call self._broadcastInitEvent() @@ -99,18 +96,26 @@ function! s:Creator.createSecondary(dir) exec "silent edit " . self._nextBufferName() let b:NERDTreePreviousBuf = bufnr(previousBuf) - - let b:NERDTreeRoot = g:NERDTreeDirNode.New(path) - call b:NERDTreeRoot.open() - + call self._createNERDTree(path) call self._setCommonBufOptions() let b:NERDTreeType = "secondary" - call nerdtree#renderView() + call b:NERDTree.render() call self._broadcastInitEvent() endfunction +" FUNCTION: s:Creator._createNERDTree(path) {{{1 +function! s:Creator._createNERDTree(path) + let b:NERDTree = g:NERDTree.New(a:path) + "TODO: This is kept for compatability only since many things use + "b:NERDTreeRoot instead of the new NERDTree.root + "Remove this one day + let b:NERDTreeRoot = b:NERDTree.root + + call b:NERDTree.root.open() +endfunction + " FUNCTION: s:Creator.CreateMirror() {{{1 function! s:Creator.CreateMirror() let creator = s:Creator.New() @@ -122,12 +127,12 @@ function! s:Creator.createMirror() "get the names off all the nerd tree buffers let treeBufNames = [] for i in range(1, tabpagenr("$")) - let nextName = nerdtree#tabpagevar(i, 'NERDTreeBufName') + let nextName = self._tabpagevar(i, 'NERDTreeBufName') if nextName != -1 && (!exists("t:NERDTreeBufName") || nextName != t:NERDTreeBufName) call add(treeBufNames, nextName) endif endfor - let treeBufNames = nerdtree#unique(treeBufNames) + let treeBufNames = self._uniq(treeBufNames) "map the option names (that the user will be prompted with) to the nerd "tree buffer names @@ -158,7 +163,7 @@ function! s:Creator.createMirror() return endif - if nerdtree#treeExistsForTab() && nerdtree#isTreeOpen() + if g:NERDTree.ExistsForTab() && nerdtree#isTreeOpen() call nerdtree#closeTree() endif @@ -166,7 +171,7 @@ function! s:Creator.createMirror() call self._createTreeWin() exec 'buffer ' . bufferName if !&hidden - call nerdtree#renderView() + call b:NERDTree.render() endif endfunction @@ -279,8 +284,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 @@ -290,6 +295,24 @@ function! s:Creator._setupStatusline() endif endfunction +" FUNCTION: s:Creator._tabpagevar(tabnr, var) {{{1 +function! s:Creator._tabpagevar(tabnr, var) + let currentTab = tabpagenr() + let old_ei = &ei + set ei=all + + exec "tabnext " . a:tabnr + let v = -1 + if exists('t:' . a:var) + exec 'let v = t:' . a:var + endif + exec "tabnext " . currentTab + + let &ei = old_ei + + return v +endfunction + "FUNCTION: s:Creator.TogglePrimary(dir) {{{1 function! s:Creator.TogglePrimary(dir) let creator = s:Creator.New() @@ -304,13 +327,13 @@ endfunction "dir: the full path for the root node (is only used if the NERD tree is being "initialized. function! s:Creator.togglePrimary(dir) - if nerdtree#treeExistsForTab() + if g:NERDTree.ExistsForTab() if !nerdtree#isTreeOpen() call self._createTreeWin() if !&hidden - call nerdtree#renderView() + call b:NERDTree.render() endif - call nerdtree#restoreScreenState() + call b:NERDTree.ui.restoreScreenState() else call nerdtree#closeTree() endif @@ -319,4 +342,16 @@ function! s:Creator.togglePrimary(dir) endif endfunction +" Function: s:Creator._uniq(list) {{{1 +" returns a:list without duplicates +function! s:Creator._uniq(list) + let uniqlist = [] + for elem in a:list + if index(uniqlist, elem) ==# -1 + let uniqlist += [elem] + endif + endfor + return uniqlist +endfunction + " vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/nerdtree/lib/nerdtree/event.vim b/sources_non_forked/nerdtree/lib/nerdtree/event.vim new file mode 100644 index 00000000..964e8ff4 --- /dev/null +++ b/sources_non_forked/nerdtree/lib/nerdtree/event.vim @@ -0,0 +1,13 @@ +"CLASS: Event +"============================================================ +let s:Event = {} +let g:NERDTreeEvent = s:Event + +function! s:Event.New(nerdtree, subject, action, params) abort + let newObj = copy(self) + let newObj.nerdtree = a:nerdtree + let newObj.subject = a:subject + let newObj.action = a:action + let newObj.params = a:params + return newObj +endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/flag_set.vim b/sources_non_forked/nerdtree/lib/nerdtree/flag_set.vim new file mode 100644 index 00000000..9d8d3359 --- /dev/null +++ b/sources_non_forked/nerdtree/lib/nerdtree/flag_set.vim @@ -0,0 +1,56 @@ +"CLASS: FlagSet +"============================================================ +let s:FlagSet = {} +let g:NERDTreeFlagSet = s:FlagSet + +"FUNCTION: FlagSet.addFlag(scope, flag) {{{1 +function! s:FlagSet.addFlag(scope, flag) + let flags = self._flagsForScope(a:scope) + if index(flags, a:flag) == -1 + call add(flags, a:flag) + end +endfunction + +"FUNCTION: FlagSet.clearFlags(scope) {{{1 +function! s:FlagSet.clearFlags(scope) + let self._flags[a:scope] = [] +endfunction + +"FUNCTION: FlagSet._flagsForScope(scope) {{{1 +function! s:FlagSet._flagsForScope(scope) + if !has_key(self._flags, a:scope) + let self._flags[a:scope] = [] + endif + return self._flags[a:scope] +endfunction + +"FUNCTION: FlagSet.New() {{{1 +function! s:FlagSet.New() + let newObj = copy(self) + let newObj._flags = {} + return newObj +endfunction + +"FUNCTION: FlagSet.removeFlag(scope, flag) {{{1 +function! s:FlagSet.removeFlag(scope, flag) + let flags = self._flagsForScope(a:scope) + + let i = index(flags, a:flag) + if i >= 0 + call remove(flags, i) + endif +endfunction + +"FUNCTION: FlagSet.renderToString() {{{1 +function! s:FlagSet.renderToString() + let flagstring = "" + for i in values(self._flags) + let flagstring .= join(i) + endfor + + if len(flagstring) == 0 + return "" + endif + + return '[' . flagstring . ']' +endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim index 86457652..2411406e 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/key_map.vim @@ -44,7 +44,7 @@ function! s:KeyMap.bind() let premap = self.key == "" ? " " : " " - exec 'nnoremap '. self.key . premap . ':call nerdtree#invokeKeyMap("'. keymapInvokeString .'")' + exec 'nnoremap '. self.key . premap . ':call nerdtree#ui_glue#invokeKeyMap("'. keymapInvokeString .'")' endfunction "FUNCTION: KeyMap.Remove(key, scope) {{{1 @@ -79,6 +79,16 @@ endfunction "If a keymap has the scope of "all" then it will be called if no other keymap "is found for a:key and the scope. function! s:KeyMap.Invoke(key) + + "required because clicking the command window below another window still + "invokes the mapping - but changes the window cursor + "is in first + " + "TODO: remove this check when the vim bug is fixed + if !g:NERDTree.ExistsForBuf() + return {} + endif + let node = g:NERDTreeFileNode.GetSelected() if !empty(node) @@ -124,8 +134,14 @@ endfunction "FUNCTION: KeyMap.Create(options) {{{1 function! s:KeyMap.Create(options) - let newKeyMap = copy(self) let opts = extend({'scope': 'all', 'quickhelpText': ''}, copy(a:options)) + + "dont override other mappings unless the 'override' option is given + if get(opts, 'override', 0) == 0 && !empty(s:KeyMap.FindFor(opts['key'], opts['scope'])) + return + end + + let newKeyMap = copy(self) let newKeyMap.key = opts['key'] let newKeyMap.quickhelpText = opts['quickhelpText'] let newKeyMap.callback = opts['callback'] diff --git a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim index 6fb9d9e3..92c1bbbf 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/menu_item.vim @@ -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 diff --git a/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim new file mode 100644 index 00000000..a41490b7 --- /dev/null +++ b/sources_non_forked/nerdtree/lib/nerdtree/nerdtree.vim @@ -0,0 +1,39 @@ +"CLASS: NERDTree +"============================================================ +let s:NERDTree = {} +let g:NERDTree = s:NERDTree + +" Function: s:NERDTree.ExistsForBuffer() {{{1 +" Returns 1 if a nerd tree root exists in the current buffer +function! s:NERDTree.ExistsForBuf() + return exists("b:NERDTreeRoot") +endfunction + +" Function: s:NERDTree.ExistsForTab() {{{1 +" Returns 1 if a nerd tree root exists in the current tab +function! s:NERDTree.ExistsForTab() + return exists("t:NERDTreeBufName") +endfunction + +function! s:NERDTree.ForCurrentBuf() + if s:NERDTree.ExistsForBuf() + return b:NERDTree + else + return {} + endif +endfunction + +function! s:NERDTree.New(path) + let newObj = copy(self) + let newObj.ui = g:NERDTreeUI.New(newObj) + let newObj.root = g:NERDTreeDirNode.New(a:path) + + return newObj +endfunction + +"FUNCTION: s:NERDTree.render() {{{1 +"A convenience function - since this is called often +function! s:NERDTree.render() + call self.ui.render() +endfunction + diff --git a/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim new file mode 100644 index 00000000..b445f8ad --- /dev/null +++ b/sources_non_forked/nerdtree/lib/nerdtree/notifier.vim @@ -0,0 +1,35 @@ +"CLASS: Notifier +"============================================================ +let s:Notifier = {} + +function! s:Notifier.AddListener(event, funcname) + let listeners = s:Notifier.GetListenersForEvent(a:event) + if listeners == [] + let listenersMap = s:Notifier.GetListenersMap() + let listenersMap[a:event] = listeners + endif + call add(listeners, a:funcname) +endfunction + +function! s:Notifier.NotifyListeners(event, path, params) + let event = g:NERDTreeEvent.New(b:NERDTree, a:path, a:event, a:params) + + for listener in s:Notifier.GetListenersForEvent(a:event) + call {listener}(event) + endfor +endfunction + +function! s:Notifier.GetListenersMap() + if !exists("s:refreshListenersMap") + let s:refreshListenersMap = {} + endif + return s:refreshListenersMap +endfunction + +function! s:Notifier.GetListenersForEvent(name) + let listenersMap = s:Notifier.GetListenersMap() + return get(listenersMap, a:name, []) +endfunction + +let g:NERDTreePathNotifier = deepcopy(s:Notifier) + diff --git a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim index bcc0d4fc..845e55c4 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/opener.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/opener.vim @@ -3,6 +3,29 @@ let s:Opener = {} let g:NERDTreeOpener = s:Opener +"FUNCTION: s:Opener._bufInWindows(bnum){{{1 +"[[STOLEN FROM VTREEEXPLORER.VIM]] +"Determine the number of windows open to this buffer number. +"Care of Yegappan Lakshman. Thanks! +" +"Args: +"bnum: the subject buffers buffer number +function! s:Opener._bufInWindows(bnum) + let cnt = 0 + let winnum = 1 + while 1 + let bufnum = winbufnr(winnum) + if bufnum < 0 + break + endif + if bufnum ==# a:bnum + let cnt = cnt + 1 + endif + let winnum = winnum + 1 + endwhile + + return cnt +endfunction "FUNCTION: Opener._checkToCloseTree(newtab) {{{1 "Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see "if the tree should be closed now. @@ -21,6 +44,24 @@ function! s:Opener._checkToCloseTree(newtab) endif endfunction + +"FUNCTION: s:Opener._firstUsableWindow(){{{1 +"find the window number of the first normal window +function! s:Opener._firstUsableWindow() + let i = 1 + while i <= winnr("$") + let bnum = winbufnr(i) + if bnum != -1 && getbufvar(bnum, '&buftype') ==# '' + \ && !getwinvar(i, '&previewwindow') + \ && (!getbufvar(bnum, '&modified') || &hidden) + return i + endif + + let i += 1 + endwhile + return -1 +endfunction + "FUNCTION: Opener._gotoTargetWin() {{{1 function! s:Opener._gotoTargetWin() if b:NERDTreeType ==# "secondary" @@ -48,6 +89,37 @@ function! s:Opener._gotoTargetWin() endif endfunction +"FUNCTION: s:Opener._isWindowUsable(winnumber) {{{1 +"Returns 0 if opening a file from the tree in the given window requires it to +"be split, 1 otherwise +" +"Args: +"winnumber: the number of the window in question +function! s:Opener._isWindowUsable(winnumber) + "gotta split if theres only one window (i.e. the NERD tree) + if winnr("$") ==# 1 + return 0 + endif + + let oldwinnr = winnr() + call nerdtree#exec(a:winnumber . "wincmd p") + let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow') + let modified = &modified + call nerdtree#exec(oldwinnr . "wincmd p") + + "if its a special window e.g. quickfix or another explorer plugin then we + "have to split + if specialWindow + return 0 + endif + + if &hidden + return 1 + endif + + return !modified || self._bufInWindows(winbufnr(a:winnumber)) >= 2 +endfunction + "FUNCTION: Opener.New(path, opts) {{{1 "Args: " @@ -190,7 +262,7 @@ function! s:Opener._openDirectory(node) call self._gotoTargetWin() if empty(self._where) call a:node.makeRoot() - call nerdtree#renderView() + call b:NERDTree.render() call a:node.putCursorHere(0, 0) elseif self._where == 't' call g:NERDTreeCreator.CreatePrimary(a:node.path.str()) @@ -206,12 +278,12 @@ endfunction "FUNCTION: Opener._previousWindow() {{{1 function! s:Opener._previousWindow() - if !nerdtree#isWindowUsable(winnr("#")) && nerdtree#firstUsableWindow() ==# -1 + if !self._isWindowUsable(winnr("#")) && self._firstUsableWindow() ==# -1 call self._newSplit() else try - if !nerdtree#isWindowUsable(winnr("#")) - call nerdtree#exec(nerdtree#firstUsableWindow() . "wincmd w") + if !self._isWindowUsable(winnr("#")) + call nerdtree#exec(self._firstUsableWindow() . "wincmd w") else call nerdtree#exec('wincmd p') endif diff --git a/sources_non_forked/nerdtree/lib/nerdtree/path.vim b/sources_non_forked/nerdtree/lib/nerdtree/path.vim index 58bb0138..5de1dfe2 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/path.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/path.vim @@ -33,8 +33,10 @@ function! s:Path.bookmarkNames() endfunction "FUNCTION: Path.cacheDisplayString() {{{1 -function! s:Path.cacheDisplayString() - let self.cachedDisplayString = self.getLastPathComponent(1) +function! s:Path.cacheDisplayString() abort + let self.cachedDisplayString = self.flagSet.renderToString() + + let self.cachedDisplayString .= self.getLastPathComponent(1) if self.isExecutable let self.cachedDisplayString = self.cachedDisplayString . '*' @@ -103,6 +105,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 " + endif + + return " \\`\|\"#%&,?()\*^<>[]" +endfunction + "FUNCTION: Path.getDir() {{{1 " "Returns this path if it is a directory, else this paths parent. @@ -439,6 +471,7 @@ function! s:Path.New(path) call newPath.readInfoFromDisk(s:Path.AbsolutePathFor(a:path)) let newPath.cachedDisplayString = "" + let newPath.flagSet = g:NERDTreeFlagSet.New() return newPath endfunction @@ -516,6 +549,13 @@ endfunction "FUNCTION: Path.refresh() {{{1 function! s:Path.refresh() call self.readInfoFromDisk(self.str()) + call g:NERDTreePathNotifier.NotifyListeners('refresh', self, {}) + call self.cacheDisplayString() +endfunction + +"FUNCTION: Path.refreshFlags() {{{1 +function! s:Path.refreshFlags() + call g:NERDTreePathNotifier.NotifyListeners('refreshFlags', self, {}) call self.cacheDisplayString() endfunction @@ -604,7 +644,7 @@ endfunction " " returns a string that can be used with :cd function! s:Path._strForCd() - return escape(self.str(), nerdtree#escChars()) + return escape(self.str(), self._escChars()) endfunction "FUNCTION: Path._strForEdit() {{{1 @@ -612,7 +652,7 @@ endfunction "Return: the string for this path that is suitable to be used with the :edit "command function! s:Path._strForEdit() - let p = escape(self.str({'format': 'UI'}), nerdtree#escChars()) + let p = escape(self.str({'format': 'UI'}), self._escChars()) let cwd = getcwd() . s:Path.Slash() "return a relative path if we can @@ -652,7 +692,7 @@ function! s:Path._strForGlob() let toReturn = lead . join(self.pathSegments, s:Path.Slash()) if !nerdtree#runningWindows() - let toReturn = escape(toReturn, nerdtree#escChars()) + let toReturn = escape(toReturn, self._escChars()) endif return toReturn endfunction diff --git a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim index e3a068ed..a24c2704 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_dir_node.vim @@ -21,7 +21,7 @@ unlet s:TreeDirNode.activate function! s:TreeDirNode.activate(...) let opts = a:0 ? a:1 : {} call self.toggleOpen(opts) - call nerdtree#renderView() + call b:NERDTree.render() call self.putCursorHere(0, 0) endfunction @@ -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 @@ -252,6 +252,7 @@ function! s:TreeDirNode._initChildren(silent) try let path = g:NERDTreePath.New(i) call self.createChild(path, 0) + call g:NERDTreePathNotifier.NotifyListeners('init', path, {}) catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/ let invalidFilesFound += 1 endtry @@ -438,6 +439,20 @@ function! s:TreeDirNode.refresh() endif endfunction +"FUNCTION: TreeDirNode.refreshFlags() {{{1 +unlet s:TreeDirNode.refreshFlags +function! s:TreeDirNode.refreshFlags() + call self.path.refreshFlags() + for i in self.children + call i.refreshFlags() + endfor +endfunction + +"FUNCTION: TreeDirNode.refreshDirFlags() {{{1 +function! s:TreeDirNode.refreshDirFlags() + call self.path.refreshFlags() +endfunction + "FUNCTION: TreeDirNode.reveal(path) {{{1 "reveal the given path, i.e. cache and open all treenodes needed to display it "in the UI @@ -450,7 +465,7 @@ function! s:TreeDirNode.reveal(path) if self.path.equals(a:path.getParent()) let n = self.findNode(a:path) - call nerdtree#renderView() + call b:NERDTree.render() call n.putCursorHere(1,0) return endif @@ -500,7 +515,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) diff --git a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim index ab8d3719..b4924d78 100644 --- a/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim +++ b/sources_non_forked/nerdtree/lib/nerdtree/tree_file_node.vim @@ -178,79 +178,20 @@ function! s:TreeFileNode.findSibling(direction) return {} endfunction -"FUNCTION: TreeFileNode.getLineNum(){{{1 -"returns the line number this node is rendered on, or -1 if it isnt rendered -function! s:TreeFileNode.getLineNum() - "if the node is the root then return the root line no. - if self.isRoot() - return s:TreeFileNode.GetRootLineNum() - endif - - let totalLines = line("$") - - "the path components we have matched so far - let pathcomponents = [substitute(b:NERDTreeRoot.path.str({'format': 'UI'}), '/ *$', '', '')] - "the index of the component we are searching for - let curPathComponent = 1 - - let fullpath = self.path.str({'format': 'UI'}) - - - let lnum = s:TreeFileNode.GetRootLineNum() - while lnum > 0 - let lnum = lnum + 1 - "have we reached the bottom of the tree? - if lnum ==# totalLines+1 - return -1 - endif - - let curLine = getline(lnum) - - let indent = nerdtree#indentLevelFor(curLine) - if indent ==# curPathComponent - let curLine = nerdtree#stripMarkupFromLine(curLine, 1) - - let curPath = join(pathcomponents, '/') . '/' . curLine - if stridx(fullpath, curPath, 0) ==# 0 - if fullpath ==# curPath || strpart(fullpath, len(curPath)-1,1) ==# '/' - let curLine = substitute(curLine, '/ *$', '', '') - call add(pathcomponents, curLine) - let curPathComponent = curPathComponent + 1 - - if fullpath ==# curPath - return lnum - endif - endif - endif - endif - endwhile - return -1 -endfunction - "FUNCTION: TreeFileNode.GetRootForTab(){{{1 "get the root node for this tab function! s:TreeFileNode.GetRootForTab() - if nerdtree#treeExistsForTab() + if g:NERDTree.ExistsForTab() return getbufvar(t:NERDTreeBufName, 'NERDTreeRoot') end return {} endfunction -"FUNCTION: TreeFileNode.GetRootLineNum(){{{1 -"gets the line number of the root node -function! s:TreeFileNode.GetRootLineNum() - let rootLine = 1 - while getline(rootLine) !~# '^\(/\|<\)' - let rootLine = rootLine + 1 - endwhile - return rootLine -endfunction - "FUNCTION: TreeFileNode.GetSelected() {{{1 "gets the treenode that the cursor is currently over function! s:TreeFileNode.GetSelected() try - let path = nerdtree#getPath(line(".")) + let path = b:NERDTree.ui.getPath(line(".")) if path ==# {} return {} endif @@ -270,7 +211,7 @@ endfunction "FUNCTION: TreeFileNode.isRoot() {{{1 "returns 1 if this node is b:NERDTreeRoot function! s:TreeFileNode.isRoot() - if !nerdtree#treeExistsForBuf() + if !g:NERDTree.ExistsForBuf() throw "NERDTree.NoTreeError: No tree exists for the current buffer" endif @@ -348,7 +289,7 @@ endfunction "recurseUpward: try to put the cursor on the parent if the this node isnt "visible function! s:TreeFileNode.putCursorHere(isJump, recurseUpward) - let ln = self.getLineNum() + let ln = b:NERDTree.ui.getLineNum(self) if ln != -1 if a:isJump mark ' @@ -357,11 +298,11 @@ function! s:TreeFileNode.putCursorHere(isJump, recurseUpward) else if a:recurseUpward let node = self - while node != {} && node.getLineNum() ==# -1 + while node != {} && b:NERDTree.ui.getLineNum(node) ==# -1 let node = node.parent call node.open() endwhile - call nerdtree#renderView() + call b:NERDTree.render() call node.putCursorHere(a:isJump, 0) endif endif @@ -372,6 +313,11 @@ function! s:TreeFileNode.refresh() call self.path.refresh() endfunction +"FUNCTION: TreeFileNode.refreshFlags() {{{1 +function! s:TreeFileNode.refreshFlags() + call self.path.refreshFlags() +endfunction + "FUNCTION: TreeFileNode.rename() {{{1 "Calls the rename method for this nodes path obj function! s:TreeFileNode.rename(newName) diff --git a/sources_non_forked/nerdtree/lib/nerdtree/ui.vim b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim new file mode 100644 index 00000000..ed93d80c --- /dev/null +++ b/sources_non_forked/nerdtree/lib/nerdtree/ui.vim @@ -0,0 +1,332 @@ +"CLASS: UI +"============================================================ +let s:UI = {} +let g:NERDTreeUI = s:UI + + +function! s:UI.lolcats() + echomsg "lolcats" +endfunction + +"FUNCTION: s:UI.centerView() {{{2 +"centers the nerd tree window around the cursor (provided the nerd tree +"options permit) +function! s:UI.centerView() + if g:NERDTreeAutoCenter + let current_line = winline() + let lines_to_top = current_line + let lines_to_bottom = winheight(nerdtree#getTreeWinNum()) - current_line + if lines_to_top < g:NERDTreeAutoCenterThreshold || lines_to_bottom < g:NERDTreeAutoCenterThreshold + normal! zz + endif + endif +endfunction + +"FUNCTION: s:UI.new(nerdtree) {{{1 +function! s:UI.New(nerdtree) + let newObj = copy(self) + let newObj.nerdtree = a:nerdtree + return newObj +endfunction + +"FUNCTION: s:UI.getPath(ln) {{{1 +"Gets the full path to the node that is rendered on the given line number +" +"Args: +"ln: the line number to get the path for +" +"Return: +"A path if a node was selected, {} if nothing is selected. +"If the 'up a dir' line was selected then the path to the parent of the +"current root is returned +function! s:UI.getPath(ln) + let line = getline(a:ln) + + let rootLine = self.getRootLineNum() + + "check to see if we have the root node + if a:ln == rootLine + return b:NERDTreeRoot.path + endif + + if !g:NERDTreeDirArrows + " in case called from outside the tree + if line !~# '^ *[|`▸▾ ]' || line =~# '^$' + return {} + endif + endif + + if line ==# nerdtree#treeUpDirLine() + return b:NERDTreeRoot.path.getParent() + endif + + let indent = self._indentLevelFor(line) + + "remove the tree parts and the leading space + let curFile = nerdtree#stripMarkupFromLine(line, 0) + + let wasdir = 0 + if curFile =~# '/$' + let wasdir = 1 + let curFile = substitute(curFile, '/\?$', '/', "") + endif + + let dir = "" + let lnum = a:ln + while lnum > 0 + let lnum = lnum - 1 + let curLine = getline(lnum) + let curLineStripped = nerdtree#stripMarkupFromLine(curLine, 1) + + "have we reached the top of the tree? + if lnum == rootLine + let dir = b:NERDTreeRoot.path.str({'format': 'UI'}) . dir + break + endif + if curLineStripped =~# '/$' + let lpindent = self._indentLevelFor(curLine) + if lpindent < indent + let indent = indent - 1 + + let dir = substitute (curLineStripped,'^\\', "", "") . dir + continue + endif + endif + endwhile + let curFile = b:NERDTreeRoot.path.drive . dir . curFile + let toReturn = g:NERDTreePath.New(curFile) + return toReturn +endfunction + +"FUNCTION: s:UI.getLineNum(file_node){{{1 +"returns the line number this node is rendered on, or -1 if it isnt rendered +function! s:UI.getLineNum(file_node) + "if the node is the root then return the root line no. + if a:file_node.isRoot() + return b:NERDTree.ui.getRootLineNum() + endif + + let totalLines = line("$") + + "the path components we have matched so far + let pathcomponents = [substitute(b:NERDTreeRoot.path.str({'format': 'UI'}), '/ *$', '', '')] + "the index of the component we are searching for + let curPathComponent = 1 + + let fullpath = a:file_node.path.str({'format': 'UI'}) + + let lnum = b:NERDTree.ui.getRootLineNum() + while lnum > 0 + let lnum = lnum + 1 + "have we reached the bottom of the tree? + if lnum ==# totalLines+1 + return -1 + endif + + let curLine = getline(lnum) + + let indent = self._indentLevelFor(curLine) + if indent ==# curPathComponent + let curLine = nerdtree#stripMarkupFromLine(curLine, 1) + + let curPath = join(pathcomponents, '/') . '/' . curLine + if stridx(fullpath, curPath, 0) ==# 0 + if fullpath ==# curPath || strpart(fullpath, len(curPath)-1,1) ==# '/' + let curLine = substitute(curLine, '/ *$', '', '') + call add(pathcomponents, curLine) + let curPathComponent = curPathComponent + 1 + + if fullpath ==# curPath + return lnum + endif + endif + endif + endif + endwhile + return -1 +endfunction + + +"FUNCTION: s:UI.getRootLineNum(){{{1 +"gets the line number of the root node +function! s:UI.getRootLineNum() + let rootLine = 1 + while getline(rootLine) !~# '^\(/\|<\)' + let rootLine = rootLine + 1 + endwhile + return rootLine +endfunction + +"FUNCTION: s:UI._indentLevelFor(line) {{{2 +function! s:UI._indentLevelFor(line) + let level = match(a:line, '[^ \-+~▸▾`|]') / nerdtree#treeWid() + " check if line includes arrows + if match(a:line, '[▸▾]') > -1 + " decrement level as arrow uses 3 ascii chars + let level = level - 1 + endif + return level +endfunction + + +"FUNCTION: s:UI.restoreScreenState() {{{2 +" +"Sets the screen state back to what it was when nerdtree#saveScreenState was last +"called. +" +"Assumes the cursor is in the NERDTree window +function! s:UI.restoreScreenState() + if !has_key(self, '_screenState') + return + endif + exec("silent vertical resize " . self._screenState['oldWindowSize']) + + let old_scrolloff=&scrolloff + let &scrolloff=0 + call cursor(self._screenState['oldTopLine'], 0) + normal! zt + call setpos(".", self._screenState['oldPos']) + let &scrolloff=old_scrolloff +endfunction + +"FUNCTION: s:UI.saveScreenState() {{{2 +"Saves the current cursor position in the current buffer and the window +"scroll position +function! s:UI.saveScreenState() + let win = winnr() + try + call nerdtree#putCursorInTreeWin() + let self._screenState = {} + let self._screenState['oldPos'] = getpos(".") + let self._screenState['oldTopLine'] = line("w0") + let self._screenState['oldWindowSize']= winwidth("") + call nerdtree#exec(win . "wincmd w") + catch /^NERDTree.InvalidOperationError/ + endtry +endfunction + +"FUNCTION: s:UI.render() {{{2 +function! s:UI.render() + setlocal modifiable + + "remember the top line of the buffer and the current line so we can + "restore the view exactly how it was + let curLine = line(".") + let curCol = col(".") + let topLine = line("w0") + + "delete all lines in the buffer (being careful not to clobber a register) + silent 1,$delete _ + + call nerdtree#dumpHelp() + + "delete the blank line before the help and add one after it + if g:NERDTreeMinimalUI == 0 + call setline(line(".")+1, "") + call cursor(line(".")+1, col(".")) + endif + + if b:NERDTreeShowBookmarks + call nerdtree#renderBookmarks() + endif + + "add the 'up a dir' line + if !g:NERDTreeMinimalUI + call setline(line(".")+1, nerdtree#treeUpDirLine()) + call cursor(line(".")+1, col(".")) + endif + + "draw the header line + let header = b:NERDTreeRoot.path.str({'format': 'UI', 'truncateTo': winwidth(0)}) + call setline(line(".")+1, header) + call cursor(line(".")+1, col(".")) + + "draw the tree + let old_o = @o + let @o = b:NERDTreeRoot.renderToString() + silent put o + let @o = old_o + + "delete the blank line at the top of the buffer + silent 1,1delete _ + + "restore the view + let old_scrolloff=&scrolloff + let &scrolloff=0 + call cursor(topLine, 1) + normal! zt + call cursor(curLine, curCol) + let &scrolloff = old_scrolloff + + setlocal nomodifiable +endfunction + + +"FUNCTION: UI.renderViewSavingPosition {{{1 +"Renders the tree and ensures the cursor stays on the current node or the +"current nodes parent if it is no longer available upon re-rendering +function! s:UI.renderViewSavingPosition() + let currentNode = g:NERDTreeFileNode.GetSelected() + + "go up the tree till we find a node that will be visible or till we run + "out of nodes + while currentNode != {} && !currentNode.isVisible() && !currentNode.isRoot() + let currentNode = currentNode.parent + endwhile + + call b:NERDTree.render() + + if currentNode != {} + call currentNode.putCursorHere(0, 0) + endif +endfunction + +" FUNCTION: s:UI.toggleIgnoreFilter() {{{1 +" toggles the use of the NERDTreeIgnore option +function! s:UI.toggleIgnoreFilter() + let b:NERDTreeIgnoreEnabled = !b:NERDTreeIgnoreEnabled + call b:NERDTree.ui.renderViewSavingPosition() + call b:NERDTree.ui.centerView() +endfunction + +" FUNCTION: s:UI.toggleShowBookmarks() {{{1 +" toggles the display of bookmarks +function! s:UI.toggleShowBookmarks() + let b:NERDTreeShowBookmarks = !b:NERDTreeShowBookmarks + if b:NERDTreeShowBookmarks + call b:NERDTree.render() + call nerdtree#putCursorOnBookmarkTable() + else + call b:NERDTree.ui.renderViewSavingPosition() + endif + call b:NERDTree.ui.centerView() +endfunction + +" FUNCTION: s:UI.toggleShowFiles() {{{1 +" toggles the display of hidden files +function! s:UI.toggleShowFiles() + let b:NERDTreeShowFiles = !b:NERDTreeShowFiles + call b:NERDTree.ui.renderViewSavingPosition() + call b:NERDTree.ui.centerView() +endfunction + +" FUNCTION: s:UI.toggleShowHidden() {{{1 +" toggles the display of hidden files +function! s:UI.toggleShowHidden() + let b:NERDTreeShowHidden = !b:NERDTreeShowHidden + call b:NERDTree.ui.renderViewSavingPosition() + call self.centerView() +endfunction + +" FUNCTION: s:UI.toggleZoom() {{{1 +" zoom (maximize/minimize) the NERDTree window +function! s:UI.toggleZoom() + if exists("b:NERDTreeZoomed") && b:NERDTreeZoomed + let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize + exec "silent vertical resize ". size + let b:NERDTreeZoomed = 0 + else + exec "vertical resize" + let b:NERDTreeZoomed = 1 + endif +endfunction diff --git a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim index 9b81ed37..4e03f35e 100644 --- a/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim +++ b/sources_non_forked/nerdtree/nerdtree_plugin/fs_menu.vim @@ -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 b:NERDTree.render() + 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 b:NERDTree.render() + else call NERDTreeRender() call newNode.putCursorHere(0, 0) endif diff --git a/sources_non_forked/nerdtree/plugin/NERD_tree.vim b/sources_non_forked/nerdtree/plugin/NERD_tree.vim index 5bee03ad..28fd3ad1 100644 --- a/sources_non_forked/nerdtree/plugin/NERD_tree.vim +++ b/sources_non_forked/nerdtree/plugin/NERD_tree.vim @@ -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$', '\~$'] @@ -140,20 +142,13 @@ call nerdtree#loadClassFiles() " SECTION: Commands {{{1 "============================================================ -"init the command that users start the nerd tree with -command! -n=? -complete=dir -bar NERDTree :call g:NERDTreeCreator.CreatePrimary('') -command! -n=? -complete=dir -bar NERDTreeToggle :call g:NERDTreeCreator.TogglePrimary('') -command! -n=0 -bar NERDTreeClose :call nerdtree#closeTreeIfOpen() -command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreatePrimary('') -command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror() -command! -n=0 -bar NERDTreeFind call nerdtree#findAndRevealPath() -command! -n=0 -bar NERDTreeFocus call NERDTreeFocus() -command! -n=0 -bar NERDTreeCWD call NERDTreeCWD() +call nerdtree#ui_glue#setupCommands() + " SECTION: Auto commands {{{1 "============================================================ augroup NERDTree "Save the cursor position whenever we close the nerd tree - exec "autocmd BufWinLeave ". g:NERDTreeCreator.BufNamePrefix() ."* call nerdtree#saveScreenState()" + exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* call b:NERDTree.ui.saveScreenState()" "disallow insert mode in the NERDTree exec "autocmd BufEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert" @@ -199,7 +194,7 @@ endfunction function! NERDTreeCWD() call NERDTreeFocus() - call nerdtree#chRootCwd() + call nerdtree#ui_glue#chRootCwd() endfunction " SECTION: Post Source Actions {{{1 call nerdtree#postSourceActions() diff --git a/sources_non_forked/nerdtree/syntax/nerdtree.vim b/sources_non_forked/nerdtree/syntax/nerdtree.vim index 636d2af7..5f7b49cc 100644 --- a/sources_non_forked/nerdtree/syntax/nerdtree.vim +++ b/sources_non_forked/nerdtree/syntax/nerdtree.vim @@ -1,44 +1,64 @@ let s:tree_up_dir_line = '.. (up a dir)' -"NERDTreeFlags are syntax items that should be invisible, but give clues as to -"how things should be highlighted -syn match NERDTreeFlag #\~# -syn match NERDTreeFlag #\[RO\]# +syn match NERDTreeIgnore #\~# +syn match NERDTreeIgnore #\[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 +syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeIgnore,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand "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=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile + + syn match NERDTreeFlags #^ *\zs\[.\]# containedin=NERDTreeFile + syn match NERDTreeFlags #\[.\]# containedin=NERDTreeDir +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=NERDTreeIgnore,NERDTreeBookmark,NERDTreePart,NERDTreePartFile + + syn match NERDTreeFlags #-\[.\]# containedin=NERDTreeFile,NERDTreePartFile + syn match NERDTreeFlags #[+~]\zs\[.\]# containedin=NERDTreeDir +endif + syn match NERDTreeCWD #^[-\+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,13 +87,19 @@ 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 NERDTreeFlag ignore +hi def link NERDTreeClosable Title +hi def link NERDTreeIgnore ignore hi def link NERDTreeRO WarningMsg hi def link NERDTreeBookmark Statement +hi def link NERDTreeFlags Number hi def link NERDTreeCurrentNode Search diff --git a/sources_non_forked/syntastic/.gitignore b/sources_non_forked/syntastic/.gitignore deleted file mode 100644 index cc07c931..00000000 --- a/sources_non_forked/syntastic/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*~ -*.swp -tags -.DS_Store diff --git a/sources_non_forked/syntastic/CONTRIBUTING.md b/sources_non_forked/syntastic/CONTRIBUTING.md deleted file mode 100644 index 764ffffc..00000000 --- a/sources_non_forked/syntastic/CONTRIBUTING.md +++ /dev/null @@ -1,49 +0,0 @@ -# Bug reports / Github issues - -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. - -For syntax checker bugs also state the version of the checker executable that you are using. - -# Submitting a patch - -* 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 - -Small focused patches are preferred. - -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. - -# General style notes - -Following 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](http://www.refactoring.com/catalog/introduceExplainingVariable.html) to aid readability. - -# Syntax checker style notes - -The preferred style for error format strings is one "clause" per line. E.g. -(from the coffeelint checker): - -```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%.%#' -``` diff --git a/sources_non_forked/syntastic/LICENCE b/sources_non_forked/syntastic/LICENCE deleted file mode 100644 index 8b1a9d81..00000000 --- a/sources_non_forked/syntastic/LICENCE +++ /dev/null @@ -1,13 +0,0 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - -Copyright (C) 2004 Sam Hocevar - -Everyone is permitted to copy and distribute verbatim or modified -copies of this license document, and changing it is allowed as long -as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/sources_non_forked/syntastic/README.markdown b/sources_non_forked/syntastic/README.markdown deleted file mode 100644 index d7492750..00000000 --- a/sources_non_forked/syntastic/README.markdown +++ /dev/null @@ -1,175 +0,0 @@ - , - / \,,_ .'| - ,{{| /}}}}/_.' _____________________________________________ - }}}}` '{{' '. / \ - {{{{{ _ ;, \ / Ladies and Gentlemen, \ - ,}}}}}} /o`\ ` ;) | | - {{{{{{ / ( | this is ... | - }}}}}} | \ | | - {{{{{{{{ \ \ | | - }}}}}}}}} '.__ _ | | _____ __ __ _ | - {{{{{{{{ /`._ (_\ / | / ___/__ ______ / /_____ ______/ /_(_)____ | - }}}}}}' | //___/ --=: \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ | - jgs `{{{{` | '--' | ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ | - }}}` | /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ | - | /____/ | - | / - \_____________________________________________/ - - - - -Syntastic is a syntax checking plugin that runs files through external syntax -checkers and displays any resulting errors to the user. This can be done on -demand, or automatically as files are saved. If syntax errors are detected, the -user is notified and is happy because they didn't have to compile their code or -execute their script to find them. - -At the time of this writing, syntax checking plugins exist for Ada, -AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, -Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, -Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript, -JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, -Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, -reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, -Twig, TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page -templates, zsh. - -## Screenshot - -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 -enabled. - -![Screenshot 1](https://github.com/scrooloose/syntastic/raw/master/_assets/screenshot_1.png) - -1. Errors are loaded into the location list for the corresponding window. -2. When the cursor is on a line containing an error, the error message is echoed in the command window. -3. Signs are placed beside lines with errors - note that warnings are displayed in a different color. -4. There is a configurable statusline flag you can include in your statusline config. -5. Hover the mouse over a line containing an error and the error message is displayed as a balloon. -6. (not shown) Highlighting errors with syntax highlighting. Erroneous parts of lines can be highlighted. - -## Installation - -Installing syntastic is easy but first you need to have the pathogen plugin installed. If you already -have pathogen working then skip Step 1 and go to Step 2. - -### Step 1: Install pathogen.vim - -First I'll show you how to install tpope's [pathogen.vim](https://github.com/tpope/vim-pathogen) 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: - - mkdir -p ~/.vim/autoload ~/.vim/bundle; \ - curl -so ~/.vim/autoload/pathogen.vim \ - https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim - -Next you *need to add this* to your ~/.vimrc: - - execute pathogen#infect() - -### Step 2: Install syntastic as a pathogen bundle - -You now have pathogen installed and can put syntastic into ~/.vim/bundle like this: - - - cd ~/.vim/bundle - git clone https://github.com/scrooloose/syntastic.git - -Quit vim and start it back up to reload it, then type: - - :Helptags - -If you get an error when you do this, then you probably didn't install pathogen right. Go back to -step 1 and make sure you did the following: - -1. Created both the ~/.vim/autoload and ~/.vim/bundle directories. -2. Added the "call pathogen#infect()" line to your ~/.vimrc file -3. Did the git clone of syntastic inside ~/.vim/bundle -4. Have permissions to access all of these directories. - - -## Google group - -To get information or make suggestions check out the [google group](https://groups.google.com/group/vim-syntastic). - - -## FAQ - -__Q. I installed syntastic but it isn't reporting any errors...__ - -A. The most likely reason is that none of the syntax checkers that it requires is installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executables are supported, just look in `syntax_checkers//*.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay. You can see syntastic's idea of available checkers by running `:SyntasticInfo`. - -Another reason it could fail is that either the command line options or the error output for a syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request. - -__Q. Recently some of my syntax checker options have stopped working...__ - -A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `syntastic#makeprg#build()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options. - -e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntastic_php_phpcs_args`. - -See `:help syntastic-checker-options` for more information. - -__Q. I run a checker and the location list is not updated...__ - -A. By default, the location list is changed only when you run the `:Errors` command, in order to minimise conflicts with other plugins. If you want the location list to always be updated when you run the checkers, add this line to your vimrc: -```vim -let g:syntastic_always_populate_loc_list=1 -``` - -__Q. How can I pass additional arguments to a checker?__ - -A. Almost all syntax checkers use the `syntastic#makeprg#build()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are: -```vim -syntastic___args -``` - -So, If you wanted to pass "--my --args --here" to the ruby mri checker you would add this line to your vimrc: -```vim -let g:syntastic_ruby_mri_args="--my --args --here" -``` - -See `:help syntastic-checker-options` for more information. - -__Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use?__ - -A. Stick a line like this in your vimrc: -```vim -let g:syntastic__checkers=[''] -``` - -To see the list of checkers for your filetype, look in `syntax_checkers//`. - -e.g. Python has the following checkers: `flake8`, `pyflakes`, `pylint` and a native `python` checker. - -To tell syntastic to use `pylint`, you would use this setting: -```vim -let g:syntastic_python_checkers=['pylint'] -``` - -Some filetypes, like PHP, have style checkers as well as syntax checkers. These can be chained together like this: -```vim -let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd'] -``` - -This is telling syntastic to run the `php` checker first, and if no errors are found, run `phpcs`, and then `phpmd`. - -__Q. How can I jump between the different errors without using the location list at the bottom of the window?__ - -A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`. - -If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired), which provides such mappings (among other things). - -__Q. A syntax checker is giving me unwanted/strange style tips?__ - -A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the [wiki](https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers) to see what options are available. - -__Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__ - -A. There is no safe way to handle that situation automatically, but you can work around it: - -```vim -nnoremap :lclose:bdelete -cabbrev bd lclose\|bdelete -``` diff --git a/sources_non_forked/syntastic/_assets/screenshot_1.png b/sources_non_forked/syntastic/_assets/screenshot_1.png deleted file mode 100644 index c1b69f4b..00000000 Binary files a/sources_non_forked/syntastic/_assets/screenshot_1.png and /dev/null differ diff --git a/sources_non_forked/syntastic/autoload/syntastic/c.vim b/sources_non_forked/syntastic/autoload/syntastic/c.vim deleted file mode 100644 index aac6fc38..00000000 --- a/sources_non_forked/syntastic/autoload/syntastic/c.vim +++ /dev/null @@ -1,239 +0,0 @@ -if exists("g:loaded_syntastic_c_autoload") - finish -endif -let g:loaded_syntastic_c_autoload = 1 - -let s:save_cpo = &cpo -set cpo&vim - -" initialize c/cpp syntax checker handlers -function! s:Init() - let s:handlers = [] - let s:cflags = {} - - call s:RegHandler('gtk', 'syntastic#c#CheckPKG', - \ ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib']) - call s:RegHandler('glib', 'syntastic#c#CheckPKG', - \ ['glib', 'glib-2.0', 'glib']) - call s:RegHandler('glade', 'syntastic#c#CheckPKG', - \ ['glade', 'libglade-2.0', 'libglade']) - call s:RegHandler('libsoup', 'syntastic#c#CheckPKG', - \ ['libsoup', 'libsoup-2.4', 'libsoup-2.2']) - call s:RegHandler('webkit', 'syntastic#c#CheckPKG', - \ ['webkit', 'webkit-1.0']) - call s:RegHandler('cairo', 'syntastic#c#CheckPKG', - \ ['cairo', 'cairo']) - call s:RegHandler('pango', 'syntastic#c#CheckPKG', - \ ['pango', 'pango']) - call s:RegHandler('libxml', 'syntastic#c#CheckPKG', - \ ['libxml', 'libxml-2.0', 'libxml']) - call s:RegHandler('freetype', 'syntastic#c#CheckPKG', - \ ['freetype', 'freetype2', 'freetype']) - call s:RegHandler('SDL', 'syntastic#c#CheckPKG', - \ ['sdl', 'sdl']) - call s:RegHandler('opengl', 'syntastic#c#CheckPKG', - \ ['opengl', 'gl']) - call s:RegHandler('ruby', 'syntastic#c#CheckRuby', []) - call s:RegHandler('Python\.h', 'syntastic#c#CheckPython', []) - call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', []) -endfunction - -" default include directories -let s:default_includes = [ '.', '..', 'include', 'includes', - \ '../include', '../includes' ] - -" convenience function to determine the 'null device' parameter -" based on the current operating system -function! syntastic#c#GetNullDevice() - if has('win32') - return '-o nul' - elseif has('unix') || has('mac') - return '-o /dev/null' - endif - return '' -endfunction - -" get the gcc include directory argument depending on the default -" includes and the optional user-defined 'g:syntastic_c_include_dirs' -function! syntastic#c#GetIncludeDirs(filetype) - let include_dirs = [] - - if !exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') || - \ !g:syntastic_{a:filetype}_no_default_include_dirs - let include_dirs = copy(s:default_includes) - endif - - if exists('g:syntastic_'.a:filetype.'_include_dirs') - call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs) - endif - - return join(map(syntastic#util#unique(include_dirs), '"-I" . v:val'), ' ') -endfunction - -" read additional compiler flags from the given configuration file -" the file format and its parsing mechanism is inspired by clang_complete -function! syntastic#c#ReadConfig(file) - " search in the current file's directory upwards - let config = findfile(a:file, '.;') - if config == '' || !filereadable(config) | return '' | endif - - " convert filename into absolute path - let filepath = substitute(fnamemodify(config, ':p:h'), '\', '/', 'g') - - " try to read config file - try - let lines = map(readfile(config), - \ 'substitute(v:val, ''\'', ''/'', ''g'')') - catch /E484/ - return '' - endtry - - let parameters = [] - for line in lines - let matches = matchlist(line, '\C^\s*-I\s*\(\S\+\)') - if matches != [] && matches[1] != '' - " this one looks like an absolute path - if match(matches[1], '^\%(/\|\a:\)') != -1 - call add(parameters, '-I' . matches[1]) - else - call add(parameters, '-I' . filepath . '/' . matches[1]) - endif - else - call add(parameters, line) - endif - endfor - - return join(parameters, ' ') -endfunction - -" search the first 100 lines for include statements that are -" given in the handlers dictionary -function! syntastic#c#SearchHeaders() - let includes = '' - let files = [] - let found = [] - let lines = filter(getline(1, 100), 'v:val =~# "#\s*include"') - - " search current buffer - for line in lines - let file = matchstr(line, '"\zs\S\+\ze"') - if file != '' - call add(files, file) - continue - endif - for handler in s:handlers - if line =~# handler["regex"] - let includes .= call(handler["func"], handler["args"]) - call add(found, handler["regex"]) - break - endif - endfor - endfor - - " search included headers - for hfile in files - if hfile != '' - let filename = expand('%:p:h') . (has('win32') ? - \ '\' : '/') . hfile - try - let lines = readfile(filename, '', 100) - catch /E484/ - continue - endtry - let lines = filter(lines, 'v:val =~# "#\s*include"') - for handler in s:handlers - if index(found, handler["regex"]) != -1 - continue - endif - for line in lines - if line =~# handler["regex"] - let includes .= call(handler["func"], handler["args"]) - call add(found, handler["regex"]) - break - endif - endfor - endfor - endif - endfor - - return includes -endfunction - -" try to find library with 'pkg-config' -" search possible libraries from first to last given -" argument until one is found -function! syntastic#c#CheckPKG(name, ...) - if executable('pkg-config') - if !has_key(s:cflags, a:name) - for i in range(a:0) - let l:cflags = system('pkg-config --cflags '.a:000[i]) - " since we cannot necessarily trust the pkg-config exit code - " we have to check for an error output as well - if v:shell_error == 0 && l:cflags !~? 'not found' - let l:cflags = ' '.substitute(l:cflags, "\n", '', '') - let s:cflags[a:name] = l:cflags - return l:cflags - endif - endfor - else - return s:cflags[a:name] - endif - endif - return '' -endfunction - -" try to find PHP includes with 'php-config' -function! syntastic#c#CheckPhp() - if executable('php-config') - if !exists('s:php_flags') - let s:php_flags = system('php-config --includes') - let s:php_flags = ' ' . substitute(s:php_flags, "\n", '', '') - endif - return s:php_flags - endif - return '' -endfunction - -" try to find the ruby headers with 'rbconfig' -function! syntastic#c#CheckRuby() - if executable('ruby') - if !exists('s:ruby_flags') - let s:ruby_flags = system('ruby -r rbconfig -e ' - \ . '''puts Config::CONFIG["archdir"]''') - let s:ruby_flags = substitute(s:ruby_flags, "\n", '', '') - let s:ruby_flags = ' -I' . s:ruby_flags - endif - return s:ruby_flags - endif - return '' -endfunction - -" try to find the python headers with distutils -function! syntastic#c#CheckPython() - if executable('python') - if !exists('s:python_flags') - let s:python_flags = system('python -c ''from distutils import ' - \ . 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''') - let s:python_flags = substitute(s:python_flags, "\n", '', '') - let s:python_flags = ' -I' . s:python_flags - endif - return s:python_flags - endif - return '' -endfunction - -" return a handler dictionary object -function! s:RegHandler(regex, function, args) - let handler = {} - let handler["regex"] = a:regex - let handler["func"] = function(a:function) - let handler["args"] = a:args - call add(s:handlers, handler) -endfunction - -call s:Init() - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/autoload/syntastic/makeprg.vim b/sources_non_forked/syntastic/autoload/syntastic/makeprg.vim deleted file mode 100644 index 4d7a0331..00000000 --- a/sources_non_forked/syntastic/autoload/syntastic/makeprg.vim +++ /dev/null @@ -1,50 +0,0 @@ -if exists("g:loaded_syntastic_makeprg_autoload") - finish -endif -let g:loaded_syntastic_makeprg_autoload = 1 - -"Returns a makeprg of the form -" -"[exe] [args] [filename] [post_args] [tail] -" -"A (made up) example: -" ruby -a -b -c test_file.rb --more --args > /tmp/output -" -"To generate this you would call: -" -" let makeprg = syntastic#makeprg#build({ -" \ 'exe': 'ruby', -" \ 'args': '-a -b -c', -" \ 'post_args': '--more --args', -" \ 'tail': '> /tmp/output', -" \ 'filetype': 'ruby', -" \ 'subchecker': 'mri' }) -" -"Note that the current filename is added by default - but can be overridden by -"passing in an 'fname' arg. -" -"Arguments 'filetype' and 'subchecker' are mandatory, handling of composite -"types and user-defined variables breaks if you omit them. -" -"All other options can be overriden by the user with global variables - even -"when not specified by the checker in syntastic#makeprg#build(). -" -"E.g. They could override the checker exe with -" -" let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb" -" -"The general form of the override option is: -" syntastic_[filetype]_[subchecker]_[option-name] -" -function! syntastic#makeprg#build(opts) - let builder = g:SyntasticMakeprgBuilder.New( - \ get(a:opts, 'exe', ''), - \ get(a:opts, 'args', ''), - \ get(a:opts, 'fname', ''), - \ get(a:opts, 'post_args', ''), - \ get(a:opts, 'tail', ''), - \ get(a:opts, 'filetype', ''), - \ get(a:opts, 'subchecker', '') ) - - return builder.makeprg() -endfunction diff --git a/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim b/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim deleted file mode 100644 index 188a28a4..00000000 --- a/sources_non_forked/syntastic/autoload/syntastic/postprocess.vim +++ /dev/null @@ -1,58 +0,0 @@ -if exists("g:loaded_syntastic_postprocess_autoload") - finish -endif -let g:loaded_syntastic_postprocess_autoload = 1 - -let s:save_cpo = &cpo -set cpo&vim - -function! s:compareErrorItems(a, b) - if a:a['bufnr'] != a:b['bufnr'] - " group by files - return a:a['bufnr'] - a:b['bufnr'] - elseif a:a['lnum'] != a:b['lnum'] - return a:a['lnum'] - a:b['lnum'] - elseif a:a['type'] !=? a:b['type'] - " errors take precedence over warnings - return a:a['type'] ==? 'e' ? -1 : 1 - else - return get(a:a, 'col') - get(a:b, 'col') - endif -endfunction - -" natural sort -function! syntastic#postprocess#sort(errors) - return sort(a:errors, 's:compareErrorItems') -endfunction - -function syntastic#postprocess#compressWhitespace(errors) - let llist = [] - - for e in a:errors - let e['text'] = substitute(e['text'], '\n', ' ', 'g') - let e['text'] = substitute(e['text'], '\s\{2,}', ' ', 'g') - call add(llist, e) - endfor - - return llist -endfunction - -" remove spurious CR under Cygwin -function! syntastic#postprocess#cygwinRemoveCR(errors) - if has('win32unix') - let llist = [] - - for e in a:errors - let e['text'] = substitute(e['text'], '\r', '', 'g') - call add(llist, e) - endfor - else - let llist = a:errors - endif - - return llist -endfunction - -let &cpo = s:save_cpo -unlet s:save_cpo -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/autoload/syntastic/util.vim b/sources_non_forked/syntastic/autoload/syntastic/util.vim deleted file mode 100644 index b569bc18..00000000 --- a/sources_non_forked/syntastic/autoload/syntastic/util.vim +++ /dev/null @@ -1,201 +0,0 @@ -if exists("g:loaded_syntastic_util_autoload") - finish -endif -let g:loaded_syntastic_util_autoload = 1 - -let s:save_cpo = &cpo -set cpo&vim - -if !exists("g:syntastic_debug") - let g:syntastic_debug = 0 -endif - -let s:deprecationNoticesIssued = [] - -function! syntastic#util#DevNull() - if has('win32') - return 'NUL' - endif - return '/dev/null' -endfunction - -"search the first 5 lines of the file for a magic number and return a map -"containing the args and the executable -" -"e.g. -" -"#!/usr/bin/perl -f -bar -" -"returns -" -"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']} -function! syntastic#util#parseShebang() - for lnum in range(1,5) - let line = getline(lnum) - - if line =~ '^#!' - let exe = matchstr(line, '^#!\s*\zs[^ \t]*') - let args = split(matchstr(line, '^#!\s*[^ \t]*\zs.*')) - return {'exe': exe, 'args': args} - endif - endfor - - return {'exe': '', 'args': []} -endfunction - -" Run 'command' in a shell and parse output as a version string. -" Returns an array of version components. -function! syntastic#util#parseVersion(command) - return split(matchstr( system(a:command), '\v^\D*\zs\d+(\.\d+)+\ze' ), '\.') -endfunction - -" Verify that the 'installed' version is at least the 'required' version. -" -" 'installed' and 'required' must be arrays. If they have different lengths, -" the "missing" elements will be assumed to be 0 for the purposes of checking. -" -" See http://semver.org for info about version numbers. -function! syntastic#util#versionIsAtLeast(installed, required) - for index in range(max([len(a:installed), len(a:required)])) - if len(a:installed) <= index - let installed_element = 0 - else - let installed_element = a:installed[index] - endif - if len(a:required) <= index - let required_element = 0 - else - let required_element = a:required[index] - endif - if installed_element != required_element - return installed_element > required_element - endif - endfor - " Everything matched, so it is at least the required version. - return 1 -endfunction - -"print as much of a:msg as possible without "Press Enter" prompt appearing -function! syntastic#util#wideMsg(msg) - let old_ruler = &ruler - let old_showcmd = &showcmd - - "convert tabs to spaces so that the tabs count towards the window width - "as the proper amount of characters - let msg = substitute(a:msg, "\t", repeat(" ", &tabstop), "g") - let msg = strpart(msg, 0, winwidth(0)-1) - - "This is here because it is possible for some error messages to begin with - "\n which will cause a "press enter" prompt. I have noticed this in the - "javascript:jshint checker and have been unable to figure out why it - "happens - let msg = substitute(msg, "\n", "", "g") - - set noruler noshowcmd - redraw - - echo msg - - let &ruler=old_ruler - let &showcmd=old_showcmd -endfunction - -" Check whether a buffer is loaded, listed, and not hidden -function! syntastic#util#bufIsActive(buffer) - " convert to number, or hell breaks loose - let buf = str2nr(a:buffer) - - if !bufloaded(buf) || !buflisted(buf) - return 0 - endif - - " get rid of hidden buffers - for tab in range(1, tabpagenr('$')) - if index(tabpagebuflist(tab), buf) >= 0 - return 1 - endif - endfor - - return 0 -endfunction - -" start in directory a:where and walk up the parent folders until it -" finds a file matching a:what; return path to that file -function! syntastic#util#findInParent(what, where) - let here = fnamemodify(a:where, ':p') - - while !empty(here) - let p = split(globpath(here, a:what), '\n') - - if !empty(p) - return fnamemodify(p[0], ':p') - elseif here == '/' - break - endif - - " we use ':h:h' rather than ':h' since ':p' adds a trailing '/' - " if 'here' is a directory - let here = fnamemodify(here, ':p:h:h') - endwhile - - return '' -endfunction - -" Returns unique elements in a list -function! syntastic#util#unique(list) - let seen = {} - let uniques = [] - for e in a:list - if !has_key(seen, e) - let seen[e] = 1 - call add(uniques, e) - endif - endfor - return uniques -endfunction - -" A less noisy shellescape() -function! syntastic#util#shescape(string) - return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string, 1) -endfunction - -" A less noisy shellescape(expand()) -function! syntastic#util#shexpand(string) - return syntastic#util#shescape(escape(expand(a:string), '|')) -endfunction - -function! syntastic#util#debug(msg) - if g:syntastic_debug - echomsg "syntastic: debug: " . a:msg - endif -endfunction - -function! syntastic#util#info(msg) - echomsg "syntastic: info: " . a:msg -endfunction - -function! syntastic#util#warn(msg) - echohl WarningMsg - echomsg "syntastic: warning: " . a:msg - echohl None -endfunction - -function! syntastic#util#error(msg) - execute "normal \" - echohl ErrorMsg - echomsg "syntastic: error: " . a:msg - echohl None -endfunction - -function! syntastic#util#deprecationWarn(msg) - if index(s:deprecationNoticesIssued, a:msg) >= 0 - return - endif - - call add(s:deprecationNoticesIssued, a:msg) - call syntastic#util#warn(a:msg) -endfunction - -let &cpo = s:save_cpo -unlet s:save_cpo -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/doc/syntastic.txt b/sources_non_forked/syntastic/doc/syntastic.txt deleted file mode 100644 index 0c95ab7c..00000000 --- a/sources_non_forked/syntastic/doc/syntastic.txt +++ /dev/null @@ -1,455 +0,0 @@ -*syntastic.txt* Syntax checking on the fly has never been so pimp. -*syntastic* - - - It's a bird! It's a plane! ZOMG It's ... ~ - - _____ __ __ _ ~ - / ___/__ ______ / /_____ ______/ /_(_)____ ~ - \__ \/ / / / __ \/ __/ __ `/ ___/ __/ / ___/ ~ - ___/ / /_/ / / / / /_/ /_/ (__ ) /_/ / /__ ~ - /____/\__, /_/ /_/\__/\__,_/____/\__/_/\___/ ~ - /____/ ~ - - - - Reference Manual~ - - -============================================================================== -CONTENTS *syntastic-contents* - - 1.Intro...................................|syntastic-intro| - 2.Functionality provided..................|syntastic-functionality| - 2.1.The statusline flag...............|syntastic-statusline-flag| - 2.2.Error signs.......................|syntastic-error-signs| - 2.3.Error window......................|syntastic-error-window| - 3.Commands................................|syntastic-commands| - 4.Global Options..........................|syntastic-global-options| - 5.Checker Options.........................|syntastic-checker-options| - 6.About...................................|syntastic-about| - 7.License.................................|syntastic-license| - - -============================================================================== -1. Intro *syntastic-intro* - -Note: This doc only deals with using syntastic. To learn how to write syntax -checker integrations, see the guide on the github wiki: - - https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide - -Syntastic is a syntax checking plugin that runs files through external syntax -checkers. This can be done on demand, or automatically as files are saved and -opened. If syntax errors are detected, the user is notified and is happy -because they didn't have to compile their code or execute their script to find -them. - -Syntastic comes in two parts: the syntax checker plugins, and the core. The -syntax checker plugins are defined on a per-filetype basis where each one wraps -up an external syntax checking program. The core script delegates off to these -plugins and uses their output to provide the syntastic functionality. - -Take a look in the syntax_checkers directory for a list of supported filetypes -and checkers. - - -============================================================================== -2. Functionality provided *syntastic-functionality* - -Syntax checking can be done automatically or on demand (see -|'syntastic_mode_map'| 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 -activate/deactivate these features. - - * A statusline flag - * Signs beside lines with errors - * The |location-list| can be populated with the errors for the associated - buffer. - * Erroneous parts of lines can be highlighted (this functionality is only - provided by some syntax checkers). - * Balloons (if compiled in) can be used to display error messages for - erroneous lines when hovering the mouse over them. - - ------------------------------------------------------------------------------- -2.1. The statusline flag *syntastic-statusline-flag* - -To use the statusline flag, this must appear in your |'statusline'| setting > - %{SyntasticStatuslineFlag()} -< -Something like this could be more useful: > - set statusline+=%#warningmsg# - set statusline+=%{SyntasticStatuslineFlag()} - set statusline+=%* -< -When syntax errors are detected a flag will be shown. The content of the flag -is derived from the |syntastic_stl_format| option ------------------------------------------------------------------------------- -2.2. Error signs *syntastic-error-signs* - -Syntastic uses the |:sign| commands to mark lines with errors and warnings in -the sign column. To enable this feature, use the |'syntastic_enable_signs'| -option. - -Signs are colored using the Error and Todo syntax highlight groups by default. -If you wish to customize the colors for the signs, you can use the following -groups: - SyntasticErrorSign - For syntax errors, links to 'error' by default - SyntasticWarningSign - For syntax warnings, links to 'todo' by default - SyntasticStyleErrorSign - For style errors, links to 'SyntasticErrorSign' - by default - SyntasticStyleWarningSign - For style warnings, links to - 'SyntasticWarningSign' by default - -Example: > - highlight SyntasticErrorSign guifg=white guibg=red -< -To set up highlighting for the line where a sign resides, you can use the -following highlight groups: - SyntasticErrorLine - SyntasticWarningLine - SyntasticStyleErrorLine - Links to 'SyntasticErrorLine' by default - SyntasticStyleWarningLine - Links to 'SyntasticWarningLine' by default - -Example: > - highlight SyntasticErrorLine guibg=#2f0000 -< - ------------------------------------------------------------------------------- -2.3. The error window *:Errors* *syntastic-error-window* - -You can use the :Errors command to display the errors for the current buffer -in the |location-list|. - -Note that when you use :Errors, the current location list is overwritten with -Syntastic's own location list. - - -============================================================================== -3. Commands *syntastic-commands* - -:Errors *:SyntasticErrors* - -When errors have been detected, use this command to pop up the |location-list| -and display the error messages. - - -:SyntasticToggleMode *:SyntasticToggleMode* - -Toggles syntastic between active and passive mode. See |'syntastic_mode_map'| -for more info. - - -:SyntasticCheck *:SyntasticCheck* - -Manually cause a syntax check to be done. Useful in passive mode, or if the -current filetype is set to passive. See |'syntastic_mode_map'| for more info. - -:SyntasticInfo *:SyntasticInfo* - -Output info about what checkers are available and in use for the current -filetype. - - -============================================================================== -4. Global Options *syntastic-global-options* - - - *'syntastic_check_on_open'* -Default: 0 -If enabled, syntastic will do syntax checks when buffers are first loaded as -well as on saving > - let g:syntastic_check_on_open=1 -< - - *'syntastic_check_on_wq'* -Default: 1 -Normally syntastic runs syntax checks whenever buffers are written to disk. -If you want to skip these checks when you issue |:wq|, |:x|, and |:ZZ|, set this -variable to 0. > - let g:syntastic_check_on_wq=0 -< - - *'syntastic_echo_current_error'* -Default: 1 -If enabled, syntastic will echo the error associated with the current line to -the command window. If multiple errors are found, the first will be used. > - let g:syntastic_echo_current_error=1 -< - - *'syntastic_enable_signs'* -Default: 1 -Use this option to tell syntastic whether to use the |:sign| interface to mark -syntax errors: > - let g:syntastic_enable_signs=1 -< - - *'syntastic_error_symbol'* *'syntastic_style_error_symbol'* - *'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'* -Use this option to control what the syntastic |:sign| text contains. Several -error symobls can be customized: - syntastic_error_symbol - For syntax errors, defaults to '>>' - syntastic_style_error_symbol - For style errors, defaults to 'S>' - syntastic_warning_symbol - For syntax warnings, defaults to '>>' - syntastic_style_warning_symbol - For style warnings, defaults to 'S>' - -Example: > - let g:syntastic_error_symbol='✗' - let g:syntastic_warning_symbol='⚠' -< - - *'syntastic_enable_balloons'* -Default: 1 -Use this option to tell syntastic whether to display error messages in balloons -when the mouse is hovered over erroneous lines: > - let g:syntastic_enable_balloons = 1 -< -Note that vim must be compiled with |+balloon_eval|. - - *'syntastic_enable_highlighting'* -Default: 1 -Use this option to tell syntastic whether to use syntax highlighting to mark -errors (where possible). Highlighting can be turned off with the following > - let g:syntastic_enable_highlighting = 0 -< - - *'syntastic_always_populate_loc_list'* -Default: 0 -Enable this option to tell syntastic to always stick any detected errors into -the loclist: > - let g:syntastic_always_populate_loc_list=1 -< - *'syntastic_auto_jump'* -Default: 0 -Enable this option if you want the cursor to jump to the first detected error -when saving or opening a file: > - let g:syntastic_auto_jump=1 -< - - *'syntastic_auto_loc_list'* -Default: 2 -Use this option to tell syntastic to automatically open and/or close the -|location-list| (see |syntastic-error-window|). - -When set to 0 the error window will not be opened or closed automatically. > - let g:syntastic_auto_loc_list=0 -< - -When set to 1 the error window will be automatically opened when errors are -detected, and closed when none are detected. > - let g:syntastic_auto_loc_list=1 -< -When set to 2 the error window will be automatically closed when no errors are -detected, but not opened automatically. > - let g:syntastic_auto_loc_list=2 -< - - *'syntastic_loc_list_height'* -Default: 10 -Use this option to specify the height of the location lists that syntastic -opens. > - let g:syntastic_loc_list_height=5 -< - - *'syntastic_ignore_files'* -Default: [] -Use this option to specify files that syntastic should neither check, nor -include in error lists. It has to be a list of |regular-expression| patterns. -The full paths of files (see |::p|) are matched against these patterns, and -the matches are case sensitive. Use |\c| if you need case insensitive -patterns. > - let g:syntastic_ignore_files=['^/usr/include/', '\c\.h$'] -< - - *'syntastic_filetype_map'* -Default: {} -Use this option to map non-standard filetypes to standard ones. Corresponding -checkers are mapped accordingly, which allows syntastic to check files with -non-standard filetypes: > - let g:syntastic_filetype_map = { 'latex': 'tex', - \ 'gentoo-metadata': 'xml' } -< - - *'syntastic_mode_map'* -Default: { "mode": "active", - "active_filetypes": [], - "passive_filetypes": [] } - -Use this option to fine tune when automatic syntax checking is done (or not -done). - -The option should be set to something like: > - - let g:syntastic_mode_map = { 'mode': 'active', - \ 'active_filetypes': ['ruby', 'php'], - \ 'passive_filetypes': ['puppet'] } -< - -"mode" can be mapped to one of two values - "active" or "passive". When set to -active, syntastic does automatic checking whenever a buffer is saved or -initially opened. When set to "passive" syntastic only checks when the user -calls :SyntasticCheck. - -The exceptions to these rules are defined with "active_filetypes" and -"passive_filetypes". In passive mode, automatic checks are still done -for all filetypes in the "active_filetypes" array. In active mode, -automatic checks are not done for any filetypes in the -"passive_filetypes" array. - -At runtime, the |:SyntasticToggleMode| command can be used to switch between -active and passive mode. - -If any of "mode", "active_filetypes", or "passive_filetypes" are not specified -then they will default to their default value as above. - - *'syntastic_quiet_warnings'* - -Use this option if you only care about syntax errors, not warnings. When set, -this option has the following effects: - * no |signs| appear unless there is at least one error, whereupon both - errors and warnings are displayed - * the |'syntastic_auto_loc_list'| option only pops up the error window if - there's at least one error, whereupon both errors and warnings are - displayed -> - let g:syntastic_quiet_warnings=1 -< - - *'syntastic_stl_format'* - -Default: [Syntax: line:%F (%t)] -Use this option to control what the syntastic statusline text contains. Several -magic flags are available to insert information: - %e - number of errors - %w - number of warnings - %t - total number of warnings and errors - %fe - line number of first error - %fw - line number of first warning - %F - line number of first warning or error - -Several additional flags are available to hide text under certain conditions: - %E{...} - hide the text in the brackets unless there are errors - %W{...} - hide the text in the brackets unless there are warnings - %B{...} - hide the text in the brackets unless there are both warnings AND - errors -These flags cant be nested. - -Example: > - let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]' -< -If this format is used and the current buffer has 5 errors and 1 warning -starting on lines 20 and 10 respectively then this would appear on the -statusline: > - [Err: 20 #5, Warn: 10 #1] -< -If the buffer had 2 warnings, starting on line 5 then this would appear: > - [Warn: 5 #2] -< - *'syntastic_full_redraws'* -Default: 0 in GUI Vim and MacVim, 1 otherwise -Controls whether syntastic calls |:redraw| or |:redraw!| for screen redraws. -Changing it can in principle make screen redraws smoother, but it can also -cause screen flicker, or ghost characters. Leaving it to the default should -be safe. - - *'syntastic_debug'* -Default: 0 -Set this to 1 to enable debugging: > - let g:syntastic_debug = 1 -< -Checkers will then add debugging messages to Vim's |message-history|. You can -examine these messages with |:mes|. - - -============================================================================== -5. Checker Options *syntastic-checker-options* - ------------------------------------------------------------------------------- -5.1 Telling syntastic which checker to use. - -Stick a line like this in your vimrc: > - let g:syntastic__checkers = [''] -< -e.g. > - let g:syntastic_python_checkers = ['flake8'] -< - -There's also a per-buffer version of this setting, b:syntastic_checkers. Use -this in an autocmd to configure specific checkers for particular paths: > - autocmd FileType python if stridx(expand('%:p'), '/some/path/') == 0 | - \ let b:syntastic_checkers = ['pylint'] | endif -< - -To see the list of available checkers for your filetype, look in -`syntax_checkers//`. The names of the files here correspond to -'' above. - -e.g. Python has the following checkers: flake8, pyflakes, pylint and a -native python checker. - -Some filetypes, like PHP, have style checkers as well as syntax checkers. These -can be chained together like this: > - let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']` -< -This is telling syntastic to run the 'php' checker first, and if no errors are -found, run 'phpcs', and then 'phpmd'. - ------------------------------------------------------------------------------- -5.2 Configuring specific checkers *syntastic-config-makeprg* - -Most checkers use the 'syntastic#makeprg#build()' function and provide many -options by default - in fact you can customise every part of the command -that gets called. - -Checkers that use 'syntastic#makeprg#build()' look like this: > - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ruby', - \ 'args': '-a -b -c', - \ 'post_args': '--more --args', - \ 'tail': '> /tmp/output', - \ 'filetype': 'ruby', - \ 'subchecker': 'mri' }) -< - -The 'filetype' and 'subchecker' parameters are mandatory. All of the other -parameters above are optional (well, you probably need at least 'exe'), and -can be overriden by setting global variables - even parameters not specified -in the call to syntastic#makeprg#build(). - -E.g. To override the checker exe above, you could do this: > - let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb" -< -To override the args and the tail: > - let g:syntastic_ruby_mri_args="--my --args --here" - let g:syntastic_ruby_mri_tail="> /tmp/my-output-file-biatch" -< - -The general form of the override options is: > - syntastic_[filetype]_[subchecker]_[option-name] -< - -For checkers that do not use the 'syntastic#makeprg#build()' function you -will have to look at the source code of the checker in question. If there are -specific options that can be set, these are usually documented at the top of -the script. - -============================================================================== -6. About *syntastic-about* - -The core maintainers of syntastic are: - Martin Grenfell (github: scrooloose) - Gregor Uhlenheuer (github: kongo2002) - -Find the latest version of syntastic here: - http://github.com/scrooloose/syntastic - -============================================================================== -7. License *syntastic-license* - -Syntastic is released under the wtfpl. -See http://sam.zoy.org/wtfpl/COPYING. - - vim:tw=78:sw=4:ft=help:norl: diff --git a/sources_non_forked/syntastic/plugin/syntastic.vim b/sources_non_forked/syntastic/plugin/syntastic.vim deleted file mode 100644 index b603149a..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic.vim +++ /dev/null @@ -1,423 +0,0 @@ -"============================================================================ -"File: syntastic.vim -"Description: Vim plugin for on the fly syntax checking. -"Version: 3.0.0 -"Released On: 13 April, 2013 -"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_plugin") - finish -endif -let g:loaded_syntastic_plugin = 1 - -runtime! plugin/syntastic/*.vim - -let s:running_windows = has("win16") || has("win32") - -if !exists("g:syntastic_always_populate_loc_list") - let g:syntastic_always_populate_loc_list = 0 -endif - -if !exists("g:syntastic_auto_jump") - let g:syntastic_auto_jump = 0 -endif - -if !exists("g:syntastic_quiet_warnings") - let g:syntastic_quiet_warnings = 0 -endif - -if !exists("g:syntastic_stl_format") - let g:syntastic_stl_format = '[Syntax: line:%F (%t)]' -endif - -if !exists("g:syntastic_check_on_open") - let g:syntastic_check_on_open = 0 -endif - -if !exists("g:syntastic_check_on_wq") - let g:syntastic_check_on_wq = 1 -endif - -if !exists("g:syntastic_loc_list_height") - let g:syntastic_loc_list_height = 10 -endif - -if !exists("g:syntastic_ignore_files") - let g:syntastic_ignore_files = [] -endif - -if !exists("g:syntastic_filetype_map") - let g:syntastic_filetype_map = {} -endif - -if !exists("g:syntastic_full_redraws") - let g:syntastic_full_redraws = !( has('gui_running') || has('gui_macvim')) -endif - -let s:registry = g:SyntasticRegistry.Instance() -let s:notifiers = g:SyntasticNotifiers.Instance() -let s:modemap = g:SyntasticModeMap.Instance() - -function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) - let checker_names = [] - for ft in s:CurrentFiletypes() - for checker in s:registry.availableCheckersFor(ft) - call add(checker_names, checker.getName()) - endfor - endfor - return join(checker_names, "\n") -endfunction - -command! SyntasticToggleMode call s:ToggleMode() -command! -nargs=? -complete=custom,s:CompleteCheckerName SyntasticCheck call s:UpdateErrors(0, ) call s:Redraw() -command! Errors call s:ShowLocList() -command! SyntasticInfo call s:registry.echoInfoFor(s:CurrentFiletypes()) - -highlight link SyntasticError SpellBad -highlight link SyntasticWarning SpellCap - -augroup syntastic - autocmd BufReadPost * if g:syntastic_check_on_open | call s:UpdateErrors(1) | endif - autocmd BufWritePost * call s:UpdateErrors(1) - - autocmd BufWinEnter * call s:BufWinEnterHook() - - " TODO: the next autocmd should be "autocmd BufWinLeave * if empty(&bt) | lclose | endif" - " but in recent versions of Vim lclose can no longer be called from BufWinLeave - autocmd BufEnter * call s:BufEnterHook() -augroup END - -if v:version > 703 || (v:version == 703 && has('patch544')) - " QuitPre was added in Vim 7.3.544 - augroup syntastic - autocmd QuitPre * call s:QuitPreHook() - augroup END -endif - - -function! s:BufWinEnterHook() - if empty(&bt) - let loclist = g:SyntasticLoclist.current() - call s:notifiers.refresh(loclist) - endif -endfunction - -function! s:BufEnterHook() - " 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 &bt=='quickfix' && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) - call g:SyntasticLoclistHide() - endif -endfunction - - -function! s:QuitPreHook() - let b:syntastic_skip_checks = !g:syntastic_check_on_wq - call g:SyntasticLoclistHide() -endfunction - -"refresh and redraw all the error info for this buf when saving or reading -function! s:UpdateErrors(auto_invoked, ...) - if s:SkipFile() - return - endif - - let run_checks = !a:auto_invoked || s:modemap.allowsAutoChecking(&filetype) - if run_checks - if a:0 >= 1 - call s:CacheErrors(a:1) - else - call s:CacheErrors() - endif - end - - let loclist = g:SyntasticLoclist.current() - - if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump - call setloclist(0, loclist.filteredRaw()) - if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() - silent! lrewind - endif - endif - - call s:notifiers.refresh(loclist) -endfunction - -"clear the loc list for the buffer -function! s:ClearCache() - call s:notifiers.reset(g:SyntasticLoclist.current()) - unlet! b:syntastic_loclist -endfunction - -function! s:CurrentFiletypes() - return split(&filetype, '\.') -endfunction - -"detect and cache all syntax errors in this buffer -function! s:CacheErrors(...) - call s:ClearCache() - let newLoclist = g:SyntasticLoclist.New([]) - - if !s:SkipFile() - let active_checkers = 0 - for ft in s:CurrentFiletypes() - if a:0 - let checker = s:registry.getChecker(ft, a:1) - let checkers = !empty(checker) ? [checker] : [] - else - let checkers = s:registry.getActiveCheckers(ft) - endif - - for checker in checkers - let active_checkers += 1 - call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) - - let loclist = checker.getLocList() - - if !loclist.isEmpty() - let newLoclist = newLoclist.extend(loclist) - call newLoclist.setName( checker.getName() . ' ('. checker.getFiletype() . ')' ) - - "only get errors from one checker at a time - break - endif - endfor - endfor - - if !active_checkers - if a:0 - call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype) - else - call syntastic#util#debug('no active checkers for filetype ' . &filetype) - endif - endif - endif - - let b:syntastic_loclist = newLoclist -endfunction - -function! s:ToggleMode() - call s:modemap.toggleMode() - call s:ClearCache() - call s:UpdateErrors(1) - call s:modemap.echoMode() -endfunction - -"display the cached errors for this buf in the location list -function! s:ShowLocList() - let loclist = g:SyntasticLoclist.current() - call loclist.show() -endfunction - -"the script changes &shellpipe and &shell to stop the screen flicking when -"shelling out to syntax checkers. Not all OSs support the hacks though -function! s:OSSupportsShellpipeHack() - return !s:running_windows && executable('/bin/bash') && (s:uname() !~ "FreeBSD") && (s:uname() !~ "OpenBSD") -endfunction - -function! s:IsRedrawRequiredAfterMake() - return !s:running_windows && (s:uname() =~ "FreeBSD" || s:uname() =~ "OpenBSD") -endfunction - -"Redraw in a way that doesnt make the screen flicker or leave anomalies behind. -" -"Some terminal versions of vim require `redraw!` - otherwise there can be -"random anomalies left behind. -" -"However, on some versions of gvim using `redraw!` causes the screen to -"flicker - so use redraw. -function! s:Redraw() - if g:syntastic_full_redraws - redraw! - else - redraw - endif -endfunction - -function! s:IgnoreFile(filename) - let fname = fnamemodify(a:filename, ':p') - for p in g:syntastic_ignore_files - if fname =~# p - return 1 - endif - endfor - return 0 -endfunction - -" Skip running in special buffers -function! s:SkipFile() - let force_skip = exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0 - let fname = expand('%') - return force_skip || !empty(&buftype) || !filereadable(fname) || getwinvar(0, '&diff') || s:IgnoreFile(fname) -endfunction - -function! s:uname() - if !exists('s:uname') - let s:uname = system('uname') - endif - return s:uname -endfunction - -"return a string representing the state of buffer according to -"g:syntastic_stl_format -" -"return '' if no errors are cached for the buffer -function! SyntasticStatuslineFlag() - let loclist = g:SyntasticLoclist.current() - let issues = loclist.filteredRaw() - let num_issues = loclist.getLength() - if loclist.hasErrorsOrWarningsToDisplay() - let errors = loclist.errors() - let warnings = loclist.warnings() - - let num_errors = len(errors) - let num_warnings = len(warnings) - - let output = g:syntastic_stl_format - - "hide stuff wrapped in %E(...) unless there are errors - let output = substitute(output, '\C%E{\([^}]*\)}', num_errors ? '\1' : '' , 'g') - - "hide stuff wrapped in %W(...) unless there are warnings - let output = substitute(output, '\C%W{\([^}]*\)}', num_warnings ? '\1' : '' , 'g') - - "hide stuff wrapped in %B(...) unless there are both errors and warnings - let output = substitute(output, '\C%B{\([^}]*\)}', (num_warnings && num_errors) ? '\1' : '' , 'g') - - - "sub in the total errors/warnings/both - let output = substitute(output, '\C%w', num_warnings, 'g') - let output = substitute(output, '\C%e', num_errors, 'g') - let output = substitute(output, '\C%t', num_issues, 'g') - - "first error/warning line num - let output = substitute(output, '\C%F', num_issues ? issues[0]['lnum'] : '', 'g') - - "first error line num - let output = substitute(output, '\C%fe', num_errors ? errors[0]['lnum'] : '', 'g') - - "first warning line num - let output = substitute(output, '\C%fw', num_warnings ? warnings[0]['lnum'] : '', 'g') - - return output - else - return '' - endif -endfunction - -"A wrapper for the :lmake command. Sets up the make environment according to -"the options given, runs make, resets the environment, returns the location -"list -" -"a:options can contain the following keys: -" 'makeprg' -" 'errorformat' -" -"The corresponding options are set for the duration of the function call. They -"are set with :let, so dont escape spaces. -" -"a:options may also contain: -" 'defaults' - a dict containing default values for the returned errors -" 'subtype' - all errors will be assigned the given subtype -" 'postprocess' - a list of functions to be applied to the error list -" 'cwd' - change directory to the given path before running the checker -" 'returns' - a list of valid exit codes for the checker -function! SyntasticMake(options) - call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options)) - - let old_loclist = getloclist(0) - let old_makeprg = &l:makeprg - let old_shellpipe = &shellpipe - let old_shell = &shell - let old_errorformat = &l:errorformat - let old_cwd = getcwd() - let old_lc_all = $LC_ALL - - if s:OSSupportsShellpipeHack() - "this is a hack to stop the screen needing to be ':redraw'n when - "when :lmake is run. Otherwise the screen flickers annoyingly - let &shellpipe='&>' - let &shell = '/bin/bash' - endif - - if has_key(a:options, 'makeprg') - let &l:makeprg = a:options['makeprg'] - endif - - if has_key(a:options, 'errorformat') - let &l:errorformat = a:options['errorformat'] - endif - - if has_key(a:options, 'cwd') - exec 'lcd ' . fnameescape(a:options['cwd']) - endif - - let $LC_ALL = 'C' - silent lmake! - let $LC_ALL = old_lc_all - - let errors = getloclist(0) - - if has_key(a:options, 'cwd') - exec 'lcd ' . fnameescape(old_cwd) - endif - - call setloclist(0, old_loclist) - let &l:makeprg = old_makeprg - let &l:errorformat = old_errorformat - let &shellpipe=old_shellpipe - let &shell=old_shell - - if s:IsRedrawRequiredAfterMake() - call s:Redraw() - endif - - if has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1 - throw 'Syntastic: checker error' - endif - - if has_key(a:options, 'defaults') - call SyntasticAddToErrors(errors, a:options['defaults']) - endif - - " Apply ignore patterns - let ignore = {} - for buf in syntastic#util#unique(map(copy(errors), 'v:val["bufnr"]')) - let ignore[buf] = s:IgnoreFile(bufname(str2nr(buf))) - endfor - call filter(errors, '!ignore[v:val["bufnr"]]') - - " Add subtype info if present. - if has_key(a:options, 'subtype') - call SyntasticAddToErrors(errors, {'subtype': a:options['subtype']}) - endif - - if has_key(a:options, 'postprocess') && !empty(a:options['postprocess']) - for rule in a:options['postprocess'] - let errors = call('syntastic#postprocess#' . rule, [errors]) - endfor - endif - - return errors -endfunction - -"take a list of errors and add default values to them from a:options -function! SyntasticAddToErrors(errors, options) - for i in range(0, len(a:errors)-1) - for key in keys(a:options) - if !has_key(a:errors[i], key) || empty(a:errors[i][key]) - let a:errors[i][key] = a:options[key] - endif - endfor - endfor - return a:errors -endfunction - -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/plugin/syntastic/autoloclist.vim b/sources_non_forked/syntastic/plugin/syntastic/autoloclist.vim deleted file mode 100644 index 9a1a018f..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/autoloclist.vim +++ /dev/null @@ -1,38 +0,0 @@ -if exists("g:loaded_syntastic_notifier_autoloclist") - finish -endif -let g:loaded_syntastic_notifier_autoloclist = 1 - -if !exists("g:syntastic_auto_loc_list") - let g:syntastic_auto_loc_list = 2 -endif - -let g:SyntasticAutoloclistNotifier = {} - -" Public methods {{{1 -" -function! g:SyntasticAutoloclistNotifier.New() - let newObj = copy(self) - return newObj -endfunction - -function! g:SyntasticAutoloclistNotifier.refresh(loclist) - call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist) -endfunction - -function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) - if a:loclist.hasErrorsOrWarningsToDisplay() - if g:syntastic_auto_loc_list == 1 - call a:loclist.show() - endif - else - if g:syntastic_auto_loc_list > 0 - - "TODO: this will close the loc list window if one was opened by - "something other than syntastic - lclose - endif - endif -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/balloons.vim b/sources_non_forked/syntastic/plugin/syntastic/balloons.vim deleted file mode 100644 index f6e60418..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/balloons.vim +++ /dev/null @@ -1,64 +0,0 @@ -if exists("g:loaded_syntastic_notifier_balloons") - finish -endif -let g:loaded_syntastic_notifier_balloons = 1 - -if !exists("g:syntastic_enable_balloons") - let g:syntastic_enable_balloons = 1 -endif - -if !has('balloon_eval') - let g:syntastic_enable_balloons = 0 -endif - -let g:SyntasticBalloonsNotifier = {} - -" Public methods {{{1 - -function! g:SyntasticBalloonsNotifier.New() - let newObj = copy(self) - return newObj -endfunction - -function! g:SyntasticBalloonsNotifier.enabled() - return - \ has('balloon_eval') && - \ (exists('b:syntastic_enable_balloons') ? b:syntastic_enable_balloons : g:syntastic_enable_balloons) -endfunction - -" Update the error balloons -function! g:SyntasticBalloonsNotifier.refresh(loclist) - let b:syntastic_balloons = {} - if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() - let buf = bufnr('') - let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') - if !empty(issues) - for i in issues - if has_key(b:syntastic_balloons, i['lnum']) - let b:syntastic_balloons[i['lnum']] .= "\n" . i['text'] - else - let b:syntastic_balloons[i['lnum']] = i['text'] - endif - endfor - set beval bexpr=SyntasticBalloonsExprNotifier() - endif - endif -endfunction - -" Reset the error balloons -function! g:SyntasticBalloonsNotifier.reset(loclist) - if has('balloon_eval') - set nobeval - endif -endfunction - -" Private functions {{{1 - -function! SyntasticBalloonsExprNotifier() - if !exists('b:syntastic_balloons') - return '' - endif - return get(b:syntastic_balloons, v:beval_lnum, '') -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/checker.vim b/sources_non_forked/syntastic/plugin/syntastic/checker.vim deleted file mode 100644 index 3ab1d212..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/checker.vim +++ /dev/null @@ -1,79 +0,0 @@ -if exists("g:loaded_syntastic_checker") - finish -endif -let g:loaded_syntastic_checker = 1 - -let g:SyntasticChecker = {} - -" Public methods {{{1 - -function! g:SyntasticChecker.New(args) - let newObj = copy(self) - - let newObj._filetype = a:args['filetype'] - let newObj._name = a:args['name'] - - - let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_' - let newObj._locListFunc = function(prefix . 'GetLocList') - let newObj._isAvailableFunc = function(prefix . 'IsAvailable') - - if exists('*' . prefix . 'GetHighlightRegex') - let newObj._highlightRegexFunc = function(prefix. 'GetHighlightRegex') - else - let newObj._highlightRegexFunc = '' - endif - - return newObj -endfunction - -function! g:SyntasticChecker.getFiletype() - return self._filetype -endfunction - -function! g:SyntasticChecker.getName() - return self._name -endfunction - -function! g:SyntasticChecker.getLocList() - try - let list = self._locListFunc() - call syntastic#util#debug('getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error) - catch /\m\C^Syntastic: checker error$/ - let list = [] - call syntastic#util#error('checker ' . self._filetype . '/' . self._name . ' returned abnormal status ' . v:shell_error) - endtry - call self._populateHighlightRegexes(list) - return g:SyntasticLoclist.New(list) -endfunction - -function! g:SyntasticChecker.getHighlightRegexFor(error) - if empty(self._highlightRegexFunc) - return [] - endif - - return self._highlightRegexFunc(error) -endfunction - -function! g:SyntasticChecker.isAvailable() - return self._isAvailableFunc() -endfunction - -" Private methods {{{1 - -function! g:SyntasticChecker._populateHighlightRegexes(list) - let list = a:list - if !empty(self._highlightRegexFunc) - for i in range(0, len(list)-1) - if list[i]['valid'] - let term = self._highlightRegexFunc(list[i]) - if len(term) > 0 - let list[i]['hl'] = term - endif - endif - endfor - endif - return list -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/cursor.vim b/sources_non_forked/syntastic/plugin/syntastic/cursor.vim deleted file mode 100644 index 77f97dc5..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/cursor.vim +++ /dev/null @@ -1,63 +0,0 @@ -if exists("g:loaded_syntastic_notifier_cursor") - finish -endif -let g:loaded_syntastic_notifier_cursor = 1 - -if !exists('g:syntastic_echo_current_error') - let g:syntastic_echo_current_error = 1 -endif - -let g:SyntasticCursorNotifier = {} - -" Public methods {{{1 - -function! g:SyntasticCursorNotifier.New() - let newObj = copy(self) - return newObj -endfunction - -function! g:SyntasticCursorNotifier.enabled() - return exists('b:syntastic_echo_current_error') ? b:syntastic_echo_current_error : g:syntastic_echo_current_error -endfunction - -function! g:SyntasticCursorNotifier.refresh(loclist) - if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() - let b:syntastic_messages = copy(a:loclist.messages(bufnr(''))) - let b:oldLine = -1 - autocmd! syntastic CursorMoved - autocmd syntastic CursorMoved * call g:SyntasticRefreshCursor() - endif -endfunction - -function! g:SyntasticCursorNotifier.reset(loclist) - autocmd! syntastic CursorMoved - unlet! b:syntastic_messages - let b:oldLine = -1 -endfunction - -" Private methods {{{1 - -" The following defensive nonsense is needed because of the nature of autocmd -function! g:SyntasticRefreshCursor() - if !exists('b:syntastic_messages') || empty(b:syntastic_messages) - " file not checked - return - endif - - if !exists('b:oldLine') - let b:oldLine = -1 - endif - let l = line('.') - if l == b:oldLine - return - endif - let b:oldLine = l - - if has_key(b:syntastic_messages, l) - call syntastic#util#wideMsg(b:syntastic_messages[l]) - else - echo - endif -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/highlighting.vim b/sources_non_forked/syntastic/plugin/syntastic/highlighting.vim deleted file mode 100644 index e04e6cc5..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/highlighting.vim +++ /dev/null @@ -1,66 +0,0 @@ -if exists("g:loaded_syntastic_notifier_highlighting") - finish -endif -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')) - -if !exists("g:syntastic_enable_highlighting") - let g:syntastic_enable_highlighting = 1 -endif - -let g:SyntasticHighlightingNotifier = {} - -" Public methods {{{1 - -function! g:SyntasticHighlightingNotifier.New() - let newObj = copy(self) - return newObj -endfunction - -function! g:SyntasticHighlightingNotifier.enabled() - return - \ s:has_highlighting && - \ (exists('b:syntastic_enable_highlighting') ? b:syntastic_enable_highlighting : g:syntastic_enable_highlighting) -endfunction - -" Sets error highlights in the cuirrent window -function! g:SyntasticHighlightingNotifier.refresh(loclist) - if self.enabled() - call self.reset(a:loclist) - let buf = bufnr('') - let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') - for item in issues - let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning' - - " The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is - " used to override default highlighting. - if has_key(item, 'hl') - call matchadd(group, '\%' . item['lnum'] . 'l' . item['hl']) - elseif get(item, 'col') - let lastcol = col([item['lnum'], '$']) - let lcol = min([lastcol, item['col']]) - - " a bug in vim can sometimes cause there to be no 'vcol' key, - " so check for its existence - let coltype = has_key(item, 'vcol') && item['vcol'] ? 'v' : 'c' - - call matchadd(group, '\%' . item['lnum'] . 'l\%' . lcol . coltype) - endif - endfor - endif -endfunction - -" Remove all error highlights from the window -function! g:SyntasticHighlightingNotifier.reset(loclist) - if s:has_highlighting - for match in getmatches() - if stridx(match['group'], 'Syntastic') == 0 - call matchdelete(match['id']) - endif - endfor - endif -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/loclist.vim b/sources_non_forked/syntastic/plugin/syntastic/loclist.vim deleted file mode 100644 index d5cd6e39..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/loclist.vim +++ /dev/null @@ -1,173 +0,0 @@ -if exists("g:loaded_syntastic_loclist") - finish -endif -let g:loaded_syntastic_loclist = 1 - -let g:SyntasticLoclist = {} - -" Public methods {{{1 - -function! g:SyntasticLoclist.New(rawLoclist) - let newObj = copy(self) - let newObj._quietWarnings = g:syntastic_quiet_warnings - - let llist = copy(a:rawLoclist) - let llist = filter(llist, 'v:val["valid"] == 1') - - for e in llist - if empty(e['type']) - let e['type'] = 'E' - endif - endfor - - let newObj._rawLoclist = llist - let newObj._hasErrorsOrWarningsToDisplay = -1 - - let newObj._name = '' - - return newObj -endfunction - -function! g:SyntasticLoclist.current() - if !exists("b:syntastic_loclist") - let b:syntastic_loclist = g:SyntasticLoclist.New([]) - endif - return b:syntastic_loclist -endfunction - -function! g:SyntasticLoclist.extend(other) - let list = self.toRaw() - call extend(list, a:other.toRaw()) - return g:SyntasticLoclist.New(list) -endfunction - -function! g:SyntasticLoclist.toRaw() - return copy(self._rawLoclist) -endfunction - -function! g:SyntasticLoclist.filteredRaw() - return copy(self._quietWarnings ? self.errors() : self._rawLoclist) -endfunction - -function! g:SyntasticLoclist.quietWarnings() - return self._quietWarnings -endfunction - -function! g:SyntasticLoclist.isEmpty() - return empty(self._rawLoclist) -endfunction - -function! g:SyntasticLoclist.getLength() - return len(self._rawLoclist) -endfunction - -function! g:SyntasticLoclist.getName() - return len(self._name) -endfunction - -function! g:SyntasticLoclist.setName(name) - let self._name = a:name -endfunction - -function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() - if self._hasErrorsOrWarningsToDisplay >= 0 - return self._hasErrorsOrWarningsToDisplay - endif - let self._hasErrorsOrWarningsToDisplay = empty(self._rawLoclist) ? 0 : (!self._quietWarnings || len(self.errors())) - return self._hasErrorsOrWarningsToDisplay -endfunction - -function! g:SyntasticLoclist.errors() - if !exists("self._cachedErrors") - let self._cachedErrors = self.filter({'type': "E"}) - endif - return self._cachedErrors -endfunction - -function! g:SyntasticLoclist.warnings() - if !exists("self._cachedWarnings") - let self._cachedWarnings = self.filter({'type': "W"}) - endif - return self._cachedWarnings -endfunction - -" cache used by EchoCurrentError() -function! g:SyntasticLoclist.messages(buf) - if !exists("self._cachedMessages") - let self._cachedMessages = {} - let errors = self.errors() + (self._quietWarnings ? [] : self.warnings()) - - for e in errors - let b = e['bufnr'] - let l = e['lnum'] - - if !has_key(self._cachedMessages, b) - let self._cachedMessages[b] = {} - endif - - if !has_key(self._cachedMessages[b], l) - let self._cachedMessages[b][l] = e['text'] - endif - endfor - endif - - return get(self._cachedMessages, a:buf, {}) -endfunction - -"Filter the list and return new native loclist -"e.g. -" .filter({'bufnr': 10, 'type': 'e'}) -" -"would return all errors for buffer 10. -" -"Note that all comparisons are done with ==? -function! g:SyntasticLoclist.filter(filters) - let rv = [] - - for error in self._rawLoclist - - let passes_filters = 1 - for key in keys(a:filters) - if error[key] !=? a:filters[key] - let passes_filters = 0 - break - endif - endfor - - if passes_filters - call add(rv, error) - endif - endfor - return rv -endfunction - -"display the cached errors for this buf in the location list -function! g:SyntasticLoclist.show() - call setloclist(0, self.filteredRaw()) - if self.hasErrorsOrWarningsToDisplay() - let num = winnr() - exec "lopen " . g:syntastic_loc_list_height - if num != winnr() - wincmd p - endif - - " try to find the loclist window and set w:quickfix_title - for buf in tabpagebuflist() - if buflisted(buf) && bufloaded(buf) && getbufvar(buf, '&buftype') ==# 'quickfix' - let win = bufwinnr(buf) - let title = getwinvar(win, 'quickfix_title') - if title ==# ':setloclist()' || strpart(title, 0, 16) ==# ':SyntasticCheck ' - call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name) - endif - endif - endfor - endif -endfunction - -" Non-method functions {{{1 - -function! g:SyntasticLoclistHide() - silent! lclose -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/makeprg_builder.vim b/sources_non_forked/syntastic/plugin/syntastic/makeprg_builder.vim deleted file mode 100644 index ef77efa9..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/makeprg_builder.vim +++ /dev/null @@ -1,72 +0,0 @@ -if exists("g:loaded_syntastic_makeprg_builder") - finish -endif -let g:loaded_syntastic_makeprg_builder = 1 - -let g:SyntasticMakeprgBuilder = {} - -" Public methods {{{1 - -function! g:SyntasticMakeprgBuilder.New(exe, args, fname, post_args, tail, filetype, subchecker) - let newObj = copy(self) - let newObj._exe = a:exe - let newObj._args = a:args - let newObj._fname = a:fname - let newObj._post_args = a:post_args - let newObj._tail = a:tail - let newObj._filetype = empty(a:filetype) ? &filetype : a:filetype - let newObj._subchecker = a:subchecker - return newObj -endfunction - -function! g:SyntasticMakeprgBuilder.makeprg() - return join([self.exe(), self.args(), self.fname(), self.post_args(), self.tail()]) -endfunction - -function! g:SyntasticMakeprgBuilder.exe() - return self._getOpt('exe') -endfunction - -function! g:SyntasticMakeprgBuilder.args() - return self._getOpt('args') -endfunction - -function! g:SyntasticMakeprgBuilder.fname() - if empty(self._fname) - return syntastic#util#shexpand('%') - else - return self._fname - endif -endfunction - -function! g:SyntasticMakeprgBuilder.post_args() - return self._getOpt('post_args') -endfunction - -function! g:SyntasticMakeprgBuilder.tail() - return self._getOpt('tail') -endfunction - -" Private methods {{{1 - -function g:SyntasticMakeprgBuilder._getOpt(name) - if self._optExists(a:name) - return {self._optName(a:name)} - endif - - return self['_' . a:name] -endfunction - -function! g:SyntasticMakeprgBuilder._optExists(name) - return exists(self._optName(a:name)) -endfunction - -function! g:SyntasticMakeprgBuilder._optName(name) - let setting = "g:syntastic_" . self._filetype - if !empty(self._subchecker) - let setting .= '_' . self._subchecker - endif - return setting . '_' . a:name -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/modemap.vim b/sources_non_forked/syntastic/plugin/syntastic/modemap.vim deleted file mode 100644 index 2a838883..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/modemap.vim +++ /dev/null @@ -1,67 +0,0 @@ -if exists("g:loaded_syntastic_modemap") - finish -endif -let g:loaded_syntastic_modemap = 1 - -let g:SyntasticModeMap = {} - -" Public methods {{{1 - -function! g:SyntasticModeMap.Instance() - if !exists('s:SyntasticModeMapInstance') - let s:SyntasticModeMapInstance = copy(self) - call s:SyntasticModeMapInstance._initModeMapFromGlobalOpts() - endif - - return s:SyntasticModeMapInstance -endfunction - -function! g:SyntasticModeMap.allowsAutoChecking(filetype) - let fts = split(a:filetype, '\.') - - if self.isPassive() - return self._isOneFiletypeActive(fts) - else - return self._noFiletypesArePassive(fts) - endif -endfunction - -function! g:SyntasticModeMap.isPassive() - return self._mode == "passive" -endfunction - -function! g:SyntasticModeMap.toggleMode() - if self._mode == "active" - let self._mode = "passive" - else - let self._mode = "active" - endif -endfunction - -function! g:SyntasticModeMap.echoMode() - echo "Syntastic: " . self._mode . " mode enabled" -endfunction - -" Private methods {{{1 - -function! g:SyntasticModeMap._initModeMapFromGlobalOpts() - let self._mode = "active" - let self._activeFiletypes = [] - let self._passiveFiletypes = [] - - if exists("g:syntastic_mode_map") - let self._mode = get(g:syntastic_mode_map, 'mode', self._mode) - let self._activeFiletypes = get(g:syntastic_mode_map, 'active_filetypes', self._activeFiletypes) - let self._passiveFiletypes = get(g:syntastic_mode_map, 'passive_filetypes', self._passiveFiletypes) - endif -endfunction - -function! g:SyntasticModeMap._isOneFiletypeActive(filetypes) - return !empty(filter(a:filetypes, 'index(self._activeFiletypes, v:val) != -1')) -endfunction - -function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) - return empty(filter(a:filetypes, 'index(self._passiveFiletypes, v:val) != -1')) -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/notifiers.vim b/sources_non_forked/syntastic/plugin/syntastic/notifiers.vim deleted file mode 100644 index 12f41445..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/notifiers.vim +++ /dev/null @@ -1,55 +0,0 @@ -if exists("g:loaded_syntastic_notifiers") - finish -endif -let g:loaded_syntastic_notifiers = 1 - -let g:SyntasticNotifiers = {} - -let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist'] - -" Public methods {{{1 - -function! g:SyntasticNotifiers.Instance() - if !exists('s:SyntasticNotifiersInstance') - let s:SyntasticNotifiersInstance = copy(self) - call s:SyntasticNotifiersInstance._initNotifiers() - endif - - return s:SyntasticNotifiersInstance -endfunction - -function! g:SyntasticNotifiers.refresh(loclist) - for type in self._enabled_types - let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') - if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled() - call self._notifier[type].refresh(a:loclist) - endif - endfor -endfunction - -function! g:SyntasticNotifiers.reset(loclist) - for type in self._enabled_types - let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') - - " reset notifiers regardless if they are enabled or not, since - " the user might have disabled them since the last refresh(); - " notifiers MUST be prepared to deal with reset() when disabled - if has_key(g:{class}, 'reset') - call self._notifier[type].reset(a:loclist) - endif - endfor -endfunction - -" Private methods {{{1 - -function! g:SyntasticNotifiers._initNotifiers() - let self._notifier = {} - for type in s:notifier_types - let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') - let self._notifier[type] = g:{class}.New() - endfor - - let self._enabled_types = copy(s:notifier_types) -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/registry.vim b/sources_non_forked/syntastic/plugin/syntastic/registry.vim deleted file mode 100644 index 6f61d65f..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/registry.vim +++ /dev/null @@ -1,213 +0,0 @@ -if exists("g:loaded_syntastic_registry") - finish -endif -let g:loaded_syntastic_registry = 1 - -let s:defaultCheckers = { - \ 'c': ['gcc'], - \ 'coffee': ['coffee', 'coffeelint'], - \ 'cpp': ['gcc'], - \ 'css': ['csslint', 'phpcs'], - \ 'go': ['go'], - \ 'html': ['tidy'], - \ 'java': ['javac'], - \ 'javascript': ['jshint', 'jslint'], - \ 'json': ['jsonlint', 'jsonval'], - \ 'objc': ['gcc'], - \ 'objcpp': ['gcc'], - \ 'perl': ['perl', 'perlcritic'], - \ 'php': ['php', 'phpcs', 'phpmd'], - \ 'puppet': ['puppet', 'puppetlint'], - \ 'python': ['python', 'flake8', 'pylint'], - \ 'ruby': ['mri'], - \ 'sh': ['sh'], - \ 'tex': ['lacheck'] - \ } - -let s:defaultFiletypeMap = { - \ 'gentoo-metadata': 'xml', - \ 'lhaskell': 'haskell' - \ } - -let g:SyntasticRegistry = {} - -" TODO: 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. - -" Public methods {{{1 - -function! g:SyntasticRegistry.Instance() - if !exists('s:SyntasticRegistryInstance') - let s:SyntasticRegistryInstance = copy(self) - let s:SyntasticRegistryInstance._checkerMap = {} - endif - - return s:SyntasticRegistryInstance -endfunction - -function! g:SyntasticRegistry.CreateAndRegisterChecker(args) - let checker = g:SyntasticChecker.New(a:args) - let registry = g:SyntasticRegistry.Instance() - call registry.registerChecker(checker) -endfunction - -function! g:SyntasticRegistry.registerChecker(checker) abort - let ft = a:checker.getFiletype() - - if !has_key(self._checkerMap, ft) - let self._checkerMap[ft] = [] - endif - - call self._validateUniqueName(a:checker) - - call add(self._checkerMap[ft], a:checker) -endfunction - -function! g:SyntasticRegistry.checkable(ftalias) - return !empty(self.getActiveCheckers(a:ftalias)) -endfunction - -function! g:SyntasticRegistry.getActiveCheckers(ftalias) - let filetype = s:SyntasticRegistryNormaliseFiletype(a:ftalias) - let checkers = self.availableCheckersFor(a:ftalias) - - if self._userHasFiletypeSettings(filetype) - return self._filterCheckersByUserSettings(checkers, filetype) - endif - - if has_key(s:defaultCheckers, filetype) - return self._filterCheckersByDefaultSettings(checkers, filetype) - endif - - let checkers = self.availableCheckersFor(filetype) - - if !empty(checkers) - return [checkers[0]] - endif - - return [] -endfunction - -function! g:SyntasticRegistry.getChecker(ftalias, name) - for checker in self.availableCheckersFor(a:ftalias) - if checker.getName() == a:name - return checker - endif - endfor - - return {} -endfunction - -function! g:SyntasticRegistry.availableCheckersFor(ftalias) - let filetype = s:SyntasticRegistryNormaliseFiletype(a:ftalias) - let checkers = copy(self._allCheckersFor(filetype)) - return self._filterCheckersByAvailability(checkers) -endfunction - -function! g:SyntasticRegistry.echoInfoFor(ftalias_list) - echomsg "Syntastic info for filetype: " . join(a:ftalias_list, '.') - - let available = [] - let active = [] - for ftalias in a:ftalias_list - call extend(available, self.availableCheckersFor(ftalias)) - call extend(active, self.getActiveCheckers(ftalias)) - endfor - - echomsg "Available checkers: " . join(syntastic#util#unique(map(available, "v:val.getName()"))) - echomsg "Currently active checker(s): " . join(syntastic#util#unique(map(active, "v:val.getName()"))) -endfunction - -" Private methods {{{1 - -function! g:SyntasticRegistry._allCheckersFor(filetype) - call self._loadCheckers(a:filetype) - if empty(self._checkerMap[a:filetype]) - return [] - endif - - return self._checkerMap[a:filetype] -endfunction - -function! g:SyntasticRegistry._filterCheckersByDefaultSettings(checkers, filetype) - if has_key(s:defaultCheckers, a:filetype) - return self._filterCheckersByName(a:checkers, s:defaultCheckers[a:filetype]) - endif - - return a:checkers -endfunction - -function! g:SyntasticRegistry._filterCheckersByUserSettings(checkers, filetype) - if exists("b:syntastic_checkers") - let whitelist = b:syntastic_checkers - else - let whitelist = g:syntastic_{a:filetype}_checkers - endif - return self._filterCheckersByName(a:checkers, whitelist) -endfunction - -function! g:SyntasticRegistry._filterCheckersByName(checkers, list) - let checkers_by_name = {} - for c in a:checkers - let checkers_by_name[c.getName()] = c - endfor - - let filtered = [] - for name in a:list - if has_key(checkers_by_name, name) - call add(filtered, checkers_by_name[name]) - endif - endfor - - return filtered -endfunction - -function! g:SyntasticRegistry._filterCheckersByAvailability(checkers) - return filter(copy(a:checkers), "v:val.isAvailable()") -endfunction - -function! g:SyntasticRegistry._loadCheckers(filetype) - if self._haveLoadedCheckers(a:filetype) - return - endif - - exec "runtime! syntax_checkers/" . a:filetype . "/*.vim" - - if !has_key(self._checkerMap, a:filetype) - let self._checkerMap[a:filetype] = [] - endif -endfunction - -function! g:SyntasticRegistry._haveLoadedCheckers(filetype) - return has_key(self._checkerMap, a:filetype) -endfunction - -function! g:SyntasticRegistry._userHasFiletypeSettings(filetype) - 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#util#deprecationWarn("variable g:syntastic_" . a:filetype . "_checker is deprecated") - endif - return exists("b:syntastic_checkers") || exists("g:syntastic_" . a:filetype . "_checkers") -endfunction - -function! g:SyntasticRegistry._validateUniqueName(checker) abort - for checker in self._allCheckersFor(a:checker.getFiletype()) - if checker.getName() == a:checker.getName() - throw "Syntastic: Duplicate syntax checker name for: " . a:checker.getName() - endif - endfor -endfunction - -" Private functions {{{1 - -"resolve filetype aliases, and replace - with _ otherwise we cant name -"syntax checker functions legally for filetypes like "gentoo-metadata" -function! s:SyntasticRegistryNormaliseFiletype(ftalias) - let ft = get(s:defaultFiletypeMap, a:ftalias, a:ftalias) - let ft = get(g:syntastic_filetype_map, ft, ft) - let ft = substitute(ft, '-', '_', 'g') - return ft -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/plugin/syntastic/signs.vim b/sources_non_forked/syntastic/plugin/syntastic/signs.vim deleted file mode 100644 index 067658b1..00000000 --- a/sources_non_forked/syntastic/plugin/syntastic/signs.vim +++ /dev/null @@ -1,149 +0,0 @@ -if exists("g:loaded_syntastic_notifier_signs") - finish -endif -let g:loaded_syntastic_notifier_signs = 1 - -if !exists("g:syntastic_enable_signs") - let g:syntastic_enable_signs = 1 -endif - -if !exists("g:syntastic_error_symbol") - let g:syntastic_error_symbol = '>>' -endif - -if !exists("g:syntastic_warning_symbol") - let g:syntastic_warning_symbol = '>>' -endif - -if !exists("g:syntastic_style_error_symbol") - let g:syntastic_style_error_symbol = 'S>' -endif - -if !exists("g:syntastic_style_warning_symbol") - let g:syntastic_style_warning_symbol = 'S>' -endif - - -" start counting sign ids at 5000, start here to hopefully avoid conflicting -" with any other code that places signs (not sure if this precaution is -" actually needed) -let s:first_sign_id = 5000 -let s:next_sign_id = s:first_sign_id - -let g:SyntasticSignsNotifier = {} - -let s:setup_done = 0 - -" Public methods {{{1 - -function! g:SyntasticSignsNotifier.New() - let newObj = copy(self) - - if !s:setup_done - call self._setup() - let s:setup_done = 1 - endif - - return newObj -endfunction - -function! g:SyntasticSignsNotifier.enabled() - return - \ has('signs') && - \ exists('b:syntastic_enable_signs') ? b:syntastic_enable_signs : g:syntastic_enable_signs -endfunction - -function! g:SyntasticSignsNotifier.refresh(loclist) - let old_signs = copy(self._bufSignIds()) - if self.enabled() - call self._signErrors(a:loclist) - endif - call self._removeSigns(old_signs) - let s:first_sign_id = s:next_sign_id -endfunction - -" Private methods {{{1 - -" One time setup: define our own sign types and highlighting -function! g:SyntasticSignsNotifier._setup() - if has('signs') - if !hlexists('SyntasticErrorSign') - highlight link SyntasticErrorSign error - endif - if !hlexists('SyntasticWarningSign') - highlight link SyntasticWarningSign todo - endif - if !hlexists('SyntasticStyleErrorSign') - highlight link SyntasticStyleErrorSign SyntasticErrorSign - endif - if !hlexists('SyntasticStyleWarningSign') - highlight link SyntasticStyleWarningSign SyntasticWarningSign - endif - if !hlexists('SyntasticStyleErrorLine') - highlight link SyntasticStyleErrorLine SyntasticErrorLine - endif - if !hlexists('SyntasticStyleWarningLine') - highlight link SyntasticStyleWarningLine SyntasticWarningLine - endif - - " define the signs used to display syntax and style errors/warns - exe 'sign define SyntasticError text=' . g:syntastic_error_symbol . - \ ' texthl=SyntasticErrorSign linehl=SyntasticErrorLine' - exe 'sign define SyntasticWarning text=' . g:syntastic_warning_symbol . - \ ' texthl=SyntasticWarningSign linehl=SyntasticWarningLine' - exe 'sign define SyntasticStyleError text=' . g:syntastic_style_error_symbol . - \ ' texthl=SyntasticStyleErrorSign linehl=SyntasticStyleErrorLine' - exe 'sign define SyntasticStyleWarning text=' . g:syntastic_style_warning_symbol . - \ ' texthl=SyntasticStyleWarningSign linehl=SyntasticStyleWarningLine' - endif -endfunction - -" Place signs by all syntax errors in the buffer -function! g:SyntasticSignsNotifier._signErrors(loclist) - let loclist = a:loclist - if loclist.hasErrorsOrWarningsToDisplay() - - " errors some first, so that they are not masked by warnings - let buf = bufnr('') - let issues = copy(loclist.errors()) - if !loclist.quietWarnings() - call extend(issues, loclist.warnings()) - endif - call filter(issues, 'v:val["bufnr"] == buf') - let seen = {} - - for i in issues - 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 - - exec "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 - endfor - endif -endfunction - -" Remove the signs with the given ids from this buffer -function! g:SyntasticSignsNotifier._removeSigns(ids) - if has('signs') - for i in a:ids - exec "sign unplace " . i - call remove(self._bufSignIds(), index(self._bufSignIds(), i)) - endfor - endif -endfunction - -" Get all the ids of the SyntaxError signs in the buffer -function! g:SyntasticSignsNotifier._bufSignIds() - if !exists("b:syntastic_sign_ids") - let b:syntastic_sign_ids = [] - endif - return b:syntastic_sign_ids -endfunction - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/sources_non_forked/syntastic/syntax_checkers/ada/gcc.vim b/sources_non_forked/syntastic/syntax_checkers/ada/gcc.vim deleted file mode 100644 index 7050c3d5..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/ada/gcc.vim +++ /dev/null @@ -1,168 +0,0 @@ -"============================================================================ -"File: ada.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Alfredo Di Napoli -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. -" -"============================================================================ - -" In order to also check header files add this to your .vimrc: -" -" let g:syntastic_ada_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_ada_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_ada_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_ada_includes. Then the header files are being re-checked -" on the next file write. -" -" let g:syntastic_ada_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_ada_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_ada_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" gcc command line you can add those to the global variable -" g:syntastic_ada_include_dirs. This list can be used like this: -" -" let g:syntastic_ada_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_ada_compiler_options': -" -" let g:syntastic_ada_compiler_options = ' -std=c++0x' -" -" Additionally the setting 'g:syntastic_ada_config_file' allows you to define -" a file that contains additional compiler arguments like include directories -" or CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_ada_config': -" -" let g:syntastic_ada_config_file = '.config' -" -" Using the global variable 'g:syntastic_ada_remove_include_errors' you can -" specify whether errors of files included via the -" g:syntastic_ada_include_dirs' setting are removed from the result set: -" -" let g:syntastic_ada_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_ada_errorformat' to override the default error -" format: -" -" let g:syntastic_ada_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to gcc) -" -" let g:syntastic_ada_compiler = 'gcc' - -if exists('g:loaded_syntastic_ada_gcc_checker') - finish -endif -let g:loaded_syntastic_ada_gcc_checker = 1 - -if !exists('g:syntastic_ada_compiler') - let g:syntastic_ada_compiler = 'gcc' -endif - -function! SyntaxCheckers_ada_gcc_IsAvailable() - return executable(g:syntastic_ada_compiler) -endfunction - -let s:save_cpo = &cpo -set cpo&vim - -if !exists('g:syntastic_ada_compiler_options') - let g:syntastic_ada_compiler_options = '' -endif - -if !exists('g:syntastic_ada_config_file') - let g:syntastic_ada_config_file = '.syntastic_ada_config' -endif - -function! SyntaxCheckers_ada_gcc_GetLocList() - let makeprg = g:syntastic_ada_compiler . ' -c -x ada -fsyntax-only ' - let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m' - - if exists('g:syntastic_c_errorformat') - let errorformat = g:syntastic_c_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_ada_compiler_options - - let makeprg .= ' ' . syntastic#util#shexpand('%') . - \ ' ' . syntastic#c#GetIncludeDirs('ada') - - " determine whether to parse header files as well - if expand('%') =~? '\.ads$' - if exists('g:syntastic_ada_check_header') - let makeprg = g:syntastic_ada_compiler . - \ ' -c ' . syntastic#util#shexpand('%') . - \ ' ' . g:syntastic_ada_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs('ada') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_ada_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_ada_no_include_search') || - \ g:syntastic_ada_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_ada_auto_refresh_includes') && - \ g:syntastic_ada_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_ada_includes') - let b:syntastic_ada_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_ada_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_ada_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_ada_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_ada_remove_include_errors') && - \ g:syntastic_ada_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'ada', - \ 'name': 'gcc'}) - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/applescript/osacompile.vim b/sources_non_forked/syntastic/syntax_checkers/applescript/osacompile.vim deleted file mode 100644 index 7567eb08..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/applescript/osacompile.vim +++ /dev/null @@ -1,50 +0,0 @@ -"============================================================================== -" FileName: applescript.vim -" Desc: Syntax checking plugin for syntastic.vim -" Author: Zhao Cai -" Email: caizhaoff@gmail.com -" Version: 0.2.1 -" Date Created: Thu 09 Sep 2011 10:30:09 AM EST -" Last Modified: Fri 09 Dec 2011 01:10:24 PM EST -" -" History: 0.1.0 - working, but it will run the script everytime to check -" syntax. Should use osacompile but strangely it does not give -" errors. -" -" 0.2.0 - switch to osacompile, it gives less errors compared -" with osascript. -" -" 0.2.1 - remove g:syntastic_applescript_tempfile. use -" tempname() instead. -" -" 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_applescript_osacompile_checker") - finish -endif -let g:loaded_syntastic_applescript_osacompile_checker=1 - -function! SyntaxCheckers_applescript_osacompile_IsAvailable() - return executable('osacompile') -endfunction - -function! SyntaxCheckers_applescript_osacompile_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'osacompile', - \ 'args': '-o ' . tempname() . '.scpt ', - \ 'filetype': 'applescript', - \ 'subchecker': 'osacompile' }) - let errorformat = '%f:%l:%m' - - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'applescript', - \ 'name': 'osacompile'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/c/checkpatch.vim b/sources_non_forked/syntastic/syntax_checkers/c/checkpatch.vim deleted file mode 100644 index 0d579bfd..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/c/checkpatch.vim +++ /dev/null @@ -1,48 +0,0 @@ -"============================================================================ -"File: checkpatch.vim -"Description: Syntax checking plugin for syntastic.vim using checkpatch.pl -"Maintainer: Daniel Walker -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -"============================================================================ -if exists("g:loaded_syntastic_c_checkpatch_checker") - finish -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 - -function SyntaxCheckers_c_checkpatch_IsAvailable() - return exists("g:syntastic_c_checker_checkpatch_location") -endfunction - - -function! SyntaxCheckers_c_checkpatch_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': g:syntastic_c_checker_checkpatch_location, - \ 'args': '--no-summary --no-tree --terse --file', - \ 'filetype': 'c', - \ 'subchecker': 'checkpatch' }) - - let errorformat = - \ '%f:%l: %tARNING: %m,' . - \ '%f:%l: %tRROR: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'returns': [0], - \ 'subtype': 'Style' }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'c', - \ 'name': 'checkpatch'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/c/gcc.vim b/sources_non_forked/syntastic/syntax_checkers/c/gcc.vim deleted file mode 100644 index d5c05f99..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/c/gcc.vim +++ /dev/null @@ -1,183 +0,0 @@ -"============================================================================ -"File: c.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Gregor Uhlenheuer -"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. -" -"============================================================================ - -" In order to also check header files add this to your .vimrc: -" -" let g:syntastic_c_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_c_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_c_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_c_includes. Then the header files are being re-checked on -" the next file write. -" -" let g:syntastic_c_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_c_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_c_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" gcc command line you can add those to the global variable -" g:syntastic_c_include_dirs. This list can be used like this: -" -" let g:syntastic_c_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_c_compiler_options': -" -" let g:syntastic_c_compiler_options = ' -ansi' -" -" Additionally the setting 'g:syntastic_c_config_file' allows you to define a -" file that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_c_config': -" -" let g:syntastic_c_config_file = '.config' -" -" Using the global variable 'g:syntastic_c_remove_include_errors' you can -" specify whether errors of files included via the g:syntastic_c_include_dirs' -" setting are removed from the result set: -" -" let g:syntastic_c_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_c_errorformat' to override the default error -" format: -" -" let g:syntastic_c_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to gcc) -" -" let g:syntastic_c_compiler = 'clang' - -if exists('g:loaded_syntastic_c_gcc_checker') - finish -endif -let g:loaded_syntastic_c_gcc_checker = 1 - -if !exists('g:syntastic_c_compiler') - let g:syntastic_c_compiler = 'gcc' -endif - -function! SyntaxCheckers_c_gcc_IsAvailable() - return executable(g:syntastic_c_compiler) -endfunction - -let s:save_cpo = &cpo -set cpo&vim - -if !exists('g:syntastic_c_compiler_options') - let g:syntastic_c_compiler_options = '-std=gnu99' -endif - -if !exists('g:syntastic_c_config_file') - let g:syntastic_c_config_file = '.syntastic_c_config' -endif - -function! SyntaxCheckers_c_gcc_GetLocList() - let makeprg = g:syntastic_c_compiler . ' -x c -fsyntax-only ' - let errorformat = - \ '%-G%f:%s:,' . - \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . - \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . - \ '%-GIn file included%.%#,' . - \ '%-G %#from %f:%l\,,' . - \ '%f:%l:%c: %trror: %m,' . - \ '%f:%l:%c: %tarning: %m,' . - \ '%f:%l:%c: %m,' . - \ '%f:%l: %trror: %m,' . - \ '%f:%l: %tarning: %m,'. - \ '%f:%l: %m' - - if exists('g:syntastic_c_errorformat') - let errorformat = g:syntastic_c_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_c_compiler_options - - let makeprg .= ' ' . syntastic#util#shexpand('%') . - \ ' ' . syntastic#c#GetIncludeDirs('c') - - " determine whether to parse header files as well - if expand('%') =~? '\.h$' - if exists('g:syntastic_c_check_header') - let makeprg = g:syntastic_c_compiler . - \ ' -c ' . syntastic#util#shexpand('%') . - \ ' ' . g:syntastic_c_compiler_options . - \ ' ' . syntastic#c#GetNullDevice() . - \ ' ' . syntastic#c#GetIncludeDirs('c') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_c_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_c_no_include_search') || - \ g:syntastic_c_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_c_auto_refresh_includes') && - \ g:syntastic_c_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_c_includes') - let b:syntastic_c_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_c_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_c_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_c_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_c_remove_include_errors') && - \ g:syntastic_c_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'c', - \ 'name': 'gcc'}) - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/c/make.vim b/sources_non_forked/syntastic/syntax_checkers/c/make.vim deleted file mode 100644 index a0ccbf61..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/c/make.vim +++ /dev/null @@ -1,65 +0,0 @@ -"============================================================================ -"File: make.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Gregor Uhlenheuer -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -" -"============================================================================ - -if exists('g:loaded_syntastic_c_make_checker') - finish -endif -let g:loaded_syntastic_c_make_checker = 1 - -function SyntaxCheckers_c_make_IsAvailable() - return executable('make') -endfunction - -let s:save_cpo = &cpo -set cpo&vim - -function! SyntaxCheckers_c_make_GetLocList() - - let makeprg = 'make -sk' - - let errorformat = - \ '%-G%f:%s:,' . - \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . - \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . - \ '%-GIn file included%.%#,' . - \ '%-G %#from %f:%l\,,' . - \ '%f:%l:%c: %trror: %m,' . - \ '%f:%l:%c: %tarning: %m,' . - \ '%f:%l:%c: %m,' . - \ '%f:%l: %trror: %m,' . - \ '%f:%l: %tarning: %m,'. - \ '%f:%l: %m' - - if exists('g:syntastic_c_errorformat') - let errorformat = g:syntastic_c_errorformat - endif - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_c_remove_include_errors') && - \ g:syntastic_c_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'c', - \ 'name': 'make'}) - -let &cpo = s:save_cpo -unlet s:save_cpo diff --git a/sources_non_forked/syntastic/syntax_checkers/c/oclint.vim b/sources_non_forked/syntastic/syntax_checkers/c/oclint.vim deleted file mode 100644 index e366a7ab..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/c/oclint.vim +++ /dev/null @@ -1,58 +0,0 @@ -"============================================================================ -"File: oclint.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: "UnCO" Lin -"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. -"============================================================================ -" -" The setting 'g:syntastic_oclint_config_file' allows you to define a file -" that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_oclint_config': -" -" let g:syntastic_oclint_config_file = '.config' - -if exists("g:loaded_syntastic_c_oclint_checker") - finish -endif -let g:loaded_syntastic_c_oclint_checker = 1 - -function! SyntaxCheckers_c_oclint_IsAvailable() - return executable("oclint") -endfunction - -if !exists('g:syntastic_oclint_config_file') - let g:syntastic_oclint_config_file = '.syntastic_oclint_config' -endif - -function! SyntaxCheckers_c_oclint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'oclint', - \ 'args': '-text', - \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), - \ 'filetype': 'c', - \ 'subchecker': 'oclint' }) - - let errorformat = - \ '%E%f:%l:%c: %m P1 ,' . - \ '%E%f:%l:%c: %m P2 ,' . - \ '%W%f:%l:%c: %m P3 ,' . - \ '%E%f:%l:%c: fatal error: %m,' . - \ '%E%f:%l:%c: error: %m,' . - \ '%W%f:%l:%c: warning: %m,' . - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace', 'sort'] }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'c', - \ 'name': 'oclint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/c/sparse.vim b/sources_non_forked/syntastic/syntax_checkers/c/sparse.vim deleted file mode 100644 index 0307e324..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/c/sparse.vim +++ /dev/null @@ -1,51 +0,0 @@ -"============================================================================ -"File: sparse.vim -"Description: Syntax checking plugin for syntastic.vim using sparse.pl -"Maintainer: Daniel Walker -"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. -"============================================================================ -" -" The setting 'g:syntastic_sparse_config_file' allows you to define a file -" that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_sparse_config': -" -" let g:syntastic_sparse_config_file = '.config' - -if exists("g:loaded_syntastic_c_sparse_checker") - finish -endif -let g:loaded_syntastic_c_sparse_checker = 1 - -function! SyntaxCheckers_c_sparse_IsAvailable() - return executable("sparse") -endfunction - -if !exists('g:syntastic_sparse_config_file') - let g:syntastic_sparse_config_file = '.syntastic_sparse_config' -endif - -function! SyntaxCheckers_c_sparse_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'sparse', - \ 'args': '-ftabstop=' . &ts . ' ' . syntastic#c#ReadConfig(g:syntastic_sparse_config_file), - \ 'filetype': 'c', - \ 'subchecker': 'sparse' }) - - let errorformat = '%f:%l:%v: %trror: %m,%f:%l:%v: %tarning: %m,' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")}, - \ 'returns': [0] }) - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'c', - \ 'name': 'sparse'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/c/splint.vim b/sources_non_forked/syntastic/syntax_checkers/c/splint.vim deleted file mode 100644 index 6b2a1c1b..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/c/splint.vim +++ /dev/null @@ -1,57 +0,0 @@ -"============================================================================ -"File: splint.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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. -"============================================================================ -" -" The setting 'g:syntastic_splint_config_file' allows you to define a file -" that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_splint_config': -" -" let g:syntastic_splint_config_file = '.config' - -if exists("g:loaded_syntastic_c_splint_checker") - finish -endif -let g:loaded_syntastic_c_splint_checker = 1 - -function! SyntaxCheckers_c_splint_IsAvailable() - return executable("splint") -endfunction - -if !exists('g:syntastic_splint_config_file') - let g:syntastic_splint_config_file = '.syntastic_splint_config' -endif - -function! SyntaxCheckers_c_splint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'splint', - \ 'post_args': '-showfunc -hints +quiet ' . syntastic#c#ReadConfig(g:syntastic_splint_config_file), - \ 'filetype': 'c', - \ 'subchecker': 'splint' }) - - let errorformat = - \ '%-G%f:%l:%v: %[%#]%[%#]%[%#] Internal Bug %.%#,' . - \ '%W%f:%l:%v: %m,' . - \ '%W%f:%l: %m,' . - \ '%-C %\+In file included from %.%#,' . - \ '%-C %\+from %.%#,' . - \ '%+C %.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace'], - \ 'defaults': {'type': 'W'} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'c', - \ 'name': 'splint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/c/ycm.vim b/sources_non_forked/syntastic/syntax_checkers/c/ycm.vim deleted file mode 100644 index 5cce6fc5..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/c/ycm.vim +++ /dev/null @@ -1,32 +0,0 @@ -"============================================================================ -"File: ycm.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Val Markovic -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -" -"============================================================================ - -if exists("g:loaded_syntastic_c_ycm_checker") - finish -endif -let g:loaded_syntastic_c_ycm_checker = 1 - -function! SyntaxCheckers_c_ycm_IsAvailable() - return exists('g:loaded_youcompleteme') -endfunction - -if !exists('g:loaded_youcompleteme') - finish -endif - -function! SyntaxCheckers_c_ycm_GetLocList() - return youcompleteme#CurrentFileDiagnostics() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'c', - \ 'name': 'ycm'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/co/coco.vim b/sources_non_forked/syntastic/syntax_checkers/co/coco.vim deleted file mode 100644 index a3186108..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/co/coco.vim +++ /dev/null @@ -1,44 +0,0 @@ -"============================================================================ -"File: co.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Andrew Kelley -"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_co_coco_checker") - finish -endif -let g:loaded_syntastic_co_coco_checker=1 - -"bail if the user doesnt have coco installed -if !executable("coco") - finish -endif - -function! SyntaxCheckers_co_coco_GetLocList() - return executable('coco') -endfunction - -function! SyntaxCheckers_co_coco_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coco', - \ 'args': '-c -o /tmp', - \ 'filetype': 'co', - \ 'subchecker': 'coco' }) - - let errorformat = - \ '%EFailed at: %f,' . - \ '%ZSyntax%trror: %m on line %l,'. - \ '%EFailed at: %f,'. - \ '%Z%trror: Parse error on line %l: %m' - - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'co', - \ 'name': 'coco'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/coffee/coffee.vim b/sources_non_forked/syntastic/syntax_checkers/coffee/coffee.vim deleted file mode 100644 index 846180b9..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/coffee/coffee.vim +++ /dev/null @@ -1,48 +0,0 @@ -"============================================================================ -"File: coffee.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Lincoln Stoll -"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. -" -"============================================================================ -" -" Note: this script requires CoffeeScript version 1.6.2 or newer. -" -if exists("g:loaded_syntastic_coffee_coffee_checker") - finish -endif -let g:loaded_syntastic_coffee_coffee_checker=1 - -function! SyntaxCheckers_coffee_coffee_IsAvailable() - return executable("coffee") && - \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2]) -endfunction - -function! SyntaxCheckers_coffee_coffee_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coffee', - \ 'args': '-cp', - \ 'filetype': 'coffee', - \ 'subchecker': 'coffee' }) - - 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%.%#' - - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'coffee', - \ 'name': 'coffee'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/coffee/coffeelint.vim b/sources_non_forked/syntastic/syntax_checkers/coffee/coffeelint.vim deleted file mode 100644 index cae5c40c..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/coffee/coffeelint.vim +++ /dev/null @@ -1,38 +0,0 @@ -"============================================================================ -"File: coffeelint.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Lincoln Stoll -"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_coffee_coffeelint_checker") - finish -endif -let g:loaded_syntastic_coffee_coffeelint_checker=1 - -function! SyntaxCheckers_coffee_coffeelint_IsAvailable() - return executable('coffeelint') -endfunction - -function! SyntaxCheckers_coffee_coffeelint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coffeelint', - \ 'args': '--csv', - \ 'filetype': 'coffee', - \ 'subchecker': 'coffeelint' }) - - let errorformat = '%f\,%l\,%trror\,%m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style' }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'coffee', - \ 'name': 'coffeelint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/coq/coqtop.vim b/sources_non_forked/syntastic/syntax_checkers/coq/coqtop.vim deleted file mode 100644 index f1efa4d8..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/coq/coqtop.vim +++ /dev/null @@ -1,40 +0,0 @@ -"============================================================================ -"File: coqtop.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Matvey Aksenov -"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_coq_coqtop_checker") - finish -endif -let g:loaded_syntastic_coq_coqtop_checker=1 - -function! SyntaxCheckers_coq_coqtop_IsAvailable() - return executable('coqtop') -endfunction - -function! SyntaxCheckers_coq_coqtop_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coqtop', - \ 'args': '-noglob -batch -load-vernac-source', - \ 'filetype': 'coq', - \ 'subchecker': 'coqtop' }) - - let errorformat = - \ '%AFile \"%f\"\, line %l\, characters %c\-%.%#\:,'. - \ '%C%m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'coq', - \ 'name': 'coqtop'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/cpp/cpplint.vim b/sources_non_forked/syntastic/syntax_checkers/cpp/cpplint.vim deleted file mode 100644 index 35e77ccc..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/cpp/cpplint.vim +++ /dev/null @@ -1,65 +0,0 @@ -"============================================================================ -"File: cpplint.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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. -" -"============================================================================ -" -" For details about cpplint see: -" https://code.google.com/p/google-styleguide/ -" -" Checker options: -" -" - g:syntastic_cpp_cpplint_thres (integer; default: 5) -" error threshold: policy violations with a severity above this -" value are highlighted as errors, the others are warnings -" -" - g:syntastic_cpp_cpplint_args (string; default: '--verbose=3') -" command line options to pass to cpplint - -if exists("g:loaded_syntastic_cpp_cpplint_checker") - finish -endif -let g:loaded_syntastic_cpp_cpplint_checker = 1 - -if !exists('g:syntastic_cpp_cpplint_thres') - let g:syntastic_cpp_cpplint_thres = 5 -endif - -if ! exists('g:syntastic_cpp_cpplint_args') - let g:syntastic_cpp_cpplint_args = '--verbose=3' -endif - -function! SyntaxCheckers_cpp_cpplint_IsAvailable() - return executable('cpplint.py') -endfunction - -function! SyntaxCheckers_cpp_cpplint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'cpplint.py', - \ 'filetype': 'cpp', - \ 'subchecker': 'cpplint' }) - - let errorformat = '%A%f:%l: %m [%t],%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style' }) - - " change error types according to the prescribed threshold - for n in range(len(loclist)) - let loclist[n]['type'] = loclist[n]['type'] < g:syntastic_cpp_cpplint_thres ? 'W' : 'E' - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'cpp', - \ 'name': 'cpplint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/cpp/gcc.vim b/sources_non_forked/syntastic/syntax_checkers/cpp/gcc.vim deleted file mode 100644 index 40b2a105..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/cpp/gcc.vim +++ /dev/null @@ -1,179 +0,0 @@ -"============================================================================ -"File: cpp.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Gregor Uhlenheuer -"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. -" -"============================================================================ - -" In order to also check header files add this to your .vimrc: -" -" let g:syntastic_cpp_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_cpp_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_cpp_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_cpp_includes. Then the header files are being re-checked -" on the next file write. -" -" let g:syntastic_cpp_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" gcc command line you can add those to the global variable -" g:syntastic_cpp_include_dirs. This list can be used like this: -" -" let g:syntastic_cpp_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_cpp_compiler_options': -" -" let g:syntastic_cpp_compiler_options = ' -std=c++0x' -" -" Additionally the setting 'g:syntastic_cpp_config_file' allows you to define -" a file that contains additional compiler arguments like include directories -" or CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_cpp_config': -" -" let g:syntastic_cpp_config_file = '.config' -" -" Using the global variable 'g:syntastic_cpp_remove_include_errors' you can -" specify whether errors of files included via the -" g:syntastic_cpp_include_dirs' setting are removed from the result set: -" -" let g:syntastic_cpp_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_cpp_errorformat' to override the default error -" format: -" -" let g:syntastic_cpp_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to g++) -" -" let g:syntastic_cpp_compiler = 'clang++' - -if exists('g:loaded_syntastic_cpp_gcc_checker') - finish -endif -let g:loaded_syntastic_cpp_gcc_checker = 1 - -if !exists('g:syntastic_cpp_compiler') - let g:syntastic_cpp_compiler = 'g++' -endif - -function! SyntaxCheckers_cpp_gcc_IsAvailable() - return executable(g:syntastic_cpp_compiler) -endfunction - -let s:save_cpo = &cpo -set cpo&vim - -if !exists('g:syntastic_cpp_compiler_options') - let g:syntastic_cpp_compiler_options = '' -endif - -if !exists('g:syntastic_cpp_config_file') - let g:syntastic_cpp_config_file = '.syntastic_cpp_config' -endif - -function! SyntaxCheckers_cpp_gcc_GetLocList() - let makeprg = g:syntastic_cpp_compiler . ' -x c++ -fsyntax-only ' - let errorformat = - \ '%-G%f:%s:,' . - \ '%f:%l:%c: %trror: %m,' . - \ '%f:%l:%c: %tarning: %m,' . - \ '%f:%l:%c: %m,'. - \ '%f:%l: %trror: %m,'. - \ '%f:%l: %tarning: %m,'. - \ '%f:%l: %m' - - if exists('g:syntastic_cpp_errorformat') - let errorformat = g:syntastic_cpp_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_cpp_compiler_options - - let makeprg .= ' ' . syntastic#util#shexpand('%') . - \ ' ' . syntastic#c#GetIncludeDirs('cpp') - - " determine whether to parse header files as well - if expand('%') =~? '\.\(h\|hpp\|hh\)$' - if exists('g:syntastic_cpp_check_header') - let makeprg = g:syntastic_cpp_compiler . - \ ' -c ' . syntastic#util#shexpand('%') . - \ ' ' . g:syntastic_cpp_compiler_options . - \ ' ' . syntastic#c#GetNullDevice() . - \ ' ' . syntastic#c#GetIncludeDirs('cpp') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_cpp_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_cpp_no_include_search') || - \ g:syntastic_cpp_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_cpp_auto_refresh_includes') && - \ g:syntastic_cpp_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_cpp_includes') - let b:syntastic_cpp_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_cpp_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_cpp_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_cpp_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_cpp_remove_include_errors') && - \ g:syntastic_cpp_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'cpp', - \ 'name': 'gcc'}) - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/cpp/oclint.vim b/sources_non_forked/syntastic/syntax_checkers/cpp/oclint.vim deleted file mode 100644 index 867f15de..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/cpp/oclint.vim +++ /dev/null @@ -1,36 +0,0 @@ -"============================================================================ -"File: oclint.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: "UnCO" Lin -"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. -"============================================================================ -" -" The setting 'g:syntastic_oclint_config_file' allows you to define a file -" that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_oclint_config': -" -" let g:syntastic_oclint_config_file = '.config' - -if exists("g:loaded_syntastic_cpp_oclint_checker") - finish -endif -let g:loaded_syntastic_cpp_oclint_checker = 1 - -function! SyntaxCheckers_cpp_oclint_IsAvailable() - return SyntaxCheckers_c_oclint_IsAvailable() -endfunction - -function! SyntaxCheckers_cpp_oclint_GetLocList() - return SyntaxCheckers_c_oclint_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'cpp', - \ 'name': 'oclint'}) - -runtime! syntax_checkers/c/*.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/cpp/ycm.vim b/sources_non_forked/syntastic/syntax_checkers/cpp/ycm.vim deleted file mode 100644 index b0dbab58..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/cpp/ycm.vim +++ /dev/null @@ -1,34 +0,0 @@ -"============================================================================ -"File: ycm.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Val Markovic -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -" -"============================================================================ - -if exists("g:loaded_syntastic_cpp_ycm_checker") - finish -endif -let g:loaded_syntastic_cpp_ycm_checker = 1 - -function! SyntaxCheckers_cpp_ycm_IsAvailable() - return SyntaxCheckers_c_ycm_IsAvailable() -endfunction - -if !exists('g:loaded_youcompleteme') - finish -endif - -function! SyntaxCheckers_cpp_ycm_GetLocList() - return SyntaxCheckers_c_ycm_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'cpp', - \ 'name': 'ycm'}) - -runtime! syntax_checkers/c/*.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/cs/mcs.vim b/sources_non_forked/syntastic/syntax_checkers/cs/mcs.vim deleted file mode 100644 index b3c96a95..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/cs/mcs.vim +++ /dev/null @@ -1,39 +0,0 @@ -"============================================================================ -"File: cs.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Daniel Walker -"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_cs_mcs_checker") - finish -endif -let g:loaded_syntastic_cs_mcs_checker=1 - -function! SyntaxCheckers_cs_mcs_IsAvailable() - return executable('mcs') -endfunction - -function! SyntaxCheckers_cs_mcs_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'mcs', - \ 'args': '--parse', - \ 'filetype': 'cs', - \ 'subchecker': 'mcs' }) - - let errorformat = '%f(%l\,%c): %trror %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'cs', - \ 'name': 'mcs'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/css/csslint.vim b/sources_non_forked/syntastic/syntax_checkers/css/csslint.vim deleted file mode 100644 index 6a2659d7..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/css/csslint.vim +++ /dev/null @@ -1,54 +0,0 @@ -"============================================================================ -"File: css.vim -"Description: Syntax checking plugin for syntastic.vim using `csslint` CLI tool (http://csslint.net). -"Maintainer: Ory Band -"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. -"============================================================================ -" -" Specify additional options to csslint with this option. e.g. to disable -" warnings: -" -" let g:syntastic_csslint_options = "--warnings=none" - -if exists("g:loaded_syntastic_css_csslint_checker") - finish -endif -let g:loaded_syntastic_css_csslint_checker=1 - -if !exists('g:syntastic_csslint_options') - let g:syntastic_csslint_options = "" -endif - -function! SyntaxCheckers_css_csslint_IsAvailable() - return executable('csslint') -endfunction - -function! SyntaxCheckers_css_csslint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'csslint', - \ 'args': '--format=compact ' . g:syntastic_csslint_options, - \ 'filetype': 'css', - \ 'subchecker': 'csslint' }) - - " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. - let errorformat = - \ '%-G,' . - \ '%-G%f: lint free!,' . - \ '%f: line %l\, col %c\, %trror - %m,' . - \ '%f: line %l\, col %c\, %tarning - %m,'. - \ '%f: line %l\, col %c\, %m,' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) - -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'css', - \ 'name': 'csslint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/css/phpcs.vim b/sources_non_forked/syntastic/syntax_checkers/css/phpcs.vim deleted file mode 100644 index ffcb7fee..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/css/phpcs.vim +++ /dev/null @@ -1,33 +0,0 @@ -"============================================================================ -"File: phpcs.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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. -" -"============================================================================ -" -" See here for details of phpcs -" - phpcs (see http://pear.php.net/package/PHP_CodeSniffer) -" -if exists("g:loaded_syntastic_css_phpcs_checker") - finish -endif -let g:loaded_syntastic_css_phpcs_checker=1 - -function! SyntaxCheckers_css_phpcs_IsAvailable() - return SyntaxCheckers_php_phpcs_IsAvailable() -endfunction - -function! SyntaxCheckers_css_phpcs_GetLocList() - return SyntaxCheckers_php_phpcs_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'css', - \ 'name': 'phpcs'}) - -runtime! syntax_checkers/php/*.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/css/prettycss.vim b/sources_non_forked/syntastic/syntax_checkers/css/prettycss.vim deleted file mode 100644 index c3cd9de1..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/css/prettycss.vim +++ /dev/null @@ -1,62 +0,0 @@ -"============================================================================ -"File: prettycss.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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. -" -"============================================================================ -" -" For details about PrettyCSS see: -" -" - http://fidian.github.io/PrettyCSS/ -" - https://github.com/fidian/PrettyCSS - -if exists("g:loaded_syntastic_css_prettycss_checker") - finish -endif -let g:loaded_syntastic_css_prettycss_checker=1 - -function! SyntaxCheckers_css_prettycss_IsAvailable() - return executable('prettycss') -endfunction - -function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item) - let term = matchstr(a:item["text"], ' (\zs[^)]\+\ze)$') - if term != '' - let term = '\V' . term - endif - return term -endfunction - -function! SyntaxCheckers_css_prettycss_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'prettycss', - \ 'filetype': 'css', - \ 'subchecker': 'prettycss' }) - - " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. - let errorformat = - \ '%EError: %m\, line %l\, char %c),' . - \ '%WWarning: %m\, line %l\, char %c),' . - \ '%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")}, - \ 'postprocess': ['sort'] }) - - for n in range(len(loclist)) - let loclist[n]["text"] .= ')' - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'css', - \ 'name': 'prettycss'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/cucumber/cucumber.vim b/sources_non_forked/syntastic/syntax_checkers/cucumber/cucumber.vim deleted file mode 100644 index 4458c78f..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/cucumber/cucumber.vim +++ /dev/null @@ -1,42 +0,0 @@ -"============================================================================ -"File: cucumber.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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_cucumber_cucumber_checker") - finish -endif -let g:loaded_syntastic_cucumber_cucumber_checker=1 - -function! SyntaxCheckers_cucumber_cucumber_IsAvailable() - return executable('cucumber') -endfunction - -function! SyntaxCheckers_cucumber_cucumber_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'cucumber', - \ 'args': '--dry-run --quiet --strict --format pretty', - \ 'filetype': 'cucumber', - \ 'subchecker': 'cucumber' }) - - let errorformat = - \ '%f:%l:%c:%m,' . - \ '%W %.%# (%m),' . - \ '%-Z%f:%l:%.%#,'. - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'cucumber', - \ 'name': 'cucumber'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim b/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim deleted file mode 100644 index 7bc6c4bb..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/cuda/nvcc.vim +++ /dev/null @@ -1,72 +0,0 @@ -"============================================================================ -"File: cuda.vim -"Description: Syntax checking plugin for syntastic.vim -" -"Author: Hannes Schulz -" -"============================================================================ - -" in order to also check header files add this to your .vimrc: -" (this creates an empty .syntastic_dummy.cu file in your source directory) -" -" let g:syntastic_cuda_check_header = 1 - -" By default, nvcc and thus syntastic, defaults to the most basic architecture. -" This can produce false errors if the developer intends to compile for newer -" hardware and use newer features, eg. double precision numbers. To pass a -" specific target arch to nvcc, e.g. add the following to your .vimrc: -" -" let g:syntastic_cuda_arch = "sm_20" - - -if exists("g:loaded_syntastic_cuda_nvcc_checker") - finish -endif -let g:loaded_syntastic_cuda_nvcc_checker=1 - -function! SyntaxCheckers_cuda_nvcc_IsAvailable() - return executable('nvcc') -endfunction - -function! SyntaxCheckers_cuda_nvcc_GetLocList() - if exists('g:syntastic_cuda_arch') - let arch_flag = '-arch=' . g:syntastic_cuda_arch - else - let arch_flag = '' - endif - let makeprg = - \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' . - \ syntastic#util#shexpand('%') . ' ' . syntastic#c#GetNullDevice() - let errorformat = - \ '%*[^"]"%f"%*\D%l: %m,'. - \ '"%f"%*\D%l: %m,'. - \ '%-G%f:%l: (Each undeclared identifier is reported only once,'. - \ '%-G%f:%l: for each function it appears in.),'. - \ '%f:%l:%c:%m,'. - \ '%f(%l):%m,'. - \ '%f:%l:%m,'. - \ '"%f"\, line %l%*\D%c%*[^ ] %m,'. - \ '%D%*\a[%*\d]: Entering directory `%f'','. - \ '%X%*\a[%*\d]: Leaving directory `%f'','. - \ '%D%*\a: Entering directory `%f'','. - \ '%X%*\a: Leaving directory `%f'','. - \ '%DMaking %*\a in %f,'. - \ '%f|%l| %m' - - if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$' - if exists('g:syntastic_cuda_check_header') - let makeprg = - \ 'echo > .syntastic_dummy.cu ; ' . - \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' . - \ syntastic#util#shexpand('%') . ' ' . syntastic#c#GetNullDevice() - else - return [] - endif - endif - - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'cuda', - \ 'name': 'nvcc'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim b/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim deleted file mode 100644 index 17228e41..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/d/dmd.vim +++ /dev/null @@ -1,177 +0,0 @@ -"============================================================================ -"File: d.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Alfredo Di Napoli -"License: Based on the original work of Gregor Uhlenheuer and his -" cpp.vim checker so credits are dued. -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -" HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -" OTHER DEALINGS IN THE SOFTWARE. -" -"============================================================================ - -" In order to also check header files add this to your .vimrc: -" -" let g:syntastic_d_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_d_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_d_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_d_includes. Then the header files are being re-checked -" on the next file write. -" -" let g:syntastic_d_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_d_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_d_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" dmd command line you can add those to the global variable -" g:syntastic_d_include_dirs. This list can be used like this: -" -" let g:syntastic_d_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_d_compiler_options': -" -" let g:syntastic_d_compiler_options = ' -std=c++0x' -" -" Additionally the setting 'g:syntastic_d_config_file' allows you to define -" a file that contains additional compiler arguments like include directories -" or CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_d_config': -" -" let g:syntastic_d_config_file = '.config' -" -" Using the global variable 'g:syntastic_d_remove_include_errors' you can -" specify whether errors of files included via the -" g:syntastic_d_include_dirs' setting are removed from the result set: -" -" let g:syntastic_d_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_d_errorformat' to override the default error -" format: -" -" let g:syntastic_d_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to dmd) -" -" let g:syntastic_d_compiler = 'clang++' - -if exists('g:loaded_syntastic_d_dmd_checker') - finish -endif -let g:loaded_syntastic_d_dmd_checker = 1 - -if !exists('g:syntastic_d_compiler') - let g:syntastic_d_compiler = 'dmd' -endif - -function! SyntaxCheckers_d_dmd_IsAvailable() - return executable(g:syntastic_d_compiler) -endfunction - -let s:save_cpo = &cpo -set cpo&vim - -if !exists('g:syntastic_d_compiler_options') - let g:syntastic_d_compiler_options = '' -endif - -if !exists('g:syntastic_d_config_file') - let g:syntastic_d_config_file = '.syntastic_d_config' -endif - -function! SyntaxCheckers_d_dmd_GetLocList() - let makeprg = g:syntastic_d_compiler . ' -c -of' . syntastic#util#DevNull() . ' ' - let errorformat = '%-G%f:%s:,%f(%l): %m,%f:%l: %m' - - if exists('g:syntastic_d_errorformat') - let errorformat = g:syntastic_d_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_d_compiler_options - - let makeprg .= ' ' . syntastic#util#shexpand('%') . - \ ' ' . syntastic#c#GetIncludeDirs('d') - - " determine whether to parse header files as well - if expand('%') =~? '\.di$' - if exists('g:syntastic_d_check_header') - let makeprg = g:syntastic_d_compiler . - \ ' -c ' . syntastic#util#shexpand('%') . - \ ' -of' . syntastic#util#DevNull() . - \ ' ' . g:syntastic_d_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs('d') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_d_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_d_no_include_search') || - \ g:syntastic_d_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_d_auto_refresh_includes') && - \ g:syntastic_d_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_d_includes') - let b:syntastic_d_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_d_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_d_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_d_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_d_remove_include_errors') && - \ g:syntastic_d_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'd', - \ 'name': 'dmd'}) - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/dart/dart_analyzer.vim b/sources_non_forked/syntastic/syntax_checkers/dart/dart_analyzer.vim deleted file mode 100644 index a0835c41..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/dart/dart_analyzer.vim +++ /dev/null @@ -1,66 +0,0 @@ -"============================================================================ -"File: dart_analyzer.vim -"Description: Dart syntax checker - using dart_analyzer -"Maintainer: Maksim Ryzhikov -"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_dart_dart_analyzer_checker") - finish -endif -let g:loaded_syntastic_dart_dart_analyzer_checker=1 - -if !exists("g:syntastic_dart_analyzer_conf") - let g:syntastic_dart_analyzer_conf = '' -endif - -function! SyntaxCheckers_dart_dart_analyzer_IsAvailable() - return executable("dart_analyzer") -endfunction - -function! SyntaxCheckers_dart_dart_analyzer_GetHighlightRegex(error) - let lcol = a:error['col'] - 1 - let rcol = a:error['nr'] + lcol + 1 - - return '\%>'.lcol.'c\%<'.rcol.'c' -endfunction - -function! SyntaxCheckers_dart_dart_analyzer_GetLocList() - let args = !empty(g:syntastic_dart_analyzer_conf) ? ' ' . g:syntastic_dart_analyzer_conf : '' - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'dart_analyzer', - \ 'args': '--error_format machine', - \ 'post_args': args, - \ 'filetype': 'dart', - \ 'subchecker': 'dart_analyzer' }) - - " Machine readable format looks like: - " SEVERITY|TYPE|ERROR_CODE|file:FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE - " SEVERITY: (WARNING|ERROR) - " TYPE: (RESOLVER|STATIC_TYPE|...) - " ERROR_CODE: (NO_SUCH_TYPE|...) - " FILENAME: String - " LINE_NUMBER: int - " COLUMN: int - " LENGHT: int - " MESSAGE: String - - " We use %n to grab the error length to be able to access it in the matcher. - let commonformat = '|%.%#|%.%#|file:%f|%l|%c|%n|%m' - - " TODO(amouravski): simply take everything after ERROR|WARNING as a message - " and then parse it by hand later. - let errorformat = '%EERROR'.l:commonformat.','. - \'%WWARNING'.l:commonformat - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'dart', - \ 'name': 'dart_analyzer'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/docbk/xmllint.vim b/sources_non_forked/syntastic/syntax_checkers/docbk/xmllint.vim deleted file mode 100644 index cc0e3e35..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/docbk/xmllint.vim +++ /dev/null @@ -1,30 +0,0 @@ -"============================================================================ -"File: docbk.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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_docbk_xmllint_checker") - finish -endif -let g:loaded_syntastic_docbk_xmllint_checker=1 - -function! SyntaxCheckers_docbk_xmllint_IsAvailable() - return SyntaxCheckers_xml_xmllint_IsAvailable() -endfunction - -function! SyntaxCheckers_docbk_xmllint_GetLocList() - return SyntaxCheckers_xml_xmllint_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'docbk', - \ 'name': 'xmllint'}) - -runtime! syntax_checkers/xml/*.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim b/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim deleted file mode 100644 index 521e9456..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/elixir/elixir.vim +++ /dev/null @@ -1,45 +0,0 @@ -"============================================================================ -"File: elixir.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Richard Ramsden -"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_elixir_elixir_checker") - finish -endif -let g:loaded_syntastic_elixir_elixir_checker=1 - -" TODO: we should probably split this into separate checkers -function! SyntaxCheckers_elixir_elixir_IsAvailable() - return executable('elixir') && executable('mix') -endfunction - -function! SyntaxCheckers_elixir_elixir_GetLocList() - - let make_options = {} - let compile_command = 'elixir' - let mix_file = syntastic#util#findInParent('mix.exs', expand('%:p:h')) - - if filereadable(mix_file) - let compile_command = 'mix compile' - let make_options['cwd'] = fnamemodify(mix_file, ':p:h') - endif - - let make_options['makeprg'] = syntastic#makeprg#build({ - \ 'exe': compile_command, - \ 'filetype': 'elixir', - \ 'subchecker': 'elixir' }) - - let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m' - - return SyntasticMake(make_options) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'elixir', - \ 'name': 'elixir'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/erlang/erlang.vim b/sources_non_forked/syntastic/syntax_checkers/erlang/erlang.vim deleted file mode 100644 index 967b759d..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/erlang/erlang.vim +++ /dev/null @@ -1,51 +0,0 @@ -"============================================================================ -"File: erlang.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Pawel Salata -"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_erlang_erlang_checker") - finish -endif -let g:loaded_syntastic_erlang_erlang_checker=1 - -let s:check_file = expand(':p:h') . '/erlang_check_file.erl' -if !exists("g:syntastic_erlc_include_path") - let g:syntastic_erlc_include_path="" -endif - -function! SyntaxCheckers_erlang_escript_IsAvailable() - return executable('escript') -endfunction - -function! SyntaxCheckers_erlang_escript_GetLocList() - let extension = expand('%:e') - if match(extension, 'hrl') >= 0 - return [] - endif - let shebang = getbufline(bufnr('%'), 1)[0] - if len(shebang) > 0 - if match(shebang, 'escript') >= 0 - let makeprg = 'escript -s ' . syntastic#util#shexpand('%:p') - else - let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' ' . g:syntastic_erlc_include_path - endif - else - let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' '. g:syntastic_erlc_include_path - endif - let errorformat = - \ '%f:%l:\ %tarning:\ %m,'. - \ '%E%f:%l:\ %m' - - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'erlang', - \ 'name': 'escript'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/erlang/erlang_check_file.erl b/sources_non_forked/syntastic/syntax_checkers/erlang/erlang_check_file.erl deleted file mode 100755 index 54cc9366..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/erlang/erlang_check_file.erl +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env escript --export([main/1]). - -main([FileName]) -> - LibDirs = filelib:wildcard("{lib,deps}/*/ebin"), - compile(FileName, LibDirs); -main([FileName | LibDirs]) -> - compile(FileName, LibDirs). - -compile(FileName, LibDirs) -> - Root = get_root(filename:dirname(FileName)), - ok = code:add_pathsa(LibDirs), - compile:file(FileName, [warn_obsolete_guard, - warn_unused_import, - warn_shadow_vars, - warn_export_vars, - strong_validation, - report, - {i, filename:join(Root, "include")}, - {i, filename:join(Root, "deps")}, - {i, filename:join(Root, "apps")}, - {i, filename:join(Root, "lib")} - ]). - -get_root(Dir) -> - Path = filename:split(filename:absname(Dir)), - filename:join(get_root(lists:reverse(Path), Path)). - -get_root([], Path) -> - Path; -get_root(["src" | Tail], _Path) -> - lists:reverse(Tail); -get_root([_ | Tail], Path) -> - get_root(Tail, Path). diff --git a/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim b/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim deleted file mode 100644 index 3a772351..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/eruby/ruby.vim +++ /dev/null @@ -1,65 +0,0 @@ -"============================================================================ -"File: ruby.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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_eruby_ruby_checker") - finish -endif -let g:loaded_syntastic_eruby_ruby_checker=1 - -if !exists("g:syntastic_ruby_exec") - let g:syntastic_ruby_exec = "ruby" -endif - -function! SyntaxCheckers_eruby_ruby_IsAvailable() - return executable(expand(g:syntastic_ruby_exec)) -endfunction - -function! SyntaxCheckers_eruby_ruby_GetLocList() - let exe = expand(g:syntastic_ruby_exec) - if !has('win32') - let exe = 'RUBYOPT= ' . exe - endif - - let fname = "'" . escape(expand('%'), "\\'") . "'" - - " TODO: encodings became useful in ruby 1.9 :) - if syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('ruby --version'), [1, 9]) - let enc = &fileencoding != '' ? &fileencoding : &encoding - let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' - else - let encoding_spec = '' - endif - - "gsub fixes issue #7, rails has it's own eruby syntax - let makeprg = - \ exe . ' -rerb -e ' . - \ syntastic#util#shescape('puts ERB.new(File.read(' . - \ fname . encoding_spec . - \ ').gsub(''<\%='',''<\%''), nil, ''-'').src') . - \ ' \| ' . exe . ' -c' - - let errorformat = - \ '%-GSyntax OK,'. - \ '%E-:%l: syntax error\, %m,%Z%p^,'. - \ '%W-:%l: warning: %m,'. - \ '%Z%p^,'. - \ '%-C%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'eruby', - \ 'name': 'ruby'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/fortran/gfortran.vim b/sources_non_forked/syntastic/syntax_checkers/fortran/gfortran.vim deleted file mode 100644 index 0df45d3a..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/fortran/gfortran.vim +++ /dev/null @@ -1,63 +0,0 @@ -"============================================================================ -"File: fortran.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Karl Yngve Lervåg -"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. -"Note: This syntax checker uses gfortran with the option -fsyntax-only -" to check for errors and warnings. Additional flags may be -" supplied through both local and global variables, -" b:syntastic_fortran_flags, -" g:syntastic_fortran_flags. -" This is particularly useful when the source requires module files -" in order to compile (that is when it needs modules defined in -" separate files). -" -"============================================================================ - -if exists("g:loaded_syntastic_fortran_gfortran_checker") - finish -endif -let g:loaded_syntastic_fortran_gfortran_checker=1 - -if !exists('g:syntastic_fortran_flags') - let g:syntastic_fortran_flags = '' -endif - -function! SyntaxCheckers_fortran_gfortran_IsAvailable() - return executable('gfortran') -endfunction - -function! SyntaxCheckers_fortran_gfortran_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'gfortran', - \ 'args': s:args(), - \ 'filetype': 'fortran', - \ 'subchecker': 'gfortran' }) - - let errorformat = - \ '%-C %#,'. - \ '%-C %#%.%#,'. - \ '%A%f:%l.%c:,'. - \ '%Z%m,'. - \ '%G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -function s:args() - let rv = '-fsyntax-only ' . g:syntastic_fortran_flags - if exists('b:syntastic_fortran_flags') - let rv .= " " . b:syntastic_fortran_flags - endif - return rv -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'fortran', - \ 'name': 'gfortran'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/go/go.vim b/sources_non_forked/syntastic/syntax_checkers/go/go.vim deleted file mode 100644 index e389012a..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/go/go.vim +++ /dev/null @@ -1,75 +0,0 @@ -"============================================================================ -"File: go.vim -"Description: Check go syntax using 'gofmt -l' followed by 'go [build|test]' -"Maintainer: Kamil Kisiel -"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. -" -" This syntax checker does not reformat your source code. -" Use a BufWritePre autocommand to that end: -" autocmd FileType go autocmd BufWritePre Fmt -"============================================================================ -if exists("g:loaded_syntastic_go_go_checker") - finish -endif -let g:loaded_syntastic_go_go_checker=1 - -function! SyntaxCheckers_go_go_IsAvailable() - return executable('go') -endfunction - -function! SyntaxCheckers_go_go_GetLocList() - " Check with gofmt first, since `go build` and `go test` might not report - " syntax errors in the current file if another file with syntax error is - " compiled first. - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'gofmt', - \ 'args': '-l', - \ 'tail': '1>' . syntastic#util#DevNull(), - \ 'filetype': 'go', - \ 'subchecker': 'go' }) - - let errorformat = - \ '%f:%l:%c: %m,' . - \ '%-G%.%#' - - let errors = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'type': 'e'} }) - if !empty(errors) - return errors - endif - - " Test files, i.e. files with a name ending in `_test.go`, are not - " compiled by `go build`, therefore `go test` must be called for those. - if match(expand('%'), '_test.go$') == -1 - let makeprg = 'go build ' . syntastic#c#GetNullDevice() - else - let makeprg = 'go test -c ' . syntastic#c#GetNullDevice() - endif - - let errorformat = - \ '%f:%l:%c:%m,' . - \ '%f:%l%m,' . - \ '%-G#%.%#' - - " The go compiler needs to either be run with an import path as an - " argument or directly from the package directory. Since figuring out - " the proper import path is fickle, just cwd to the package. - - let errors = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h'), - \ 'defaults': {'type': 'e'} }) - - return errors -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'go', - \ 'name': 'go'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/go/gofmt.vim b/sources_non_forked/syntastic/syntax_checkers/go/gofmt.vim deleted file mode 100644 index b150916f..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/go/gofmt.vim +++ /dev/null @@ -1,42 +0,0 @@ -"============================================================================ -"File: gofmt.vim -"Description: Check go syntax using 'gofmt -l' -"Maintainer: Brandon Thomson -"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. -" -" This syntax checker does not reformat your source code. -" Use a BufWritePre autocommand to that end: -" autocmd FileType go autocmd BufWritePre Fmt -"============================================================================ -if exists("g:loaded_syntastic_go_gofmt_checker") - finish -endif -let g:loaded_syntastic_go_gofmt_checker=1 - -function! SyntaxCheckers_go_gofmt_IsAvailable() - return executable('gofmt') -endfunction - -function! SyntaxCheckers_go_gofmt_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'gofmt', - \ 'args': '-l', - \ 'tail': '1>' . syntastic#util#DevNull(), - \ 'filetype': 'go', - \ 'subchecker': 'gofmt' }) - - let errorformat = '%f:%l:%c: %m,%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'type': 'e'} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'go', - \ 'name': 'gofmt'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/go/golint.vim b/sources_non_forked/syntastic/syntax_checkers/go/golint.vim deleted file mode 100644 index 954a7c2a..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/go/golint.vim +++ /dev/null @@ -1,37 +0,0 @@ -"============================================================================ -"File: golint.vim -"Description: Check go syntax using 'golint' -"Maintainer: Hiroshi Ioka -"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_go_golint_checker") - finish -endif -let g:loaded_syntastic_go_golint_checker=1 - -function! SyntaxCheckers_go_golint_IsAvailable() - return executable('golint') -endfunction - -function! SyntaxCheckers_go_golint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'golint', - \ 'filetype': 'go', - \ 'subchecker': 'golint' }) - - let errorformat = '%f:%l:%c: %m,%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style' }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'go', - \ 'name': 'golint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/go/govet.vim b/sources_non_forked/syntastic/syntax_checkers/go/govet.vim deleted file mode 100644 index 4b1d7efb..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/go/govet.vim +++ /dev/null @@ -1,40 +0,0 @@ -"============================================================================ -"File: govet.vim -"Description: Perform static analysis of Go code with the vet tool -"Maintainer: Kamil Kisiel -"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_go_govet_checker") - finish -endif -let g:loaded_syntastic_go_govet_checker=1 - -function! SyntaxCheckers_go_govet_IsAvailable() - return executable('go') -endfunction - -function! SyntaxCheckers_go_govet_GetLocList() - let makeprg = 'go vet' - let errorformat = '%Evet: %.%\+: %f:%l:%c: %m,%W%f:%l: %m,%-G%.%#' - - " The go compiler needs to either be run with an import path as an - " argument or directly from the package directory. Since figuring out - " the proper import path is fickle, just cwd to the package. - - let errors = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'cwd': expand('%:p:h'), - \ 'defaults': {'type': 'w'} }) - - return errors -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'go', - \ 'name': 'govet'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/haml/haml.vim b/sources_non_forked/syntastic/syntax_checkers/haml/haml.vim deleted file mode 100644 index 77d0a8dc..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/haml/haml.vim +++ /dev/null @@ -1,45 +0,0 @@ -"============================================================================ -"File: haml.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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_haml_haml_checker") - finish -endif -let g:loaded_syntastic_haml_haml_checker=1 - -if !exists("g:syntastic_haml_interpreter") - let g:syntastic_haml_interpreter = "haml" -endif - -function! SyntaxCheckers_haml_haml_IsAvailable() - return executable(g:syntastic_haml_interpreter) -endfunction - -function! SyntaxCheckers_haml_haml_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': g:syntastic_haml_interpreter, - \ 'args': '-c', - \ 'filetype': 'haml', - \ 'subchecker': 'haml' }) - - let errorformat = - \ 'Haml error on line %l: %m,' . - \ 'Syntax error on line %l: %m,' . - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'haml', - \ 'name': 'haml'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/haskell/ghc-mod.vim b/sources_non_forked/syntastic/syntax_checkers/haskell/ghc-mod.vim deleted file mode 100644 index f3677dc1..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/haskell/ghc-mod.vim +++ /dev/null @@ -1,47 +0,0 @@ -"============================================================================ -"File: ghc-mod.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Anthony Carapetis -"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_haskell_ghc_mod_checker") - finish -endif -let g:loaded_syntastic_haskell_ghc_mod_checker=1 - -function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() - return executable('ghc-mod') -endfunction - -function! SyntaxCheckers_haskell_ghc_mod_GetLocList() - let errorformat = - \ '%-G%\s%#,' . - \ '%f:%l:%c:%trror: %m,' . - \ '%f:%l:%c:%tarning: %m,'. - \ '%f:%l:%c: %trror: %m,' . - \ '%f:%l:%c: %tarning: %m,' . - \ '%f:%l:%c:%m,' . - \ '%E%f:%l:%c:,' . - \ '%Z%m' - - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ghc-mod check', - \ 'filetype': 'haskell', - \ 'subchecker': 'ghc_mod' }) - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'haskell', - \ 'name': 'ghc_mod'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim b/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim deleted file mode 100644 index 3f4b0b73..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/haskell/hdevtools.vim +++ /dev/null @@ -1,46 +0,0 @@ -"============================================================================ -"File: hdevtools.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Anthony Carapetis -"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_haskell_hdevtools_checker") - finish -endif -let g:loaded_syntastic_haskell_hdevtools_checker=1 - -function! SyntaxCheckers_haskell_hdevtools_IsAvailable() - return executable('hdevtools') -endfunction - -function! SyntaxCheckers_haskell_hdevtools_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'hdevtools check', - \ 'args': get(g:, 'hdevtools_options', ''), - \ 'filetype': 'haskell', - \ 'subchecker': 'hdevtools' }) - - let errorformat= '\%-Z\ %#,'. - \ '%W%f:%l:%c:\ Warning:\ %m,'. - \ '%E%f:%l:%c:\ %m,'. - \ '%E%>%f:%l:%c:,'. - \ '%+C\ \ %#%m,'. - \ '%W%>%f:%l:%c:,'. - \ '%+C\ \ %#%tarning:\ %m,' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': ['compressWhitespace'] }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'haskell', - \ 'name': 'hdevtools'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim b/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim deleted file mode 100644 index c748b77c..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/haskell/hlint.vim +++ /dev/null @@ -1,38 +0,0 @@ -"============================================================================ -"File: hlint.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Nicolas Wu -"License: BSD -"============================================================================ - -if exists("g:loaded_syntastic_haskell_hlint_checker") - finish -endif -let g:loaded_syntastic_haskell_hlint_checker=1 - -function! SyntaxCheckers_haskell_hlint_IsAvailable() - return executable('hlint') -endfunction - -function! SyntaxCheckers_haskell_hlint_GetLocList() - let errorformat = - \ '%E%f:%l:%c: Error: %m,' . - \ '%W%f:%l:%c: Warning: %m,' . - \ '%C%m' - - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'hlint', - \ 'filetype': 'haskell', - \ 'subchecker': 'hlint' }) - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': ['compressWhitespace'] }) - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'haskell', - \ 'name': 'hlint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim b/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim deleted file mode 100644 index 969a9369..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/haxe/haxe.vim +++ /dev/null @@ -1,52 +0,0 @@ -"============================================================================ -"File: haxe.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: David Bernard -"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_haxe_haxe_checker") - finish -endif -let g:loaded_syntastic_haxe_haxe_checker=1 - -function! SyntaxCheckers_haxe_haxe_IsAvailable() - return executable('haxe') -endfunction - -function! SyntaxCheckers_haxe_haxe_GetLocList() - if exists('b:vaxe_hxml') - let hxml = b:vaxe_hxml - elseif exists('g:vaxe_hxml') - let hxml = g:vaxe_hxml - else - let hxml = syntastic#util#findInParent('*.hxml', expand('%:p:h')) - endif - let hxml = fnamemodify(hxml, ':p') - - if !empty(hxml) - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'haxe', - \ 'fname': syntastic#util#shescape(fnameescape(fnamemodify(hxml, ':t'))), - \ 'filetype': 'haxe', - \ 'subchecker': 'haxe' }) - - let errorformat = '%E%f:%l: characters %c-%*[0-9] : %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'cwd': fnamemodify(hxml, ':h') }) - endif - - return [] -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'haxe', - \ 'name': 'haxe'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/hss/hss.vim b/sources_non_forked/syntastic/syntax_checkers/hss/hss.vim deleted file mode 100644 index 5d2cf005..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/hss/hss.vim +++ /dev/null @@ -1,38 +0,0 @@ -"============================================================================ -"File: hss.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Justin Donaldson (jdonaldson@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_hss_hss_checker") - finish -endif -let g:loaded_syntastic_hss_hss_checker=1 - -function! SyntaxCheckers_hss_hss_IsAvailable() - return executable('hss') -endfunction - -function! SyntaxCheckers_hss_hss_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'hss', - \ 'args' : '-output ' . syntastic#util#DevNull(), - \ 'filetype': 'hss', - \ 'subchecker': 'hss' }) - - let errorformat = '%E%f:%l: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'hss', - \ 'name': 'hss'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/html/tidy.vim b/sources_non_forked/syntastic/syntax_checkers/html/tidy.vim deleted file mode 100644 index 27a97613..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/html/tidy.vim +++ /dev/null @@ -1,174 +0,0 @@ -"============================================================================ -"File: tidy.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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. -" -"============================================================================ -" -" Checker option: -" -" - g:syntastic_html_tidy_ignore_errors (list; default: []) -" list of errors to ignore -" - g:syntastic_html_tidy_blocklevel_tags (list; default: []) -" list of additional blocklevel tags, to be added to "--new-blocklevel-tags" -" - g:syntastic_html_tidy_inline_tags (list; default: []) -" list of additional inline tags, to be added to "--new-inline-tags" -" - g:syntastic_html_tidy_empty_tags (list; default: []) -" list of additional empty tags, to be added to "--new-empty-tags" - -if exists("g:loaded_syntastic_html_tidy_checker") - finish -endif -let g:loaded_syntastic_html_tidy_checker = 1 - -if !exists('g:syntastic_html_tidy_ignore_errors') - let g:syntastic_html_tidy_ignore_errors = [] -endif - -if !exists('g:syntastic_html_tidy_blocklevel_tags') - let g:syntastic_html_tidy_blocklevel_tags = [] -endif - -if !exists('g:syntastic_html_tidy_inline_tags') - let g:syntastic_html_tidy_inline_tags = [] -endif - -if !exists('g:syntastic_html_tidy_empty_tags') - let g:syntastic_html_tidy_empty_tags = [] -endif - -function! SyntaxCheckers_html_tidy_IsAvailable() - return executable('tidy') -endfunction - -" TODO: join this with xhtml.vim for DRY's sake? -function! s:TidyEncOptByFenc() - let tidy_opts = { - \'utf-8' : '-utf8', - \'ascii' : '-ascii', - \'latin1' : '-latin1', - \'iso-2022-jp' : '-iso-2022', - \'cp1252' : '-win1252', - \'macroman' : '-mac', - \'utf-16le' : '-utf16le', - \'utf-16' : '-utf16', - \'big5' : '-big5', - \'cp932' : '-shiftjis', - \'sjis' : '-shiftjis', - \'cp850' : '-ibm858', - \} - return get(tidy_opts, &fileencoding, '-utf8') -endfunction - -let s:ignore_errors = [ - \ " lacks \"summary\" attribute", - \ "not approved by W3C", - \ "attribute \"placeholder\"", - \ " proprietary attribute \"charset\"", - \ " lacks \"content\" attribute", - \ "inserting \"type\" attribute", - \ "proprietary attribute \"data-", - \ "missing declaration", - \ "inserting implicit ", - \ "inserting missing 'title' element", - \ "attribute \"[+", - \ "unescaped & or unknown entity", - \ " attribute \"type\" has invalid value \"search\"" - \ ] - -let s:blocklevel_tags = [ - \ "main", - \ "section", - \ "article", - \ "aside", - \ "hgroup", - \ "header", - \ "footer", - \ "nav", - \ "figure", - \ "figcaption" - \ ] - -let s:inline_tags = [ - \ "video", - \ "audio", - \ "source", - \ "embed", - \ "mark", - \ "progress", - \ "meter", - \ "time", - \ "ruby", - \ "rt", - \ "rp", - \ "canvas", - \ "command", - \ "details", - \ "datalist" - \ ] - -let s:empty_tags = [ - \ "wbr", - \ "keygen" - \ ] - -function! s:IgnoreError(text) - for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors - if stridx(a:text, i) != -1 - return 1 - endif - endfor - return 0 -endfunction - -function! s:NewTags(name) - return syntastic#util#shescape(join( s:{a:name} + g:syntastic_html_tidy_{a:name}, ',' )) -endfunction - -function s:Args() - let args = s:TidyEncOptByFenc() . - \ ' --new-blocklevel-tags ' . s:NewTags('blocklevel_tags') . - \ ' --new-inline-tags ' . s:NewTags('inline_tags') . - \ ' --new-empty-tags ' . s:NewTags('empty_tags') . - \ ' -e' - return args -endfunction - -function! SyntaxCheckers_html_tidy_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'tidy', - \ 'args': s:Args(), - \ 'tail': '2>&1', - \ 'filetype': 'html', - \ 'subchecker': 'tidy' }) - - let errorformat = - \ '%Wline %l column %v - Warning: %m,' . - \ '%Eline %l column %v - Error: %m,' . - \ '%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")}, - \ 'returns': [0, 1, 2] }) - - " filter out valid HTML5 from the errors - for n in range(len(loclist)) - if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1 - let loclist[n]['valid'] = 0 - endif - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'html', - \ 'name': 'tidy'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/html/validator.vim b/sources_non_forked/syntastic/syntax_checkers/html/validator.vim deleted file mode 100644 index 7e24a17b..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/html/validator.vim +++ /dev/null @@ -1,78 +0,0 @@ -"============================================================================ -"File: validator.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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. -" -"============================================================================ -" -" For detail;s about validator see: http://about.validator.nu/ -" -" Checker options: -" -" - g:syntastic_html_validator_api (string; default: 'http://validator.nu/') -" URL of the service to use for checking; leave it to the default to run the -" checks against http://validator.nu/, or set it to 'http://localhost:8888/' -" if you're running a local service as per http://about.validator.nu/#src -" -" - g:syntastic_html_validator_parser (string; default: empty) -" parser to use; legal values are: xml, xmldtd, html, html5, html4, html4tr; -" set it to 'html5' to check HTML5 files; see the wiki for reference: -" http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#parser -" -" - g:syntastic_html_validator_nsfilter (string; default: empty) -" sets the nsfilter for the parser; see the wiki for details: -" http://wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#nsfilter - -if exists("g:loaded_syntastic_html_validator_checker") - finish -endif -let g:loaded_syntastic_html_validator_checker=1 - -if !exists('g:syntastic_html_validator_api') - let g:syntastic_html_validator_api = 'http://validator.nu/' -endif - -if !exists('g:syntastic_html_validator_parser') - let g:syntastic_html_validator_parser = '' -endif - -if !exists('g:syntastic_html_validator_nsfilter') - let g:syntastic_html_validator_nsfilter = '' -endif - -let s:decoder = 'awk -f ' . syntastic#util#shescape(expand(':p:h') . '/validator_decode.awk') - -function! SyntaxCheckers_html_validator_IsAvailable() - return executable('curl') && executable('awk') -endfunction - -function! SyntaxCheckers_html_validator_GetLocList() - let makeprg = 'curl -s --compressed -F out=gnu -F asciiquotes=yes' . - \ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') . - \ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . - \ ' -F doc=@' . syntastic#util#shexpand('%') . '\;type=text/html\;filename=' . syntastic#util#shexpand('%') . ' ' . - \ g:syntastic_html_validator_api . ' \| ' . s:decoder - let errorformat = - \ '%E"%f":%l: %trror: %m,' . - \ '%E"%f":%l-%\d%\+: %trror: %m,' . - \ '%E"%f":%l%\%.%c: %trror: %m,' . - \ '%E"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: %trror: %m,' . - \ '%E"%f":%l: %trror fatal: %m,' . - \ '%E"%f":%l-%\d%\+: %trror fatal: %m,' . - \ '%E"%f":%l%\%.%c: %trror fatal: %m,' . - \ '%E"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: %trror fatal: %m,' . - \ '%W"%f":%l: info %tarning: %m,' . - \ '%W"%f":%l-%\d%\+: info %tarning: %m,' . - \ '%W"%f":%l%\%.%c: info %tarning: %m,' . - \ '%W"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: info %tarning: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'html', - \ 'name': 'validator'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/html/validator_decode.awk b/sources_non_forked/syntastic/syntax_checkers/html/validator_decode.awk deleted file mode 100644 index 71db8067..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/html/validator_decode.awk +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/awk -f -#============================================================================ -#File: validator_decode.awk -#Description: Helper script for validator.vim -#Maintainer: LCD 47 -#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. -# -#============================================================================ - -BEGIN { - FS = OFS = "\"" - hextab ["0"] = 0; hextab ["8"] = 8; - hextab ["1"] = 1; hextab ["9"] = 9; - hextab ["2"] = 2; hextab ["A"] = hextab ["a"] = 10 - hextab ["3"] = 3; hextab ["B"] = hextab ["b"] = 11; - hextab ["4"] = 4; hextab ["C"] = hextab ["c"] = 12; - hextab ["5"] = 5; hextab ["D"] = hextab ["d"] = 13; - hextab ["6"] = 6; hextab ["E"] = hextab ["e"] = 14; - hextab ["7"] = 7; hextab ["F"] = hextab ["f"] = 15; -} - -function urldecode (url) { - decoded = "" - i = 1 - len = length (url) - while ( i <= len ) { - c = substr (url, i, 1) - if ( c == "%" ) { - if ( i + 2 <= len ) { - c1 = substr (url, i + 1, 1) - c2 = substr (url, i + 2, 1) - if ( hextab [c1] != "" && hextab [c2] != "" ) { - code = 0 + hextab [c1] * 16 + hextab [c2] + 0 - c = sprintf ("%c", code) - } - else - c = c c1 c2 - i += 2 - } - else if ( i + 1 <= len ) { - c = substr (url, i, 2) - i++ - } - } - else if ( c == "+" ) - c = " " - decoded = decoded c - i++ - } - return decoded -} - -{ - $2 = urldecode($2) - gsub ("\\\\\"", "\"", $2) - print -} diff --git a/sources_non_forked/syntastic/syntax_checkers/html/w3.vim b/sources_non_forked/syntastic/syntax_checkers/html/w3.vim deleted file mode 100644 index 01c413cc..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/html/w3.vim +++ /dev/null @@ -1,65 +0,0 @@ -"============================================================================ -"File: w3.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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. -" -"============================================================================ -" -" Checker option: -" -" - g:syntastic_html_w3_api (string; default: 'http://validator.w3.org/check') -" URL of the service to use for checking; leave it to the default to run the -" checks against http://validator.w3.org/, or set it to -" 'http://localhost/w3c-validator/check' if you're running a local service - -if exists("g:loaded_syntastic_html_w3_checker") - finish -endif -let g:loaded_syntastic_html_w3_checker = 1 - -if !exists('g:syntastic_html_w3_api') - let g:syntastic_html_w3_api = 'http://validator.w3.org/check' -endif - -function! SyntaxCheckers_html_w3_IsAvailable() - return executable('curl') -endfunction - -function! SyntaxCheckers_html_w3_GetLocList() - let makeprg = 'curl -s -F output=json ' . - \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . - \ g:syntastic_html_w3_api - - let errorformat = - \ '%A %\+{,' . - \ '%C %\+"lastLine": %l\,%\?,' . - \ '%C %\+"lastColumn": %c\,%\?,' . - \ '%C %\+"message": "%m"\,%\?,' . - \ '%C %\+"type": "%trror"\,%\?,' . - \ '%-G %\+"type": "%tnfo"\,%\?,' . - \ '%C %\+"subtype": "%tarning"\,%\?,' . - \ '%Z %\+}\,,' . - \ '%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")}, - \ 'returns': [0] }) - - for n in range(len(loclist)) - let loclist[n]['text'] = substitute(loclist[n]['text'], '\\\([\"]\)', '\1', 'g') - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'html', - \ 'name': 'w3'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim b/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim deleted file mode 100644 index da32c65c..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/java/checkstyle.vim +++ /dev/null @@ -1,60 +0,0 @@ -"============================================================================ -"File: checkstyle.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Dmitry Geurkov -"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. -" -" Tested with checkstyle 5.5 -"============================================================================ -if exists("g:loaded_syntastic_java_checkstyle_checker") - finish -endif -let g:loaded_syntastic_java_checkstyle_checker=1 - -if !exists("g:syntastic_java_checkstyle_classpath") - let g:syntastic_java_checkstyle_classpath = 'checkstyle-5.5-all.jar' -endif - -if !exists("g:syntastic_java_checkstyle_conf_file") - let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml' -endif - -function! SyntaxCheckers_java_checkstyle_IsAvailable() - return executable('java') -endfunction - -function! SyntaxCheckers_java_checkstyle_GetLocList() - - let fname = fnameescape( expand('%:p:h') . '/' . expand('%:t') ) - - if has('win32unix') - let fname = substitute(system('cygpath -m ' . fname), '\%x00', '', 'g') - endif - - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'java', - \ 'args': '-cp ' . g:syntastic_java_checkstyle_classpath . - \ ' com.puppycrawl.tools.checkstyle.Main -c ' . g:syntastic_java_checkstyle_conf_file, - \ 'fname': fname, - \ 'filetype': 'java', - \ 'subchecker': 'checkstyle' }) - - let errorformat = - \ '%f:%l:%c:\ %m,' . - \ '%f:%l:\ %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['cygwinRemoveCR'] }) - -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'java', - \ 'name': 'checkstyle'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/java/javac.vim b/sources_non_forked/syntastic/syntax_checkers/java/javac.vim deleted file mode 100644 index 122a6368..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/java/javac.vim +++ /dev/null @@ -1,366 +0,0 @@ -"============================================================================ -"File: javac.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Jochen Keil -" Dmitry Geurkov -"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_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_properties = {} - -" Global Options -if !exists("g:syntastic_java_javac_executable") - let g:syntastic_java_javac_executable = 'javac' -endif - -if !exists("g:syntastic_java_maven_executable") - let g:syntastic_java_maven_executable = 'mvn' -endif - -if !exists("g:syntastic_java_javac_options") - let g:syntastic_java_javac_options = '-Xlint' -endif - -if !exists("g:syntastic_java_javac_classpath") - let g:syntastic_java_javac_classpath = '' -endif - -if !exists("g:syntastic_java_javac_delete_output") - let g:syntastic_java_javac_delete_output = 1 -endif - -function! s:CygwinPath(path) - return substitute(system("cygpath -m ".a:path), '\%x00', '', 'g') -endfunction - -if !exists("g:syntastic_java_javac_temp_dir") - if has('win32') || has('win64') - let g:syntastic_java_javac_temp_dir = $TEMP."\\vim-syntastic-javac" - elseif has('win32unix') - let g:syntastic_java_javac_temp_dir = s:CygwinPath('/tmp/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") - let g:syntastic_java_javac_autoload_maven_classpath = 1 -endif - -if !exists('g:syntastic_java_javac_config_file_enabled') - let g:syntastic_java_javac_config_file_enabled = 0 -endif - -if !exists('g:syntastic_java_javac_config_file') - let g:syntastic_java_javac_config_file = '.syntastic_javac_config' -endif - -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") - let g:syntastic_java_javac_maven_pom_classpath = {} -endif - -function! s:RemoveCarriageReturn(line) - return substitute(a:line, '\r', '', 'g') -endfunction - -" recursively remove directory and all it's sub-directories -function! s:RemoveDir(dir) - if isdirectory(a:dir) - for f in split(globpath(a:dir, '*'), "\n") - call s:RemoveDir(f) - endfor - silent! call system('rmdir ' . a:dir) - else - silent! call delete(a:dir) - endif -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 -endfunction - -function! s:LoadClasspathFromConfigFile() - if filereadable(g:syntastic_java_javac_config_file) - let path = '' - let lines = readfile(g:syntastic_java_javac_config_file) - for l in lines - if l != '' - let path .= l . "\n" - endif - endfor - return path - else - return '' - endif -endfunction - -function! s:SaveClasspath() - let path = '' - let lines = getline(1, line('$')) - " save classpath to config file - if g:syntastic_java_javac_config_file_enabled - call writefile(lines,g:syntastic_java_javac_config_file) - endif - for l in lines - if l != '' - let path .= l . "\n" - endif - endfor - let g:syntastic_java_javac_classpath = path - let &modified = 0 -endfunction - -function! s:EditClasspath() - let command = 'syntastic javac classpath' - let winnr = bufwinnr('^' . command . '$') - if winnr < 0 - let pathlist = split(g:syntastic_java_javac_classpath,"\n") - execute (len(pathlist) + 5) . 'sp ' . fnameescape(command) - - augroup syntastic - autocmd BufWriteCmd call s:SaveClasspath() | bwipeout - augroup END - - setlocal buftype=acwrite bufhidden=wipe nobuflisted noswapfile nowrap number - for p in pathlist - call append(line('$') - 1, p) - endfor - else - execute winnr . 'wincmd w' - endif -endfunction - -function! s:GetMavenProperties() - let mvn_properties = {} - let pom = findfile("pom.xml", ".;") - if filereadable(pom) - if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) - let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom - let mvn_is_managed_tag = 1 - let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n") - let current_path = 'project' - for line in mvn_settings_output - let matches = matchlist(line, '^\s*<\([a-zA-Z0-9\-\.]\+\)>\s*$') - if mvn_is_managed_tag && !empty(matches) - let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) >= 0 - let current_path .= '.' . matches[1] - else - let matches = matchlist(line, '^\s*\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, '\.' . matches[1] . "$", '', '') - else - let matches = matchlist(line, '^\s*<\([a-zA-Z0-9\-\.]\+\)>\(.\+\)\s*$') - if mvn_is_managed_tag && !empty(matches) - let mvn_properties[current_path . '.' . matches[1]] = matches[2] - endif - endif - endif - endfor - let g:syntastic_java_javac_maven_pom_properties[pom] = mvn_properties - endif - return g:syntastic_java_javac_maven_pom_properties[pom] - endif - return mvn_properties -endfunction - -command! SyntasticJavacEditClasspath call s:EditClasspath() - -function! s:GetMavenClasspath() - let pom = findfile("pom.xml", ".;") - if 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 = g:syntastic_java_maven_executable . ' -f ' . pom - let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") - let class_path_next = 0 - - for line in mvn_classpath_output - if class_path_next == 1 - let mvn_classpath = s:RemoveCarriageReturn(line) - break - endif - if match(line,'Dependencies classpath:') >= 0 - let class_path_next = 1 - endif - endfor - - let mvn_properties = s:GetMavenProperties() - - let output_dir = 'target/classes' - if has_key(mvn_properties, 'project.build.outputDirectory') - let output_dir = mvn_properties['project.build.outputDirectory'] - endif - let mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir) - - let test_output_dir = 'target/test-classes' - if has_key(mvn_properties, 'project.build.testOutputDirectory') - let test_output_dir = mvn_properties['project.build.testOutputDirectory'] - endif - let mvn_classpath = s:AddToClasspath(mvn_classpath, test_output_dir) - - let g:syntastic_java_javac_maven_pom_ftime[pom] = getftime(pom) - let g:syntastic_java_javac_maven_pom_classpath[pom] = mvn_classpath - endif - return g:syntastic_java_javac_maven_pom_classpath[pom] - endif - return '' -endfunction - -function! SyntaxCheckers_java_javac_IsAvailable() - return executable(g:syntastic_java_javac_executable) -endfunction - -function! s:MavenOutputDirectory() - let pom = findfile("pom.xml", ".;") - if 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 match(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 match(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'] - endif - endif - - if has('win32unix') - let output_dir=s:CygwinPath(output_dir) - endif - return output_dir - endif -endfunction - -function! SyntaxCheckers_java_javac_GetLocList() - - let javac_opts = g:syntastic_java_javac_options - - if g:syntastic_java_javac_delete_output - let output_dir = g:syntastic_java_javac_temp_dir - let javac_opts .= ' -d ' . output_dir - endif - - " load classpath from config file - if g:syntastic_java_javac_config_file_enabled - let loaded_classpath = s:LoadClasspathFromConfigFile() - if loaded_classpath != '' - let g:syntastic_java_javac_classpath = loaded_classpath - endif - endif - - let javac_classpath = '' - - " add classpathes to javac_classpath - for path in split(g:syntastic_java_javac_classpath,"\n") - if path != '' - try - let ps = glob(path,0,1) - catch - let ps = split(glob(path,0),"\n") - endtry - if type(ps) == type([]) - for p in ps - if p != '' - let javac_classpath = s:AddToClasspath(javac_classpath,p) - endif - endfor - else - let javac_classpath = s:AddToClasspath(javac_classpath,ps) - endif - endif - endfor - - if g:syntastic_java_javac_autoload_maven_classpath - if !g:syntastic_java_javac_delete_output - let maven_output_dir = s:MavenOutputDirectory() - let javac_opts .= ' -d ' . maven_output_dir - endif - let maven_classpath = s:GetMavenClasspath() - let javac_classpath = s:AddToClasspath(javac_classpath,maven_classpath) - endif - - if javac_classpath != '' - let javac_opts .= ' -cp "' . fnameescape(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' )) - - if has('win32unix') - let fname = s:CygwinPath(fname) - endif - - let makeprg = syntastic#makeprg#build({ - \ 'exe': g:syntastic_java_javac_executable, - \ 'args': javac_opts, - \ 'fname': fname, - \ 'tail': '2>&1', - \ 'filetype': 'java', - \ 'subchecker': 'javac' }) - - " unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types - let errorformat = - \ '%E%f:%l:\ error:\ %m,'. - \ '%W%f:%l:\ warning:\ %m,'. - \ '%A%f:%l:\ %m,'. - \ '%+Z%p^,'. - \ '%+C%.%#,'. - \ '%-G%.%#' - - if g:syntastic_java_javac_delete_output - silent! call mkdir(output_dir,'p') - endif - let errors = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': ['cygwinRemoveCR'] }) - - if g:syntastic_java_javac_delete_output - call s:RemoveDir(output_dir) - endif - return errors - -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'java', - \ 'name': 'javac'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim deleted file mode 100644 index 6c55f4f2..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/closurecompiler.vim +++ /dev/null @@ -1,66 +0,0 @@ -"============================================================================ -"File: closurecompiler.vim -"Description: Javascript syntax checker - using Google Closure Compiler -"Maintainer: Motohiro Takayama -"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. -"============================================================================ -" -" 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 - -function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() - return exists("g:syntastic_javascript_closure_compiler_path") -endfunction - -function! SyntaxCheckers_javascript_closurecompiler_GetLocList() - if exists("g:syntastic_javascript_closure_compiler_file_list") - let file_list = join(readfile(g:syntastic_javascript_closure_compiler_file_list), ' ') - else - let file_list = syntastic#util#shexpand('%') - endif - - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path, - \ 'args': g:syntastic_javascript_closure_compiler_options . ' --js' , - \ 'fname': file_list, - \ 'filetype': 'javascript', - \ 'subchecker': 'closurecompiler' }) - - let errorformat = - \ '%-GOK,'. - \ '%E%f:%l: ERROR - %m,'. - \ '%Z%p^,'. - \ '%W%f:%l: WARNING - %m,'. - \ '%Z%p^' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'javascript', - \ 'name': 'closurecompiler'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/gjslint.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/gjslint.vim deleted file mode 100644 index 039d0eed..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/gjslint.vim +++ /dev/null @@ -1,46 +0,0 @@ -"============================================================================ -"File: gjslint.vim -"Description: Javascript syntax checker - using gjslint -"Maintainer: Martin Grenfell -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -"============================================================================ -if exists("g:loaded_syntastic_javascript_gjslint_checker") - finish -endif -let g:loaded_syntastic_javascript_gjslint_checker=1 - -if !exists("g:syntastic_javascript_gjslint_conf") - let g:syntastic_javascript_gjslint_conf = "" -endif - -function! SyntaxCheckers_javascript_gjslint_IsAvailable() - return executable('gjslint') -endfunction - -function! SyntaxCheckers_javascript_gjslint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'gjslint', - \ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep", - \ 'filetype': 'javascript', - \ 'subchecker': 'gjslint' }) - - let errorformat = - \ "%f:%l:(New Error -%\\?\%n) %m," . - \ "%f:%l:(-%\\?%n) %m," . - \ "%-G1 files checked," . - \ " no errors found.," . - \ "%-G%.%#" - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'javascript', - \ 'name': 'gjslint'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/jshint.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/jshint.vim deleted file mode 100644 index e98e5628..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/jshint.vim +++ /dev/null @@ -1,55 +0,0 @@ -"============================================================================ -"File: jshint.vim -"Description: Javascript syntax checker - using jshint -"Maintainer: Martin Grenfell -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -"============================================================================ - -if exists("g:loaded_syntastic_javascript_jshint_checker") - finish -endif -let g:loaded_syntastic_javascript_jshint_checker=1 - -if !exists("g:syntastic_javascript_jshint_conf") - let g:syntastic_javascript_jshint_conf = "" -endif - -function! SyntaxCheckers_javascript_jshint_IsAvailable() - return executable('jshint') -endfunction - -function! SyntaxCheckers_javascript_jshint_GetLocList() - let jshint_new = s:JshintNew() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jshint', - \ 'post_args': (jshint_new ? ' --verbose ' : '') . s:Args(), - \ 'filetype': 'javascript', - \ 'subchecker': 'jshint' }) - - let errorformat = jshint_new ? - \ '%f: line %l\, col %c\, %m \(%t%*\d\)' : - \ '%E%f: line %l\, col %c\, %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr('')} }) -endfunction - -function s:JshintNew() - return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('jshint --version'), [1, 1]) -endfunction - -function s:Args() - " node-jshint uses .jshintrc as config unless --config arg is present - return !empty(g:syntastic_javascript_jshint_conf) ? ' --config ' . g:syntastic_javascript_jshint_conf : '' -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'javascript', - \ 'name': 'jshint'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/jsl.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/jsl.vim deleted file mode 100644 index bef1b89a..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/jsl.vim +++ /dev/null @@ -1,56 +0,0 @@ -"============================================================================ -"File: jsl.vim -"Description: Javascript syntax checker - using jsl -"Maintainer: Martin Grenfell -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -"============================================================================ -if exists("g:loaded_syntastic_javascript_jsl_checker") - finish -endif -let g:loaded_syntastic_javascript_jsl_checker=1 - -if !exists("g:syntastic_javascript_jsl_conf") - let g:syntastic_javascript_jsl_conf = "" -endif - -function s:ConfFlag() - if !empty(g:syntastic_javascript_jsl_conf) - return "-conf " . g:syntastic_javascript_jsl_conf - endif - - return "" -endfunction - -function! SyntaxCheckers_javascript_jsl_IsAvailable() - return executable('jsl') -endfunction - -function! SyntaxCheckers_javascript_jsl_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jsl', - \ 'args': s:ConfFlag() . " -nologo -nofilelisting -nosummary -nocontext -process", - \ 'filetype': 'javascript', - \ 'subchecker': 'jsl' }) - - let errorformat = - \ '%W%f(%l): lint warning: %m,'. - \ '%-Z%p^,'. - \ '%W%f(%l): warning: %m,'. - \ '%-Z%p^,'. - \ '%E%f(%l): SyntaxError: %m,'. - \ '%-Z%p^,'. - \ '%-G' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'javascript', - \ 'name': 'jsl'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/javascript/jslint.vim b/sources_non_forked/syntastic/syntax_checkers/javascript/jslint.vim deleted file mode 100644 index ab6469d4..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/javascript/jslint.vim +++ /dev/null @@ -1,53 +0,0 @@ -"============================================================================ -"File: jslint.vim -"Description: Javascript syntax checker - using jslint -"Maintainer: Martin Grenfell -"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. -" -"Tested with jslint 0.1.4. -"============================================================================ -if exists("g:loaded_syntastic_javascript_jslint_checker") - finish -endif -let g:loaded_syntastic_javascript_jslint_checker=1 - -if !exists("g:syntastic_javascript_jslint_conf") - let g:syntastic_javascript_jslint_conf = "--white --undef --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars" -endif - -function! SyntaxCheckers_javascript_jslint_IsAvailable() - return executable('jslint') -endfunction - -function! SyntaxCheckers_javascript_jslint_HighlightTerm(error) - let unexpected = matchstr(a:error['text'], 'Expected.*and instead saw \'\zs.*\ze\'') - if len(unexpected) < 1 | return '' | end - return '\V'.split(unexpected, "'")[1] -endfunction - -function! SyntaxCheckers_javascript_jslint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jslint', - \ 'args': g:syntastic_javascript_jslint_conf, - \ 'filetype': 'javascript', - \ 'subchecker': 'jslint' }) - - let errorformat = - \ '%E %##%n %m,'. - \ '%-Z%.%#Line %l\, Pos %c,'. - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'javascript', - \ 'name': 'jslint'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/json/jsonlint.vim b/sources_non_forked/syntastic/syntax_checkers/json/jsonlint.vim deleted file mode 100644 index 7c6b34d5..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/json/jsonlint.vim +++ /dev/null @@ -1,43 +0,0 @@ -"============================================================================ -"File: jsonlint.vim -"Description: JSON syntax checker - using jsonlint -"Maintainer: Miller Medeiros -"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_json_jsonlint_checker") - finish -endif -let g:loaded_syntastic_json_jsonlint_checker=1 - -function! SyntaxCheckers_json_jsonlint_IsAvailable() - return executable('jsonlint') -endfunction - -function! SyntaxCheckers_json_jsonlint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jsonlint', - \ 'post_args': '--compact', - \ 'filetype': 'json', - \ 'subchecker': 'jsonlint' }) - - let errorformat = - \ '%ELine %l:%c,'. - \ '%Z\\s%#Reason: %m,'. - \ '%C%.%#,'. - \ '%f: line %l\, col %c\, %m,'. - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr('')} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'json', - \ 'name': 'jsonlint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/json/jsonval.vim b/sources_non_forked/syntastic/syntax_checkers/json/jsonval.vim deleted file mode 100644 index 4359e86c..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/json/jsonval.vim +++ /dev/null @@ -1,40 +0,0 @@ -"============================================================================ -"File: jsonval.vim -"Description: JSON syntax checker - using jsonval -"Maintainer: Miller Medeiros -"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_json_jsonval_checker") - finish -endif -let g:loaded_syntastic_json_jsonval_checker=1 - -function! SyntaxCheckers_json_jsonval_IsAvailable() - return executable('jsonval') -endfunction - -function! SyntaxCheckers_json_jsonval_GetLocList() - " based on https://gist.github.com/1196345 - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jsonval', - \ 'filetype': 'json', - \ 'subchecker': 'jsonval' }) - - let errorformat = - \ '%E%f:\ %m\ at\ line\ %l,' . - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr('')} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'json', - \ 'name': 'jsonval'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/less/less-lint.coffee b/sources_non_forked/syntastic/syntax_checkers/less/less-lint.coffee deleted file mode 100644 index 0b05e4a7..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/less/less-lint.coffee +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env node - -fs = require 'fs' -less = require 'less' -args = process.argv.slice(1) -options = {} - -args = args.filter (arg) -> - match = arg.match(/^-I(.+)$/) - if match - options.paths.push(match[1]); - return false - - match = arg.match(/^--?([a-z][\-0-9a-z]*)(?:=([^\s]+))?$/i) - if match - arg = match[1] - else - return arg - - switch arg - when 'strict-imports' then options.strictImports = true - when 'include-path' - options.paths = match[2].split(if os.type().match(/Windows/) then ';' else ':') - .map (p) -> - if p - return path.resolve(process.cwd(), p) - when 'O0' then options.optimization = 0 - when 'O1' then options.optimization = 1 - when 'O2' then options.optimization = 2 - -options.filename = args[1] - -parser = new(less.Parser) options - -fs.readFile(options.filename, 'utf-8', (err,data) -> - parser.parse(data, (err, tree) -> - if err - less.writeError err - process.exit(1) - ) -) diff --git a/sources_non_forked/syntastic/syntax_checkers/less/less-lint.js b/sources_non_forked/syntastic/syntax_checkers/less/less-lint.js deleted file mode 100644 index 5abc653c..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/less/less-lint.js +++ /dev/null @@ -1,57 +0,0 @@ -// Generated by CoffeeScript 1.3.3 -(function() { - var args, fs, less, options, parser; - - fs = require('fs'); - - less = require('less'); - - args = process.argv.slice(1); - - options = {}; - - args = args.filter(function(arg) { - var match; - match = arg.match(/^-I(.+)$/); - if (match) { - options.paths.push(match[1]); - return false; - } - match = arg.match(/^--?([a-z][\-0-9a-z]*)(?:=([^\s]+))?$/i); - if (match) { - arg = match[1]; - } else { - return arg; - } - switch (arg) { - case 'strict-imports': - return options.strictImports = true; - case 'include-path': - return options.paths = match[2].split(os.type().match(/Windows/) ? ';' : ':').map(function(p) { - if (p) { - return path.resolve(process.cwd(), p); - } - }); - case 'O0': - return options.optimization = 0; - case 'O1': - return options.optimization = 1; - case 'O2': - return options.optimization = 2; - } - }); - - options.filename = args[1]; - - parser = new less.Parser(options); - - fs.readFile(options.filename, 'utf-8', function(err, data) { - return parser.parse(data, function(err, tree) { - if (err) { - less.writeError(err); - return process.exit(1); - } - }); - }); - -}).call(this); diff --git a/sources_non_forked/syntastic/syntax_checkers/less/lessc.vim b/sources_non_forked/syntastic/syntax_checkers/less/lessc.vim deleted file mode 100644 index 001be351..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/less/lessc.vim +++ /dev/null @@ -1,61 +0,0 @@ -"============================================================================ -"File: less.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Julien Blanchard -"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. -" -"============================================================================ - -" To send additional options to less use the variable g:syntastic_less_options. -" The default is -" let g:syntastic_less_options = "--no-color" -" -" To use less-lint instead of less set the variable -" g:syntastic_less_use_less_lint. - -if exists("g:loaded_syntastic_less_lessc_checker") - finish -endif -let g:loaded_syntastic_less_lessc_checker=1 - -if !exists("g:syntastic_less_options") - let g:syntastic_less_options = "--no-color" -endif - -if !exists("g:syntastic_less_use_less_lint") - let g:syntastic_less_use_less_lint = 0 -endif - -if g:syntastic_less_use_less_lint - let s:check_file = 'node ' . expand(':p:h') . '/less-lint.js' -else - let s:check_file = 'lessc' -end - -function! SyntaxCheckers_less_lessc_IsAvailable() - return executable('lessc') -endfunction - -function! SyntaxCheckers_less_lessc_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': s:check_file, - \ 'args': g:syntastic_less_options, - \ 'tail': syntastic#util#DevNull(), - \ 'filetype': 'less', - \ 'subchecker': 'lessc' }) - - let errorformat = '%m in %f:%l:%c' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'less', - \ 'name': 'lessc'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/lisp/clisp.vim b/sources_non_forked/syntastic/syntax_checkers/lisp/clisp.vim deleted file mode 100644 index caf094f1..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/lisp/clisp.vim +++ /dev/null @@ -1,47 +0,0 @@ -"============================================================================ -"File: lisp.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Karl Yngve Lervåg -"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_lisp_clisp_checker") - finish -endif -let g:loaded_syntastic_lisp_clisp_checker=1 - -function! SyntaxCheckers_lisp_clisp_IsAvailable() - return executable("clisp") -endfunction - -function! SyntaxCheckers_lisp_clisp_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'clisp', - \ 'args': '-q -c', - \ 'tail': '-o /tmp/clisp-vim-compiled-file', - \ 'filetype': 'lisp', - \ 'subchecker': 'clisp' }) - - let errorformat = - \ '%-G;%.%#,' . - \ '%W%>WARNING:%.%#line %l : %m,' . - \ '%Z %#%m,' . - \ '%W%>WARNING:%.%#lines %l..%\d\# : %m,' . - \ '%Z %#%m,' . - \ '%E%>The following functions were %m,' . - \ '%Z %m,' . - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr('')} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'lisp', - \ 'name': 'clisp'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/llvm/llvm.vim b/sources_non_forked/syntastic/syntax_checkers/llvm/llvm.vim deleted file mode 100644 index ea4fa04b..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/llvm/llvm.vim +++ /dev/null @@ -1,38 +0,0 @@ -"============================================================================ -"File: llvm.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Andrew Kelley -"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_llvm_llvm_checker") - finish -endif -let g:loaded_syntastic_llvm_llvm_checker=1 - -function! SyntaxCheckers_llvm_llvm_IsAvailable() - return executable("llc") -endfunction - -function! SyntaxCheckers_llvm_llvm_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'llc', - \ 'args': syntastic#c#GetNullDevice(), - \ 'filetype': 'llvm', - \ 'subchecker': 'llvm' }) - - let errorformat = 'llc: %f:%l:%c: %trror: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'llvm', - \ 'name': 'llvm'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/lua/luac.vim b/sources_non_forked/syntastic/syntax_checkers/lua/luac.vim deleted file mode 100644 index c26e520a..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/lua/luac.vim +++ /dev/null @@ -1,64 +0,0 @@ -"============================================================================ -"File: lua.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Gregor Uhlenheuer -"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_lua_luac_checker") - finish -endif -let g:loaded_syntastic_lua_luac_checker=1 - -function! SyntaxCheckers_lua_luac_IsAvailable() - return executable('luac') -endfunction - -function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) - let near = matchstr(a:pos['text'], "near '[^']\\+'") - let result = '' - if len(near) > 0 - let near = split(near, "'")[1] - if near == '' - let p = getpos('$') - let a:pos['lnum'] = p[1] - let a:pos['col'] = p[2] - let result = '\%'.p[2].'c' - else - let result = '\V'.near - endif - let open = matchstr(a:pos['text'], "(to close '[^']\\+' at line [0-9]\\+)") - if len(open) > 0 - let oline = split(open, "'")[1:2] - let line = 0+strpart(oline[1], 9) - call matchadd('SpellCap', '\%'.line.'l\V'.oline[0]) - endif - endif - return result -endfunction - - -function! SyntaxCheckers_lua_luac_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'luac', - \ 'args': '-p', - \ 'filetype': 'lua', - \ 'subchecker': 'luac' }) - - let errorformat = 'luac: %#%f:%l: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } }) - -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'lua', - \ 'name': 'luac'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/matlab/mlint.vim b/sources_non_forked/syntastic/syntax_checkers/matlab/mlint.vim deleted file mode 100644 index 380d22c8..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/matlab/mlint.vim +++ /dev/null @@ -1,41 +0,0 @@ -"============================================================================ -"File: matlab.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Jason Graham -"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_matlab_mlint_checker") - finish -endif -let g:loaded_syntastic_matlab_mlint_checker=1 - -function! SyntaxCheckers_matlab_mlint_IsAvailable() - return executable("mlint") -endfunction - -function! SyntaxCheckers_matlab_mlint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'mlint', - \ 'args': '-id $*', - \ 'filetype': 'matlab', - \ 'subchecker': 'mlint' }) - - let errorformat = - \ 'L %l (C %c): %*[a-zA-Z0-9]: %m,'. - \ 'L %l (C %c-%*[0-9]): %*[a-zA-Z0-9]: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'matlab', - \ 'name': 'mlint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim b/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim deleted file mode 100644 index 9c6195cf..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/nasm/nasm.vim +++ /dev/null @@ -1,38 +0,0 @@ -"============================================================================ -"File: nasm.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Håvard Pettersson -"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_nasm_nasm_checker") - finish -endif -let g:loaded_syntastic_nasm_nasm_checker=1 - -function! SyntaxCheckers_nasm_nasm_IsAvailable() - return executable("nasm") -endfunction - -function! SyntaxCheckers_nasm_nasm_GetLocList() - let wd = syntastic#util#shescape(expand("%:p:h") . "/") - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'nasm', - \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#GetNullDevice() - \ 'filetype': 'nasm', - \ 'subchecker': 'nasm' }) - - let errorformat = '%f:%l: %t%*[^:]: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'nasm', - \ 'name': 'nasm'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/nroff/mandoc.vim b/sources_non_forked/syntastic/syntax_checkers/nroff/mandoc.vim deleted file mode 100644 index 3333d24e..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/nroff/mandoc.vim +++ /dev/null @@ -1,41 +0,0 @@ -"============================================================================ -"File: mandoc.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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_nroff_mandoc_checker") - finish -endif -let g:loaded_syntastic_nroff_mandoc_checker=1 - -function! SyntaxCheckers_nroff_mandoc_IsAvailable() - return executable("mandoc") -endfunction - -function! SyntaxCheckers_nroff_mandoc_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'mandoc', - \ 'args': '-Tlint', - \ 'filetype': 'nroff', - \ 'subchecker': 'mandoc' }) - - let errorformat = - \ '%E%f:%l:%c: %tRROR: %m,' . - \ '%W%f:%l:%c: %tARNING: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'returns': [0, 2, 3, 4] }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'nroff', - \ 'name': 'mandoc'}) - diff --git a/sources_non_forked/syntastic/syntax_checkers/objc/gcc.vim b/sources_non_forked/syntastic/syntax_checkers/objc/gcc.vim deleted file mode 100644 index e16822f3..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/objc/gcc.vim +++ /dev/null @@ -1,184 +0,0 @@ -"============================================================================ -"File: objc.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Gregor Uhlenheuer -"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. -" -"============================================================================ - -" In order to also check header files add this to your .vimrc: -" (this usually creates a .gch file in your source directory) -" -" let g:syntastic_objc_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_objc_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_objc_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_objc_includes. Then the header files are being re-checked on -" the next file write. -" -" let g:syntastic_objc_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_objc_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_objc_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" gcc command line you can add those to the global variable -" g:syntastic_objc_include_dirs. This list can be used like this: -" -" let g:syntastic_objc_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_objc_compiler_options': -" -" let g:syntastic_objc_compiler_options = ' -ansi' -" -" Additionally the setting 'g:syntastic_objc_config_file' allows you to define a -" file that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_objc_config': -" -" let g:syntastic_objc_config_file = '.config' -" -" Using the global variable 'g:syntastic_objc_remove_include_errors' you can -" specify whether errors of files included via the g:syntastic_objc_include_dirs' -" setting are removed from the result set: -" -" let g:syntastic_objc_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_objc_errorformat' to override the default error -" format: -" -" let g:syntastic_objc_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to gcc) -" -" let g:syntastic_objc_compiler = 'clang' - -if exists('g:loaded_syntastic_objc_gcc_checker') - finish -endif -let g:loaded_syntastic_objc_gcc_checker = 1 - -if !exists('g:syntastic_objc_compiler') - let g:syntastic_objc_compiler = 'gcc' -endif - -function! SyntaxCheckers_objc_gcc_IsAvailable() - return executable(g:syntastic_objc_compiler) -endfunction - -let s:save_cpo = &cpo -set cpo&vim - -if !exists('g:syntastic_objc_compiler_options') - let g:syntastic_objc_compiler_options = '-std=gnu99' -endif - -if !exists('g:syntastic_objc_config_file') - let g:syntastic_objc_config_file = '.syntastic_objc_config' -endif - -function! SyntaxCheckers_objc_gcc_GetLocList() - let makeprg = g:syntastic_objc_compiler . ' -x objective-c -fsyntax-only -lobjc' - let errorformat = - \ '%-G%f:%s:,' . - \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . - \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . - \ '%-GIn file included%.%#,'. - \ '%-G %#from %f:%l\,,' . - \ '%f:%l:%c: %trror: %m,' . - \ '%f:%l:%c: %tarning: %m,' . - \ '%f:%l:%c: %m,' . - \ '%f:%l: %trror: %m,' . - \ '%f:%l: %tarning: %m,' . - \ '%f:%l: %m' - - if exists('g:syntastic_objc_errorformat') - let errorformat = g:syntastic_objc_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_objc_compiler_options - - let makeprg .= ' ' . syntastic#util#shexpand('%') . - \ ' ' . syntastic#c#GetIncludeDirs('objc') - - " determine whether to parse header files as well - if expand('%') =~? '\.h$' - if exists('g:syntastic_objc_check_header') - let makeprg = g:syntastic_objc_compiler . - \ ' -x objective-c-header ' . - \ ' -c ' . syntastic#util#shexpand('%') . - \ ' ' . g:syntastic_objc_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs('objc') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_objc_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_objc_no_include_search') || - \ g:syntastic_objc_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_objc_auto_refresh_includes') && - \ g:syntastic_objc_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_objc_includes') - let b:syntastic_objc_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_objc_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_objc_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_objc_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_objc_remove_include_errors') && - \ g:syntastic_objc_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'objc', - \ 'name': 'gcc'}) - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/objc/oclint.vim b/sources_non_forked/syntastic/syntax_checkers/objc/oclint.vim deleted file mode 100644 index 0ebd6612..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/objc/oclint.vim +++ /dev/null @@ -1,36 +0,0 @@ -"============================================================================ -"File: oclint.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: "UnCO" Lin -"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. -"============================================================================ -" -" The setting 'g:syntastic_oclint_config_file' allows you to define a file -" that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_oclint_config': -" -" let g:syntastic_oclint_config_file = '.config' - -if exists("g:loaded_syntastic_objc_oclint_checker") - finish -endif -let g:loaded_syntastic_objc_oclint_checker = 1 - -function! SyntaxCheckers_objc_oclint_IsAvailable() - return SyntaxCheckers_c_oclint_IsAvailable() -endfunction - -function! SyntaxCheckers_objc_oclint_GetLocList() - return SyntaxCheckers_c_oclint_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'objc', - \ 'name': 'oclint'}) - -runtime! syntax_checkers/c/*.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/objc/ycm.vim b/sources_non_forked/syntastic/syntax_checkers/objc/ycm.vim deleted file mode 100644 index 40f53fb4..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/objc/ycm.vim +++ /dev/null @@ -1,34 +0,0 @@ -"============================================================================ -"File: ycm.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Val Markovic -"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_objc_ycm_checker") - finish -endif -let g:loaded_syntastic_objc_ycm_checker = 1 - -runtime! syntax_checkers/c/*.vim - -function! SyntaxCheckers_objc_ycm_IsAvailable() - return SyntaxCheckers_c_ycm_IsAvailable() -endfunction - -if !exists('g:loaded_youcompleteme') - finish -endif - -function! SyntaxCheckers_objc_ycm_GetLocList() - return SyntaxCheckers_c_ycm_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'objc', - \ 'name': 'ycm'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/objcpp/gcc.vim b/sources_non_forked/syntastic/syntax_checkers/objcpp/gcc.vim deleted file mode 100644 index 889a5973..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/objcpp/gcc.vim +++ /dev/null @@ -1,184 +0,0 @@ -"============================================================================ -"File: objcpp.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Gregor Uhlenheuer -"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. -" -"============================================================================ - -" In order to also check header files add this to your .vimrc: -" (this usually creates a .gch file in your source directory) -" -" let g:syntastic_objcpp_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_objcpp_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_objcpp_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_objcpp_includes. Then the header files are being re-checked on -" the next file write. -" -" let g:syntastic_objcpp_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_objcpp_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_objcpp_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" gcc command line you can add those to the global variable -" g:syntastic_objcpp_include_dirs. This list can be used like this: -" -" let g:syntastic_objcpp_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_objcpp_compiler_options': -" -" let g:syntastic_objcpp_compiler_options = ' -ansi' -" -" Additionally the setting 'g:syntastic_objcpp_config_file' allows you to define a -" file that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_objcpp_config': -" -" let g:syntastic_objcpp_config_file = '.config' -" -" Using the global variable 'g:syntastic_objcpp_remove_include_errors' you can -" specify whether errors of files included via the g:syntastic_objcpp_include_dirs' -" setting are removed from the result set: -" -" let g:syntastic_objcpp_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_objcpp_errorformat' to override the default error -" format: -" -" let g:syntastic_objcpp_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to gcc) -" -" let g:syntastic_objcpp_compiler = 'clang' - -if exists('g:loaded_syntastic_objcpp_gcc_checker') - finish -endif -let g:loaded_syntastic_objcpp_gcc_checker = 1 - -if !exists('g:syntastic_objcpp_compiler') - let g:syntastic_objcpp_compiler = 'gcc' -endif - -function! SyntaxCheckers_objcpp_gcc_IsAvailable() - return executable(g:syntastic_objcpp_compiler) -endfunction - -let s:save_cpo = &cpo -set cpo&vim - -if !exists('g:syntastic_objcpp_compiler_options') - let g:syntastic_objcpp_compiler_options = '-std=gnu99' -endif - -if !exists('g:syntastic_objcpp_config_file') - let g:syntastic_objcpp_config_file = '.syntastic_objcpp_config' -endif - -function! SyntaxCheckers_objcpp_gcc_GetLocList() - let makeprg = g:syntastic_objcpp_compiler . ' -x objective-c++ -fsyntax-only -lobjc' - let errorformat = - \ '%-G%f:%s:,' . - \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . - \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . - \ '%-GIn file included%.%#,'. - \ '%-G %#from %f:%l\,,' . - \ '%f:%l:%c: %trror: %m,' . - \ '%f:%l:%c: %tarning: %m,' . - \ '%f:%l:%c: %m,' . - \ '%f:%l: %trror: %m,' . - \ '%f:%l: %tarning: %m,' . - \ '%f:%l: %m' - - if exists('g:syntastic_objcpp_errorformat') - let errorformat = g:syntastic_objcpp_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_objcpp_compiler_options - - let makeprg .= ' ' . syntastic#util#shexpand('%') . - \ ' ' . syntastic#c#GetIncludeDirs('objcpp') - - " determine whether to parse header files as well - if expand('%') =~? '\.h$' - if exists('g:syntastic_objcpp_check_header') - let makeprg = g:syntastic_objcpp_compiler . - \ ' -x objective-c++-header ' . - \ ' -c ' . syntastic#util#shexpand('%') . - \ ' ' . g:syntastic_objcpp_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs('objcpp') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_objcpp_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_objcpp_no_include_search') || - \ g:syntastic_objcpp_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_objcpp_auto_refresh_includes') && - \ g:syntastic_objcpp_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_objcpp_includes') - let b:syntastic_objcpp_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_objcpp_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_objcpp_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_objcpp_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_objcpp_remove_include_errors') && - \ g:syntastic_objcpp_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'objcpp', - \ 'name': 'gcc'}) - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4: diff --git a/sources_non_forked/syntastic/syntax_checkers/objcpp/oclint.vim b/sources_non_forked/syntastic/syntax_checkers/objcpp/oclint.vim deleted file mode 100644 index a46fe045..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/objcpp/oclint.vim +++ /dev/null @@ -1,36 +0,0 @@ -"============================================================================ -"File: oclint.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: "UnCO" Lin -"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. -"============================================================================ -" -" The setting 'g:syntastic_oclint_config_file' allows you to define a file -" that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_oclint_config': -" -" let g:syntastic_oclint_config_file = '.config' - -if exists("g:loaded_syntastic_objcpp_oclint_checker") - finish -endif -let g:loaded_syntastic_objcpp_oclint_checker = 1 - -function! SyntaxCheckers_objcpp_oclint_IsAvailable() - return SyntaxCheckers_c_oclint_IsAvailable() -endfunction - -function! SyntaxCheckers_objcpp_oclint_GetLocList() - return SyntaxCheckers_c_oclint_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'objcpp', - \ 'name': 'oclint'}) - -runtime! syntax_checkers/c/*.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/objcpp/ycm.vim b/sources_non_forked/syntastic/syntax_checkers/objcpp/ycm.vim deleted file mode 100644 index c9a0e458..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/objcpp/ycm.vim +++ /dev/null @@ -1,34 +0,0 @@ -"============================================================================ -"File: ycm.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Val Markovic -"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_objcpp_ycm_checker") - finish -endif -let g:loaded_syntastic_objcpp_ycm_checker = 1 - -runtime! syntax_checkers/c/*.vim - -function! SyntaxCheckers_objcpp_ycm_IsAvailable() - return SyntaxCheckers_c_ycm_IsAvailable() -endfunction - -if !exists('g:loaded_youcompleteme') - finish -endif - -function! SyntaxCheckers_objcpp_ycm_GetLocList() - return SyntaxCheckers_c_ycm_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'objcpp', - \ 'name': 'ycm'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim b/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim deleted file mode 100644 index ebec5cb7..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/ocaml/camlp4o.vim +++ /dev/null @@ -1,149 +0,0 @@ -"============================================================================ -"File: ocaml.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Török Edwin -"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. -" -"============================================================================ -" -" The more reliable way to check for a single .ml file is to use ocamlc. -" You can do that setting this in your .vimrc: -" -" let g:syntastic_ocaml_use_ocamlc = 1 -" It's possible to use ocamlc in conjuction with Jane Street's Core. In order -" to do that, you have to specify this in your .vimrc: -" -" let g:syntastic_ocaml_use_janestreet_core = 1 -" let g:syntastic_ocaml_janestreet_core_dir = -" -" Where path is the path to your core installation (usually a collection of -" .cmx and .cmxa files). -" -" -" By default the camlp4o preprocessor is used to check the syntax of .ml, and .mli files, -" ocamllex is used to check .mll files and menhir is used to check .mly files. -" The output is all redirected to /dev/null, nothing is written to the disk. -" -" If your source code needs camlp4r then you can define this in your .vimrc: -" -" let g:syntastic_ocaml_camlp4r = 1 -" -" If you used some syntax extensions, or you want to also typecheck the source -" code, then you can define this: -" -" let g:syntastic_ocaml_use_ocamlbuild = 1 -" -" This will run ocamlbuild .inferred.mli, so it will write to your _build -" directory (and possibly rebuild your myocamlbuild.ml plugin), only enable this -" if you are ok with that. -" -" If you are using syntax extensions / external libraries and have a properly -" set up _tags (and myocamlbuild.ml file) then it should just work -" to enable this flag and get syntax / type checks through syntastic. -" -" For best results your current directory should be the project root -" (same situation if you want useful output from :make). - -if exists("g:loaded_syntastic_ocaml_camlp4o_checker") - finish -endif -let g:loaded_syntastic_ocaml_camlp4o_checker=1 - -if exists('g:syntastic_ocaml_camlp4r') && - \ g:syntastic_ocaml_camlp4r != 0 - let s:ocamlpp="camlp4r" -else - let s:ocamlpp="camlp4o" -endif - -function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() - return executable(s:ocamlpp) -endfunction - -if !exists('g:syntastic_ocaml_use_ocamlc') || !executable('ocamlc') - let g:syntastic_ocaml_use_ocamlc = 0 -endif - -if !exists('g:syntastic_ocaml_use_janestreet_core') - let g:syntastic_ocaml_use_ocamlc = 0 -endif - -if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable("ocamlbuild") - let g:syntastic_ocaml_use_ocamlbuild = 0 -endif - -function! SyntaxCheckers_ocaml_camlp4o_GetLocList() - let makeprg = s:GetMakeprg() - if makeprg == "" - return [] - endif - - let errorformat = - \ '%AFile "%f"\, line %l\, characters %c-%*\d:,'. - \ '%AFile "%f"\, line %l\, characters %c-%*\d (end at line %*\d\, character %*\d):,'. - \ '%AFile "%f"\, line %l\, character %c:,'. - \ '%AFile "%f"\, line %l\, character %c:%m,'. - \ '%-GPreprocessing error %.%#,'. - \ '%-GCommand exited %.%#,'. - \ '%C%tarning %n: %m,'. - \ '%C%m,'. - \ '%-G+%.%#' - - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) -endfunction - -function s:GetMakeprg() - if g:syntastic_ocaml_use_ocamlc - return s:GetOcamlcMakeprg() - endif - - if g:syntastic_ocaml_use_ocamlbuild && isdirectory('_build') - return s:GetOcamlBuildMakeprg() - endif - - return s:GetOtherMakeprg() -endfunction - -function s:GetOcamlcMakeprg() - if g:syntastic_ocaml_use_janestreet_core - let build_cmd = "ocamlc -I " - let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir) - let build_cmd .= " -c " . syntastic#util#shexpand('%') - return build_cmd - else - return "ocamlc -c " . syntastic#util#shexpand('%') - endif -endfunction - -function s:GetOcamlBuildMakeprg() - return "ocamlbuild -quiet -no-log -tag annot," . s:ocamlpp . " -no-links -no-hygiene -no-sanitize " . - \ syntastic#util#shexpand('%:r') . ".cmi" -endfunction - -function s:GetOtherMakeprg() - "TODO: give this function a better name? - " - "TODO: should use throw/catch instead of returning an empty makeprg - - let extension = expand('%:e') - let makeprg = "" - - if match(extension, 'mly') >= 0 && executable("menhir") - " ocamlyacc output can't be redirected, so use menhir - let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull() - elseif match(extension,'mll') >= 0 && executable("ocamllex") - let makeprg = "ocamllex -q " . syntastic#c#GetNullDevice() . " " . syntastic#util#shexpand('%') - else - let makeprg = "camlp4o " . syntastic#c#GetNullDevice() . " " . syntastic#util#shexpand('%') - endif - - return makeprg -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'ocaml', - \ 'name': 'camlp4o'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/perl/efm_perl.pl b/sources_non_forked/syntastic/syntax_checkers/perl/efm_perl.pl deleted file mode 100644 index 2e74bcb0..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/perl/efm_perl.pl +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env perl -# vimparse.pl - Reformats the error messages of the Perl interpreter for use -# with the quickfix mode of Vim -# -# Copyright (c) 2001 by Jörg Ziefle -# Copyright (c) 2012 Eric Harmon -# You may use and distribute this software under the same terms as Perl itself. -# -# Usage: put one of the two configurations below in your ~/.vimrc (without the -# description and '# ') and enjoy (be sure to adjust the paths to vimparse.pl -# before): -# -# Program is run interactively with 'perl -w': -# -# set makeprg=$HOME/bin/vimparse.pl\ %\ $* -# set errorformat=%t:%f:%l:%m -# -# Program is only compiled with 'perl -wc': -# -# set makeprg=$HOME/bin/vimparse.pl\ -c\ %\ $* -# set errorformat=%t:%f:%l:%m -# -# Usage: -# vimparse.pl [-c] [-w] [-f ] [programargs] -# -# -c compile only, don't run (perl -wc) -# -w output warnings as warnings instead of errors (slightly slower) -# -f write errors to -# -# Example usages: -# * From the command line: -# vimparse.pl program.pl -# -# vimparse.pl -c -w -f errorfile program.pl -# Then run vim -q errorfile to edit the errors with Vim. -# This uses the custom errorformat: %t:%f:%l:%m. -# -# * From Vim: -# Edit in Vim (and save, if you don't have autowrite on), then -# type ':mak' or ':mak args' (args being the program arguments) -# to error check. -# -# Version history: -# 0.3 (05/31/2012): -# * Added support for the seperate display of warnings -# * Switched output format to %t:%f:%l:%m to support error levels -# 0.2 (04/12/2001): -# * First public version (sent to Bram) -# * -c command line option for compiling only -# * grammatical fix: 'There was 1 error.' -# * bug fix for multiple arguments -# * more error checks -# * documentation (top of file, &usage) -# * minor code clean ups -# 0.1 (02/02/2001): -# * Initial version -# * Basic functionality -# -# Todo: -# * test on more systems -# * use portable way to determine the location of perl ('use Config') -# * include option that shows perldiag messages for each error -# * allow to pass in program by STDIN -# * more intuitive behaviour if no error is found (show message) -# -# Tested under SunOS 5.7 with Perl 5.6.0. Let me know if it's not working for -# you. -use warnings; -use strict; -use Getopt::Std; -use File::Temp qw( tempfile ); - -use vars qw/$opt_I $opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars' - -use constant VERSION => 0.2; - -getopts('cwf:hI:'); - -&usage if $opt_h; # not necessarily needed, but good for further extension - -if (defined $opt_f) { - - open FILE, "> $opt_f" or do { - warn "Couldn't open $opt_f: $!. Using STDOUT instead.\n"; - undef $opt_f; - }; - -}; - -my $handle = (defined $opt_f ? \*FILE : \*STDOUT); - -(my $file = shift) or &usage; # display usage if no filename is supplied -my $args = (@ARGV ? ' ' . join ' ', @ARGV : ''); - -if ($file eq '-') { # make STDIN seek-able, so it can be read twice - my $fh = tempfile(); - print {$fh} ; - open \*STDIN, '<&', $fh or die "open: $!"; - seek \*STDIN, 0, 0 or die "seek: $!"; -} - -my $libs = join ' ', map {"-I$_"} split ',', $opt_I || ''; -my @error_lines = `$^X $libs @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-Mwarnings ']} "$file$args" 2>&1`; - -my @lines = map { "E:$_" } @error_lines; - -my @warn_lines; -if(defined($opt_w)) { - if ($file eq '-') { - seek \*STDIN, 0, 0 or die "seek: $!"; - } - @warn_lines = `$^X $libs @{[defined $opt_c ? '-c ' : '' ]} -Mwarnings "$file$args" 2>&1`; -} - -# Any new errors must be warnings -foreach my $line (@warn_lines) { - if(!grep { $_ eq $line } @error_lines) { - push(@lines, "W:$line"); - } -} - -my $errors = 0; -foreach my $line (@lines) { - - chomp($line); - my ($file, $lineno, $message, $rest, $severity); - - if ($line =~ /^([EW]):(.*)\sat\s(.*)\sline\s(\d+)(.*)$/) { - ($severity, $message, $file, $lineno, $rest) = ($1, $2, $3, $4, $5); - $errors++; - $message .= $rest if ($rest =~ s/^,//); - print $handle "$severity:$file:$lineno:$message\n"; - - } else { next }; - -} - -if (defined $opt_f) { - - my $msg; - if ($errors == 1) { - - $msg = "There was 1 error.\n"; - - } else { - - $msg = "There were $errors errors.\n"; - - }; - - print STDOUT $msg; - close FILE; - unlink $opt_f unless $errors; - -}; - -sub usage { - - (local $0 = $0) =~ s/^.*\/([^\/]+)$/$1/; # remove path from name of program - print<] [programargs] - - -c compile only, don't run (executes 'perl -c') - -w output warnings as warnings instead of errors (slightly slower) - -f write errors to - -I specify \@INC/#include directory - -Examples: - * At the command line: - $0 program.pl - Displays output on STDOUT. - - $0 -c -w -f errorfile program.pl - Then run 'vim -q errorfile' to edit the errors with Vim. - This uses the custom errorformat: %t:%f:%l:%m. - - * In Vim: - Edit in Vim (and save, if you don't have autowrite on), then - type ':mak' or ':mak args' (args being the program arguments) - to error check. -EOT - - exit 0; - -}; diff --git a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim b/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim deleted file mode 100644 index d88437dd..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/perl/perl.vim +++ /dev/null @@ -1,71 +0,0 @@ -"============================================================================ -"File: perl.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Anthony Carapetis , -" Eric Harmon -"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. -" -"============================================================================ -" -" In order to add some custom lib directories that should be added to the -" perl command line you can add those as a comma-separated list to the variable -" g:syntastic_perl_lib_path. -" -" let g:syntastic_perl_lib_path = './lib,./lib/auto' -" -" To use your own perl error output munger script, use the -" g:syntastic_perl_efm_program option. Any command line parameters should be -" included in the variable declaration. The program should expect a single -" parameter; the fully qualified filename of the file to be checked. -" -" let g:syntastic_perl_efm_program = "foo.pl -o -m -g" -" - -if exists("g:loaded_syntastic_perl_perl_checker") - finish -endif -let g:loaded_syntastic_perl_perl_checker=1 - -if !exists("g:syntastic_perl_interpreter") - let g:syntastic_perl_interpreter = "perl" -endif - -function! SyntaxCheckers_perl_perl_IsAvailable() - return executable(g:syntastic_perl_interpreter) -endfunction - -if !exists("g:syntastic_perl_efm_program") - let g:syntastic_perl_efm_program = - \ g:syntastic_perl_interpreter . ' ' . - \ syntastic#util#shescape(expand(':p:h') . '/efm_perl.pl') . - \ ' -c -w' -endif - -function! SyntaxCheckers_perl_perl_GetLocList() - let makeprg = exists("b:syntastic_perl_efm_program") ? b:syntastic_perl_efm_program : g:syntastic_perl_efm_program - if exists("g:syntastic_perl_lib_path") - let makeprg .= ' -I' . g:syntastic_perl_lib_path - endif - let makeprg .= ' ' . syntastic#util#shexpand('%') . s:ExtraMakeprgArgs() - - let errorformat = '%t:%f:%l:%m' - - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) -endfunction - -function! s:ExtraMakeprgArgs() - let shebang = syntastic#util#parseShebang() - if index(shebang['args'], '-T') != -1 - return ' -Tc' - endif - - return '' -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'perl', - \ 'name': 'perl'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/perl/perlcritic.vim b/sources_non_forked/syntastic/syntax_checkers/perl/perlcritic.vim deleted file mode 100644 index 910ded2b..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/perl/perlcritic.vim +++ /dev/null @@ -1,65 +0,0 @@ -"============================================================================ -"File: perlcritic.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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. -" -"============================================================================ -" -" For details about perlcritic see: -" -" - http://perlcritic.tigris.org/ -" - https://metacpan.org/module/Perl::Critic -" -" Checker options: -" -" - g:syntastic_perl_perlcritic_thres (integer; default: 5) -" error threshold: policy violations with a severity above this -" value are highlighted as errors, the others are warnings -" -" - g:syntastic_perl_perlcritic_args (string; default: empty) -" command line options to pass to perlcritic - -if exists("g:loaded_syntastic_perl_perlcritic_checker") - finish -endif -let g:loaded_syntastic_perl_perlcritic_checker=1 - -if !exists('g:syntastic_perl_perlcritic_thres') - let g:syntastic_perl_perlcritic_thres = 5 -endif - -function! SyntaxCheckers_perl_perlcritic_IsAvailable() - return executable('perlcritic') -endfunction - -function! SyntaxCheckers_perl_perlcritic_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'perlcritic', - \ 'post_args': '--quiet --nocolor --verbose "\%s:\%f:\%l:\%c:(\%s) \%m (\%e)\n"', - \ 'filetype': 'perl', - \ 'subchecker': 'perlcritic' }) - - let errorformat = '%t:%f:%l:%c:%m' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'returns': [0, 2], - \ 'subtype': 'Style' }) - - " change error types according to the prescribed threshold - for n in range(len(loclist)) - let loclist[n]['type'] = loclist[n]['type'] < g:syntastic_perl_perlcritic_thres ? 'W' : 'E' - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'perl', - \ 'name': 'perlcritic'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/perl/podchecker.vim b/sources_non_forked/syntastic/syntax_checkers/perl/podchecker.vim deleted file mode 100644 index e6f80e66..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/perl/podchecker.vim +++ /dev/null @@ -1,30 +0,0 @@ -"============================================================================ -"File: podchecker.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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_perl_podchecker_checker") - finish -endif -let g:loaded_syntastic_perl_podchecker_checker=1 - -function! SyntaxCheckers_perl_podchecker_IsAvailable() - return SyntaxCheckers_pod_podchecker_IsAvailable() -endfunction - -function! SyntaxCheckers_perl_podchecker_GetLocList() - return SyntaxCheckers_pod_podchecker_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'perl', - \ 'name': 'podchecker'}) - -runtime! syntax_checkers/pod/*.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/php/php.vim b/sources_non_forked/syntastic/syntax_checkers/php/php.vim deleted file mode 100644 index a6abffb1..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/php/php.vim +++ /dev/null @@ -1,52 +0,0 @@ -"============================================================================ -"File: php.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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_php_php_checker") - finish -endif -let g:loaded_syntastic_php_php_checker=1 - -function! SyntaxCheckers_php_php_IsAvailable() - return executable("php") -endfunction - -function! SyntaxCheckers_php_php_GetHighlightRegex(item) - let unexpected = matchstr(a:item['text'], "unexpected '[^']\\+'") - if len(unexpected) < 1 - return '' - endif - return '\V'.split(unexpected, "'")[1] -endfunction - -function! SyntaxCheckers_php_php_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'php', - \ 'args': '-l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0', - \ 'filetype': 'php', - \ 'subchecker': 'php' }) - - let errorformat = - \ '%-GNo syntax errors detected in%.%#,'. - \ 'Parse error: %#syntax %trror\, %m in %f on line %l,'. - \ 'Parse %trror: %m in %f on line %l,'. - \ 'Fatal %trror: %m in %f on line %l,'. - \ '%-G\s%#,'. - \ '%-GErrors parsing %.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'php', - \ 'name': 'php'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/php/phpcs.vim b/sources_non_forked/syntastic/syntax_checkers/php/phpcs.vim deleted file mode 100644 index f6646c66..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/php/phpcs.vim +++ /dev/null @@ -1,44 +0,0 @@ -"============================================================================ -"File: phpcs.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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. -" -"============================================================================ -" -" See here for details of phpcs -" - phpcs (see http://pear.php.net/package/PHP_CodeSniffer) -" -if exists("g:loaded_syntastic_php_phpcs_checker") - finish -endif -let g:loaded_syntastic_php_phpcs_checker=1 - -function! SyntaxCheckers_php_phpcs_IsAvailable() - return executable('phpcs') -endfunction - -function! SyntaxCheckers_php_phpcs_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'phpcs', - \ 'args': '--report=csv', - \ 'filetype': 'php', - \ 'subchecker': 'phpcs' }) - - let errorformat = - \ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'. - \ '"%f"\,%l\,%c\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style' }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'php', - \ 'name': 'phpcs'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/php/phpmd.vim b/sources_non_forked/syntastic/syntax_checkers/php/phpmd.vim deleted file mode 100644 index c21362f9..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/php/phpmd.vim +++ /dev/null @@ -1,78 +0,0 @@ -"============================================================================ -"File: phpmd.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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. -" -"============================================================================ -" -" See here for details of phpmd -" - phpmd (see http://phpmd.org) - -if exists("g:loaded_syntastic_php_phpmd_checker") - finish -endif -let g:loaded_syntastic_php_phpmd_checker=1 - -function! SyntaxCheckers_php_phpmd_IsAvailable() - return executable('phpmd') -endfunction - -function! SyntaxCheckers_php_phpmd_GetHighlightRegex(item) - let term = matchstr(a:item['text'], '\C^The \S\+ \w\+\(()\)\= \(has\|is not\|utilizes\)') - if term != '' - return '\V'.substitute(term, '\C^The \S\+ \(\w\+\)\(()\)\= .*', '\1', '') - endif - let term = matchstr(a:item['text'], '\C^Avoid \(variables with short\|excessively long variable\) names like \S\+\.') - if term != '' - return '\V'.substitute(term, '\C^Avoid \(variables with short\|excessively long variable\) names like \(\S\+\)\..*', '\2', '') - endif - let term = matchstr(a:item['text'], '\C^Avoid using short method names like \S\+::\S\+()\.') - if term != '' - return '\V'.substitute(term, '\C^Avoid using short method names like \S\+::\(\S\+\)()\..*', '\1', '') - endif - let term = matchstr(a:item['text'], '\C^\S\+ accesses the super-global variable ') - if term != '' - return '\V'.substitute(term, '\C accesses the super-global variable .*$', '', '') - endif - let term = matchstr(a:item['text'], '\C^Constant \S\+ should be defined in uppercase') - if term != '' - return '\V'.substitute(term, '\C^Constant \(\S\+\) should be defined in uppercase', '\1', '') - endif - let term = matchstr(a:item['text'], "\\C^The '\\S\\+()' method which returns ") - if term != '' - return '\V'.substitute(term, "\\C^The '\\(\\S\\+\\()' method which returns.*", '\1', '') - endif - let term = matchstr(a:item['text'], '\C variable \S\+ should begin with ') - if term != '' - return '\V'.substitute(term, '\C.* variable \(\S\+\) should begin with .*', '\1', '') - endif - let term = matchstr(a:item['text'], "\\C^Avoid unused \\(private fields\\|local variables\\|private methods\\|parameters\\) such as '\\S\\+'") - if term != '' - return '\V'.substitute(term, "\\C^Avoid unused \\(private fields\\|local variables\\|private methods\\|parameters\\) such as '\\(\\S\\+\\)'.*", '\2', '') - endif - return '' -endfunction - -function! SyntaxCheckers_php_phpmd_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'phpmd', - \ 'post_args': 'text codesize,design,unusedcode,naming', - \ 'filetype': 'php', - \ 'subchecker': 'phpmd' }) - - let errorformat = '%E%f:%l%\s%#%m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype' : 'Style' }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'php', - \ 'name': 'phpmd'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/pod/podchecker.vim b/sources_non_forked/syntastic/syntax_checkers/pod/podchecker.vim deleted file mode 100644 index c429a495..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/pod/podchecker.vim +++ /dev/null @@ -1,51 +0,0 @@ -"============================================================================ -"File: podchecker.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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_pod_podchecker_checker") - finish -endif -let g:loaded_syntastic_pod_podchecker_checker=1 - -function! SyntaxCheckers_pod_podchecker_IsAvailable() - return executable("podchecker") -endfunction - -function! SyntaxCheckers_pod_podchecker_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'podchecker', - \ 'filetype': 'pod', - \ 'subchecker': 'podchecker' }) - - let errorformat = - \ '%W%[%#]%[%#]%[%#] WARNING: %m at line %l in file %f,' . - \ '%W%[%#]%[%#]%[%#] WARNING: %m at line EOF in file %f,' . - \ '%E%[%#]%[%#]%[%#] ERROR: %m at line %l in file %f,' . - \ '%E%[%#]%[%#]%[%#] ERROR: %m at line EOF in file %f' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'returns': [0, 1, 2] }) - - for n in range(len(loclist)) - let e = loclist[n] - if e['valid'] && e['lnum'] == 0 - let e['lnum'] = str2nr(matchstr(e['text'], '\m\ -"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_puppet_puppet_checker") - finish -endif -let g:loaded_syntastic_puppet_puppet_checker=1 - -function! SyntaxCheckers_puppet_puppet_IsAvailable() - return executable("puppet") -endfunction - -function! SyntaxCheckers_puppet_puppet_GetLocList() - - let ver = syntastic#util#parseVersion('puppet --version 2>' . syntastic#util#DevNull()) - - if syntastic#util#versionIsAtLeast(ver, [2,7,0]) - let args = 'parser validate --color=false' - else - let args = '--color=false --parseonly' - endif - - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'puppet', - \ 'args': args, - \ 'filetype': 'puppet', - \ 'subchecker': 'puppet' }) - - let errorformat = - \ '%-Gerr: Try ''puppet help parser validate'' for usage,' . - \ '%-GError: Try ''puppet help parser validate'' for usage,' . - \ '%Eerr: Could not parse for environment %*[a-z]: %m at %f:%l,' . - \ '%EError: Could not parse for environment %*[a-z]: %m at %f:%l' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'puppet', - \ 'name': 'puppet'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/puppet/puppetlint.vim b/sources_non_forked/syntastic/syntax_checkers/puppet/puppetlint.vim deleted file mode 100644 index c65e601b..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/puppet/puppetlint.vim +++ /dev/null @@ -1,47 +0,0 @@ -"============================================================================ -"File: puppetlint.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Eivind Uggedal -"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_puppet_puppetlint_checker") - finish -endif -let g:loaded_syntastic_puppet_puppetlint_checker=1 - -if exists("g:syntastic_puppet_lint_arguments") - let g:syntastic_puppet_puppetlint_args = g:syntastic_puppet_lint_arguments - call syntastic#util#deprecationWarn("variable g:syntastic_puppet_lint_arguments is deprecated, please use g:syntastic_puppet_puppetlint_args instead") -endif - -function! SyntaxCheckers_puppet_puppetlint_IsAvailable() - return - \ executable("puppet") && - \ executable("puppet-lint") && - \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('puppet-lint --version 2>' . - \ syntastic#util#DevNull()), [0,1,10]) -endfunction - -function! SyntaxCheckers_puppet_puppetlint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'puppet-lint', - \ 'post_args': '--log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}"', - \ 'filetype': 'puppet', - \ 'subchecker': 'puppetlint' }) - - let errorformat = '%t%*[a-zA-Z] %m at %f:%l' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'puppet', - \ 'name': 'puppetlint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/python/flake8.vim b/sources_non_forked/syntastic/syntax_checkers/python/flake8.vim deleted file mode 100644 index 796ba6bd..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/python/flake8.vim +++ /dev/null @@ -1,44 +0,0 @@ -"============================================================================ -"File: flake8.vim -"Description: Syntax checking plugin for syntastic.vim -"Authors: Sylvain Soliman -" kstep -" -"============================================================================ -if exists("g:loaded_syntastic_python_flake8_checker") - finish -endif -let g:loaded_syntastic_python_flake8_checker=1 - -function! SyntaxCheckers_python_flake8_IsAvailable() - return executable('flake8') -endfunction - -function! SyntaxCheckers_python_flake8_GetHighlightRegex(i) - return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) -endfunction - -function! SyntaxCheckers_python_flake8_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'flake8', - \ 'filetype': 'python', - \ 'subchecker': 'flake8' }) - - let errorformat = - \ '%E%f:%l: could not compile,%-Z%p^,'. - \ '%W%f:%l:%c: F%n %m,'. - \ '%W%f:%l:%c: C%n %m,'. - \ '%E%f:%l:%c: %t%n %m,'. - \ '%E%f:%l: %t%n %m,'. - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'python', - \ 'name': 'flake8'}) - -runtime! syntax_checkers/python/pyflakes.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/python/pep8.vim b/sources_non_forked/syntastic/syntax_checkers/python/pep8.vim deleted file mode 100644 index 71837187..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/python/pep8.vim +++ /dev/null @@ -1,46 +0,0 @@ -"============================================================================ -"File: pep8.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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. -" -"============================================================================ -" -" For details about pep8 see: https://github.com/jcrocholl/pep8 - -if exists("g:loaded_syntastic_python_pep8_checker") - finish -endif -let g:loaded_syntastic_python_pep8_checker=1 - -function! SyntaxCheckers_python_pep8_IsAvailable() - return executable('pep8') -endfunction - -function! SyntaxCheckers_python_pep8_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pep8', - \ 'filetype': 'python', - \ 'subchecker': 'pep8' }) - - let errorformat = '%f:%l:%c: %m' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style' }) - - for n in range(len(loclist)) - let loclist[n]['type'] = loclist[n]['text'] =~? '^W' ? 'W' : 'E' - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'python', - \ 'name': 'pep8'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/python/py3kwarn.vim b/sources_non_forked/syntastic/syntax_checkers/python/py3kwarn.vim deleted file mode 100644 index 44d03655..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/python/py3kwarn.vim +++ /dev/null @@ -1,31 +0,0 @@ -"============================================================================ -"File: py3kwarn.vim -"Description: Syntax checking plugin for syntastic.vim -"Authors: Liam Curry -" -"============================================================================ -if exists("g:loaded_syntastic_python_py3kwarn_checker") - finish -endif -let g:loaded_syntastic_python_py3kwarn_checker=1 - -function! SyntaxCheckers_python_py3kwarn_IsAvailable() - return executable('py3kwarn') -endfunction - -function! SyntaxCheckers_python_py3kwarn_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'py3kwarn', - \ 'filetype': 'python', - \ 'subchecker': 'py3kwarn' }) - - let errorformat = '%W%f:%l:%c: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'python', - \ 'name': 'py3kwarn'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/python/pyflakes.vim b/sources_non_forked/syntastic/syntax_checkers/python/pyflakes.vim deleted file mode 100644 index f93047bf..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/python/pyflakes.vim +++ /dev/null @@ -1,63 +0,0 @@ -"============================================================================ -"File: pyflakes.vim -"Description: Syntax checking plugin for syntastic.vim -"Authors: Martin Grenfell -" kstep -" Parantapa Bhattacharya -" -"============================================================================ -if exists("g:loaded_syntastic_python_pyflakes_checker") - finish -endif -let g:loaded_syntastic_python_pyflakes_checker=1 - -function! SyntaxCheckers_python_pyflakes_IsAvailable() - return executable('pyflakes') -endfunction - -function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) - if match(a:i['text'], 'is assigned to but never used') > -1 - \ || match(a:i['text'], 'imported but unused') > -1 - \ || match(a:i['text'], 'undefined name') > -1 - \ || match(a:i['text'], 'redefinition of') > -1 - \ || match(a:i['text'], 'referenced before assignment') > -1 - \ || match(a:i['text'], 'duplicate argument') > -1 - \ || match(a:i['text'], 'after other statements') > -1 - \ || match(a:i['text'], 'shadowed by loop variable') > -1 - - " fun with Python's %r: try "..." first, then '...' - let terms = split(a:i['text'], '"', 1) - if len(terms) > 2 - return terms[1] - endif - - let terms = split(a:i['text'], "'", 1) - if len(terms) > 2 - return terms[1] - endif - endif - return '' -endfunction - -function! SyntaxCheckers_python_pyflakes_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pyflakes', - \ 'filetype': 'python', - \ 'subchecker': 'pyflakes' }) - - let errorformat = - \ '%E%f:%l: could not compile,'. - \ '%-Z%p^,'. - \ '%E%f:%l:%c: %m,'. - \ '%E%f:%l: %m,'. - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'text': "Syntax error"} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'python', - \ 'name': 'pyflakes'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/python/pylama.vim b/sources_non_forked/syntastic/syntax_checkers/python/pylama.vim deleted file mode 100644 index 4d7d02ad..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/python/pylama.vim +++ /dev/null @@ -1,53 +0,0 @@ -"============================================================================ -"File: pylama.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -" -"============================================================================ -if exists("g:loaded_syntastic_python_pylama_checker") - finish -endif -let g:loaded_syntastic_python_pylama_checker=1 - -function! SyntaxCheckers_python_pylama_IsAvailable() - return executable('pylama') -endfunction - -function! SyntaxCheckers_python_pylama_GetHighlightRegex(i) - return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) -endfunction - -function! SyntaxCheckers_python_pylama_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pylama', - \ 'post_args': ' -f pep8', - \ 'filetype': 'python', - \ 'subchecker': 'pylama' }) - - let errorformat = '%A%f:%l:%c: %m' - - let loclist=SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': ['sort'] }) - - for n in range(len(loclist)) - let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][0]) >= 0 ? 'W' : 'E' - if loclist[n]['text'] =~# '\v\[%(pep8|pep257|mccabe)\]$' - let loclist[n]['subtype'] = 'Style' - endif - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'python', - \ 'name': 'pylama' }) - -runtime! syntax_checkers/python/pyflakes.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/python/pylint.vim b/sources_non_forked/syntastic/syntax_checkers/python/pylint.vim deleted file mode 100644 index 923664d4..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/python/pylint.vim +++ /dev/null @@ -1,43 +0,0 @@ -"============================================================================ -"File: pylint.vim -"Description: Syntax checking plugin for syntastic.vim -"Author: Parantapa Bhattacharya -" -"============================================================================ -if exists("g:loaded_syntastic_python_pylint_checker") - finish -endif -let g:loaded_syntastic_python_pylint_checker=1 - -function! SyntaxCheckers_python_pylint_IsAvailable() - return executable('pylint') -endfunction - -function! SyntaxCheckers_python_pylint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pylint', - \ 'args': ' -f parseable -r n -i y', - \ 'filetype': 'python', - \ 'subchecker': 'pylint' }) - - let errorformat = - \ '%A%f:%l:%m,' . - \ '%A%f:(%l):%m,' . - \ '%-Z%p^%.%#,' . - \ '%-G%.%#' - - let loclist=SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': ['sort'] }) - - for n in range(len(loclist)) - let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][2]) >= 0 ? 'W' : 'E' - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'python', - \ 'name': 'pylint' }) diff --git a/sources_non_forked/syntastic/syntax_checkers/python/python.vim b/sources_non_forked/syntastic/syntax_checkers/python/python.vim deleted file mode 100644 index eff1696b..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/python/python.vim +++ /dev/null @@ -1,43 +0,0 @@ -"============================================================================ -"File: python.vim -"Description: Syntax checking plugin for syntastic.vim -"Author: Artem Nezvigin -" -" `errorformat` derived from: -" http://www.vim.org/scripts/download_script.php?src_id=1392 -" -"============================================================================ -if exists("g:loaded_syntastic_python_python_checker") - finish -endif -let g:loaded_syntastic_python_python_checker=1 - -function! SyntaxCheckers_python_python_IsAvailable() - return executable('python') -endfunction - -function! SyntaxCheckers_python_python_GetLocList() - let fname = "'" . escape(expand('%'), "\\'") . "'" - - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'python', - \ 'args': '-c', - \ 'fname': syntastic#util#shescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"), - \ 'filetype': 'python', - \ 'subchecker': 'python' }) - - let errorformat = - \ '%E File "%f"\, line %l,' . - \ '%C %p^,' . - \ '%C %.%#,' . - \ '%Z%m,' . - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'python', - \ 'name': 'python'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/rst/rst2pseudoxml.vim b/sources_non_forked/syntastic/syntax_checkers/rst/rst2pseudoxml.vim deleted file mode 100644 index 454b4d85..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/rst/rst2pseudoxml.vim +++ /dev/null @@ -1,62 +0,0 @@ -"============================================================================ -"File: rst.vim -"Description: Syntax checking plugin for docutil's reStructuredText files -"Maintainer: James Rowe -"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. -" -"============================================================================ - -" We use rst2pseudoxml.py, as it is ever so marginally faster than the other -" rst2${x} tools in docutils. - -if exists("g:loaded_syntastic_rst_rst2pseudoxml_checker") - finish -endif -let g:loaded_syntastic_rst_rst2pseudoxml_checker=1 - -function! SyntaxCheckers_rst_rst2pseudoxml_IsAvailable() - return executable("rst2pseudoxml.py") || executable("rst2pseudoxml") -endfunction - -function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': s:exe(), - \ 'args': '--report=2 --exit-status=1', - \ 'tail': syntastic#util#DevNull(), - \ 'filetype': 'rst', - \ 'subchecker': 'rst2pseudoxml' }) - - let errorformat = - \ '%f:%l: (%tNFO/1) %m,'. - \ '%f:%l: (%tARNING/2) %m,'. - \ '%f:%l: (%tRROR/3) %m,'. - \ '%f:%l: (%tEVERE/4) %m,'. - \ '%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - for n in range(len(loclist)) - if loclist[n]['type'] ==? 'S' - let loclist[n]['type'] = 'E' - elseif loclist[n]['type'] ==? 'I' - let loclist[n]['type'] = 'W' - let loclist[n]['subtype'] = 'Style' - endif - endfor - - return loclist -endfunction - -function s:exe() - return executable("rst2pseudoxml.py") ? "rst2pseudoxml.py" : "rst2pseudoxml" -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'rst', - \ 'name': 'rst2pseudoxml'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/ruby/jruby.vim b/sources_non_forked/syntastic/syntax_checkers/ruby/jruby.vim deleted file mode 100644 index bef2b5f5..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/ruby/jruby.vim +++ /dev/null @@ -1,52 +0,0 @@ -"============================================================================ -"File: jruby.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Leonid Shevtsov -"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_ruby_jruby_checker") - finish -endif -let g:loaded_syntastic_ruby_jruby_checker=1 - -function! SyntaxCheckers_ruby_jruby_IsAvailable() - return executable('jruby') -endfunction - -function! SyntaxCheckers_ruby_jruby_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': s:exe(), - \ 'args': s:args(), - \ 'filetype': 'ruby', - \ 'subchecker': 'jruby' }) - - let errorformat = - \ '%-GSyntax OK for %f,'. - \ '%ESyntaxError in %f:%l: syntax error\, %m,'. - \ '%Z%p^,'. - \ '%W%f:%l: warning: %m,'. - \ '%Z%p^,'. - \ '%W%f:%l: %m,'. - \ '%-C%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -function s:args() - return has('win32') ? '-W1 -T1 -c' : '-W1 -c' -endfunction - -function s:exe() - return has('win32') ? 'jruby' : 'RUBYOPT= jruby' -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'ruby', - \ 'name': 'jruby'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/ruby/macruby.vim b/sources_non_forked/syntastic/syntax_checkers/ruby/macruby.vim deleted file mode 100644 index 9226e41e..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/ruby/macruby.vim +++ /dev/null @@ -1,43 +0,0 @@ -"============================================================================ -"File: macruby.vim -"Description: Syntax checking plugin for syntastic.vim -"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_ruby_macruby_checker") - finish -endif -let g:loaded_syntastic_ruby_macruby_checker=1 - -function! SyntaxCheckers_ruby_macruby_IsAvailable() - return executable('macruby') -endfunction - -function! SyntaxCheckers_ruby_macruby_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'RUBYOPT= macruby', - \ 'args': '-W1 -c', - \ 'filetype': 'ruby', - \ 'subchecker': 'macruby' }) - - let errorformat = - \ '%-GSyntax OK,'. - \ '%E%f:%l: syntax error\, %m,'. - \ '%Z%p^,'. - \ '%W%f:%l: warning: %m,'. - \ '%Z%p^,'. - \ '%W%f:%l: %m,'. - \ '%-C%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'ruby', - \ 'name': 'macruby'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/ruby/mri.vim b/sources_non_forked/syntastic/syntax_checkers/ruby/mri.vim deleted file mode 100644 index 27a46a48..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/ruby/mri.vim +++ /dev/null @@ -1,77 +0,0 @@ -"============================================================================ -"File: mri.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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_ruby_mri_checker") - finish -endif -let g:loaded_syntastic_ruby_mri_checker=1 - -if !exists("g:syntastic_ruby_exec") - let g:syntastic_ruby_exec = "ruby" -endif - -function! SyntaxCheckers_ruby_mri_IsAvailable() - return executable(expand(g:syntastic_ruby_exec)) -endfunction - -function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) - if match(a:i['text'], 'assigned but unused variable') > -1 - let term = split(a:i['text'], ' - ')[1] - return '\V\<'.term.'\>' - endif - - return '' -endfunction - -function! SyntaxCheckers_ruby_mri_GetLocList() - let exe = expand(g:syntastic_ruby_exec) - if !has('win32') - let exe = 'RUBYOPT= ' . exe - endif - - let makeprg = syntastic#makeprg#build({ - \ 'exe': exe, - \ 'args': '-w -T1 -c', - \ 'filetype': 'ruby', - \ 'subchecker': 'mri' }) - - "this is a hack to filter out a repeated useless warning in rspec files - "containing lines like - " - " foo.should == 'bar' - " - "Which always generate the warning below. Note that ruby >= 1.9.3 includes - "the word "possibly" in the warning - let errorformat = '%-G%.%#warning: %\(possibly %\)%\?useless use of == in void context,' - - " filter out lines starting with ... - " long lines are truncated and wrapped in ... %p then returns the wrong - " column offset - let errorformat .= '%-G%\%.%\%.%\%.%.%#,' - - let errorformat .= - \ '%-GSyntax OK,'. - \ '%E%f:%l: syntax error\, %m,'. - \ '%Z%p^,'. - \ '%W%f:%l: warning: %m,'. - \ '%Z%p^,'. - \ '%W%f:%l: %m,'. - \ '%-C%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'ruby', - \ 'name': 'mri'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/ruby/rubocop.vim b/sources_non_forked/syntastic/syntax_checkers/ruby/rubocop.vim deleted file mode 100644 index b93d8d1a..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/ruby/rubocop.vim +++ /dev/null @@ -1,55 +0,0 @@ -"============================================================================ -"File: rubocop.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Recai Oktaş -"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. -" -"============================================================================ -" -" In order to use rubocop with the default ruby checker (mri): -" let g:syntastic_ruby_checkers = ['mri', 'rubocop'] - -if exists("g:loaded_syntastic_ruby_rubocop_checker") - finish -endif -let g:loaded_syntastic_ruby_rubocop_checker=1 - -function! SyntaxCheckers_ruby_rubocop_IsAvailable() - return - \ executable('rubocop') && - \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('rubocop --version'), [0,9,0]) -endfunction - -function! SyntaxCheckers_ruby_rubocop_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'rubocop', - \ 'args': '--format emacs --silent', - \ 'filetype': 'ruby', - \ 'subchecker': 'rubocop' }) - - let errorformat = '%f:%l:%c: %t: %m' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style'}) - - " convert rubocop severities to error types recognized by syntastic - for n in range(len(loclist)) - if loclist[n]['type'] == 'F' - let loclist[n]['type'] = 'E' - elseif loclist[n]['type'] != 'W' && loclist[n]['type'] != 'E' - let loclist[n]['type'] = 'W' - endif - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'ruby', - \ 'name': 'rubocop'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/rust/rustc.vim b/sources_non_forked/syntastic/syntax_checkers/rust/rustc.vim deleted file mode 100644 index e88b4cf9..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/rust/rustc.vim +++ /dev/null @@ -1,42 +0,0 @@ -"============================================================================ -"File: rust.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Chad Jablonski -"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_rust_rustc_checker") - finish -endif -let g:loaded_syntastic_rust_rustc_checker=1 - -function! SyntaxCheckers_rust_rustc_IsAvailable() - return executable("rustc") -endfunction - -function! SyntaxCheckers_rust_rustc_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'rustc', - \ 'args': '--parse-only', - \ 'filetype': 'rust', - \ 'subchecker': 'rustc' }) - - let errorformat = - \ '%E%f:%l:%c: \\d%#:\\d%# %.%\{-}error:%.%\{-} %m,' . - \ '%W%f:%l:%c: \\d%#:\\d%# %.%\{-}warning:%.%\{-} %m,' . - \ '%C%f:%l %m,' . - \ '%-Z%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'rust', - \ 'name': 'rustc'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim b/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim deleted file mode 100644 index 4b8d4863..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/sass/sass.vim +++ /dev/null @@ -1,78 +0,0 @@ -"============================================================================ -"File: sass.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -" -"============================================================================ - -if exists("g:loaded_syntastic_sass_sass_checker") - finish -endif -let g:loaded_syntastic_sass_sass_checker=1 - -function! SyntaxCheckers_sass_sass_IsAvailable() - return executable("sass") -endfunction - -"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() - -"By default do not check partials as unknown variables are a syntax error -if !exists("g:syntastic_sass_check_partials") - let g:syntastic_sass_check_partials = 0 -endif - -"use compass imports if available -let s:imports = "" -if executable("compass") - let s:imports = "--compass" -endif - -function! SyntaxCheckers_sass_sass_GetLocList() - if !g:syntastic_sass_check_partials && expand('%:t')[0] == '_' - return [] - endif - - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'sass', - \ 'args': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check', - \ 'filetype': 'sass', - \ 'subchecker': 'sass' }) - - let errorformat = - \ '%ESyntax %trror: %m,' . - \ '%+C %.%#,' . - \ '%C on line %l of %f\, %.%#,' . - \ '%C on line %l of %f,' . - \ '%-G %\+from line %.%#,' . - \ '%-G %\+Use --trace for backtrace.,' . - \ '%W%>DEPRECATION WARNING on line %l of %f:,' . - \ '%+C%> %.%#,' . - \ '%W%>WARNING: on line %l of %f:,' . - \ '%+C%> %.%#,' . - \ '%W%>WARNING on line %l of %f: %m,' . - \ '%+C%> %.%#,' . - \ '%W%>WARNING on line %l of %f:,' . - \ '%Z%m,' . - \ '%W%>WARNING: %m,' . - \ '%C on line %l of %f\, %.%#,' . - \ '%C on line %l of %f,' . - \ '%-G %\+from line %.%#,' . - \ 'Syntax %trror on line %l: %m,' . - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': ['compressWhitespace'] }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'sass', - \ 'name': 'sass'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim b/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim deleted file mode 100644 index d0e95a7d..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/scala/fsc.vim +++ /dev/null @@ -1,46 +0,0 @@ -"============================================================================ -"File: fsc.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Gregor Uhlenheuer -"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_scala_fsc_checker') - finish -endif -let g:loaded_syntastic_scala_fsc_checker = 1 - -function! SyntaxCheckers_scala_fsc_IsAvailable() - return executable('fsc') -endfunction - -if !exists('g:syntastic_scala_options') - let g:syntastic_scala_options = '' -endif - -function! SyntaxCheckers_scala_fsc_GetLocList() - " fsc has some serious problems with the - " working directory changing after being started - " that's why we better pass an absolute path - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'fsc', - \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, - \ 'fname': syntastic#util#shexpand('%:p'), - \ 'filetype': 'scala', - \ 'subchecker': 'fsc' }) - - let errorformat = '%f:%l: %trror: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'scala', - \ 'name': 'fsc'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/scala/scalac.vim b/sources_non_forked/syntastic/syntax_checkers/scala/scalac.vim deleted file mode 100644 index d6319c16..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/scala/scalac.vim +++ /dev/null @@ -1,43 +0,0 @@ -"============================================================================ -"File: scala.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Rickey Visinski -"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_scala_scalac_checker") - finish -endif -let g:loaded_syntastic_scala_scalac_checker=1 - -function! SyntaxCheckers_scala_scalac_IsAvailable() - return executable("scalac") -endfunction - -if !exists('g:syntastic_scala_options') - let g:syntastic_scala_options = '' -endif - - -function! SyntaxCheckers_scala_scalac_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'scalac', - \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, - \ 'filetype': 'scala', - \ 'subchecker': 'scalac' }) - - let errorformat = '%f:%l: %trror: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'scala', - \ 'name': 'scalac'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/scss/sass.vim b/sources_non_forked/syntastic/syntax_checkers/scss/sass.vim deleted file mode 100644 index 604bb41d..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/scss/sass.vim +++ /dev/null @@ -1,31 +0,0 @@ - -"============================================================================ -"File: scss.vim -"Description: scss syntax checking plugin for syntastic -"Maintainer: Martin Grenfell -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -" -"============================================================================ - -if exists("g:loaded_syntastic_scss_sass_checker") - finish -endif -let g:loaded_syntastic_scss_sass_checker=1 - -function! SyntaxCheckers_scss_sass_IsAvailable() - return SyntaxCheckers_sass_sass_IsAvailable() -endfunction - -function! SyntaxCheckers_scss_sass_GetLocList() - return SyntaxCheckers_sass_sass_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'scss', - \ 'name': 'sass'}) - -runtime! syntax_checkers/sass/*.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/sh/checkbashisms.vim b/sources_non_forked/syntastic/syntax_checkers/sh/checkbashisms.vim deleted file mode 100644 index 9fb1f7ae..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/sh/checkbashisms.vim +++ /dev/null @@ -1,45 +0,0 @@ -"============================================================================ -"File: checkbashisms.vim -"Description: Shell script syntax/style checking plugin for syntastic.vim -"Notes: checkbashisms.pl can be downloaded from -" http://debian.inode.at/debian/pool/main/d/devscripts/ -" as part of the devscripts package. -"============================================================================ - -if exists("g:loaded_syntastic_sh_checkbashisms_checker") - finish -endif -let g:loaded_syntastic_sh_checkbashisms_checker=1 - - -function! SyntaxCheckers_sh_checkbashisms_IsAvailable() - return executable('checkbashisms') -endfunction - - -function! SyntaxCheckers_sh_checkbashisms_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'checkbashisms', - \ 'args': '-fx', - \ 'filetype': 'sh', - \ 'subchecker': 'checkbashisms'}) - - let errorformat = - \ '%-Gscript %f is already a bash script; skipping,' . - \ '%Eerror: %f: %m\, opened in line %l,' . - \ '%Eerror: %f: %m,' . - \ '%Ecannot open script %f for reading: %m,' . - \ '%Wscript %f %m,%C%.# lines,' . - \ '%Wpossible bashism in %f line %l (%m):,%C%.%#,%Z.%#,' . - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style'}) -endfunction - - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'sh', - \ 'name': 'checkbashisms'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim b/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim deleted file mode 100644 index 8c44960b..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/sh/sh.vim +++ /dev/null @@ -1,83 +0,0 @@ -"============================================================================ -"File: sh.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Gregor Uhlenheuer -"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_sh_sh_checker") - finish -endif -let g:loaded_syntastic_sh_sh_checker=1 - -function! s:GetShell() - if !exists('b:shell') || b:shell == '' - let b:shell = '' - let shebang = getbufline(bufnr('%'), 1)[0] - if len(shebang) > 0 - if match(shebang, 'bash') >= 0 - let b:shell = 'bash' - elseif match(shebang, 'zsh') >= 0 - let b:shell = 'zsh' - elseif match(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.checkable('zsh') - return SyntaxCheckers_zsh_zsh_GetLocList() - else - return [] - endif - -endfunction - - -function! s:IsShellValid() - return len(s:GetShell()) > 0 && executable(s:GetShell()) -endfunction - - -function! SyntaxCheckers_sh_sh_IsAvailable() - return s:IsShellValid() -endfunction - -function! SyntaxCheckers_sh_sh_GetLocList() - if s:GetShell() == 'zsh' - return s:ForwardToZshChecker() - endif - - if !s:IsShellValid() - return [] - endif - - let makeprg = syntastic#makeprg#build({ - \ 'exe': s:GetShell(), - \ 'args': '-n', - \ 'filetype': 'sh', - \ 'subchecker': 'sh'}) - - let errorformat = '%f: line %l: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat}) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'sh', - \ 'name': 'sh'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/slim/slimrb.vim b/sources_non_forked/syntastic/syntax_checkers/slim/slimrb.vim deleted file mode 100644 index 2644decf..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/slim/slimrb.vim +++ /dev/null @@ -1,57 +0,0 @@ -"============================================================================ -"File: slim.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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_slim_slimrb_checker") - finish -endif -let g:loaded_syntastic_slim_slimrb_checker=1 - -function! SyntaxCheckers_slim_slimrb_IsAvailable() - return executable("slimrb") -endfunction - -function! s:SlimrbVersion() - if !exists('s:slimrb_version') - let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>' . syntastic#util#DevNull()) - end - return s:slimrb_version -endfunction - -function! SyntaxCheckers_slim_slimrb_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'slimrb', - \ 'args': '-c', - \ 'filetype': 'slim', - \ 'subchecker': 'slimrb' }) - - if syntastic#util#versionIsAtLeast(s:SlimrbVersion(), [1,3,1]) - let errorformat = - \ '%C\ %#%f\, Line %l\, Column %c,'. - \ '%-G\ %.%#,'. - \ '%ESlim::Parser::SyntaxError: %m,'. - \ '%+C%.%#' - else - let errorformat = - \ '%C\ %#%f\, Line %l,'. - \ '%-G\ %.%#,'. - \ '%ESlim::Parser::SyntaxError: %m,'. - \ '%+C%.%#' - endif - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'slim', - \ 'name': 'slimrb'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/tcl/nagelfar.vim b/sources_non_forked/syntastic/syntax_checkers/tcl/nagelfar.vim deleted file mode 100644 index b93b17b9..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/tcl/nagelfar.vim +++ /dev/null @@ -1,42 +0,0 @@ -"============================================================================ -"File: nagelfar.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: James Pickard -"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. -"Notes: Requires nagelfar v1.1.12 or later with support for -H option. -" See nagelfar homepage http://nagelfar.berlios.de/. -" -"============================================================================ -if exists("g:loaded_syntastic_tcl_nagelfar_checker") - finish -endif -let g:loaded_syntastic_tcl_nagelfar_checker=1 - -function! SyntaxCheckers_tcl_nagelfar_IsAvailable() - return executable('nagelfar') -endfunction - -function! SyntaxCheckers_tcl_nagelfar_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'nagelfar', - \ 'args': '-H ' . g:syntastic_tcl_nagelfar_conf, - \ 'filetype': 'tcl', - \ 'subchecker': 'nagelfar' }) - - let errorformat = - \ '%I%f: %l: N %m,'. - \ '%f: %l: %t %m,'. - \ '%-GChecking file %f' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'tcl', - \ 'name': 'nagelfar'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/tex/chktex.vim b/sources_non_forked/syntastic/syntax_checkers/tex/chktex.vim deleted file mode 100644 index d7a55e0f..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/tex/chktex.vim +++ /dev/null @@ -1,62 +0,0 @@ -"============================================================================ -"File: chktex.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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. -" -"============================================================================ -" -" For details about ChkTeX see: -" -" http://baruch.ev-en.org/proj/chktex/ -" -" Checker options: -" -" - g:syntastic_tex_chktex_showmsgs (boolean; default: 1) -" whether to show informational messages (chktex option "-m"); -" by default informational messages are shown as warnings -" -" - g:syntastic_tex_chktex_args (string; default: empty) -" command line options to pass to chktex - -if exists("g:loaded_syntastic_tex_chktex_checker") - finish -endif -let g:loaded_syntastic_tex_chktex_checker = 1 - -if !exists('g:syntastic_tex_chktex_showmsgs') - let g:syntastic_tex_chktex_showmsgs = 1 -endif - -function! SyntaxCheckers_tex_chktex_IsAvailable() - return executable("chktex") -endfunction - -function! SyntaxCheckers_tex_chktex_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'chktex', - \ 'post_args': '-q -v1', - \ 'filetype': 'tex', - \ 'subchecker': 'chktex' }) - - let errorformat = - \ '%EError\ %\\d%\\+\ in\ %f\ line\ %l:\ %m,' . - \ '%WWarning\ %\\d%\\+\ in\ %f\ line\ %l:\ %m,' . - \ (g:syntastic_tex_chktex_showmsgs ? '%WMessage\ %\\d%\\+\ in\ %f\ line %l:\ %m,' : '') . - \ '%+Z%p^,' . - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['sort'] }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'tex', - \ 'name': 'chktex'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/tex/lacheck.vim b/sources_non_forked/syntastic/syntax_checkers/tex/lacheck.vim deleted file mode 100644 index 38510e85..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/tex/lacheck.vim +++ /dev/null @@ -1,37 +0,0 @@ -"============================================================================ -"File: tex.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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_tex_lacheck_checker") - finish -endif -let g:loaded_syntastic_tex_lacheck_checker=1 - -function! SyntaxCheckers_tex_lacheck_IsAvailable() - return executable("lacheck") -endfunction - -function! SyntaxCheckers_tex_lacheck_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'lacheck', - \ 'filetype': 'tex', - \ 'subchecker': 'lacheck' }) - - let errorformat = '%-G** %f:,%E"%f"\, line %l: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'tex', - \ 'name': 'lacheck'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/text/atdtool.vim b/sources_non_forked/syntastic/syntax_checkers/text/atdtool.vim deleted file mode 100644 index 9f5061b8..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/text/atdtool.vim +++ /dev/null @@ -1,57 +0,0 @@ -"============================================================================ -"File: atdtool.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: LCD 47 -"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_text_atdtool_checker") - finish -endif -let g:loaded_syntastic_text_atdtool_checker = 1 - -function! SyntaxCheckers_text_atdtool_IsAvailable() - return executable('atdtool') -endfunction - -function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) - let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') - if term != '' - let col = get(a:item, 'col', 0) - let term = (col != 0 ? '\%' . col . 'c' : '') . '\V' . term - endif - return term -endfunction - -function! SyntaxCheckers_text_atdtool_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'atdtool', - \ 'tail': '2>' . syntastic#util#DevNull(), - \ 'filetype': 'text', - \ 'subchecker': 'atdtool' }) - - let errorformat = - \ '%W%f:%l:%c: %m,'. - \ '%+C suggestions:%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'returns': [0], - \ 'subtype': 'Style' }) - - for n in range(len(loclist)) - let loclist[n]['text'] = substitute(loclist[n]['text'], '\n\s\+', ' | ', 'g') - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'text', - \ 'name': 'atdtool'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/twig/twiglint.vim b/sources_non_forked/syntastic/syntax_checkers/twig/twiglint.vim deleted file mode 100644 index 7cbba5f4..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/twig/twiglint.vim +++ /dev/null @@ -1,43 +0,0 @@ -"============================================================================ -"File: twig.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Alexander -"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_twig_twiglint_checker") - finish -endif -let g:loaded_syntastic_twig_twiglint_checker=1 - -function! SyntaxCheckers_twig_twiglint_GetHighlightRegex(item) - " Let's match the full line for now - return '\V' -endfunction - -function! SyntaxCheckers_twig_twiglint_IsAvailable() - return executable('twig-lint') -endfunction - -function! SyntaxCheckers_twig_twiglint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'twig-lint', - \ 'args': 'lint --format=csv', - \ 'filetype': 'twig', - \ 'subchecker': 'twiglint' }) - - let errorformat = '"%f"\,%l\,%m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat}) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'twig', - \ 'name': 'twiglint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/typescript/tsc.vim b/sources_non_forked/syntastic/syntax_checkers/typescript/tsc.vim deleted file mode 100644 index 78469822..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/typescript/tsc.vim +++ /dev/null @@ -1,33 +0,0 @@ -"============================================================================ -"File: typescript.vim -"Description: TypeScript syntax checker. For TypeScript v0.8.0 -"Maintainer: Bill Casarin -"============================================================================ - -if exists("g:loaded_syntastic_typescript_tsc_checker") - finish -endif -let g:loaded_syntastic_typescript_tsc_checker=1 - -function! SyntaxCheckers_typescript_tsc_IsAvailable() - return executable("tsc") -endfunction - - -function! SyntaxCheckers_typescript_tsc_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'tsc', - \ 'post_args': '--out ' . syntastic#util#DevNull(), - \ 'filetype': 'typescript', - \ 'subchecker': 'tsc' }) - - let errorformat = '%f %#(%l\,%c): %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'typescript', - \ 'name': 'tsc'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim b/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim deleted file mode 100644 index 09b6c28b..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/vala/valac.vim +++ /dev/null @@ -1,74 +0,0 @@ -"============================================================================ -"File: vala.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Konstantin Stepanov (me@kstep.me) -"Notes: Add special comment line into your vala file starting with -" "// modules: " and containing space delimited list of vala -" modules, used by the file, so this script can build correct -" --pkg arguments. -" Alternatively you can set g:syntastic_vala_modules array -" in your .vimrc or .lvimrc with localvimrc plugin -" (http://www.vim.org/scripts/script.php?script_id=441). -" Valac compiler is not the fastest thing in the world, so you -" may want to disable this plugin with -" let g:syntastic_vala_check_disabled = 1 command in your .vimrc or -" command line. Unlet this variable to set it to 0 to reenable -" this checker. -"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_vala_valac_checker") - finish -endif -let g:loaded_syntastic_vala_valac_checker = 1 - -function! SyntaxCheckers_vala_valac_IsAvailable() - return executable('valac') -endfunction - -function! SyntaxCheckers_vala_valac_GetHighlightRegex(pos) - let strlength = strlen(matchstr(a:pos['text'], '\^\+$')) - return '\%>'.(a:pos.col-1).'c.*\%<'.(a:pos.col+strlength+1).'c' -endfunction - -function! s:GetValaModules() - if exists('g:syntastic_vala_modules') - if type(g:syntastic_vala_modules) == type('') - return split(g:syntastic_vala_modules, '\s\+') - elseif type(g:syntastic_vala_modules) == type([]) - return copy(g:syntastic_vala_modules) - else - echoerr 'g:syntastic_vala_modules must be either list or string: fallback to in file modules string' - endif - endif - - let modules_line = search('^// modules: ', 'n') - let modules_str = getline(modules_line) - return split(strpart(modules_str, 12), '\s\+') -endfunction - -function! SyntaxCheckers_vala_valac_GetLocList() - let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ') - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'valac', - \ 'args': '-C ' . vala_pkg_args, - \ 'filetype': 'vala', - \ 'subchecker': 'valac' }) - let errorformat = - \ '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,'. - \ '%C%m,'. - \ '%Z%m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'vala', - \ 'name': 'valac'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/vhdl/ghdl.vim b/sources_non_forked/syntastic/syntax_checkers/vhdl/ghdl.vim deleted file mode 100644 index 7158cd78..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/vhdl/ghdl.vim +++ /dev/null @@ -1,37 +0,0 @@ -"============================================================================ -"File: ghdl.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Jan Wagner -"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_vhdl_ghdl_checker") - finish -endif -let g:loaded_syntastic_vhdl_ghdl_checker = 1 - -function! SyntaxCheckers_vhdl_ghdl_IsAvailable() - return executable("ghdl") -endfunction - -function! SyntaxCheckers_vhdl_ghdl_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ghdl', - \ 'args': '-s', - \ 'filetype': 'vhdl', - \ 'subchecker': 'ghdl' }) - - let errorformat = '%f:%l:%c: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'vhdl', - \ 'name': 'ghdl'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/xhtml/tidy.vim b/sources_non_forked/syntastic/syntax_checkers/xhtml/tidy.vim deleted file mode 100644 index e0c22fbb..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/xhtml/tidy.vim +++ /dev/null @@ -1,89 +0,0 @@ -"============================================================================ -"File: xhtml.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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. -" -"============================================================================ -" -" Checker option: -" -" - g:syntastic_xhtml_tidy_ignore_errors (list; default: []) -" list of errors to ignore - -if exists("g:loaded_syntastic_xhtml_tidy_checker") - finish -endif -let g:loaded_syntastic_xhtml_tidy_checker=1 - -if !exists('g:syntastic_xhtml_tidy_ignore_errors') - let g:syntastic_xhtml_tidy_ignore_errors = [] -endif - -function! SyntaxCheckers_xhtml_tidy_IsAvailable() - return executable("tidy") -endfunction - -" TODO: join this with html.vim DRY's sake? -function! s:TidyEncOptByFenc() - let tidy_opts = { - \'utf-8' : '-utf8', - \'ascii' : '-ascii', - \'latin1' : '-latin1', - \'iso-2022-jp' : '-iso-2022', - \'cp1252' : '-win1252', - \'macroman' : '-mac', - \'utf-16le' : '-utf16le', - \'utf-16' : '-utf16', - \'big5' : '-big5', - \'cp932' : '-shiftjis', - \'sjis' : '-shiftjis', - \'cp850' : '-ibm858', - \} - return get(tidy_opts, &fileencoding, '-utf8') -endfunction - -function! s:IgnoreError(text) - for i in g:syntastic_xhtml_tidy_ignore_errors - if stridx(a:text, i) != -1 - return 1 - endif - endfor - return 0 -endfunction - -function! SyntaxCheckers_xhtml_tidy_GetLocList() - let encopt = s:TidyEncOptByFenc() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'tidy', - \ 'args': encopt . ' -xml -e', - \ 'filetype': 'xhtml', - \ 'subchecker': 'tidy' }) - - let errorformat= - \ '%Wline %l column %v - Warning: %m,' . - \ '%Eline %l column %v - Error: %m,' . - \ '%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")}, - \ 'returns': [0, 1, 2] }) - - for n in range(len(loclist)) - if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1 - let loclist[n]['valid'] = 0 - endif - endfor - - return loclist -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'xhtml', - \ 'name': 'tidy'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/xml/xmllint.vim b/sources_non_forked/syntastic/syntax_checkers/xml/xmllint.vim deleted file mode 100644 index 5a6e1db7..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/xml/xmllint.vim +++ /dev/null @@ -1,52 +0,0 @@ -"============================================================================ -"File: xml.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Sebastian Kusnier -"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_xml_xmllint_checker") - finish -endif -let g:loaded_syntastic_xml_xmllint_checker=1 - -" You can use a local installation of DTDs to significantly speed up validation -" and allow you to validate XML data without network access, see xmlcatalog(1) -" and http://www.xmlsoft.org/catalog.html for more information. - -function! SyntaxCheckers_xml_xmllint_IsAvailable() - return executable('xmllint') -endfunction - -function! SyntaxCheckers_xml_xmllint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'xmllint', - \ 'args': '--xinclude --noout --postvalid', - \ 'filetype': 'xml', - \ 'subchecker': 'xmllint' }) - - let errorformat= - \ '%E%f:%l: error : %m,' . - \ '%-G%f:%l: validity error : Validation failed: no DTD found %m,' . - \ '%W%f:%l: warning : %m,' . - \ '%W%f:%l: validity warning : %m,' . - \ '%E%f:%l: validity error : %m,' . - \ '%E%f:%l: parser error : %m,' . - \ '%E%f:%l: %m,' . - \ '%-Z%p^,' . - \ '%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'returns': [0, 1, 2, 3, 4, 5] }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'xml', - \ 'name': 'xmllint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/xslt/xmllint.vim b/sources_non_forked/syntastic/syntax_checkers/xslt/xmllint.vim deleted file mode 100644 index db397ed8..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/xslt/xmllint.vim +++ /dev/null @@ -1,30 +0,0 @@ -"============================================================================ -"File: xslt.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Sebastian Kusnier -"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_xslt_xmllint_checker") - finish -endif -let g:loaded_syntastic_xslt_xmllint_checker=1 - -function! SyntaxCheckers_xslt_xmllint_IsAvailable() - return SyntaxCheckers_xml_xmllint_IsAvailable() -endfunction - -function! SyntaxCheckers_xslt_xmllint_GetLocList() - return SyntaxCheckers_xml_xmllint_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'xslt', - \ 'name': 'xmllint'}) - -runtime! syntax_checkers/xml/*.vim diff --git a/sources_non_forked/syntastic/syntax_checkers/yaml/jsyaml.vim b/sources_non_forked/syntastic/syntax_checkers/yaml/jsyaml.vim deleted file mode 100644 index 9ffdc658..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/yaml/jsyaml.vim +++ /dev/null @@ -1,42 +0,0 @@ -"============================================================================ -"File: yaml.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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. -" -" -"Installation: $ npm install -g js-yaml -" -"============================================================================ - -if exists("g:loaded_syntastic_yaml_jsyaml_checker") - finish -endif -let g:loaded_syntastic_yaml_jsyaml_checker=1 - -function! SyntaxCheckers_yaml_jsyaml_IsAvailable() - return executable("js-yaml") -endfunction - -function! SyntaxCheckers_yaml_jsyaml_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'js-yaml', - \ 'args': '--compact', - \ 'filetype': 'yaml', - \ 'subchecker': 'jsyaml' }) - - let errorformat='Error on line %l\, col %c:%m,%-G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'yaml', - \ 'name': 'jsyaml'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/z80/z80syntaxchecker.vim b/sources_non_forked/syntastic/syntax_checkers/z80/z80syntaxchecker.vim deleted file mode 100644 index b68acf13..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/z80/z80syntaxchecker.vim +++ /dev/null @@ -1,41 +0,0 @@ -"============================================================================ -"File: z80.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Romain Giot -"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_z80_z80syntaxchecker_checker") - finish -endif -let g:loaded_syntastic_z80_z80syntaxchecker_checker=1 - -"bail if the user doesnt have z80_syntax_checker.py installed -"To obtain this application there are two solutions: -" - 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 -function! SyntaxCheckers_z80_z80syntaxchecker_IsAvailable() - return executable("z80_syntax_checker.py") -endfunction - -function! SyntaxCheckers_z80_z80syntaxchecker_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'z80_syntax_checker.py', - \ 'filetype': 'z80', - \ 'subchecker': 'z80syntaxchecker' }) - - let errorformat = '%f:%l %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'z80', - \ 'name': 'z80syntaxchecker'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/zpt/zptlint.vim b/sources_non_forked/syntastic/syntax_checkers/zpt/zptlint.vim deleted file mode 100644 index ae6ab8a3..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/zpt/zptlint.vim +++ /dev/null @@ -1,50 +0,0 @@ -"============================================================================ -"File: zpt.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: claytron -"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_zpt_zptlint_checker") - finish -endif -let g:loaded_syntastic_zpt_zptlint_checker=1 - -" In order for this plugin to be useful, you will need to set up the -" zpt filetype in your vimrc -" -" " set up zope page templates as the zpt filetype -" au BufNewFile,BufRead *.pt,*.cpt,*.zpt set filetype=zpt syntax=xml -" -" Then install the zptlint program, found on pypi: -" http://pypi.python.org/pypi/zptlint - -function! SyntaxCheckers_zpt_zptlint_IsAvailable() - return executable("zptlint") -endfunction - -function! SyntaxCheckers_zpt_zptlint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'zptlint', - \ 'filetype': 'zpt', - \ 'subchecker': 'zptlint' }) - - let errorformat= - \ '%-P*** Error in: %f,'. - \ '%Z%*\s\, at line %l\, column %c,'. - \ '%E%*\s%m,'. - \ '%-Q' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'zpt', - \ 'name': 'zptlint'}) diff --git a/sources_non_forked/syntastic/syntax_checkers/zsh/zsh.vim b/sources_non_forked/syntastic/syntax_checkers/zsh/zsh.vim deleted file mode 100644 index 5e339a9c..00000000 --- a/sources_non_forked/syntastic/syntax_checkers/zsh/zsh.vim +++ /dev/null @@ -1,38 +0,0 @@ -"============================================================================ -"File: zsh.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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_zsh_zsh_checker") - finish -endif -let g:loaded_syntastic_zsh_zsh_checker=1 - -function! SyntaxCheckers_zsh_zsh_IsAvailable() - return executable("zsh") -endfunction - -function! SyntaxCheckers_zsh_zsh_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'zsh', - \ 'args': '-n', - \ 'filetype': 'zsh', - \ 'subchecker': 'zsh' }) - - let errorformat = '%f:%l: %m' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat}) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'zsh', - \ 'name': 'zsh'}) diff --git a/sources_non_forked/taglist.vim/doc/tags b/sources_non_forked/taglist.vim/doc/tags deleted file mode 100644 index 83e80ba1..00000000 --- a/sources_non_forked/taglist.vim/doc/tags +++ /dev/null @@ -1,62 +0,0 @@ -'Tlist_Auto_Highlight_Tag' taglist.txt /*'Tlist_Auto_Highlight_Tag'* -'Tlist_Auto_Open' taglist.txt /*'Tlist_Auto_Open'* -'Tlist_Auto_Update' taglist.txt /*'Tlist_Auto_Update'* -'Tlist_Close_On_Select' taglist.txt /*'Tlist_Close_On_Select'* -'Tlist_Compact_Format' taglist.txt /*'Tlist_Compact_Format'* -'Tlist_Ctags_Cmd' taglist.txt /*'Tlist_Ctags_Cmd'* -'Tlist_Display_Prototype' taglist.txt /*'Tlist_Display_Prototype'* -'Tlist_Display_Tag_Scope' taglist.txt /*'Tlist_Display_Tag_Scope'* -'Tlist_Enable_Fold_Column' taglist.txt /*'Tlist_Enable_Fold_Column'* -'Tlist_Exit_OnlyWindow' taglist.txt /*'Tlist_Exit_OnlyWindow'* -'Tlist_File_Fold_Auto_Close' taglist.txt /*'Tlist_File_Fold_Auto_Close'* -'Tlist_GainFocus_On_ToggleOpen' taglist.txt /*'Tlist_GainFocus_On_ToggleOpen'* -'Tlist_Highlight_Tag_On_BufEnter' taglist.txt /*'Tlist_Highlight_Tag_On_BufEnter'* -'Tlist_Inc_Winwidth' taglist.txt /*'Tlist_Inc_Winwidth'* -'Tlist_Max_Submenu_Items' taglist.txt /*'Tlist_Max_Submenu_Items'* -'Tlist_Max_Tag_Length' taglist.txt /*'Tlist_Max_Tag_Length'* -'Tlist_Process_File_Always' taglist.txt /*'Tlist_Process_File_Always'* -'Tlist_Show_Menu' taglist.txt /*'Tlist_Show_Menu'* -'Tlist_Show_One_File' taglist.txt /*'Tlist_Show_One_File'* -'Tlist_Sort_Type' taglist.txt /*'Tlist_Sort_Type'* -'Tlist_Use_Horiz_Window' taglist.txt /*'Tlist_Use_Horiz_Window'* -'Tlist_Use_Right_Window' taglist.txt /*'Tlist_Use_Right_Window'* -'Tlist_Use_SingleClick' taglist.txt /*'Tlist_Use_SingleClick'* -'Tlist_WinHeight' taglist.txt /*'Tlist_WinHeight'* -'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'* -:TlistAddFiles taglist.txt /*:TlistAddFiles* -:TlistAddFilesRecursive taglist.txt /*:TlistAddFilesRecursive* -:TlistClose taglist.txt /*:TlistClose* -:TlistDebug taglist.txt /*:TlistDebug* -:TlistHighlightTag taglist.txt /*:TlistHighlightTag* -:TlistLock taglist.txt /*:TlistLock* -:TlistMessages taglist.txt /*:TlistMessages* -:TlistOpen taglist.txt /*:TlistOpen* -:TlistSessionLoad taglist.txt /*:TlistSessionLoad* -:TlistSessionSave taglist.txt /*:TlistSessionSave* -:TlistShowPrototype taglist.txt /*:TlistShowPrototype* -:TlistShowTag taglist.txt /*:TlistShowTag* -:TlistToggle taglist.txt /*:TlistToggle* -:TlistUndebug taglist.txt /*:TlistUndebug* -:TlistUnlock taglist.txt /*:TlistUnlock* -:TlistUpdate taglist.txt /*:TlistUpdate* -Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()* -Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()* -Tlist_Set_App() taglist.txt /*Tlist_Set_App()* -Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()* -taglist-commands taglist.txt /*taglist-commands* -taglist-debug taglist.txt /*taglist-debug* -taglist-extend taglist.txt /*taglist-extend* -taglist-faq taglist.txt /*taglist-faq* -taglist-functions taglist.txt /*taglist-functions* -taglist-install taglist.txt /*taglist-install* -taglist-internet taglist.txt /*taglist-internet* -taglist-intro taglist.txt /*taglist-intro* -taglist-keys taglist.txt /*taglist-keys* -taglist-license taglist.txt /*taglist-license* -taglist-menu taglist.txt /*taglist-menu* -taglist-options taglist.txt /*taglist-options* -taglist-requirements taglist.txt /*taglist-requirements* -taglist-session taglist.txt /*taglist-session* -taglist-todo taglist.txt /*taglist-todo* -taglist-using taglist.txt /*taglist-using* -taglist.txt taglist.txt /*taglist.txt* diff --git a/sources_non_forked/taglist/doc/taglist.txt b/sources_non_forked/taglist/doc/taglist.txt deleted file mode 100755 index 6a62b396..00000000 --- a/sources_non_forked/taglist/doc/taglist.txt +++ /dev/null @@ -1,1501 +0,0 @@ -*taglist.txt* Plugin for browsing source code - -Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) -For Vim version 6.0 and above -Last change: 2007 May 24 - -1. Overview |taglist-intro| -2. Taglist on the internet |taglist-internet| -3. Requirements |taglist-requirements| -4. Installation |taglist-install| -5. Usage |taglist-using| -6. Options |taglist-options| -7. Commands |taglist-commands| -8. Global functions |taglist-functions| -9. Extending |taglist-extend| -10. FAQ |taglist-faq| -11. License |taglist-license| -12. Todo |taglist-todo| - -============================================================================== - *taglist-intro* -1. Overview~ - -The "Tag List" plugin is a source code browser plugin for Vim. This plugin -allows you to efficiently browse through source code files for different -programming languages. The "Tag List" plugin provides the following features: - - * Displays the tags (functions, classes, structures, variables, etc.) - defined in a file in a vertically or horizontally split Vim window. - * In GUI Vim, optionally displays the tags in the Tags drop-down menu and - in the popup menu. - * Automatically updates the taglist window as you switch between - files/buffers. As you open new files, the tags defined in the new files - are added to the existing file list and the tags defined in all the - files are displayed grouped by the filename. - * When a tag name is selected from the taglist window, positions the - cursor at the definition of the tag in the source file. - * Automatically highlights the current tag name. - * Groups the tags by their type and displays them in a foldable tree. - * Can display the prototype and scope of a tag. - * Can optionally display the tag prototype instead of the tag name in the - taglist window. - * The tag list can be sorted either by name or by chronological order. - * Supports the following language files: Assembly, ASP, Awk, Beta, C, - C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, - Lua, Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, - SML, Sql, TCL, Verilog, Vim and Yacc. - * Can be easily extended to support new languages. Support for - existing languages can be modified easily. - * Provides functions to display the current tag name in the Vim status - line or the window title bar. - * The list of tags and files in the taglist can be saved and - restored across Vim sessions. - * Provides commands to get the name and prototype of the current tag. - * Runs in both console/terminal and GUI versions of Vim. - * Works with the winmanager plugin. Using the winmanager plugin, you - can use Vim plugins like the file explorer, buffer explorer and the - taglist plugin at the same time like an IDE. - * Can be used in both Unix and MS-Windows systems. - -============================================================================== - *taglist-internet* -2. Taglist on the internet~ - -The home page of the taglist plugin is at: -> - http://vim-taglist.sourceforge.net/ -< -You can subscribe to the taglist mailing list to post your questions or -suggestions for improvement or to send bug reports. Visit the following page -for subscribing to the mailing list: -> - http://groups.yahoo.com/group/taglist -< -============================================================================== - *taglist-requirements* -3. Requirements~ - -The taglist plugin requires the following: - - * Vim version 6.0 and above - * Exuberant ctags 5.0 and above - -The taglist plugin will work on all the platforms where the exuberant ctags -utility and Vim are supported (this includes MS-Windows and Unix based -systems). - -The taglist plugin relies on the exuberant ctags utility to dynamically -generate the tag listing. The exuberant ctags utility must be installed in -your system to use this plugin. The exuberant ctags utility is shipped with -most of the Linux distributions. You can download the exuberant ctags utility -from -> - http://ctags.sourceforge.net -< -The taglist plugin doesn't use or create a tags file and there is no need to -create a tags file to use this plugin. The taglist plugin will not work with -the GNU ctags or the Unix ctags utility. - -This plugin relies on the Vim "filetype" detection mechanism to determine the -type of the current file. You have to turn on the Vim filetype detection by -adding the following line to your .vimrc file: -> - filetype on -< -The taglist plugin will not work if you run Vim in the restricted mode (using -the -Z command-line argument). - -The taglist plugin uses the Vim system() function to invoke the exuberant -ctags utility. If Vim is compiled without the system() function then you -cannot use the taglist plugin. Some of the Linux distributions (Suse) compile -Vim without the system() function for security reasons. - -============================================================================== - *taglist-install* -4. Installation~ - -1. Download the taglist.zip file and unzip the files to the $HOME/.vim or the - $HOME/vimfiles or the $VIM/vimfiles directory. After this step, you should - have the following two files (the directory structure should be preserved): - - plugin/taglist.vim - main taglist plugin file - doc/taglist.txt - documentation (help) file - - Refer to the |add-plugin|and |'runtimepath'| Vim help pages for more - details about installing Vim plugins. -2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or $VIM/vimfiles/doc - directory, start Vim and run the ":helptags ." command to process the - taglist help file. Without this step, you cannot jump to the taglist help - topics. -3. If the exuberant ctags utility is not present in one of the directories in - the PATH environment variable, then set the 'Tlist_Ctags_Cmd' variable to - point to the location of the exuberant ctags utility (not to the directory) - in the .vimrc file. -4. If you are running a terminal/console version of Vim and the terminal - doesn't support changing the window width then set the - 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file. -5. Restart Vim. -6. You can now use the ":TlistToggle" command to open/close the taglist - window. You can use the ":help taglist" command to get more information - about using the taglist plugin. - -To uninstall the taglist plugin, remove the plugin/taglist.vim and -doc/taglist.txt files from the $HOME/.vim or $HOME/vimfiles directory. - -============================================================================== - *taglist-using* -5. Usage~ - -The taglist plugin can be used in several different ways. - -1. You can keep the taglist window open during the entire editing session. On - opening the taglist window, the tags defined in all the files in the Vim - buffer list will be displayed in the taglist window. As you edit files, the - tags defined in them will be added to the taglist window. You can select a - tag from the taglist window and jump to it. The current tag will be - highlighted in the taglist window. You can close the taglist window when - you no longer need the window. -2. You can configure the taglist plugin to process the tags defined in all the - edited files always. In this configuration, even if the taglist window is - closed and the taglist menu is not displayed, the taglist plugin will - processes the tags defined in newly edited files. You can then open the - taglist window only when you need to select a tag and then automatically - close the taglist window after selecting the tag. -3. You can configure the taglist plugin to display only the tags defined in - the current file in the taglist window. By default, the taglist plugin - displays the tags defined in all the files in the Vim buffer list. As you - switch between files, the taglist window will be refreshed to display only - the tags defined in the current file. -4. In GUI Vim, you can use the Tags pull-down and popup menu created by the - taglist plugin to display the tags defined in the current file and select a - tag to jump to it. You can use the menu without opening the taglist window. - By default, the Tags menu is disabled. -5. You can configure the taglist plugin to display the name of the current tag - in the Vim window status line or in the Vim window title bar. For this to - work without the taglist window or menu, you need to configure the taglist - plugin to process the tags defined in a file always. -6. You can save the tags defined in multiple files to a taglist session file - and load it when needed. You can also configure the taglist plugin to not - update the taglist window when editing new files. You can then manually add - files to the taglist window. - -Opening the taglist window~ -You can open the taglist window using the ":TlistOpen" or the ":TlistToggle" -commands. The ":TlistOpen" command opens the taglist window and jumps to it. -The ":TlistToggle" command opens or closes (toggle) the taglist window and the -cursor remains in the current window. If the 'Tlist_GainFocus_On_ToggleOpen' -variable is set to 1, then the ":TlistToggle" command opens the taglist window -and moves the cursor to the taglist window. - -You can map a key to invoke these commands. For example, the following command -creates a normal mode mapping for the key to toggle the taglist window. -> - nnoremap :TlistToggle -< -Add the above mapping to your ~/.vimrc or $HOME/_vimrc file. - -To automatically open the taglist window on Vim startup, set the -'Tlist_Auto_Open' variable to 1. - -You can also open the taglist window on startup using the following command -line: -> - $ vim +TlistOpen -< -Closing the taglist window~ -You can close the taglist window from the taglist window by pressing 'q' or -using the Vim ":q" command. You can also use any of the Vim window commands to -close the taglist window. Invoking the ":TlistToggle" command when the taglist -window is opened, closes the taglist window. You can also use the -":TlistClose" command to close the taglist window. - -To automatically close the taglist window when a tag or file is selected, you -can set the 'Tlist_Close_On_Select' variable to 1. To exit Vim when only the -taglist window is present, set the 'Tlist_Exit_OnlyWindow' variable to 1. - -Jumping to a tag or a file~ -You can select a tag in the taglist window either by pressing the key -or by double clicking the tag name using the mouse. To jump to a tag on a -single mouse click set the 'Tlist_Use_SingleClick' variable to 1. - -If the selected file is already opened in a window, then the cursor is moved -to that window. If the file is not currently opened in a window then the file -is opened in the window used by the taglist plugin to show the previously -selected file. If there are no usable windows, then the file is opened in a -new window. The file is not opened in special windows like the quickfix -window, preview window and windows containing buffer with the 'buftype' option -set. - -To jump to the tag in a new window, press the 'o' key. To open the file in the -previous window (Ctrl-W_p) use the 'P' key. You can press the 'p' key to jump -to the tag but still keep the cursor in the taglist window (preview). - -To open the selected file in a tab, use the 't' key. If the file is already -present in a tab then the cursor is moved to that tab otherwise the file is -opened in a new tab. To jump to a tag in a new tab press Ctrl-t. The taglist -window is automatically opened in the newly created tab. - -Instead of jumping to a tag, you can open a file by pressing the key -or by double clicking the file name using the mouse. - -In the taglist window, you can use the [[ or key to jump to the -beginning of the previous file. You can use the ]] or key to jump to the -beginning of the next file. When you reach the first or last file, the search -wraps around and the jumps to the next/previous file. - -Highlighting the current tag~ -The taglist plugin automatically highlights the name of the current tag in the -taglist window. The Vim |CursorHold| autocmd event is used for this. If the -current tag name is not visible in the taglist window, then the taglist window -contents are scrolled to make that tag name visible. You can also use the -":TlistHighlightTag" command to force the highlighting of the current tag. - -The tag name is highlighted if no activity is performed for |'updatetime'| -milliseconds. The default value for this Vim option is 4 seconds. To avoid -unexpected problems, you should not set the |'updatetime'| option to a very -low value. - -To disable the automatic highlighting of the current tag name in the taglist -window, set the 'Tlist_Auto_Highlight_Tag' variable to zero. - -When entering a Vim buffer/window, the taglist plugin automatically highlights -the current tag in that buffer/window. If you like to disable the automatic -highlighting of the current tag when entering a buffer, set the -'Tlist_Highlight_Tag_On_BufEnter' variable to zero. - -Adding files to the taglist~ -When the taglist window is opened, all the files in the Vim buffer list are -processed and the supported files are added to the taglist. When you edit a -file in Vim, the taglist plugin automatically processes this file and adds it -to the taglist. If you close the taglist window, the tag information in the -taglist is retained. - -To process files even when the taglist window is not open, set the -'Tlist_Process_File_Always' variable to 1. - -You can manually add multiple files to the taglist without opening them using -the ":TlistAddFiles" and the ":TlistAddFilesRecursive" commands. - -For example, to add all the C files in the /my/project/dir directory to the -taglist, you can use the following command: -> - :TlistAddFiles /my/project/dir/*.c -< -Note that when adding several files with a large number of tags or a large -number of files, it will take several seconds to several minutes for the -taglist plugin to process all the files. You should not interrupt the taglist -plugin by pressing . - -You can recursively add multiple files from a directory tree using the -":TlistAddFilesRecursive" command: -> - :TlistAddFilesRecursive /my/project/dir *.c -< -This command takes two arguments. The first argument specifies the directory -from which to recursively add the files. The second optional argument -specifies the wildcard matching pattern for selecting the files to add. The -default pattern is * and all the files are added. - -Displaying tags for only one file~ -The taglist window displays the tags for all the files in the Vim buffer list -and all the manually added files. To display the tags for only the current -active buffer, set the 'Tlist_Show_One_File' variable to 1. - -Removing files from the taglist~ -You can remove a file from the taglist window, by pressing the 'd' key when the -cursor is on one of the tags listed for the file in the taglist window. The -removed file will no longer be displayed in the taglist window in the current -Vim session. To again display the tags for the file, open the file in a Vim -window and then use the ":TlistUpdate" command or use ":TlistAddFiles" command -to add the file to the taglist. - -When a buffer is removed from the Vim buffer list using the ":bdelete" or the -":bwipeout" command, the taglist is updated to remove the stored information -for this buffer. - -Updating the tags displayed for a file~ -The taglist plugin keeps track of the modification time of a file. When the -modification time changes (the file is modified), the taglist plugin -automatically updates the tags listed for that file. The modification time of -a file is checked when you enter a window containing that file or when you -load that file. - -You can also update or refresh the tags displayed for a file by pressing the -"u" key in the taglist window. If an existing file is modified, after the file -is saved, the taglist plugin automatically updates the tags displayed for the -file. - -You can also use the ":TlistUpdate" command to update the tags for the current -buffer after you made some changes to it. You should save the modified buffer -before you update the taglist window. Otherwise the listed tags will not -include the new tags created in the buffer. - -If you have deleted the tags displayed for a file in the taglist window using -the 'd' key, you can again display the tags for that file using the -":TlistUpdate" command. - -Controlling the taglist updates~ -To disable the automatic processing of new files or modified files, you can -set the 'Tlist_Auto_Update' variable to zero. When this variable is set to -zero, the taglist is updated only when you use the ":TlistUpdate" command or -the ":TlistAddFiles" or the ":TlistAddFilesRecursive" commands. You can use -this option to control which files are added to the taglist. - -You can use the ":TlistLock" command to lock the taglist contents. After this -command is executed, new files are not automatically added to the taglist. -When the taglist is locked, you can use the ":TlistUpdate" command to add the -current file or the ":TlistAddFiles" or ":TlistAddFilesRecursive" commands to -add new files to the taglist. To unlock the taglist, use the ":TlistUnlock" -command. - -Displaying the tag prototype~ -To display the prototype of the tag under the cursor in the taglist window, -press the space bar. If you place the cursor on a tag name in the taglist -window, then the tag prototype is displayed at the Vim status line after -|'updatetime'| milliseconds. The default value for the |'updatetime'| Vim -option is 4 seconds. - -You can get the name and prototype of a tag without opening the taglist window -and the taglist menu using the ":TlistShowTag" and the ":TlistShowPrototype" -commands. These commands will work only if the current file is already present -in the taglist. To use these commands without opening the taglist window, set -the 'Tlist_Process_File_Always' variable to 1. - -You can use the ":TlistShowTag" command to display the name of the tag at or -before the specified line number in the specified file. If the file name and -line number are not supplied, then this command will display the name of the -current tag. For example, -> - :TlistShowTag - :TlistShowTag myfile.java 100 -< -You can use the ":TlistShowPrototype" command to display the prototype of the -tag at or before the specified line number in the specified file. If the file -name and the line number are not supplied, then this command will display the -prototype of the current tag. For example, -> - :TlistShowPrototype - :TlistShowPrototype myfile.c 50 -< -In the taglist window, when the mouse is moved over a tag name, the tag -prototype is displayed in a balloon. This works only in GUI versions where -balloon evaluation is supported. - -Taglist window contents~ -The taglist window contains the tags defined in various files in the taglist -grouped by the filename and by the tag type (variable, function, class, etc.). -For tags with scope information (like class members, structures inside -structures, etc.), the scope information is displayed in square brackets "[]" -after the tag name. - -The contents of the taglist buffer/window are managed by the taglist plugin. -The |'filetype'| for the taglist buffer is set to 'taglist'. The Vim -|'modifiable'| option is turned off for the taglist buffer. You should not -manually edit the taglist buffer, by setting the |'modifiable'| flag. If you -manually edit the taglist buffer contents, then the taglist plugin will be out -of sync with the taglist buffer contents and the plugin will no longer work -correctly. To redisplay the taglist buffer contents again, close the taglist -window and reopen it. - -Opening and closing the tag and file tree~ -In the taglist window, the tag names are displayed as a foldable tree using -the Vim folding support. You can collapse the tree using the '-' key or using -the Vim |zc| fold command. You can open the tree using the '+' key or using -the Vim |zo| fold command. You can open all the folds using the '*' key or -using the Vim |zR| fold command. You can also use the mouse to open/close the -folds. You can close all the folds using the '=' key. You should not manually -create or delete the folds in the taglist window. - -To automatically close the fold for the inactive files/buffers and open only -the fold for the current buffer in the taglist window, set the -'Tlist_File_Fold_Auto_Close' variable to 1. - -Sorting the tags for a file~ -The tags displayed in the taglist window can be sorted either by their name or -by their chronological order. The default sorting method is by the order in -which the tags appear in a file. You can change the default sort method by -setting the 'Tlist_Sort_Type' variable to either "name" or "order". You can -sort the tags by their name by pressing the "s" key in the taglist window. You -can again sort the tags by their chronological order using the "s" key. Each -file in the taglist window can be sorted using different order. - -Zooming in and out of the taglist window~ -You can press the 'x' key in the taglist window to maximize the taglist -window width/height. The window will be maximized to the maximum possible -width/height without closing the other existing windows. You can again press -'x' to restore the taglist window to the default width/height. - - *taglist-session* -Taglist Session~ -A taglist session refers to the group of files and their tags stored in the -taglist in a Vim session. - -You can save and restore a taglist session (and all the displayed tags) using -the ":TlistSessionSave" and ":TlistSessionLoad" commands. - -To save the information about the tags and files in the taglist to a file, use -the ":TlistSessionSave" command and specify the filename: -> - :TlistSessionSave -< -To load a saved taglist session, use the ":TlistSessionLoad" command: > - - :TlistSessionLoad -< -When you load a taglist session file, the tags stored in the file will be -added to the tags already stored in the taglist. - -The taglist session feature can be used to save the tags for large files or a -group of frequently used files (like a project). By using the taglist session -file, you can minimize the amount to time it takes to load/refresh the taglist -for multiple files. - -You can create more than one taglist session file for multiple groups of -files. - -Displaying the tag name in the Vim status line or the window title bar~ -You can use the Tlist_Get_Tagname_By_Line() function provided by the taglist -plugin to display the current tag name in the Vim status line or the window -title bar. Similarly, you can use the Tlist_Get_Tag_Prototype_By_Line() -function to display the current tag prototype in the Vim status line or the -window title bar. - -For example, the following command can be used to display the current tag name -in the status line: -> - :set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%) -< -The following command can be used to display the current tag name in the -window title bar: -> - :set title titlestring=%<%f\ %([%{Tlist_Get_Tagname_By_Line()}]%) -< -Note that the current tag name can be displayed only after the file is -processed by the taglist plugin. For this, you have to either set the -'Tlist_Process_File_Always' variable to 1 or open the taglist window or use -the taglist menu. For more information about configuring the Vim status line, -refer to the documentation for the Vim |'statusline'| option. - -Changing the taglist window highlighting~ -The following Vim highlight groups are defined and used to highlight the -various entities in the taglist window: - - TagListTagName - Used for tag names - TagListTagScope - Used for tag scope - TagListTitle - Used for tag titles - TagListComment - Used for comments - TagListFileName - Used for filenames - -By default, these highlight groups are linked to the standard Vim highlight -groups. If you want to change the colors used for these highlight groups, -prefix the highlight group name with 'My' and define it in your .vimrc or -.gvimrc file: MyTagListTagName, MyTagListTagScope, MyTagListTitle, -MyTagListComment and MyTagListFileName. For example, to change the colors -used for tag names, you can use the following command: -> - :highlight MyTagListTagName guifg=blue ctermfg=blue -< -Controlling the taglist window~ -To use a horizontally split taglist window, instead of a vertically split -window, set the 'Tlist_Use_Horiz_Window' variable to 1. - -To use a vertically split taglist window on the rightmost side of the Vim -window, set the 'Tlist_Use_Right_Window' variable to 1. - -You can specify the width of the vertically split taglist window, by setting -the 'Tlist_WinWidth' variable. You can specify the height of the horizontally -split taglist window, by setting the 'Tlist_WinHeight' variable. - -When opening a vertically split taglist window, the Vim window width is -increased to accommodate the new taglist window. When the taglist window is -closed, the Vim window is reduced. To disable this, set the -'Tlist_Inc_Winwidth' variable to zero. - -To reduce the number of empty lines in the taglist window, set the -'Tlist_Compact_Format' variable to 1. - -To not display the Vim fold column in the taglist window, set the -'Tlist_Enable_Fold_Column' variable to zero. - -To display the tag prototypes instead of the tag names in the taglist window, -set the 'Tlist_Display_Prototype' variable to 1. - -To not display the scope of the tags next to the tag names, set the -'Tlist_Display_Tag_Scope' variable to zero. - - *taglist-keys* -Taglist window key list~ -The following table lists the description of the keys that can be used -in the taglist window. - - Key Description~ - - Jump to the location where the tag under cursor is - defined. - o Jump to the location where the tag under cursor is - defined in a new window. - P Jump to the tag in the previous (Ctrl-W_p) window. - p Display the tag definition in the file window and - keep the cursor in the taglist window itself. - t Jump to the tag in a new tab. If the file is already - opened in a tab, move to that tab. - Ctrl-t Jump to the tag in a new tab. - Display the prototype of the tag under the cursor. - For file names, display the full path to the file, - file type and the number of tags. For tag types, display the - tag type and the number of tags. - u Update the tags listed in the taglist window - s Change the sort order of the tags (by name or by order) - d Remove the tags for the file under the cursor - x Zoom-in or Zoom-out the taglist window - + Open a fold - - Close a fold - * Open all folds - = Close all folds - [[ Jump to the beginning of the previous file - Jump to the beginning of the previous file - ]] Jump to the beginning of the next file - Jump to the beginning of the next file - q Close the taglist window - Display help - -The above keys will work in both the normal mode and the insert mode. - - *taglist-menu* -Taglist menu~ -When using GUI Vim, the taglist plugin can display the tags defined in the -current file in the drop-down menu and the popup menu. By default, this -feature is turned off. To turn on this feature, set the 'Tlist_Show_Menu' -variable to 1. - -You can jump to a tag by selecting the tag name from the menu. You can use the -taglist menu independent of the taglist window i.e. you don't need to open the -taglist window to get the taglist menu. - -When you switch between files/buffers, the taglist menu is automatically -updated to display the tags defined in the current file/buffer. - -The tags are grouped by their type (variables, functions, classes, methods, -etc.) and displayed as a separate sub-menu for each type. If all the tags -defined in a file are of the same type (e.g. functions), then the sub-menu is -not used. - -If the number of items in a tag type submenu exceeds the value specified by -the 'Tlist_Max_Submenu_Items' variable, then the submenu will be split into -multiple submenus. The default setting for 'Tlist_Max_Submenu_Items' is 25. -The first and last tag names in the submenu are used to form the submenu name. -The menu items are prefixed by alpha-numeric characters for easy selection by -keyboard. - -If the popup menu support is enabled (the |'mousemodel'| option contains -"popup"), then the tags menu is added to the popup menu. You can access -the popup menu by right clicking on the GUI window. - -You can regenerate the tags menu by selecting the 'Tags->Refresh menu' entry. -You can sort the tags listed in the menu either by name or by order by -selecting the 'Tags->Sort menu by->Name/Order' menu entry. - -You can tear-off the Tags menu and keep it on the side of the Vim window -for quickly locating the tags. - -Using the taglist plugin with the winmanager plugin~ -You can use the taglist plugin with the winmanager plugin. This will allow you -to use the file explorer, buffer explorer and the taglist plugin at the same -time in different windows. To use the taglist plugin with the winmanager -plugin, set 'TagList' in the 'winManagerWindowLayout' variable. For example, -to use the file explorer plugin and the taglist plugin at the same time, use -the following setting: > - - let winManagerWindowLayout = 'FileExplorer|TagList' -< -Getting help~ -If you have installed the taglist help file (this file), then you can use the -Vim ":help taglist-" command to get help on the various taglist -topics. - -You can press the key in the taglist window to display the help -information about using the taglist window. If you again press the key, -the help information is removed from the taglist window. - - *taglist-debug* -Debugging the taglist plugin~ -You can use the ":TlistDebug" command to enable logging of the debug messages -from the taglist plugin. To display the logged debug messages, you can use the -":TlistMessages" command. To disable the logging of the debug messages, use -the ":TlistUndebug" command. - -You can specify a file name to the ":TlistDebug" command to log the debug -messages to a file. Otherwise, the debug messages are stored in a script-local -variable. In the later case, to minimize memory usage, only the last 3000 -characters from the debug messages are stored. - -============================================================================== - *taglist-options* -6. Options~ - -A number of Vim variables control the behavior of the taglist plugin. These -variables are initialized to a default value. By changing these variables you -can change the behavior of the taglist plugin. You need to change these -settings only if you want to change the behavior of the taglist plugin. You -should use the |:let| command in your .vimrc file to change the setting of any -of these variables. - -The configurable taglist variables are listed below. For a detailed -description of these variables refer to the text below this table. - -|'Tlist_Auto_Highlight_Tag'| Automatically highlight the current tag in the - taglist. -|'Tlist_Auto_Open'| Open the taglist window when Vim starts. -|'Tlist_Auto_Update'| Automatically update the taglist to include - newly edited files. -|'Tlist_Close_On_Select'| Close the taglist window when a file or tag is - selected. -|'Tlist_Compact_Format'| Remove extra information and blank lines from - the taglist window. -|'Tlist_Ctags_Cmd'| Specifies the path to the ctags utility. -|'Tlist_Display_Prototype'| Show prototypes and not tags in the taglist - window. -|'Tlist_Display_Tag_Scope'| Show tag scope next to the tag name. -|'Tlist_Enable_Fold_Column'| Show the fold indicator column in the taglist - window. -|'Tlist_Exit_OnlyWindow'| Close Vim if the taglist is the only window. -|'Tlist_File_Fold_Auto_Close'| Close tag folds for inactive buffers. -|'Tlist_GainFocus_On_ToggleOpen'| - Jump to taglist window on open. -|'Tlist_Highlight_Tag_On_BufEnter'| - On entering a buffer, automatically highlight - the current tag. -|'Tlist_Inc_Winwidth'| Increase the Vim window width to accommodate - the taglist window. -|'Tlist_Max_Submenu_Items'| Maximum number of items in a tags sub-menu. -|'Tlist_Max_Tag_Length'| Maximum tag length used in a tag menu entry. -|'Tlist_Process_File_Always'| Process files even when the taglist window is - closed. -|'Tlist_Show_Menu'| Display the tags menu. -|'Tlist_Show_One_File'| Show tags for the current buffer only. -|'Tlist_Sort_Type'| Sort method used for arranging the tags. -|'Tlist_Use_Horiz_Window'| Use a horizontally split window for the - taglist window. -|'Tlist_Use_Right_Window'| Place the taglist window on the right side. -|'Tlist_Use_SingleClick'| Single click on a tag jumps to it. -|'Tlist_WinHeight'| Horizontally split taglist window height. -|'Tlist_WinWidth'| Vertically split taglist window width. - - *'Tlist_Auto_Highlight_Tag'* -Tlist_Auto_Highlight_Tag~ -The taglist plugin will automatically highlight the current tag in the taglist -window. If you want to disable this, then you can set the -'Tlist_Auto_Highlight_Tag' variable to zero. Note that even though the current -tag highlighting is disabled, the tags for a new file will still be added to -the taglist window. -> - let Tlist_Auto_Highlight_Tag = 0 -< -With the above variable set to 1, you can use the ":TlistHighlightTag" command -to highlight the current tag. - - *'Tlist_Auto_Open'* -Tlist_Auto_Open~ -To automatically open the taglist window, when you start Vim, you can set the -'Tlist_Auto_Open' variable to 1. By default, this variable is set to zero and -the taglist window will not be opened automatically on Vim startup. -> - let Tlist_Auto_Open = 1 -< -The taglist window is opened only when a supported type of file is opened on -Vim startup. For example, if you open text files, then the taglist window will -not be opened. - - *'Tlist_Auto_Update'* -Tlist_Auto_Update~ -When a new file is edited, the tags defined in the file are automatically -processed and added to the taglist. To stop adding new files to the taglist, -set the 'Tlist_Auto_Update' variable to zero. By default, this variable is set -to 1. -> - let Tlist_Auto_Update = 0 -< -With the above variable set to 1, you can use the ":TlistUpdate" command to -add the tags defined in the current file to the taglist. - - *'Tlist_Close_On_Select'* -Tlist_Close_On_Select~ -If you want to close the taglist window when a file or tag is selected, then -set the 'Tlist_Close_On_Select' variable to 1. By default, this variable is -set zero and when you select a tag or file from the taglist window, the window -is not closed. -> - let Tlist_Close_On_Select = 1 -< - *'Tlist_Compact_Format'* -Tlist_Compact_Format~ -By default, empty lines are used to separate different tag types displayed for -a file and the tags displayed for different files in the taglist window. If -you want to display as many tags as possible in the taglist window, you can -set the 'Tlist_Compact_Format' variable to 1 to get a compact display. -> - let Tlist_Compact_Format = 1 -< - *'Tlist_Ctags_Cmd'* -Tlist_Ctags_Cmd~ -The 'Tlist_Ctags_Cmd' variable specifies the location (path) of the exuberant -ctags utility. If exuberant ctags is present in any one of the directories in -the PATH environment variable, then there is no need to set this variable. - -The exuberant ctags tool can be installed under different names. When the -taglist plugin starts up, if the 'Tlist_Ctags_Cmd' variable is not set, it -checks for the names exuberant-ctags, exctags, ctags, ctags.exe and tags in -the PATH environment variable. If any one of the named executable is found, -then the Tlist_Ctags_Cmd variable is set to that name. - -If exuberant ctags is not present in one of the directories specified in the -PATH environment variable, then set this variable to point to the location of -the ctags utility in your system. Note that this variable should point to the -fully qualified exuberant ctags location and NOT to the directory in which -exuberant ctags is installed. If the exuberant ctags tool is not found in -either PATH or in the specified location, then the taglist plugin will not be -loaded. Examples: -> - let Tlist_Ctags_Cmd = 'd:\tools\ctags.exe' - let Tlist_Ctags_Cmd = '/usr/local/bin/ctags' -< - *'Tlist_Display_Prototype'* -Tlist_Display_Prototype~ -By default, only the tag name will be displayed in the taglist window. If you -like to see tag prototypes instead of names, set the 'Tlist_Display_Prototype' -variable to 1. By default, this variable is set to zero and only tag names -will be displayed. -> - let Tlist_Display_Prototype = 1 -< - *'Tlist_Display_Tag_Scope'* -Tlist_Display_Tag_Scope~ -By default, the scope of a tag (like a C++ class) will be displayed in -square brackets next to the tag name. If you don't want the tag scopes -to be displayed, then set the 'Tlist_Display_Tag_Scope' to zero. By default, -this variable is set to 1 and the tag scopes will be displayed. -> - let Tlist_Display_Tag_Scope = 0 -< - *'Tlist_Enable_Fold_Column'* -Tlist_Enable_Fold_Column~ -By default, the Vim fold column is enabled and displayed in the taglist -window. If you wish to disable this (for example, when you are working with a -narrow Vim window or terminal), you can set the 'Tlist_Enable_Fold_Column' -variable to zero. -> - let Tlist_Enable_Fold_Column = 1 -< - *'Tlist_Exit_OnlyWindow'* -Tlist_Exit_OnlyWindow~ -If you want to exit Vim if only the taglist window is currently opened, then -set the 'Tlist_Exit_OnlyWindow' variable to 1. By default, this variable is -set to zero and the Vim instance will not be closed if only the taglist window -is present. -> - let Tlist_Exit_OnlyWindow = 1 -< - *'Tlist_File_Fold_Auto_Close'* -Tlist_File_Fold_Auto_Close~ -By default, the tags tree displayed in the taglist window for all the files is -opened. You can close/fold the tags tree for the files manually. To -automatically close the tags tree for inactive files, you can set the -'Tlist_File_Fold_Auto_Close' variable to 1. When this variable is set to 1, -the tags tree for the current buffer is automatically opened and for all the -other buffers is closed. -> - let Tlist_File_Fold_Auto_Close = 1 -< - *'Tlist_GainFocus_On_ToggleOpen'* -Tlist_GainFocus_On_ToggleOpen~ -When the taglist window is opened using the ':TlistToggle' command, this -option controls whether the cursor is moved to the taglist window or remains -in the current window. By default, this option is set to 0 and the cursor -remains in the current window. When this variable is set to 1, the cursor -moves to the taglist window after opening the taglist window. -> - let Tlist_GainFocus_On_ToggleOpen = 1 -< - *'Tlist_Highlight_Tag_On_BufEnter'* -Tlist_Highlight_Tag_On_BufEnter~ -When you enter a Vim buffer/window, the current tag in that buffer/window is -automatically highlighted in the taglist window. If the current tag name is -not visible in the taglist window, then the taglist window contents are -scrolled to make that tag name visible. If you like to disable the automatic -highlighting of the current tag when entering a buffer, you can set the -'Tlist_Highlight_Tag_On_BufEnter' variable to zero. The default setting for -this variable is 1. -> - let Tlist_Highlight_Tag_On_BufEnter = 0 -< - *'Tlist_Inc_Winwidth'* -Tlist_Inc_Winwidth~ -By default, when the width of the window is less than 100 and a new taglist -window is opened vertically, then the window width is increased by the value -set in the 'Tlist_WinWidth' variable to accommodate the new window. The value -of this variable is used only if you are using a vertically split taglist -window. - -If your terminal doesn't support changing the window width from Vim (older -version of xterm running in a Unix system) or if you see any weird problems in -the screen due to the change in the window width or if you prefer not to -adjust the window width then set the 'Tlist_Inc_Winwidth' variable to zero. -CAUTION: If you are using the MS-Windows version of Vim in a MS-DOS command -window then you must set this variable to zero, otherwise the system may hang -due to a Vim limitation (explained in :help win32-problems) -> - let Tlist_Inc_Winwidth = 0 -< - *'Tlist_Max_Submenu_Items'* -Tlist_Max_Submenu_Items~ -If a file contains too many tags of a particular type (function, variable, -class, etc.), greater than that specified by the 'Tlist_Max_Submenu_Items' -variable, then the menu for that tag type will be split into multiple -sub-menus. The default setting for the 'Tlist_Max_Submenu_Items' variable is -25. This can be changed by setting the 'Tlist_Max_Submenu_Items' variable: -> - let Tlist_Max_Submenu_Items = 20 -< -The name of the submenu is formed using the names of the first and the last -tag entries in that submenu. - - *'Tlist_Max_Tag_Length'* -Tlist_Max_Tag_Length~ -Only the first 'Tlist_Max_Tag_Length' characters from the tag names will be -used to form the tag type submenu name. The default value for this variable is -10. Change the 'Tlist_Max_Tag_Length' setting if you want to include more or -less characters: -> - let Tlist_Max_Tag_Length = 10 -< - *'Tlist_Process_File_Always'* -Tlist_Process_File_Always~ -By default, the taglist plugin will generate and process the tags defined in -the newly opened files only when the taglist window is opened or when the -taglist menu is enabled. When the taglist window is closed, the taglist plugin -will stop processing the tags for newly opened files. - -You can set the 'Tlist_Process_File_Always' variable to 1 to generate the list -of tags for new files even when the taglist window is closed and the taglist -menu is disabled. -> - let Tlist_Process_File_Always = 1 -< -To use the ":TlistShowTag" and the ":TlistShowPrototype" commands without the -taglist window and the taglist menu, you should set this variable to 1. - - *'Tlist_Show_Menu'* -Tlist_Show_Menu~ -When using GUI Vim, you can display the tags defined in the current file in a -menu named "Tags". By default, this feature is turned off. To turn on this -feature, set the 'Tlist_Show_Menu' variable to 1: -> - let Tlist_Show_Menu = 1 -< - *'Tlist_Show_One_File'* -Tlist_Show_One_File~ -By default, the taglist plugin will display the tags defined in all the loaded -buffers in the taglist window. If you prefer to display the tags defined only -in the current buffer, then you can set the 'Tlist_Show_One_File' to 1. When -this variable is set to 1, as you switch between buffers, the taglist window -will be refreshed to display the tags for the current buffer and the tags for -the previous buffer will be removed. -> - let Tlist_Show_One_File = 1 -< - *'Tlist_Sort_Type'* -Tlist_Sort_Type~ -The 'Tlist_Sort_Type' variable specifies the sort order for the tags in the -taglist window. The tags can be sorted either alphabetically by their name or -by the order of their appearance in the file (chronological order). By -default, the tag names will be listed by the order in which they are defined -in the file. You can change the sort type (from name to order or from order to -name) by pressing the "s" key in the taglist window. You can also change the -default sort order by setting 'Tlist_Sort_Type' to "name" or "order": -> - let Tlist_Sort_Type = "name" -< - *'Tlist_Use_Horiz_Window'* -Tlist_Use_Horiz_Window~ -Be default, the tag names are displayed in a vertically split window. If you -prefer a horizontally split window, then set the 'Tlist_Use_Horiz_Window' -variable to 1. If you are running MS-Windows version of Vim in a MS-DOS -command window, then you should use a horizontally split window instead of a -vertically split window. Also, if you are using an older version of xterm in a -Unix system that doesn't support changing the xterm window width, you should -use a horizontally split window. -> - let Tlist_Use_Horiz_Window = 1 -< - *'Tlist_Use_Right_Window'* -Tlist_Use_Right_Window~ -By default, the vertically split taglist window will appear on the left hand -side. If you prefer to open the window on the right hand side, you can set the -'Tlist_Use_Right_Window' variable to 1: -> - let Tlist_Use_Right_Window = 1 -< - *'Tlist_Use_SingleClick'* -Tlist_Use_SingleClick~ -By default, when you double click on the tag name using the left mouse -button, the cursor will be positioned at the definition of the tag. You -can set the 'Tlist_Use_SingleClick' variable to 1 to jump to a tag when -you single click on the tag name using the mouse. By default this variable -is set to zero. -> - let Tlist_Use_SingleClick = 1 -< -Due to a bug in Vim, if you set 'Tlist_Use_SingleClick' to 1 and try to resize -the taglist window using the mouse, then Vim will crash. This problem is fixed -in Vim 6.3 and above. In the meantime, instead of resizing the taglist window -using the mouse, you can use normal Vim window resizing commands to resize the -taglist window. - - *'Tlist_WinHeight'* -Tlist_WinHeight~ -The default height of the horizontally split taglist window is 10. This can be -changed by modifying the 'Tlist_WinHeight' variable: -> - let Tlist_WinHeight = 20 -< -The |'winfixheight'| option is set for the taglist window, to maintain the -height of the taglist window, when new Vim windows are opened and existing -windows are closed. - - *'Tlist_WinWidth'* -Tlist_WinWidth~ -The default width of the vertically split taglist window is 30. This can be -changed by modifying the 'Tlist_WinWidth' variable: -> - let Tlist_WinWidth = 20 -< -Note that the value of the |'winwidth'| option setting determines the minimum -width of the current window. If you set the 'Tlist_WinWidth' variable to a -value less than that of the |'winwidth'| option setting, then Vim will use the -value of the |'winwidth'| option. - -When new Vim windows are opened and existing windows are closed, the taglist -plugin will try to maintain the width of the taglist window to the size -specified by the 'Tlist_WinWidth' variable. - -============================================================================== - *taglist-commands* -7. Commands~ - -The taglist plugin provides the following ex-mode commands: - -|:TlistAddFiles| Add multiple files to the taglist. -|:TlistAddFilesRecursive| - Add files recursively to the taglist. -|:TlistClose| Close the taglist window. -|:TlistDebug| Start logging of taglist debug messages. -|:TlistLock| Stop adding new files to the taglist. -|:TlistMessages| Display the logged taglist plugin debug messages. -|:TlistOpen| Open and jump to the taglist window. -|:TlistSessionSave| Save the information about files and tags in the - taglist to a session file. -|:TlistSessionLoad| Load the information about files and tags stored - in a session file to taglist. -|:TlistShowPrototype| Display the prototype of the tag at or before the - specified line number. -|:TlistShowTag| Display the name of the tag defined at or before the - specified line number. -|:TlistHighlightTag| Highlight the current tag in the taglist window. -|:TlistToggle| Open or close (toggle) the taglist window. -|:TlistUndebug| Stop logging of taglist debug messages. -|:TlistUnlock| Start adding new files to the taglist. -|:TlistUpdate| Update the tags for the current buffer. - - *:TlistAddFiles* -:TlistAddFiles {file(s)} [file(s) ...] - Add one or more specified files to the taglist. You can - specify multiple filenames using wildcards. To specify a - file name with space character, you should escape the space - character with a backslash. - Examples: -> - :TlistAddFiles *.c *.cpp - :TlistAddFiles file1.html file2.html -< - If you specify a large number of files, then it will take some - time for the taglist plugin to process all of them. The - specified files will not be edited in a Vim window and will - not be added to the Vim buffer list. - - *:TlistAddFilesRecursive* -:TlistAddFilesRecursive {directory} [ {pattern} ] - Add files matching {pattern} recursively from the specified - {directory} to the taglist. If {pattern} is not specified, - then '*' is assumed. To specify the current directory, use "." - for {directory}. To specify a directory name with space - character, you should escape the space character with a - backslash. - Examples: -> - :TlistAddFilesRecursive myproject *.java - :TlistAddFilesRecursive smallproject -< - If large number of files are present in the specified - directory tree, then it will take some time for the taglist - plugin to process all of them. - - *:TlistClose* -:TlistClose Close the taglist window. This command can be used from any - one of the Vim windows. - - *:TlistDebug* -:TlistDebug [filename] - Start logging of debug messages from the taglist plugin. - If {filename} is specified, then the debug messages are stored - in the specified file. Otherwise, the debug messages are - stored in a script local variable. If the file {filename} is - already present, then it is overwritten. - - *:TlistLock* -:TlistLock - Lock the taglist and don't process new files. After this - command is executed, newly edited files will not be added to - the taglist. - - *:TlistMessages* -:TlistMessages - Display the logged debug messages from the taglist plugin - in a window. This command works only when logging to a - script-local variable. - - *:TlistOpen* -:TlistOpen Open and jump to the taglist window. Creates the taglist - window, if the window is not opened currently. After executing - this command, the cursor is moved to the taglist window. When - the taglist window is opened for the first time, all the files - in the buffer list are processed and the tags defined in them - are displayed in the taglist window. - - *:TlistSessionSave* -:TlistSessionSave {filename} - Saves the information about files and tags in the taglist to - the specified file. This command can be used to save and - restore the taglist contents across Vim sessions. - - *:TlistSessionLoad* -:TlistSessionLoad {filename} - Load the information about files and tags stored in the - specified session file to the taglist. - - *:TlistShowPrototype* -:TlistShowPrototype [filename] [linenumber] - Display the prototype of the tag at or before the specified - line number. If the file name and the line number are not - specified, then the current file name and line number are - used. A tag spans multiple lines starting from the line where - it is defined to the line before the next tag. This command - displays the prototype for the tag for any line number in this - range. - - *:TlistShowTag* -:TlistShowTag [filename] [linenumber] - Display the name of the tag defined at or before the specified - line number. If the file name and the line number are not - specified, then the current file name and line number are - used. A tag spans multiple lines starting from the line where - it is defined to the line before the next tag. This command - displays the tag name for any line number in this range. - - *:TlistHighlightTag* -:TlistHighlightTag - Highlight the current tag in the taglist window. By default, - the taglist plugin periodically updates the taglist window to - highlight the current tag. This command can be used to force - the taglist plugin to highlight the current tag. - - *:TlistToggle* -:TlistToggle Open or close (toggle) the taglist window. Opens the taglist - window, if the window is not opened currently. Closes the - taglist window, if the taglist window is already opened. When - the taglist window is opened for the first time, all the files - in the buffer list are processed and the tags are displayed in - the taglist window. After executing this command, the cursor - is not moved from the current window to the taglist window. - - *:TlistUndebug* -:TlistUndebug - Stop logging of debug messages from the taglist plugin. - - *:TlistUnlock* -:TlistUnlock - Unlock the taglist and start processing newly edited files. - - *:TlistUpdate* -:TlistUpdate Update the tags information for the current buffer. This - command can be used to re-process the current file/buffer and - get the tags information. As the taglist plugin uses the file - saved in the disk (instead of the file displayed in a Vim - buffer), you should save a modified buffer before you update - the taglist. Otherwise the listed tags will not include the - new tags created in the buffer. You can use this command even - when the taglist window is not opened. - -============================================================================== - *taglist-functions* -8. Global functions~ - -The taglist plugin provides several global functions that can be used from -other Vim plugins to interact with the taglist plugin. These functions are -described below. - -|Tlist_Update_File_Tags()| Update the tags for the specified file -|Tlist_Get_Tag_Prototype_By_Line()| Return the prototype of the tag at or - before the specified line number in the - specified file. -|Tlist_Get_Tagname_By_Line()| Return the name of the tag at or - before the specified line number in - the specified file. -|Tlist_Set_App()| Set the name of the application - controlling the taglist window. - - *Tlist_Update_File_Tags()* -Tlist_Update_File_Tags({filename}, {filetype}) - Update the tags for the file {filename}. The second argument - specifies the Vim filetype for the file. If the taglist plugin - has not processed the file previously, then the exuberant - ctags tool is invoked to generate the tags for the file. - - *Tlist_Get_Tag_Prototype_By_Line()* -Tlist_Get_Tag_Prototype_By_Line([{filename}, {linenumber}]) - Return the prototype of the tag at or before the specified - line number in the specified file. If the filename and line - number are not specified, then the current buffer name and the - current line number are used. - - *Tlist_Get_Tagname_By_Line()* -Tlist_Get_Tagname_By_Line([{filename}, {linenumber}]) - Return the name of the tag at or before the specified line - number in the specified file. If the filename and line number - are not specified, then the current buffer name and the - current line number are used. - - *Tlist_Set_App()* -Tlist_Set_App({appname}) - Set the name of the plugin that controls the taglist plugin - window and buffer. This can be used to integrate the taglist - plugin with other Vim plugins. - - For example, the winmanager plugin and the Cream package use - this function and specify the appname as "winmanager" and - "cream" respectively. - - By default, the taglist plugin is a stand-alone plugin and - controls the taglist window and buffer. If the taglist window - is controlled by an external plugin, then the appname should - be set appropriately. - -============================================================================== - *taglist-extend* -9. Extending~ - -The taglist plugin supports all the languages supported by the exuberant ctags -tool, which includes the following languages: Assembly, ASP, Awk, Beta, C, -C++, C#, Cobol, Eiffel, Erlang, Fortran, HTML, Java, Javascript, Lisp, Lua, -Make, Pascal, Perl, PHP, Python, Rexx, Ruby, Scheme, Shell, Slang, SML, Sql, -TCL, Verilog, Vim and Yacc. - -You can extend the taglist plugin to add support for new languages and also -modify the support for the above listed languages. - -You should NOT make modifications to the taglist plugin script file to add -support for new languages. You will lose these changes when you upgrade to the -next version of the taglist plugin. Instead you should follow the below -described instructions to extend the taglist plugin. - -You can extend the taglist plugin by setting variables in the .vimrc or _vimrc -file. The name of these variables depends on the language name and is -described below. - -Modifying support for an existing language~ -To modify the support for an already supported language, you have to set the -tlist_xxx_settings variable in the ~/.vimrc or $HOME/_vimrc file. Replace xxx -with the Vim filetype name for the language file. For example, to modify the -support for the perl language files, you have to set the tlist_perl_settings -variable. To modify the support for java files, you have to set the -tlist_java_settings variable. - -To determine the filetype name used by Vim for a file, use the following -command in the buffer containing the file: - - :set filetype - -The above command will display the Vim filetype for the current buffer. - -The format of the value set in the tlist_xxx_settings variable is - - ;flag1:name1;flag2:name2;flag3:name3 - -The different fields in the value are separated by the ';' character. - -The first field 'language_name' is the name used by exuberant ctags to refer -to this language file. This name can be different from the file type name used -by Vim. For example, for C++, the language name used by ctags is 'c++' but the -filetype name used by Vim is 'cpp'. To get the list of language names -supported by exuberant ctags, use the following command: - - $ ctags --list-maps=all - -The remaining fields follow the format "flag:name". The sub-field 'flag' is -the language specific flag used by exuberant ctags to generate the -corresponding tags. For example, for the C language, to list only the -functions, the 'f' flag is used. To get the list of flags supported by -exuberant ctags for the various languages use the following command: - - $ ctags --list-kinds=all - -The sub-field 'name' specifies the title text to use for displaying the tags -of a particular type. For example, 'name' can be set to 'functions'. This -field can be set to any text string name. - -For example, to list only the classes and functions defined in a C++ language -file, add the following line to your .vimrc file: - - let tlist_cpp_settings = 'c++;c:class;f:function' - -In the above setting, 'cpp' is the Vim filetype name and 'c++' is the name -used by the exuberant ctags tool. 'c' and 'f' are the flags passed to -exuberant ctags to list C++ classes and functions and 'class' is the title -used for the class tags and 'function' is the title used for the function tags -in the taglist window. - -For example, to display only functions defined in a C file and to use "My -Functions" as the title for the function tags, use - - let tlist_c_settings = 'c;f:My Functions' - -When you set the tlist_xxx_settings variable, you will override the default -setting used by the taglist plugin for the 'xxx' language. You cannot add to -the default options used by the taglist plugin for a particular file type. To -add to the options used by the taglist plugin for a language, copy the option -values from the taglist plugin file to your .vimrc file and modify it. - -Adding support for a new language~ -If you want to add support for a new language to the taglist plugin, you need -to first extend the exuberant ctags tool. For more information about extending -exuberant ctags, visit the following page: - - http://ctags.sourceforge.net/EXTENDING.html - -To add support for a new language, set the tlist_xxx_settings variable in the -~/.vimrc file appropriately as described above. Replace 'xxx' in the variable -name with the Vim filetype name for the new language. - -For example, to extend the taglist plugin to support the latex language, you -can use the following line (assuming, you have already extended exuberant -ctags to support the latex language): - - let tlist_tex_settings='latex;b:bibitem;c:command;l:label' - -With the above line, when you edit files of filetype "tex" in Vim, the taglist -plugin will invoke the exuberant ctags tool passing the "latex" filetype and -the flags b, c and l to generate the tags. The text heading 'bibitem', -'command' and 'label' will be used in the taglist window for the tags which -are generated for the flags b, c and l respectively. - -============================================================================== - *taglist-faq* -10. Frequently Asked Questions~ - -Q. The taglist plugin doesn't work. The taglist window is empty and the tags - defined in a file are not displayed. -A. Are you using Vim version 6.0 and above? The taglist plugin relies on the - features supported by Vim version 6.0 and above. You can use the following - command to get the Vim version: -> - $ vim --version -< - Are you using exuberant ctags version 5.0 and above? The taglist plugin - relies on the features supported by exuberant ctags and will not work with - GNU ctags or the Unix ctags utility. You can use the following command to - determine whether the ctags installed in your system is exuberant ctags: -> - $ ctags --version -< - Is exuberant ctags present in one of the directories in your PATH? If not, - you need to set the Tlist_Ctags_Cmd variable to point to the location of - exuberant ctags. Use the following Vim command to verify that this is setup - correctly: -> - :echo system(Tlist_Ctags_Cmd . ' --version') -< - The above command should display the version information for exuberant - ctags. - - Did you turn on the Vim filetype detection? The taglist plugin relies on - the filetype detected by Vim and passes the filetype to the exuberant ctags - utility to parse the tags. Check the output of the following Vim command: -> - :filetype -< - The output of the above command should contain "filetype detection:ON". - To turn on the filetype detection, add the following line to the .vimrc or - _vimrc file: -> - filetype on -< - Is your version of Vim compiled with the support for the system() function? - The following Vim command should display 1: -> - :echo exists('*system') -< - In some Linux distributions (particularly Suse Linux), the default Vim - installation is built without the support for the system() function. The - taglist plugin uses the system() function to invoke the exuberant ctags - utility. You need to rebuild Vim after enabling the support for the - system() function. If you use the default build options, the system() - function will be supported. - - Do you have the |'shellslash'| option set? You can try disabling the - |'shellslash'| option. When the taglist plugin invokes the exuberant ctags - utility with the path to the file, if the incorrect slashes are used, then - you will see errors. - - Check the shell related Vim options values using the following command: -> - :set shell? shellcmdflag? shellpipe? - :set shellquote? shellredir? shellxquote? -< - If these options are set in your .vimrc or _vimrc file, try removing those - lines. - - Are you using a Unix shell in a MS-Windows environment? For example, - the Unix shell from the MKS-toolkit. Do you have the SHELL environment - set to point to this shell? You can try resetting the SHELL environment - variable. - - If you are using a Unix shell on MS-Windows, you should try to use - exuberant ctags that is compiled for Unix-like environments so that - exuberant ctags will understand path names with forward slash characters. - - Is your filetype supported by the exuberant ctags utility? The file types - supported by the exuberant ctags utility are listed in the ctags help. If a - file type is not supported, you have to extend exuberant ctags. You can use - the following command to list the filetypes supported by exuberant ctags: -> - ctags --list-languages -< - Run the following command from the shell prompt and check whether the tags - defined in your file are listed in the output from exuberant ctags: -> - ctags -f - --format=2 --excmd=pattern --fields=nks -< - If you see your tags in the output from the above command, then the - exuberant ctags utility is properly parsing your file. - - Do you have the .ctags or _ctags or the ctags.cnf file in your home - directory for specifying default options or for extending exuberant ctags? - If you do have this file, check the options in this file and make sure - these options are not interfering with the operation of the taglist plugin. - - If you are using MS-Windows, check the value of the TEMP and TMP - environment variables. If these environment variables are set to a path - with space characters in the name, then try using the DOS 8.3 short name - for the path or set them to a path without the space characters in the - name. For example, if the temporary directory name is "C:\Documents and - Settings\xyz\Local Settings\Temp", then try setting the TEMP variable to - the following: -> - set TEMP=C:\DOCUMEN~1\xyz\LOCALS~1\Temp -< - If exuberant ctags is installed in a directory with space characters in the - name, then try adding the directory to the PATH environment variable or try - setting the 'Tlist_Ctags_Cmd' variable to the shortest path name to ctags - or try copying the exuberant ctags to a path without space characters in - the name. For example, if exuberant ctags is installed in the directory - "C:\Program Files\Ctags", then try setting the 'Tlist_Ctags_Cmd' variable - as below: -> - let Tlist_Ctags_Cmd='C:\Progra~1\Ctags\ctags.exe' -< - If you are using a cygwin compiled version of exuberant ctags on MS-Windows, - make sure that either you have the cygwin compiled sort utility installed - and available in your PATH or compile exuberant ctags with internal sort - support. Otherwise, when exuberant ctags sorts the tags output by invoking - the sort utility, it may end up invoking the MS-Windows version of - sort.exe, thereby resulting in failure. - -Q. When I try to open the taglist window, I am seeing the following error - message. How do I fix this problem? - - Taglist: Failed to generate tags for /my/path/to/file - ctags: illegal option -- -^@usage: ctags [-BFadtuwvx] [-f tagsfile] file ... - -A. The taglist plugin will work only with the exuberant ctags tool. You - cannot use the GNU ctags or the Unix ctags program with the taglist plugin. - You will see an error message similar to the one shown above, if you try - use a non-exuberant ctags program with Vim. To fix this problem, either add - the exuberant ctags tool location to the PATH environment variable or set - the 'Tlist_Ctags_Cmd' variable. - -Q. A file has more than one tag with the same name. When I select a tag name - from the taglist window, the cursor is positioned at the incorrect tag - location. -A. The taglist plugin uses the search pattern generated by the exuberant ctags - utility to position the cursor at the location of a tag definition. If a - file has more than one tag with the same name and same prototype, then the - search pattern will be the same. In this case, when searching for the tag - pattern, the cursor may be positioned at the incorrect location. - -Q. I have made some modifications to my file and introduced new - functions/classes/variables. I have not yet saved my file. The taglist - plugin is not displaying the new tags when I update the taglist window. -A. The exuberant ctags utility will process only files that are present in the - disk. To list the tags defined in a file, you have to save the file and - then update the taglist window. - -Q. I have created a ctags file using the exuberant ctags utility for my source - tree. How do I configure the taglist plugin to use this tags file? -A. The taglist plugin doesn't use a tags file stored in disk. For every opened - file, the taglist plugin invokes the exuberant ctags utility to get the - list of tags dynamically. The Vim system() function is used to invoke - exuberant ctags and get the ctags output. This function internally uses a - temporary file to store the output. This file is deleted after the output - from the command is read. So you will never see the file that contains the - output of exuberant ctags. - -Q. When I set the |'updatetime'| option to a low value (less than 1000) and if - I keep pressing a key with the taglist window open, the current buffer - contents are changed. Why is this? -A. The taglist plugin uses the |CursorHold| autocmd to highlight the current - tag. The CursorHold autocmd triggers for every |'updatetime'| milliseconds. - If the |'updatetime'| option is set to a low value, then the CursorHold - autocmd will be triggered frequently. As the taglist plugin changes - the focus to the taglist window to highlight the current tag, this could - interfere with the key movement resulting in changing the contents of - the current buffer. The workaround for this problem is to not set the - |'updatetime'| option to a low value. - -============================================================================== - *taglist-license* -11. License~ -Permission is hereby granted to use and distribute the taglist plugin, with or -without modifications, provided that this copyright notice is copied with it. -Like anything else that's free, taglist.vim is provided *as is* and comes with -no warranty of any kind, either expressed or implied. In no event will the -copyright holder be liable for any damamges resulting from the use of this -software. - -============================================================================== - *taglist-todo* -12. Todo~ - -1. Group tags according to the scope and display them. For example, - group all the tags belonging to a C++/Java class -2. Support for displaying tags in a modified (not-yet-saved) file. -3. Automatically open the taglist window only for selected filetypes. - For other filetypes, close the taglist window. -4. When using the shell from the MKS toolkit, the taglist plugin - doesn't work. -5. The taglist plugin doesn't work with files edited remotely using the - netrw plugin. The exuberant ctags utility cannot process files over - scp/rcp/ftp, etc. - -============================================================================== - -vim:tw=78:ts=8:noet:ft=help: diff --git a/sources_non_forked/taglist/doc/tags b/sources_non_forked/taglist/doc/tags deleted file mode 100644 index 83e80ba1..00000000 --- a/sources_non_forked/taglist/doc/tags +++ /dev/null @@ -1,62 +0,0 @@ -'Tlist_Auto_Highlight_Tag' taglist.txt /*'Tlist_Auto_Highlight_Tag'* -'Tlist_Auto_Open' taglist.txt /*'Tlist_Auto_Open'* -'Tlist_Auto_Update' taglist.txt /*'Tlist_Auto_Update'* -'Tlist_Close_On_Select' taglist.txt /*'Tlist_Close_On_Select'* -'Tlist_Compact_Format' taglist.txt /*'Tlist_Compact_Format'* -'Tlist_Ctags_Cmd' taglist.txt /*'Tlist_Ctags_Cmd'* -'Tlist_Display_Prototype' taglist.txt /*'Tlist_Display_Prototype'* -'Tlist_Display_Tag_Scope' taglist.txt /*'Tlist_Display_Tag_Scope'* -'Tlist_Enable_Fold_Column' taglist.txt /*'Tlist_Enable_Fold_Column'* -'Tlist_Exit_OnlyWindow' taglist.txt /*'Tlist_Exit_OnlyWindow'* -'Tlist_File_Fold_Auto_Close' taglist.txt /*'Tlist_File_Fold_Auto_Close'* -'Tlist_GainFocus_On_ToggleOpen' taglist.txt /*'Tlist_GainFocus_On_ToggleOpen'* -'Tlist_Highlight_Tag_On_BufEnter' taglist.txt /*'Tlist_Highlight_Tag_On_BufEnter'* -'Tlist_Inc_Winwidth' taglist.txt /*'Tlist_Inc_Winwidth'* -'Tlist_Max_Submenu_Items' taglist.txt /*'Tlist_Max_Submenu_Items'* -'Tlist_Max_Tag_Length' taglist.txt /*'Tlist_Max_Tag_Length'* -'Tlist_Process_File_Always' taglist.txt /*'Tlist_Process_File_Always'* -'Tlist_Show_Menu' taglist.txt /*'Tlist_Show_Menu'* -'Tlist_Show_One_File' taglist.txt /*'Tlist_Show_One_File'* -'Tlist_Sort_Type' taglist.txt /*'Tlist_Sort_Type'* -'Tlist_Use_Horiz_Window' taglist.txt /*'Tlist_Use_Horiz_Window'* -'Tlist_Use_Right_Window' taglist.txt /*'Tlist_Use_Right_Window'* -'Tlist_Use_SingleClick' taglist.txt /*'Tlist_Use_SingleClick'* -'Tlist_WinHeight' taglist.txt /*'Tlist_WinHeight'* -'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'* -:TlistAddFiles taglist.txt /*:TlistAddFiles* -:TlistAddFilesRecursive taglist.txt /*:TlistAddFilesRecursive* -:TlistClose taglist.txt /*:TlistClose* -:TlistDebug taglist.txt /*:TlistDebug* -:TlistHighlightTag taglist.txt /*:TlistHighlightTag* -:TlistLock taglist.txt /*:TlistLock* -:TlistMessages taglist.txt /*:TlistMessages* -:TlistOpen taglist.txt /*:TlistOpen* -:TlistSessionLoad taglist.txt /*:TlistSessionLoad* -:TlistSessionSave taglist.txt /*:TlistSessionSave* -:TlistShowPrototype taglist.txt /*:TlistShowPrototype* -:TlistShowTag taglist.txt /*:TlistShowTag* -:TlistToggle taglist.txt /*:TlistToggle* -:TlistUndebug taglist.txt /*:TlistUndebug* -:TlistUnlock taglist.txt /*:TlistUnlock* -:TlistUpdate taglist.txt /*:TlistUpdate* -Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()* -Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()* -Tlist_Set_App() taglist.txt /*Tlist_Set_App()* -Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()* -taglist-commands taglist.txt /*taglist-commands* -taglist-debug taglist.txt /*taglist-debug* -taglist-extend taglist.txt /*taglist-extend* -taglist-faq taglist.txt /*taglist-faq* -taglist-functions taglist.txt /*taglist-functions* -taglist-install taglist.txt /*taglist-install* -taglist-internet taglist.txt /*taglist-internet* -taglist-intro taglist.txt /*taglist-intro* -taglist-keys taglist.txt /*taglist-keys* -taglist-license taglist.txt /*taglist-license* -taglist-menu taglist.txt /*taglist-menu* -taglist-options taglist.txt /*taglist-options* -taglist-requirements taglist.txt /*taglist-requirements* -taglist-session taglist.txt /*taglist-session* -taglist-todo taglist.txt /*taglist-todo* -taglist-using taglist.txt /*taglist-using* -taglist.txt taglist.txt /*taglist.txt* diff --git a/sources_non_forked/taglist/plugin/taglist.vim b/sources_non_forked/taglist/plugin/taglist.vim deleted file mode 100644 index 59901f64..00000000 --- a/sources_non_forked/taglist/plugin/taglist.vim +++ /dev/null @@ -1,4546 +0,0 @@ -" File: taglist.vim -" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) -" Version: 4.5 -" Last Modified: September 21, 2007 -" Copyright: Copyright (C) 2002-2007 Yegappan Lakshmanan -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" taglist.vim is provided *as is* and comes with no warranty of any -" kind, either expressed or implied. In no event will the copyright -" holder be liable for any damamges resulting from the use of this -" software. -" -" The "Tag List" plugin is a source code browser plugin for Vim and provides -" an overview of the structure of the programming language files and allows -" you to efficiently browse through source code files for different -" programming languages. You can visit the taglist plugin home page for more -" information: -" -" http://vim-taglist.sourceforge.net -" -" You can subscribe to the taglist mailing list to post your questions -" or suggestions for improvement or to report bugs. Visit the following -" page for subscribing to the mailing list: -" -" http://groups.yahoo.com/group/taglist/ -" -" For more information about using this plugin, after installing the -" taglist plugin, use the ":help taglist" command. -" -" Installation -" ------------ -" 1. Download the taglist.zip file and unzip the files to the $HOME/.vim -" or the $HOME/vimfiles or the $VIM/vimfiles directory. This should -" unzip the following two files (the directory structure should be -" preserved): -" -" plugin/taglist.vim - main taglist plugin file -" doc/taglist.txt - documentation (help) file -" -" Refer to the 'add-plugin', 'add-global-plugin' and 'runtimepath' -" Vim help pages for more details about installing Vim plugins. -" 2. Change to the $HOME/.vim/doc or $HOME/vimfiles/doc or -" $VIM/vimfiles/doc directory, start Vim and run the ":helptags ." -" command to process the taglist help file. -" 3. If the exuberant ctags utility is not present in your PATH, then set the -" Tlist_Ctags_Cmd variable to point to the location of the exuberant ctags -" utility (not to the directory) in the .vimrc file. -" 4. If you are running a terminal/console version of Vim and the -" terminal doesn't support changing the window width then set the -" 'Tlist_Inc_Winwidth' variable to 0 in the .vimrc file. -" 5. Restart Vim. -" 6. You can now use the ":TlistToggle" command to open/close the taglist -" window. You can use the ":help taglist" command to get more -" information about using the taglist plugin. -" -" ****************** Do not modify after this line ************************ - -" Line continuation used here -let s:cpo_save = &cpo -set cpo&vim - -if !exists('loaded_taglist') - " First time loading the taglist plugin - " - " To speed up the loading of Vim, the taglist plugin uses autoload - " mechanism to load the taglist functions. - " Only define the configuration variables, user commands and some - " auto-commands and finish sourcing the file - - " The taglist plugin requires the built-in Vim system() function. If this - " function is not available, then don't load the plugin. - if !exists('*system') - echomsg 'Taglist: Vim system() built-in function is not available. ' . - \ 'Plugin is not loaded.' - let loaded_taglist = 'no' - let &cpo = s:cpo_save - finish - endif - - " Location of the exuberant ctags tool - if !exists('Tlist_Ctags_Cmd') - if executable('exuberant-ctags') - " On Debian Linux, exuberant ctags is installed - " as exuberant-ctags - let Tlist_Ctags_Cmd = 'exuberant-ctags' - elseif executable('exctags') - " On Free-BSD, exuberant ctags is installed as exctags - let Tlist_Ctags_Cmd = 'exctags' - elseif executable('ctags') - let Tlist_Ctags_Cmd = 'ctags' - elseif executable('ctags.exe') - let Tlist_Ctags_Cmd = 'ctags.exe' - elseif executable('tags') - let Tlist_Ctags_Cmd = 'tags' - else - echomsg 'Taglist: Exuberant ctags (http://ctags.sf.net) ' . - \ 'not found in PATH. Plugin is not loaded.' - " Skip loading the plugin - let loaded_taglist = 'no' - let &cpo = s:cpo_save - finish - endif - endif - - - " Automatically open the taglist window on Vim startup - if !exists('Tlist_Auto_Open') - let Tlist_Auto_Open = 0 - endif - - " When the taglist window is toggle opened, move the cursor to the - " taglist window - if !exists('Tlist_GainFocus_On_ToggleOpen') - let Tlist_GainFocus_On_ToggleOpen = 0 - endif - - " Process files even when the taglist window is not open - if !exists('Tlist_Process_File_Always') - let Tlist_Process_File_Always = 0 - endif - - if !exists('Tlist_Show_Menu') - let Tlist_Show_Menu = 0 - endif - - " Tag listing sort type - 'name' or 'order' - if !exists('Tlist_Sort_Type') - let Tlist_Sort_Type = 'order' - endif - - " Tag listing window split (horizontal/vertical) control - if !exists('Tlist_Use_Horiz_Window') - let Tlist_Use_Horiz_Window = 0 - endif - - " Open the vertically split taglist window on the left or on the right - " side. This setting is relevant only if Tlist_Use_Horiz_Window is set to - " zero (i.e. only for vertically split windows) - if !exists('Tlist_Use_Right_Window') - let Tlist_Use_Right_Window = 0 - endif - - " Increase Vim window width to display vertically split taglist window. - " For MS-Windows version of Vim running in a MS-DOS window, this must be - " set to 0 otherwise the system may hang due to a Vim limitation. - if !exists('Tlist_Inc_Winwidth') - if (has('win16') || has('win95')) && !has('gui_running') - let Tlist_Inc_Winwidth = 0 - else - let Tlist_Inc_Winwidth = 1 - endif - endif - - " Vertically split taglist window width setting - if !exists('Tlist_WinWidth') - let Tlist_WinWidth = 30 - endif - - " Horizontally split taglist window height setting - if !exists('Tlist_WinHeight') - let Tlist_WinHeight = 10 - endif - - " Display tag prototypes or tag names in the taglist window - if !exists('Tlist_Display_Prototype') - let Tlist_Display_Prototype = 0 - endif - - " Display tag scopes in the taglist window - if !exists('Tlist_Display_Tag_Scope') - let Tlist_Display_Tag_Scope = 1 - endif - - " Use single left mouse click to jump to a tag. By default this is disabled. - " Only double click using the mouse will be processed. - if !exists('Tlist_Use_SingleClick') - let Tlist_Use_SingleClick = 0 - endif - - " Control whether additional help is displayed as part of the taglist or - " not. Also, controls whether empty lines are used to separate the tag - " tree. - if !exists('Tlist_Compact_Format') - let Tlist_Compact_Format = 0 - endif - - " Exit Vim if only the taglist window is currently open. By default, this is - " set to zero. - if !exists('Tlist_Exit_OnlyWindow') - let Tlist_Exit_OnlyWindow = 0 - endif - - " Automatically close the folds for the non-active files in the taglist - " window - if !exists('Tlist_File_Fold_Auto_Close') - let Tlist_File_Fold_Auto_Close = 0 - endif - - " Close the taglist window when a tag is selected - if !exists('Tlist_Close_On_Select') - let Tlist_Close_On_Select = 0 - endif - - " Automatically update the taglist window to display tags for newly - " edited files - if !exists('Tlist_Auto_Update') - let Tlist_Auto_Update = 1 - endif - - " Automatically highlight the current tag - if !exists('Tlist_Auto_Highlight_Tag') - let Tlist_Auto_Highlight_Tag = 1 - endif - - " Automatically highlight the current tag on entering a buffer - if !exists('Tlist_Highlight_Tag_On_BufEnter') - let Tlist_Highlight_Tag_On_BufEnter = 1 - endif - - " Enable fold column to display the folding for the tag tree - if !exists('Tlist_Enable_Fold_Column') - let Tlist_Enable_Fold_Column = 1 - endif - - " Display the tags for only one file in the taglist window - if !exists('Tlist_Show_One_File') - let Tlist_Show_One_File = 0 - endif - - if !exists('Tlist_Max_Submenu_Items') - let Tlist_Max_Submenu_Items = 20 - endif - - if !exists('Tlist_Max_Tag_Length') - let Tlist_Max_Tag_Length = 10 - endif - - " Do not change the name of the taglist title variable. The winmanager - " plugin relies on this name to determine the title for the taglist - " plugin. - let TagList_title = "__Tag_List__" - - " Taglist debug messages - let s:tlist_msg = '' - - " Define the taglist autocommand to automatically open the taglist window - " on Vim startup - if g:Tlist_Auto_Open - autocmd VimEnter * nested call s:Tlist_Window_Check_Auto_Open() - endif - - " Refresh the taglist - if g:Tlist_Process_File_Always - autocmd BufEnter * call s:Tlist_Refresh() - endif - - if g:Tlist_Show_Menu - autocmd GUIEnter * call s:Tlist_Menu_Init() - endif - - " When the taglist buffer is created when loading a Vim session file, - " the taglist buffer needs to be initialized. The BufFilePost event - " is used to handle this case. - autocmd BufFilePost __Tag_List__ call s:Tlist_Vim_Session_Load() - - " Define the user commands to manage the taglist window - command! -nargs=0 -bar TlistToggle call s:Tlist_Window_Toggle() - command! -nargs=0 -bar TlistOpen call s:Tlist_Window_Open() - " For backwards compatiblity define the Tlist command - command! -nargs=0 -bar Tlist TlistToggle - command! -nargs=+ -complete=file TlistAddFiles - \ call s:Tlist_Add_Files() - command! -nargs=+ -complete=dir TlistAddFilesRecursive - \ call s:Tlist_Add_Files_Recursive() - command! -nargs=0 -bar TlistClose call s:Tlist_Window_Close() - command! -nargs=0 -bar TlistUpdate call s:Tlist_Update_Current_File() - command! -nargs=0 -bar TlistHighlightTag call s:Tlist_Window_Highlight_Tag( - \ fnamemodify(bufname('%'), ':p'), line('.'), 2, 1) - " For backwards compatiblity define the TlistSync command - command! -nargs=0 -bar TlistSync TlistHighlightTag - command! -nargs=* -complete=buffer TlistShowPrototype - \ echo Tlist_Get_Tag_Prototype_By_Line() - command! -nargs=* -complete=buffer TlistShowTag - \ echo Tlist_Get_Tagname_By_Line() - command! -nargs=* -complete=file TlistSessionLoad - \ call s:Tlist_Session_Load() - command! -nargs=* -complete=file TlistSessionSave - \ call s:Tlist_Session_Save() - command! -bar TlistLock let Tlist_Auto_Update=0 - command! -bar TlistUnlock let Tlist_Auto_Update=1 - - " Commands for enabling/disabling debug and to display debug messages - command! -nargs=? -complete=file -bar TlistDebug - \ call s:Tlist_Debug_Enable() - command! -nargs=0 -bar TlistUndebug call s:Tlist_Debug_Disable() - command! -nargs=0 -bar TlistMessages call s:Tlist_Debug_Show() - - " Define autocommands to autoload the taglist plugin when needed. - - " Trick to get the current script ID - map xx xx - let s:tlist_sid = substitute(maparg('xx'), '\(\d\+_\)xx$', - \ '\1', '') - unmap xx - - exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_* source ' . - \ escape(expand(''), ' ') - exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Window_* source ' . - \ escape(expand(''), ' ') - exe 'autocmd FuncUndefined *' . s:tlist_sid . 'Tlist_Menu_* source ' . - \ escape(expand(''), ' ') - exe 'autocmd FuncUndefined Tlist_* source ' . - \ escape(expand(''), ' ') - exe 'autocmd FuncUndefined TagList_* source ' . - \ escape(expand(''), ' ') - - let loaded_taglist = 'fast_load_done' - - if g:Tlist_Show_Menu && has('gui_running') - call s:Tlist_Menu_Init() - endif - - " restore 'cpo' - let &cpo = s:cpo_save - finish -endif - -if !exists('s:tlist_sid') - " Two or more versions of taglist plugin are installed. Don't - " load this version of the plugin. - finish -endif - -unlet! s:tlist_sid - -if loaded_taglist != 'fast_load_done' - " restore 'cpo' - let &cpo = s:cpo_save - finish -endif - -" Taglist plugin functionality is available -let loaded_taglist = 'available' - -"------------------- end of user configurable options -------------------- - -" Default language specific settings for supported file types and tag types -" -" Variable name format: -" -" s:tlist_def_{vim_ftype}_settings -" -" vim_ftype - Filetype detected by Vim -" -" Value format: -" -" ;:;:;... -" -" ctags_ftype - File type supported by exuberant ctags -" flag - Flag supported by exuberant ctags to generate a tag type -" name - Name of the tag type used in the taglist window to display the -" tags of this type -" - -" assembly language -let s:tlist_def_asm_settings = 'asm;d:define;l:label;m:macro;t:type' - -" aspperl language -let s:tlist_def_aspperl_settings = 'asp;f:function;s:sub;v:variable' - -" aspvbs language -let s:tlist_def_aspvbs_settings = 'asp;f:function;s:sub;v:variable' - -" awk language -let s:tlist_def_awk_settings = 'awk;f:function' - -" beta language -let s:tlist_def_beta_settings = 'beta;f:fragment;s:slot;v:pattern' - -" c language -let s:tlist_def_c_settings = 'c;d:macro;g:enum;s:struct;u:union;t:typedef;' . - \ 'v:variable;f:function' - -" c++ language -let s:tlist_def_cpp_settings = 'c++;n:namespace;v:variable;d:macro;t:typedef;' . - \ 'c:class;g:enum;s:struct;u:union;f:function' - -" c# language -let s:tlist_def_cs_settings = 'c#;d:macro;t:typedef;n:namespace;c:class;' . - \ 'E:event;g:enum;s:struct;i:interface;' . - \ 'p:properties;m:method' - -" cobol language -let s:tlist_def_cobol_settings = 'cobol;d:data;f:file;g:group;p:paragraph;' . - \ 'P:program;s:section' - -" eiffel language -let s:tlist_def_eiffel_settings = 'eiffel;c:class;f:feature' - -" erlang language -let s:tlist_def_erlang_settings = 'erlang;d:macro;r:record;m:module;f:function' - -" expect (same as tcl) language -let s:tlist_def_expect_settings = 'tcl;c:class;f:method;p:procedure' - -" fortran language -let s:tlist_def_fortran_settings = 'fortran;p:program;b:block data;' . - \ 'c:common;e:entry;i:interface;k:type;l:label;m:module;' . - \ 'n:namelist;t:derived;v:variable;f:function;s:subroutine' - -" HTML language -let s:tlist_def_html_settings = 'html;a:anchor;f:javascript function' - -" java language -let s:tlist_def_java_settings = 'java;p:package;c:class;i:interface;' . - \ 'f:field;m:method' - -" javascript language -let s:tlist_def_javascript_settings = 'javascript;f:function' - -" lisp language -let s:tlist_def_lisp_settings = 'lisp;f:function' - -" lua language -let s:tlist_def_lua_settings = 'lua;f:function' - -" makefiles -let s:tlist_def_make_settings = 'make;m:macro' - -" pascal language -let s:tlist_def_pascal_settings = 'pascal;f:function;p:procedure' - -" perl language -let s:tlist_def_perl_settings = 'perl;c:constant;l:label;p:package;s:subroutine' - -" php language -let s:tlist_def_php_settings = 'php;c:class;d:constant;v:variable;f:function' - -" python language -let s:tlist_def_python_settings = 'python;c:class;m:member;f:function' - -" rexx language -let s:tlist_def_rexx_settings = 'rexx;s:subroutine' - -" ruby language -let s:tlist_def_ruby_settings = 'ruby;c:class;f:method;F:function;' . - \ 'm:singleton method' - -" scheme language -let s:tlist_def_scheme_settings = 'scheme;s:set;f:function' - -" shell language -let s:tlist_def_sh_settings = 'sh;f:function' - -" C shell language -let s:tlist_def_csh_settings = 'sh;f:function' - -" Z shell language -let s:tlist_def_zsh_settings = 'sh;f:function' - -" slang language -let s:tlist_def_slang_settings = 'slang;n:namespace;f:function' - -" sml language -let s:tlist_def_sml_settings = 'sml;e:exception;c:functor;s:signature;' . - \ 'r:structure;t:type;v:value;f:function' - -" sql language -let s:tlist_def_sql_settings = 'sql;c:cursor;F:field;P:package;r:record;' . - \ 's:subtype;t:table;T:trigger;v:variable;f:function;p:procedure' - -" tcl language -let s:tlist_def_tcl_settings = 'tcl;c:class;f:method;m:method;p:procedure' - -" vera language -let s:tlist_def_vera_settings = 'vera;c:class;d:macro;e:enumerator;' . - \ 'f:function;g:enum;m:member;p:program;' . - \ 'P:prototype;t:task;T:typedef;v:variable;' . - \ 'x:externvar' - -"verilog language -let s:tlist_def_verilog_settings = 'verilog;m:module;c:constant;P:parameter;' . - \ 'e:event;r:register;t:task;w:write;p:port;v:variable;f:function' - -" vim language -let s:tlist_def_vim_settings = 'vim;a:autocmds;v:variable;f:function' - -" yacc language -let s:tlist_def_yacc_settings = 'yacc;l:label' - -"------------------- end of language specific options -------------------- - -" Vim window size is changed by the taglist plugin or not -let s:tlist_winsize_chgd = -1 -" Taglist window is maximized or not -let s:tlist_win_maximized = 0 -" Name of files in the taglist -let s:tlist_file_names='' -" Number of files in the taglist -let s:tlist_file_count = 0 -" Number of filetypes supported by taglist -let s:tlist_ftype_count = 0 -" Is taglist part of other plugins like winmanager or cream? -let s:tlist_app_name = "none" -" Are we displaying brief help text -let s:tlist_brief_help = 1 -" List of files removed on user request -let s:tlist_removed_flist = "" -" Index of current file displayed in the taglist window -let s:tlist_cur_file_idx = -1 -" Taglist menu is empty or not -let s:tlist_menu_empty = 1 - -" An autocommand is used to refresh the taglist window when entering any -" buffer. We don't want to refresh the taglist window if we are entering the -" file window from one of the taglist functions. The 'Tlist_Skip_Refresh' -" variable is used to skip the refresh of the taglist window and is set -" and cleared appropriately. -let s:Tlist_Skip_Refresh = 0 - -" Tlist_Window_Display_Help() -function! s:Tlist_Window_Display_Help() - if s:tlist_app_name == "winmanager" - " To handle a bug in the winmanager plugin, add a space at the - " last line - call setline('$', ' ') - endif - - if s:tlist_brief_help - " Add the brief help - call append(0, '" Press to display help text') - else - " Add the extensive help - call append(0, '" : Jump to tag definition') - call append(1, '" o : Jump to tag definition in new window') - call append(2, '" p : Preview the tag definition') - call append(3, '" : Display tag prototype') - call append(4, '" u : Update tag list') - call append(5, '" s : Select sort field') - call append(6, '" d : Remove file from taglist') - call append(7, '" x : Zoom-out/Zoom-in taglist window') - call append(8, '" + : Open a fold') - call append(9, '" - : Close a fold') - call append(10, '" * : Open all folds') - call append(11, '" = : Close all folds') - call append(12, '" [[ : Move to the start of previous file') - call append(13, '" ]] : Move to the start of next file') - call append(14, '" q : Close the taglist window') - call append(15, '" : Remove help text') - endif -endfunction - -" Tlist_Window_Toggle_Help_Text() -" Toggle taglist plugin help text between the full version and the brief -" version -function! s:Tlist_Window_Toggle_Help_Text() - if g:Tlist_Compact_Format - " In compact display mode, do not display help - return - endif - - " Include the empty line displayed after the help text - let brief_help_size = 1 - let full_help_size = 16 - - setlocal modifiable - - " Set report option to a huge value to prevent informational messages - " while deleting the lines - let old_report = &report - set report=99999 - - " Remove the currently highlighted tag. Otherwise, the help text - " might be highlighted by mistake - match none - - " Toggle between brief and full help text - if s:tlist_brief_help - let s:tlist_brief_help = 0 - - " Remove the previous help - exe '1,' . brief_help_size . ' delete _' - - " Adjust the start/end line numbers for the files - call s:Tlist_Window_Update_Line_Offsets(0, 1, full_help_size - brief_help_size) - else - let s:tlist_brief_help = 1 - - " Remove the previous help - exe '1,' . full_help_size . ' delete _' - - " Adjust the start/end line numbers for the files - call s:Tlist_Window_Update_Line_Offsets(0, 0, full_help_size - brief_help_size) - endif - - call s:Tlist_Window_Display_Help() - - " Restore the report option - let &report = old_report - - setlocal nomodifiable -endfunction - -" Taglist debug support -let s:tlist_debug = 0 - -" File for storing the debug messages -let s:tlist_debug_file = '' - -" Tlist_Debug_Enable -" Enable logging of taglist debug messages. -function! s:Tlist_Debug_Enable(...) - let s:tlist_debug = 1 - - " Check whether a valid file name is supplied. - if a:1 != '' - let s:tlist_debug_file = fnamemodify(a:1, ':p') - - " Empty the log file - exe 'redir! > ' . s:tlist_debug_file - redir END - - " Check whether the log file is present/created - if !filewritable(s:tlist_debug_file) - call s:Tlist_Warning_Msg('Taglist: Unable to create log file ' - \ . s:tlist_debug_file) - let s:tlist_debug_file = '' - endif - endif -endfunction - -" Tlist_Debug_Disable -" Disable logging of taglist debug messages. -function! s:Tlist_Debug_Disable(...) - let s:tlist_debug = 0 - let s:tlist_debug_file = '' -endfunction - -" Tlist_Debug_Show -" Display the taglist debug messages in a new window -function! s:Tlist_Debug_Show() - if s:tlist_msg == '' - call s:Tlist_Warning_Msg('Taglist: No debug messages') - return - endif - - " Open a new window to display the taglist debug messages - new taglist_debug.txt - " Delete all the lines (if the buffer already exists) - silent! %delete _ - " Add the messages - silent! put =s:tlist_msg - " Move the cursor to the first line - normal! gg -endfunction - -" Tlist_Log_Msg -" Log the supplied debug message along with the time -function! s:Tlist_Log_Msg(msg) - if s:tlist_debug - if s:tlist_debug_file != '' - exe 'redir >> ' . s:tlist_debug_file - silent echon strftime('%H:%M:%S') . ': ' . a:msg . "\n" - redir END - else - " Log the message into a variable - " Retain only the last 3000 characters - let len = strlen(s:tlist_msg) - if len > 3000 - let s:tlist_msg = strpart(s:tlist_msg, len - 3000) - endif - let s:tlist_msg = s:tlist_msg . strftime('%H:%M:%S') . ': ' . - \ a:msg . "\n" - endif - endif -endfunction - -" Tlist_Warning_Msg() -" Display a message using WarningMsg highlight group -function! s:Tlist_Warning_Msg(msg) - echohl WarningMsg - echomsg a:msg - echohl None -endfunction - -" Last returned file index for file name lookup. -" Used to speed up file lookup -let s:tlist_file_name_idx_cache = -1 - -" Tlist_Get_File_Index() -" Return the index of the specified filename -function! s:Tlist_Get_File_Index(fname) - if s:tlist_file_count == 0 || a:fname == '' - return -1 - endif - - " If the new filename is same as the last accessed filename, then - " return that index - if s:tlist_file_name_idx_cache != -1 && - \ s:tlist_file_name_idx_cache < s:tlist_file_count - if s:tlist_{s:tlist_file_name_idx_cache}_filename == a:fname - " Same as the last accessed file - return s:tlist_file_name_idx_cache - endif - endif - - " First, check whether the filename is present - let s_fname = a:fname . "\n" - let i = stridx(s:tlist_file_names, s_fname) - if i == -1 - let s:tlist_file_name_idx_cache = -1 - return -1 - endif - - " Second, compute the file name index - let nl_txt = substitute(strpart(s:tlist_file_names, 0, i), "[^\n]", '', 'g') - let s:tlist_file_name_idx_cache = strlen(nl_txt) - return s:tlist_file_name_idx_cache -endfunction - -" Last returned file index for line number lookup. -" Used to speed up file lookup -let s:tlist_file_lnum_idx_cache = -1 - -" Tlist_Window_Get_File_Index_By_Linenum() -" Return the index of the filename present in the specified line number -" Line number refers to the line number in the taglist window -function! s:Tlist_Window_Get_File_Index_By_Linenum(lnum) - call s:Tlist_Log_Msg('Tlist_Window_Get_File_Index_By_Linenum (' . a:lnum . ')') - - " First try to see whether the new line number is within the range - " of the last returned file - if s:tlist_file_lnum_idx_cache != -1 && - \ s:tlist_file_lnum_idx_cache < s:tlist_file_count - if a:lnum >= s:tlist_{s:tlist_file_lnum_idx_cache}_start && - \ a:lnum <= s:tlist_{s:tlist_file_lnum_idx_cache}_end - return s:tlist_file_lnum_idx_cache - endif - endif - - let fidx = -1 - - if g:Tlist_Show_One_File - " Displaying only one file in the taglist window. Check whether - " the line is within the tags displayed for that file - if s:tlist_cur_file_idx != -1 - if a:lnum >= s:tlist_{s:tlist_cur_file_idx}_start - \ && a:lnum <= s:tlist_{s:tlist_cur_file_idx}_end - let fidx = s:tlist_cur_file_idx - endif - - endif - else - " Do a binary search in the taglist - let left = 0 - let right = s:tlist_file_count - 1 - - while left < right - let mid = (left + right) / 2 - - if a:lnum >= s:tlist_{mid}_start && a:lnum <= s:tlist_{mid}_end - let s:tlist_file_lnum_idx_cache = mid - return mid - endif - - if a:lnum < s:tlist_{mid}_start - let right = mid - 1 - else - let left = mid + 1 - endif - endwhile - - if left >= 0 && left < s:tlist_file_count - \ && a:lnum >= s:tlist_{left}_start - \ && a:lnum <= s:tlist_{left}_end - let fidx = left - endif - endif - - let s:tlist_file_lnum_idx_cache = fidx - - return fidx -endfunction - -" Tlist_Exe_Cmd_No_Acmds -" Execute the specified Ex command after disabling autocommands -function! s:Tlist_Exe_Cmd_No_Acmds(cmd) - let old_eventignore = &eventignore - set eventignore=all - exe a:cmd - let &eventignore = old_eventignore -endfunction - -" Tlist_Skip_File() -" Check whether tag listing is supported for the specified file -function! s:Tlist_Skip_File(filename, ftype) - " Skip buffers with no names and buffers with filetype not set - if a:filename == '' || a:ftype == '' - return 1 - endif - - " Skip files which are not supported by exuberant ctags - " First check whether default settings for this filetype are available. - " If it is not available, then check whether user specified settings are - " available. If both are not available, then don't list the tags for this - " filetype - let var = 's:tlist_def_' . a:ftype . '_settings' - if !exists(var) - let var = 'g:tlist_' . a:ftype . '_settings' - if !exists(var) - return 1 - endif - endif - - " Skip files which are not readable or files which are not yet stored - " to the disk - if !filereadable(a:filename) - return 1 - endif - - return 0 -endfunction - -" Tlist_User_Removed_File -" Returns 1 if a file is removed by a user from the taglist -function! s:Tlist_User_Removed_File(filename) - return stridx(s:tlist_removed_flist, a:filename . "\n") != -1 -endfunction - -" Tlist_Update_Remove_List -" Update the list of user removed files from the taglist -" add == 1, add the file to the removed list -" add == 0, delete the file from the removed list -function! s:Tlist_Update_Remove_List(filename, add) - if a:add - let s:tlist_removed_flist = s:tlist_removed_flist . a:filename . "\n" - else - let idx = stridx(s:tlist_removed_flist, a:filename . "\n") - let text_before = strpart(s:tlist_removed_flist, 0, idx) - let rem_text = strpart(s:tlist_removed_flist, idx) - let next_idx = stridx(rem_text, "\n") - let text_after = strpart(rem_text, next_idx + 1) - - let s:tlist_removed_flist = text_before . text_after - endif -endfunction - -" Tlist_FileType_Init -" Initialize the ctags arguments and tag variable for the specified -" file type -function! s:Tlist_FileType_Init(ftype) - call s:Tlist_Log_Msg('Tlist_FileType_Init (' . a:ftype . ')') - " If the user didn't specify any settings, then use the default - " ctags args. Otherwise, use the settings specified by the user - let var = 'g:tlist_' . a:ftype . '_settings' - if exists(var) - " User specified ctags arguments - let settings = {var} . ';' - else - " Default ctags arguments - let var = 's:tlist_def_' . a:ftype . '_settings' - if !exists(var) - " No default settings for this file type. This filetype is - " not supported - return 0 - endif - let settings = s:tlist_def_{a:ftype}_settings . ';' - endif - - let msg = 'Taglist: Invalid ctags option setting - ' . settings - - " Format of the option that specifies the filetype and ctags arugments: - " - " ;flag1:name1;flag2:name2;flag3:name3 - " - - " Extract the file type to pass to ctags. This may be different from the - " file type detected by Vim - let pos = stridx(settings, ';') - if pos == -1 - call s:Tlist_Warning_Msg(msg) - return 0 - endif - let ctags_ftype = strpart(settings, 0, pos) - if ctags_ftype == '' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - " Make sure a valid filetype is supplied. If the user didn't specify a - " valid filetype, then the ctags option settings may be treated as the - " filetype - if ctags_ftype =~ ':' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - - " Remove the file type from settings - let settings = strpart(settings, pos + 1) - if settings == '' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - - " Process all the specified ctags flags. The format is - " flag1:name1;flag2:name2;flag3:name3 - let ctags_flags = '' - let cnt = 0 - while settings != '' - " Extract the flag - let pos = stridx(settings, ':') - if pos == -1 - call s:Tlist_Warning_Msg(msg) - return 0 - endif - let flag = strpart(settings, 0, pos) - if flag == '' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - " Remove the flag from settings - let settings = strpart(settings, pos + 1) - - " Extract the tag type name - let pos = stridx(settings, ';') - if pos == -1 - call s:Tlist_Warning_Msg(msg) - return 0 - endif - let name = strpart(settings, 0, pos) - if name == '' - call s:Tlist_Warning_Msg(msg) - return 0 - endif - let settings = strpart(settings, pos + 1) - - let cnt = cnt + 1 - - let s:tlist_{a:ftype}_{cnt}_name = flag - let s:tlist_{a:ftype}_{cnt}_fullname = name - let ctags_flags = ctags_flags . flag - endwhile - - let s:tlist_{a:ftype}_ctags_args = '--language-force=' . ctags_ftype . - \ ' --' . ctags_ftype . '-types=' . ctags_flags - let s:tlist_{a:ftype}_count = cnt - let s:tlist_{a:ftype}_ctags_flags = ctags_flags - - " Save the filetype name - let s:tlist_ftype_{s:tlist_ftype_count}_name = a:ftype - let s:tlist_ftype_count = s:tlist_ftype_count + 1 - - return 1 -endfunction - -" Tlist_Detect_Filetype -" Determine the filetype for the specified file using the filetypedetect -" autocmd. -function! s:Tlist_Detect_Filetype(fname) - " Ignore the filetype autocommands - let old_eventignore = &eventignore - set eventignore=FileType - - " Save the 'filetype', as this will be changed temporarily - let old_filetype = &filetype - - " Run the filetypedetect group of autocommands to determine - " the filetype - exe 'doautocmd filetypedetect BufRead ' . a:fname - - " Save the detected filetype - let ftype = &filetype - - " Restore the previous state - let &filetype = old_filetype - let &eventignore = old_eventignore - - return ftype -endfunction - -" Tlist_Get_Buffer_Filetype -" Get the filetype for the specified buffer -function! s:Tlist_Get_Buffer_Filetype(bnum) - let buf_ft = getbufvar(a:bnum, '&filetype') - - if bufloaded(a:bnum) - " For loaded buffers, the 'filetype' is already determined - return buf_ft - endif - - " For unloaded buffers, if the 'filetype' option is set, return it - if buf_ft != '' - return buf_ft - endif - - " Skip non-existent buffers - if !bufexists(a:bnum) - return '' - endif - - " For buffers whose filetype is not yet determined, try to determine - " the filetype - let bname = bufname(a:bnum) - - return s:Tlist_Detect_Filetype(bname) -endfunction - -" Tlist_Discard_TagInfo -" Discard the stored tag information for a file -function! s:Tlist_Discard_TagInfo(fidx) - call s:Tlist_Log_Msg('Tlist_Discard_TagInfo (' . - \ s:tlist_{a:fidx}_filename . ')') - let ftype = s:tlist_{a:fidx}_filetype - - " Discard information about the tags defined in the file - let i = 1 - while i <= s:tlist_{a:fidx}_tag_count - let fidx_i = 's:tlist_' . a:fidx . '_' . i - unlet! {fidx_i}_tag - unlet! {fidx_i}_tag_name - unlet! {fidx_i}_tag_type - unlet! {fidx_i}_ttype_idx - unlet! {fidx_i}_tag_proto - unlet! {fidx_i}_tag_searchpat - unlet! {fidx_i}_tag_linenum - let i = i + 1 - endwhile - - let s:tlist_{a:fidx}_tag_count = 0 - - " Discard information about tag type groups - let i = 1 - while i <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{i}_name - if s:tlist_{a:fidx}_{ttype} != '' - let fidx_ttype = 's:tlist_' . a:fidx . '_' . ttype - let {fidx_ttype} = '' - let {fidx_ttype}_offset = 0 - let cnt = {fidx_ttype}_count - let {fidx_ttype}_count = 0 - let j = 1 - while j <= cnt - unlet! {fidx_ttype}_{j} - let j = j + 1 - endwhile - endif - let i = i + 1 - endwhile - - " Discard the stored menu command also - let s:tlist_{a:fidx}_menu_cmd = '' -endfunction - -" Tlist_Window_Update_Line_Offsets -" Update the line offsets for tags for files starting from start_idx -" and displayed in the taglist window by the specified offset -function! s:Tlist_Window_Update_Line_Offsets(start_idx, increment, offset) - let i = a:start_idx - - while i < s:tlist_file_count - if s:tlist_{i}_visible - " Update the start/end line number only if the file is visible - if a:increment - let s:tlist_{i}_start = s:tlist_{i}_start + a:offset - let s:tlist_{i}_end = s:tlist_{i}_end + a:offset - else - let s:tlist_{i}_start = s:tlist_{i}_start - a:offset - let s:tlist_{i}_end = s:tlist_{i}_end - a:offset - endif - endif - let i = i + 1 - endwhile -endfunction - -" Tlist_Discard_FileInfo -" Discard the stored information for a file -function! s:Tlist_Discard_FileInfo(fidx) - call s:Tlist_Log_Msg('Tlist_Discard_FileInfo (' . - \ s:tlist_{a:fidx}_filename . ')') - call s:Tlist_Discard_TagInfo(a:fidx) - - let ftype = s:tlist_{a:fidx}_filetype - - let i = 1 - while i <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{i}_name - unlet! s:tlist_{a:fidx}_{ttype} - unlet! s:tlist_{a:fidx}_{ttype}_offset - unlet! s:tlist_{a:fidx}_{ttype}_count - let i = i + 1 - endwhile - - unlet! s:tlist_{a:fidx}_filename - unlet! s:tlist_{a:fidx}_sort_type - unlet! s:tlist_{a:fidx}_filetype - unlet! s:tlist_{a:fidx}_mtime - unlet! s:tlist_{a:fidx}_start - unlet! s:tlist_{a:fidx}_end - unlet! s:tlist_{a:fidx}_valid - unlet! s:tlist_{a:fidx}_visible - unlet! s:tlist_{a:fidx}_tag_count - unlet! s:tlist_{a:fidx}_menu_cmd -endfunction - -" Tlist_Window_Remove_File_From_Display -" Remove the specified file from display -function! s:Tlist_Window_Remove_File_From_Display(fidx) - call s:Tlist_Log_Msg('Tlist_Window_Remove_File_From_Display (' . - \ s:tlist_{a:fidx}_filename . ')') - " If the file is not visible then no need to remove it - if !s:tlist_{a:fidx}_visible - return - endif - - " Remove the tags displayed for the specified file from the window - let start = s:tlist_{a:fidx}_start - " Include the empty line after the last line also - if g:Tlist_Compact_Format - let end = s:tlist_{a:fidx}_end - else - let end = s:tlist_{a:fidx}_end + 1 - endif - - setlocal modifiable - exe 'silent! ' . start . ',' . end . 'delete _' - setlocal nomodifiable - - " Correct the start and end line offsets for all the files following - " this file, as the tags for this file are removed - call s:Tlist_Window_Update_Line_Offsets(a:fidx + 1, 0, end - start + 1) -endfunction - -" Tlist_Remove_File -" Remove the file under the cursor or the specified file index -" user_request - User requested to remove the file from taglist -function! s:Tlist_Remove_File(file_idx, user_request) - let fidx = a:file_idx - - if fidx == -1 - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) - if fidx == -1 - return - endif - endif - call s:Tlist_Log_Msg('Tlist_Remove_File (' . - \ s:tlist_{fidx}_filename . ', ' . a:user_request . ')') - - let save_winnr = winnr() - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - " Taglist window is open, remove the file from display - - if save_winnr != winnum - let old_eventignore = &eventignore - set eventignore=all - exe winnum . 'wincmd w' - endif - - call s:Tlist_Window_Remove_File_From_Display(fidx) - - if save_winnr != winnum - exe save_winnr . 'wincmd w' - let &eventignore = old_eventignore - endif - endif - - let fname = s:tlist_{fidx}_filename - - if a:user_request - " As the user requested to remove the file from taglist, - " add it to the removed list - call s:Tlist_Update_Remove_List(fname, 1) - endif - - " Remove the file name from the taglist list of filenames - let idx = stridx(s:tlist_file_names, fname . "\n") - let text_before = strpart(s:tlist_file_names, 0, idx) - let rem_text = strpart(s:tlist_file_names, idx) - let next_idx = stridx(rem_text, "\n") - let text_after = strpart(rem_text, next_idx + 1) - let s:tlist_file_names = text_before . text_after - - call s:Tlist_Discard_FileInfo(fidx) - - " Shift all the file variables by one index - let i = fidx + 1 - - while i < s:tlist_file_count - let j = i - 1 - - let s:tlist_{j}_filename = s:tlist_{i}_filename - let s:tlist_{j}_sort_type = s:tlist_{i}_sort_type - let s:tlist_{j}_filetype = s:tlist_{i}_filetype - let s:tlist_{j}_mtime = s:tlist_{i}_mtime - let s:tlist_{j}_start = s:tlist_{i}_start - let s:tlist_{j}_end = s:tlist_{i}_end - let s:tlist_{j}_valid = s:tlist_{i}_valid - let s:tlist_{j}_visible = s:tlist_{i}_visible - let s:tlist_{j}_tag_count = s:tlist_{i}_tag_count - let s:tlist_{j}_menu_cmd = s:tlist_{i}_menu_cmd - - let k = 1 - while k <= s:tlist_{j}_tag_count - let s:tlist_{j}_{k}_tag = s:tlist_{i}_{k}_tag - let s:tlist_{j}_{k}_tag_name = s:tlist_{i}_{k}_tag_name - let s:tlist_{j}_{k}_tag_type = s:Tlist_Get_Tag_Type_By_Tag(i, k) - let s:tlist_{j}_{k}_ttype_idx = s:tlist_{i}_{k}_ttype_idx - let s:tlist_{j}_{k}_tag_proto = s:Tlist_Get_Tag_Prototype(i, k) - let s:tlist_{j}_{k}_tag_searchpat = s:Tlist_Get_Tag_SearchPat(i, k) - let s:tlist_{j}_{k}_tag_linenum = s:Tlist_Get_Tag_Linenum(i, k) - let k = k + 1 - endwhile - - let ftype = s:tlist_{i}_filetype - - let k = 1 - while k <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{k}_name - let s:tlist_{j}_{ttype} = s:tlist_{i}_{ttype} - let s:tlist_{j}_{ttype}_offset = s:tlist_{i}_{ttype}_offset - let s:tlist_{j}_{ttype}_count = s:tlist_{i}_{ttype}_count - if s:tlist_{j}_{ttype} != '' - let l = 1 - while l <= s:tlist_{j}_{ttype}_count - let s:tlist_{j}_{ttype}_{l} = s:tlist_{i}_{ttype}_{l} - let l = l + 1 - endwhile - endif - let k = k + 1 - endwhile - - " As the file and tag information is copied to the new index, - " discard the previous information - call s:Tlist_Discard_FileInfo(i) - - let i = i + 1 - endwhile - - " Reduce the number of files displayed - let s:tlist_file_count = s:tlist_file_count - 1 - - if g:Tlist_Show_One_File - " If the tags for only one file is displayed and if we just - " now removed that file, then invalidate the current file idx - if s:tlist_cur_file_idx == fidx - let s:tlist_cur_file_idx = -1 - endif - endif -endfunction - -" Tlist_Window_Goto_Window -" Goto the taglist window -function! s:Tlist_Window_Goto_Window() - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - if winnr() != winnum - call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w') - endif - endif -endfunction - -" Tlist_Window_Create -" Create a new taglist window. If it is already open, jump to it -function! s:Tlist_Window_Create() - call s:Tlist_Log_Msg('Tlist_Window_Create()') - " If the window is open, jump to it - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - " Jump to the existing window - if winnr() != winnum - exe winnum . 'wincmd w' - endif - return - endif - - " If used with winmanager don't open windows. Winmanager will handle - " the window/buffer management - if s:tlist_app_name == "winmanager" - return - endif - - " Create a new window. If user prefers a horizontal window, then open - " a horizontally split window. Otherwise open a vertically split - " window - if g:Tlist_Use_Horiz_Window - " Open a horizontally split window - let win_dir = 'botright' - " Horizontal window height - let win_size = g:Tlist_WinHeight - else - if s:tlist_winsize_chgd == -1 - " Open a vertically split window. Increase the window size, if - " needed, to accomodate the new window - if g:Tlist_Inc_Winwidth && - \ &columns < (80 + g:Tlist_WinWidth) - " Save the original window position - let s:tlist_pre_winx = getwinposx() - let s:tlist_pre_winy = getwinposy() - - " one extra column is needed to include the vertical split - let &columns= &columns + g:Tlist_WinWidth + 1 - - let s:tlist_winsize_chgd = 1 - else - let s:tlist_winsize_chgd = 0 - endif - endif - - if g:Tlist_Use_Right_Window - " Open the window at the rightmost place - let win_dir = 'botright vertical' - else - " Open the window at the leftmost place - let win_dir = 'topleft vertical' - endif - let win_size = g:Tlist_WinWidth - endif - - " If the tag listing temporary buffer already exists, then reuse it. - " Otherwise create a new buffer - let bufnum = bufnr(g:TagList_title) - if bufnum == -1 - " Create a new buffer - let wcmd = g:TagList_title - else - " Edit the existing buffer - let wcmd = '+buffer' . bufnum - endif - - " Create the taglist window - exe 'silent! ' . win_dir . ' ' . win_size . 'split ' . wcmd - - " Save the new window position - let s:tlist_winx = getwinposx() - let s:tlist_winy = getwinposy() - - " Initialize the taglist window - call s:Tlist_Window_Init() -endfunction - -" Tlist_Window_Zoom -" Zoom (maximize/minimize) the taglist window -function! s:Tlist_Window_Zoom() - if s:tlist_win_maximized - " Restore the window back to the previous size - if g:Tlist_Use_Horiz_Window - exe 'resize ' . g:Tlist_WinHeight - else - exe 'vert resize ' . g:Tlist_WinWidth - endif - let s:tlist_win_maximized = 0 - else - " Set the window size to the maximum possible without closing other - " windows - if g:Tlist_Use_Horiz_Window - resize - else - vert resize - endif - let s:tlist_win_maximized = 1 - endif -endfunction - -" Tlist_Ballon_Expr -" When the mouse cursor is over a tag in the taglist window, display the -" tag prototype (balloon) -function! Tlist_Ballon_Expr() - " Get the file index - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(v:beval_lnum) - if fidx == -1 - return '' - endif - - " Get the tag output line for the current tag - let tidx = s:Tlist_Window_Get_Tag_Index(fidx, v:beval_lnum) - if tidx == 0 - return '' - endif - - " Get the tag search pattern and display it - return s:Tlist_Get_Tag_Prototype(fidx, tidx) -endfunction - -" Tlist_Window_Check_Width -" Check the width of the taglist window. For horizontally split windows, the -" 'winfixheight' option is used to fix the height of the window. For -" vertically split windows, Vim doesn't support the 'winfixwidth' option. So -" need to handle window width changes from this function. -function! s:Tlist_Window_Check_Width() - let tlist_winnr = bufwinnr(g:TagList_title) - if tlist_winnr == -1 - return - endif - - let width = winwidth(tlist_winnr) - if width != g:Tlist_WinWidth - call s:Tlist_Log_Msg("Tlist_Window_Check_Width: Changing window " . - \ "width from " . width . " to " . g:Tlist_WinWidth) - let save_winnr = winnr() - if save_winnr != tlist_winnr - call s:Tlist_Exe_Cmd_No_Acmds(tlist_winnr . 'wincmd w') - endif - exe 'vert resize ' . g:Tlist_WinWidth - if save_winnr != tlist_winnr - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - endif - endif -endfunction - -" Tlist_Window_Exit_Only_Window -" If the 'Tlist_Exit_OnlyWindow' option is set, then exit Vim if only the -" taglist window is present. -function! s:Tlist_Window_Exit_Only_Window() - " Before quitting Vim, delete the taglist buffer so that - " the '0 mark is correctly set to the previous buffer. - if v:version < 700 - if winbufnr(2) == -1 - bdelete - quit - endif - else - if winbufnr(2) == -1 - if tabpagenr('$') == 1 - " Only one tag page is present - bdelete - quit - else - " More than one tab page is present. Close only the current - " tab page - close - endif - endif - endif -endfunction - -" Tlist_Window_Init -" Set the default options for the taglist window -function! s:Tlist_Window_Init() - call s:Tlist_Log_Msg('Tlist_Window_Init()') - - " The 'readonly' option should not be set for the taglist buffer. - " If Vim is started as "view/gview" or if the ":view" command is - " used, then the 'readonly' option is set for all the buffers. - " Unset it for the taglist buffer - setlocal noreadonly - - " Set the taglist buffer filetype to taglist - setlocal filetype=taglist - - " Define taglist window element highlighting - syntax match TagListComment '^" .*' - syntax match TagListFileName '^[^" ].*$' - syntax match TagListTitle '^ \S.*$' - syntax match TagListTagScope '\s\[.\{-\}\]$' - - " Define the highlighting only if colors are supported - if has('gui_running') || &t_Co > 2 - " Colors to highlight various taglist window elements - " If user defined highlighting group exists, then use them. - " Otherwise, use default highlight groups. - if hlexists('MyTagListTagName') - highlight link TagListTagName MyTagListTagName - else - highlight default link TagListTagName Search - endif - " Colors to highlight comments and titles - if hlexists('MyTagListComment') - highlight link TagListComment MyTagListComment - else - highlight clear TagListComment - highlight default link TagListComment Comment - endif - if hlexists('MyTagListTitle') - highlight link TagListTitle MyTagListTitle - else - highlight clear TagListTitle - highlight default link TagListTitle Title - endif - if hlexists('MyTagListFileName') - highlight link TagListFileName MyTagListFileName - else - highlight clear TagListFileName - highlight default TagListFileName guibg=Grey ctermbg=darkgray - \ guifg=white ctermfg=white - endif - if hlexists('MyTagListTagScope') - highlight link TagListTagScope MyTagListTagScope - else - highlight clear TagListTagScope - highlight default link TagListTagScope Identifier - endif - else - highlight default TagListTagName term=reverse cterm=reverse - endif - - " Folding related settings - setlocal foldenable - setlocal foldminlines=0 - setlocal foldmethod=manual - setlocal foldlevel=9999 - if g:Tlist_Enable_Fold_Column - setlocal foldcolumn=3 - else - setlocal foldcolumn=0 - endif - setlocal foldtext=v:folddashes.getline(v:foldstart) - - if s:tlist_app_name != "winmanager" - " Mark buffer as scratch - silent! setlocal buftype=nofile - if s:tlist_app_name == "none" - silent! setlocal bufhidden=delete - endif - silent! setlocal noswapfile - " Due to a bug in Vim 6.0, the winbufnr() function fails for unlisted - " buffers. So if the taglist buffer is unlisted, multiple taglist - " windows will be opened. This bug is fixed in Vim 6.1 and above - if v:version >= 601 - silent! setlocal nobuflisted - endif - endif - - silent! setlocal nowrap - - " If the 'number' option is set in the source window, it will affect the - " taglist window. So forcefully disable 'number' option for the taglist - " window - silent! setlocal nonumber - - " Use fixed height when horizontally split window is used - if g:Tlist_Use_Horiz_Window - if v:version >= 602 - set winfixheight - endif - endif - if !g:Tlist_Use_Horiz_Window && v:version >= 700 - set winfixwidth - endif - - " Setup balloon evaluation to display tag prototype - if v:version >= 700 && has('balloon_eval') - setlocal balloonexpr=Tlist_Ballon_Expr() - set ballooneval - endif - - " Setup the cpoptions properly for the maps to work - let old_cpoptions = &cpoptions - set cpoptions&vim - - " Create buffer local mappings for jumping to the tags and sorting the list - nnoremap - \ :call Tlist_Window_Jump_To_Tag('useopen') - nnoremap o - \ :call Tlist_Window_Jump_To_Tag('newwin') - nnoremap p - \ :call Tlist_Window_Jump_To_Tag('preview') - nnoremap P - \ :call Tlist_Window_Jump_To_Tag('prevwin') - if v:version >= 700 - nnoremap t - \ :call Tlist_Window_Jump_To_Tag('checktab') - nnoremap - \ :call Tlist_Window_Jump_To_Tag('newtab') - endif - nnoremap <2-LeftMouse> - \ :call Tlist_Window_Jump_To_Tag('useopen') - nnoremap s - \ :call Tlist_Change_Sort('cmd', 'toggle', '') - nnoremap + :silent! foldopen - nnoremap - :silent! foldclose - nnoremap * :silent! %foldopen! - nnoremap = :silent! %foldclose - nnoremap :silent! foldopen - nnoremap :silent! foldclose - nnoremap :silent! %foldopen! - nnoremap :call Tlist_Window_Show_Info() - nnoremap u :call Tlist_Window_Update_File() - nnoremap d :call Tlist_Remove_File(-1, 1) - nnoremap x :call Tlist_Window_Zoom() - nnoremap [[ :call Tlist_Window_Move_To_File(-1) - nnoremap :call Tlist_Window_Move_To_File(-1) - nnoremap ]] :call Tlist_Window_Move_To_File(1) - nnoremap :call Tlist_Window_Move_To_File(1) - nnoremap :call Tlist_Window_Toggle_Help_Text() - nnoremap q :close - - " Insert mode mappings - inoremap - \ :call Tlist_Window_Jump_To_Tag('useopen') - " Windows needs return - inoremap - \ :call Tlist_Window_Jump_To_Tag('useopen') - inoremap o - \ :call Tlist_Window_Jump_To_Tag('newwin') - inoremap p - \ :call Tlist_Window_Jump_To_Tag('preview') - inoremap P - \ :call Tlist_Window_Jump_To_Tag('prevwin') - if v:version >= 700 - inoremap t - \ :call Tlist_Window_Jump_To_Tag('checktab') - inoremap - \ :call Tlist_Window_Jump_To_Tag('newtab') - endif - inoremap <2-LeftMouse> - \ :call Tlist_Window_Jump_To_Tag('useopen') - inoremap s - \ :call Tlist_Change_Sort('cmd', 'toggle', '') - inoremap + :silent! foldopen - inoremap - :silent! foldclose - inoremap * :silent! %foldopen! - inoremap = :silent! %foldclose - inoremap :silent! foldopen - inoremap :silent! foldclose - inoremap :silent! %foldopen! - inoremap :call - \ Tlist_Window_Show_Info() - inoremap u - \ :call Tlist_Window_Update_File() - inoremap d :call Tlist_Remove_File(-1, 1) - inoremap x :call Tlist_Window_Zoom() - inoremap [[ :call Tlist_Window_Move_To_File(-1) - inoremap :call Tlist_Window_Move_To_File(-1) - inoremap ]] :call Tlist_Window_Move_To_File(1) - inoremap :call Tlist_Window_Move_To_File(1) - inoremap :call Tlist_Window_Toggle_Help_Text() - inoremap q :close - - " Map single left mouse click if the user wants this functionality - if g:Tlist_Use_SingleClick == 1 - " Contributed by Bindu Wavell - " attempt to perform single click mapping, it would be much - " nicer if we could nnoremap ... however vim does - " not fire the when you use the mouse - " to enter a buffer. - let clickmap = ':if bufname("%") =~ "__Tag_List__" ' . - \ 'call Tlist_Window_Jump_To_Tag("useopen") ' . - \ ' endif ' - if maparg('', 'n') == '' - " no mapping for leftmouse - exe ':nnoremap ' . clickmap - else - " we have a mapping - let mapcmd = ':nnoremap ' - let mapcmd = mapcmd . substitute(substitute( - \ maparg('', 'n'), '|', '', 'g'), - \ '\c^', '', '') - let mapcmd = mapcmd . clickmap - exe mapcmd - endif - endif - - " Define the taglist autocommands - augroup TagListAutoCmds - autocmd! - " Display the tag prototype for the tag under the cursor. - autocmd CursorHold __Tag_List__ call s:Tlist_Window_Show_Info() - " Highlight the current tag periodically - autocmd CursorHold * silent call s:Tlist_Window_Highlight_Tag( - \ fnamemodify(bufname('%'), ':p'), line('.'), 1, 0) - - " Adjust the Vim window width when taglist window is closed - autocmd BufUnload __Tag_List__ call s:Tlist_Post_Close_Cleanup() - " Close the fold for this buffer when leaving the buffer - if g:Tlist_File_Fold_Auto_Close - autocmd BufEnter * silent - \ call s:Tlist_Window_Open_File_Fold(expand('')) - endif - " Exit Vim itself if only the taglist window is present (optional) - if g:Tlist_Exit_OnlyWindow - autocmd BufEnter __Tag_List__ nested - \ call s:Tlist_Window_Exit_Only_Window() - endif - if s:tlist_app_name != "winmanager" && - \ !g:Tlist_Process_File_Always && - \ (!has('gui_running') || !g:Tlist_Show_Menu) - " Auto refresh the taglist window - autocmd BufEnter * call s:Tlist_Refresh() - endif - - if !g:Tlist_Use_Horiz_Window - if v:version < 700 - autocmd WinEnter * call s:Tlist_Window_Check_Width() - endif - endif - if v:version >= 700 - autocmd TabEnter * silent call s:Tlist_Refresh_Folds() - endif - augroup end - - " Restore the previous cpoptions settings - let &cpoptions = old_cpoptions -endfunction - -" Tlist_Window_Refresh -" Display the tags for all the files in the taglist window -function! s:Tlist_Window_Refresh() - call s:Tlist_Log_Msg('Tlist_Window_Refresh()') - " Set report option to a huge value to prevent informational messages - " while deleting the lines - let old_report = &report - set report=99999 - - " Mark the buffer as modifiable - setlocal modifiable - - " Delete the contents of the buffer to the black-hole register - silent! %delete _ - - " As we have cleared the taglist window, mark all the files - " as not visible - let i = 0 - while i < s:tlist_file_count - let s:tlist_{i}_visible = 0 - let i = i + 1 - endwhile - - if g:Tlist_Compact_Format == 0 - " Display help in non-compact mode - call s:Tlist_Window_Display_Help() - endif - - " Mark the buffer as not modifiable - setlocal nomodifiable - - " Restore the report option - let &report = old_report - - " If the tags for only one file should be displayed in the taglist - " window, then no need to add the tags here. The bufenter autocommand - " will add the tags for that file. - if g:Tlist_Show_One_File - return - endif - - " List all the tags for the previously processed files - " Do this only if taglist is configured to display tags for more than - " one file. Otherwise, when Tlist_Show_One_File is configured, - " tags for the wrong file will be displayed. - let i = 0 - while i < s:tlist_file_count - call s:Tlist_Window_Refresh_File(s:tlist_{i}_filename, - \ s:tlist_{i}_filetype) - let i = i + 1 - endwhile - - if g:Tlist_Auto_Update - " Add and list the tags for all buffers in the Vim buffer list - let i = 1 - let last_bufnum = bufnr('$') - while i <= last_bufnum - if buflisted(i) - let fname = fnamemodify(bufname(i), ':p') - let ftype = s:Tlist_Get_Buffer_Filetype(i) - " If the file doesn't support tag listing, skip it - if !s:Tlist_Skip_File(fname, ftype) - call s:Tlist_Window_Refresh_File(fname, ftype) - endif - endif - let i = i + 1 - endwhile - endif - - " If Tlist_File_Fold_Auto_Close option is set, then close all the folds - if g:Tlist_File_Fold_Auto_Close - " Close all the folds - silent! %foldclose - endif - - " Move the cursor to the top of the taglist window - normal! gg -endfunction - -" Tlist_Post_Close_Cleanup() -" Close the taglist window and adjust the Vim window width -function! s:Tlist_Post_Close_Cleanup() - call s:Tlist_Log_Msg('Tlist_Post_Close_Cleanup()') - " Mark all the files as not visible - let i = 0 - while i < s:tlist_file_count - let s:tlist_{i}_visible = 0 - let i = i + 1 - endwhile - - " Remove the taglist autocommands - silent! autocmd! TagListAutoCmds - - " Clear all the highlights - match none - - silent! syntax clear TagListTitle - silent! syntax clear TagListComment - silent! syntax clear TagListTagScope - - " Remove the left mouse click mapping if it was setup initially - if g:Tlist_Use_SingleClick - if hasmapto('') - nunmap - endif - endif - - if s:tlist_app_name != "winmanager" - if g:Tlist_Use_Horiz_Window || g:Tlist_Inc_Winwidth == 0 || - \ s:tlist_winsize_chgd != 1 || - \ &columns < (80 + g:Tlist_WinWidth) - " No need to adjust window width if using horizontally split taglist - " window or if columns is less than 101 or if the user chose not to - " adjust the window width - else - " If the user didn't manually move the window, then restore the window - " position to the pre-taglist position - if s:tlist_pre_winx != -1 && s:tlist_pre_winy != -1 && - \ getwinposx() == s:tlist_winx && - \ getwinposy() == s:tlist_winy - exe 'winpos ' . s:tlist_pre_winx . ' ' . s:tlist_pre_winy - endif - - " Adjust the Vim window width - let &columns= &columns - (g:Tlist_WinWidth + 1) - endif - endif - - let s:tlist_winsize_chgd = -1 - - " Reset taglist state variables - if s:tlist_app_name == "winmanager" - let s:tlist_app_name = "none" - endif - let s:tlist_window_initialized = 0 -endfunction - -" Tlist_Window_Refresh_File() -" List the tags defined in the specified file in a Vim window -function! s:Tlist_Window_Refresh_File(filename, ftype) - call s:Tlist_Log_Msg('Tlist_Window_Refresh_File (' . a:filename . ')') - " First check whether the file already exists - let fidx = s:Tlist_Get_File_Index(a:filename) - if fidx != -1 - let file_listed = 1 - else - let file_listed = 0 - endif - - if !file_listed - " Check whether this file is removed based on user request - " If it is, then don't display the tags for this file - if s:Tlist_User_Removed_File(a:filename) - return - endif - endif - - if file_listed && s:tlist_{fidx}_visible - " Check whether the file tags are currently valid - if s:tlist_{fidx}_valid - " Goto the first line in the file - exe s:tlist_{fidx}_start - - " If the line is inside a fold, open the fold - if foldclosed('.') != -1 - exe "silent! " . s:tlist_{fidx}_start . "," . - \ s:tlist_{fidx}_end . "foldopen!" - endif - return - endif - - " Discard and remove the tags for this file from display - call s:Tlist_Discard_TagInfo(fidx) - call s:Tlist_Window_Remove_File_From_Display(fidx) - endif - - " Process and generate a list of tags defined in the file - if !file_listed || !s:tlist_{fidx}_valid - let ret_fidx = s:Tlist_Process_File(a:filename, a:ftype) - if ret_fidx == -1 - return - endif - let fidx = ret_fidx - endif - - " Set report option to a huge value to prevent informational messages - " while adding lines to the taglist window - let old_report = &report - set report=99999 - - if g:Tlist_Show_One_File - " Remove the previous file - if s:tlist_cur_file_idx != -1 - call s:Tlist_Window_Remove_File_From_Display(s:tlist_cur_file_idx) - let s:tlist_{s:tlist_cur_file_idx}_visible = 0 - let s:tlist_{s:tlist_cur_file_idx}_start = 0 - let s:tlist_{s:tlist_cur_file_idx}_end = 0 - endif - let s:tlist_cur_file_idx = fidx - endif - - " Mark the buffer as modifiable - setlocal modifiable - - " Add new files to the end of the window. For existing files, add them at - " the same line where they were previously present. If the file is not - " visible, then add it at the end - if s:tlist_{fidx}_start == 0 || !s:tlist_{fidx}_visible - if g:Tlist_Compact_Format - let s:tlist_{fidx}_start = line('$') - else - let s:tlist_{fidx}_start = line('$') + 1 - endif - endif - - let s:tlist_{fidx}_visible = 1 - - " Goto the line where this file should be placed - if g:Tlist_Compact_Format - exe s:tlist_{fidx}_start - else - exe s:tlist_{fidx}_start - 1 - endif - - let txt = fnamemodify(s:tlist_{fidx}_filename, ':t') . ' (' . - \ fnamemodify(s:tlist_{fidx}_filename, ':p:h') . ')' - if g:Tlist_Compact_Format == 0 - silent! put =txt - else - silent! put! =txt - " Move to the next line - exe line('.') + 1 - endif - let file_start = s:tlist_{fidx}_start - - " Add the tag names grouped by tag type to the buffer with a title - let i = 1 - let ttype_cnt = s:tlist_{a:ftype}_count - while i <= ttype_cnt - let ttype = s:tlist_{a:ftype}_{i}_name - " Add the tag type only if there are tags for that type - let fidx_ttype = 's:tlist_' . fidx . '_' . ttype - let ttype_txt = {fidx_ttype} - if ttype_txt != '' - let txt = ' ' . s:tlist_{a:ftype}_{i}_fullname - if g:Tlist_Compact_Format == 0 - let ttype_start_lnum = line('.') + 1 - silent! put =txt - else - let ttype_start_lnum = line('.') - silent! put! =txt - endif - silent! put =ttype_txt - - let {fidx_ttype}_offset = ttype_start_lnum - file_start - - " create a fold for this tag type - let fold_start = ttype_start_lnum - let fold_end = fold_start + {fidx_ttype}_count - exe fold_start . ',' . fold_end . 'fold' - - " Adjust the cursor position - if g:Tlist_Compact_Format == 0 - exe ttype_start_lnum + {fidx_ttype}_count - else - exe ttype_start_lnum + {fidx_ttype}_count + 1 - endif - - if g:Tlist_Compact_Format == 0 - " Separate the tag types by a empty line - silent! put ='' - endif - endif - let i = i + 1 - endwhile - - if s:tlist_{fidx}_tag_count == 0 - if g:Tlist_Compact_Format == 0 - silent! put ='' - endif - endif - - let s:tlist_{fidx}_end = line('.') - 1 - - " Create a fold for the entire file - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' - exe 'silent! ' . s:tlist_{fidx}_start . ',' . - \ s:tlist_{fidx}_end . 'foldopen!' - - " Goto the starting line for this file, - exe s:tlist_{fidx}_start - - if s:tlist_app_name == "winmanager" - " To handle a bug in the winmanager plugin, add a space at the - " last line - call setline('$', ' ') - endif - - " Mark the buffer as not modifiable - setlocal nomodifiable - - " Restore the report option - let &report = old_report - - " Update the start and end line numbers for all the files following this - " file - let start = s:tlist_{fidx}_start - " include the empty line after the last line - if g:Tlist_Compact_Format - let end = s:tlist_{fidx}_end - else - let end = s:tlist_{fidx}_end + 1 - endif - call s:Tlist_Window_Update_Line_Offsets(fidx + 1, 1, end - start + 1) - - " Now that we have updated the taglist window, update the tags - " menu (if present) - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(1) - endif -endfunction - -" Tlist_Init_File -" Initialize the variables for a new file -function! s:Tlist_Init_File(filename, ftype) - call s:Tlist_Log_Msg('Tlist_Init_File (' . a:filename . ')') - " Add new files at the end of the list - let fidx = s:tlist_file_count - let s:tlist_file_count = s:tlist_file_count + 1 - " Add the new file name to the taglist list of file names - let s:tlist_file_names = s:tlist_file_names . a:filename . "\n" - - " Initialize the file variables - let s:tlist_{fidx}_filename = a:filename - let s:tlist_{fidx}_sort_type = g:Tlist_Sort_Type - let s:tlist_{fidx}_filetype = a:ftype - let s:tlist_{fidx}_mtime = -1 - let s:tlist_{fidx}_start = 0 - let s:tlist_{fidx}_end = 0 - let s:tlist_{fidx}_valid = 0 - let s:tlist_{fidx}_visible = 0 - let s:tlist_{fidx}_tag_count = 0 - let s:tlist_{fidx}_menu_cmd = '' - - " Initialize the tag type variables - let i = 1 - while i <= s:tlist_{a:ftype}_count - let ttype = s:tlist_{a:ftype}_{i}_name - let s:tlist_{fidx}_{ttype} = '' - let s:tlist_{fidx}_{ttype}_offset = 0 - let s:tlist_{fidx}_{ttype}_count = 0 - let i = i + 1 - endwhile - - return fidx -endfunction - -" Tlist_Get_Tag_Type_By_Tag -" Return the tag type for the specified tag index -function! s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx) - let ttype_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_type' - - " Already parsed and have the tag name - if exists(ttype_var) - return {ttype_var} - endif - - let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag - let {ttype_var} = s:Tlist_Extract_Tagtype(tag_line) - - return {ttype_var} -endfunction - -" Tlist_Get_Tag_Prototype -function! s:Tlist_Get_Tag_Prototype(fidx, tidx) - let tproto_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_proto' - - " Already parsed and have the tag prototype - if exists(tproto_var) - return {tproto_var} - endif - - " Parse and extract the tag prototype - let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag - let start = stridx(tag_line, '/^') + 2 - let end = stridx(tag_line, '/;"' . "\t") - if tag_line[end - 1] == '$' - let end = end -1 - endif - let tag_proto = strpart(tag_line, start, end - start) - let {tproto_var} = substitute(tag_proto, '\s*', '', '') - - return {tproto_var} -endfunction - -" Tlist_Get_Tag_SearchPat -function! s:Tlist_Get_Tag_SearchPat(fidx, tidx) - let tpat_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_searchpat' - - " Already parsed and have the tag search pattern - if exists(tpat_var) - return {tpat_var} - endif - - " Parse and extract the tag search pattern - let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag - let start = stridx(tag_line, '/^') + 2 - let end = stridx(tag_line, '/;"' . "\t") - if tag_line[end - 1] == '$' - let end = end -1 - endif - let {tpat_var} = '\V\^' . strpart(tag_line, start, end - start) . - \ (tag_line[end] == '$' ? '\$' : '') - - return {tpat_var} -endfunction - -" Tlist_Get_Tag_Linenum -" Return the tag line number, given the tag index -function! s:Tlist_Get_Tag_Linenum(fidx, tidx) - let tline_var = 's:tlist_' . a:fidx . '_' . a:tidx . '_tag_linenum' - - " Already parsed and have the tag line number - if exists(tline_var) - return {tline_var} - endif - - " Parse and extract the tag line number - let tag_line = s:tlist_{a:fidx}_{a:tidx}_tag - let start = strridx(tag_line, 'line:') + 5 - let end = strridx(tag_line, "\t") - if end < start - let {tline_var} = strpart(tag_line, start) + 0 - else - let {tline_var} = strpart(tag_line, start, end - start) + 0 - endif - - return {tline_var} -endfunction - -" Tlist_Parse_Tagline -" Parse a tag line from the ctags output. Separate the tag output based on the -" tag type and store it in the tag type variable. -" The format of each line in the ctags output is: -" -" tag_namefile_nameex_cmd;"extension_fields -" -function! s:Tlist_Parse_Tagline(tag_line) - if a:tag_line == '' - " Skip empty lines - return - endif - - " Extract the tag type - let ttype = s:Tlist_Extract_Tagtype(a:tag_line) - - " Make sure the tag type is a valid and supported one - if ttype == '' || stridx(s:ctags_flags, ttype) == -1 - " Line is not in proper tags format or Tag type is not supported - return - endif - - " Update the total tag count - let s:tidx = s:tidx + 1 - - " The following variables are used to optimize this code. Vim is slow in - " using curly brace names. To reduce the amount of processing needed, the - " curly brace variables are pre-processed here - let fidx_tidx = 's:tlist_' . s:fidx . '_' . s:tidx - let fidx_ttype = 's:tlist_' . s:fidx . '_' . ttype - - " Update the count of this tag type - let ttype_idx = {fidx_ttype}_count + 1 - let {fidx_ttype}_count = ttype_idx - - " Store the ctags output for this tag - let {fidx_tidx}_tag = a:tag_line - - " Store the tag index and the tag type index (back pointers) - let {fidx_ttype}_{ttype_idx} = s:tidx - let {fidx_tidx}_ttype_idx = ttype_idx - - " Extract the tag name - let tag_name = strpart(a:tag_line, 0, stridx(a:tag_line, "\t")) - - " Extract the tag scope/prototype - if g:Tlist_Display_Prototype - let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(s:fidx, s:tidx) - else - let ttxt = ' ' . tag_name - - " Add the tag scope, if it is available and is configured. Tag - " scope is the last field after the 'line:\t' field - if g:Tlist_Display_Tag_Scope - let tag_scope = s:Tlist_Extract_Tag_Scope(a:tag_line) - if tag_scope != '' - let ttxt = ttxt . ' [' . tag_scope . ']' - endif - endif - endif - - " Add this tag to the tag type variable - let {fidx_ttype} = {fidx_ttype} . ttxt . "\n" - - " Save the tag name - let {fidx_tidx}_tag_name = tag_name -endfunction - -" Tlist_Process_File -" Get the list of tags defined in the specified file and store them -" in Vim variables. Returns the file index where the tags are stored. -function! s:Tlist_Process_File(filename, ftype) - call s:Tlist_Log_Msg('Tlist_Process_File (' . a:filename . ', ' . - \ a:ftype . ')') - " Check whether this file is supported - if s:Tlist_Skip_File(a:filename, a:ftype) - return -1 - endif - - " If the tag types for this filetype are not yet created, then create - " them now - let var = 's:tlist_' . a:ftype . '_count' - if !exists(var) - if s:Tlist_FileType_Init(a:ftype) == 0 - return -1 - endif - endif - - " If this file is already processed, then use the cached values - let fidx = s:Tlist_Get_File_Index(a:filename) - if fidx == -1 - " First time, this file is loaded - let fidx = s:Tlist_Init_File(a:filename, a:ftype) - else - " File was previously processed. Discard the tag information - call s:Tlist_Discard_TagInfo(fidx) - endif - - let s:tlist_{fidx}_valid = 1 - - " Exuberant ctags arguments to generate a tag list - let ctags_args = ' -f - --format=2 --excmd=pattern --fields=nks ' - - " Form the ctags argument depending on the sort type - if s:tlist_{fidx}_sort_type == 'name' - let ctags_args = ctags_args . '--sort=yes' - else - let ctags_args = ctags_args . '--sort=no' - endif - - " Add the filetype specific arguments - let ctags_args = ctags_args . ' ' . s:tlist_{a:ftype}_ctags_args - - " Ctags command to produce output with regexp for locating the tags - let ctags_cmd = g:Tlist_Ctags_Cmd . ctags_args - let ctags_cmd = ctags_cmd . ' "' . a:filename . '"' - - if &shellxquote == '"' - " Double-quotes within double-quotes will not work in the - " command-line.If the 'shellxquote' option is set to double-quotes, - " then escape the double-quotes in the ctags command-line. - let ctags_cmd = escape(ctags_cmd, '"') - endif - - " In Windows 95, if not using cygwin, disable the 'shellslash' - " option. Otherwise, this will cause problems when running the - " ctags command. - if has('win95') && !has('win32unix') - let old_shellslash = &shellslash - set noshellslash - endif - - if has('win32') && !has('win32unix') && !has('win95') - \ && (&shell =~ 'cmd.exe') - " Windows does not correctly deal with commands that have more than 1 - " set of double quotes. It will strip them all resulting in: - " 'C:\Program' is not recognized as an internal or external command - " operable program or batch file. To work around this, place the - " command inside a batch file and call the batch file. - " Do this only on Win2K, WinXP and above. - " Contributed by: David Fishburn. - let s:taglist_tempfile = fnamemodify(tempname(), ':h') . - \ '\taglist.cmd' - exe 'redir! > ' . s:taglist_tempfile - silent echo ctags_cmd - redir END - - call s:Tlist_Log_Msg('Cmd inside batch file: ' . ctags_cmd) - let ctags_cmd = '"' . s:taglist_tempfile . '"' - endif - - call s:Tlist_Log_Msg('Cmd: ' . ctags_cmd) - - " Run ctags and get the tag list - let cmd_output = system(ctags_cmd) - - " Restore the value of the 'shellslash' option. - if has('win95') && !has('win32unix') - let &shellslash = old_shellslash - endif - - if exists('s:taglist_tempfile') - " Delete the temporary cmd file created on MS-Windows - call delete(s:taglist_tempfile) - endif - - " Handle errors - if v:shell_error - let msg = "Taglist: Failed to generate tags for " . a:filename - call s:Tlist_Warning_Msg(msg) - if cmd_output != '' - call s:Tlist_Warning_Msg(cmd_output) - endif - return fidx - endif - - " Store the modification time for the file - let s:tlist_{fidx}_mtime = getftime(a:filename) - - " No tags for current file - if cmd_output == '' - call s:Tlist_Log_Msg('No tags defined in ' . a:filename) - return fidx - endif - - call s:Tlist_Log_Msg('Generated tags information for ' . a:filename) - - if v:version > 601 - " The following script local variables are used by the - " Tlist_Parse_Tagline() function. - let s:ctags_flags = s:tlist_{a:ftype}_ctags_flags - let s:fidx = fidx - let s:tidx = 0 - - " Process the ctags output one line at a time. The substitute() - " command is used to parse the tag lines instead of using the - " matchstr()/stridx()/strpart() functions for performance reason - call substitute(cmd_output, "\\([^\n]\\+\\)\n", - \ '\=s:Tlist_Parse_Tagline(submatch(1))', 'g') - - " Save the number of tags for this file - let s:tlist_{fidx}_tag_count = s:tidx - - " The following script local variables are no longer needed - unlet! s:ctags_flags - unlet! s:tidx - unlet! s:fidx - else - " Due to a bug in Vim earlier than version 6.1, - " we cannot use substitute() to parse the ctags output. - " Instead the slow str*() functions are used - let ctags_flags = s:tlist_{a:ftype}_ctags_flags - let tidx = 0 - - while cmd_output != '' - " Extract one line at a time - let idx = stridx(cmd_output, "\n") - let one_line = strpart(cmd_output, 0, idx) - " Remove the line from the tags output - let cmd_output = strpart(cmd_output, idx + 1) - - if one_line == '' - " Line is not in proper tags format - continue - endif - - " Extract the tag type - let ttype = s:Tlist_Extract_Tagtype(one_line) - - " Make sure the tag type is a valid and supported one - if ttype == '' || stridx(ctags_flags, ttype) == -1 - " Line is not in proper tags format or Tag type is not - " supported - continue - endif - - " Update the total tag count - let tidx = tidx + 1 - - " The following variables are used to optimize this code. Vim is - " slow in using curly brace names. To reduce the amount of - " processing needed, the curly brace variables are pre-processed - " here - let fidx_tidx = 's:tlist_' . fidx . '_' . tidx - let fidx_ttype = 's:tlist_' . fidx . '_' . ttype - - " Update the count of this tag type - let ttype_idx = {fidx_ttype}_count + 1 - let {fidx_ttype}_count = ttype_idx - - " Store the ctags output for this tag - let {fidx_tidx}_tag = one_line - - " Store the tag index and the tag type index (back pointers) - let {fidx_ttype}_{ttype_idx} = tidx - let {fidx_tidx}_ttype_idx = ttype_idx - - " Extract the tag name - let tag_name = strpart(one_line, 0, stridx(one_line, "\t")) - - " Extract the tag scope/prototype - if g:Tlist_Display_Prototype - let ttxt = ' ' . s:Tlist_Get_Tag_Prototype(fidx, tidx) - else - let ttxt = ' ' . tag_name - - " Add the tag scope, if it is available and is configured. Tag - " scope is the last field after the 'line:\t' field - if g:Tlist_Display_Tag_Scope - let tag_scope = s:Tlist_Extract_Tag_Scope(one_line) - if tag_scope != '' - let ttxt = ttxt . ' [' . tag_scope . ']' - endif - endif - endif - - " Add this tag to the tag type variable - let {fidx_ttype} = {fidx_ttype} . ttxt . "\n" - - " Save the tag name - let {fidx_tidx}_tag_name = tag_name - endwhile - - " Save the number of tags for this file - let s:tlist_{fidx}_tag_count = tidx - endif - - call s:Tlist_Log_Msg('Processed ' . s:tlist_{fidx}_tag_count . - \ ' tags in ' . a:filename) - - return fidx -endfunction - -" Tlist_Update_File -" Update the tags for a file (if needed) -function! Tlist_Update_File(filename, ftype) - call s:Tlist_Log_Msg('Tlist_Update_File (' . a:filename . ')') - " If the file doesn't support tag listing, skip it - if s:Tlist_Skip_File(a:filename, a:ftype) - return - endif - - " Convert the file name to a full path - let fname = fnamemodify(a:filename, ':p') - - " First check whether the file already exists - let fidx = s:Tlist_Get_File_Index(fname) - - if fidx != -1 && s:tlist_{fidx}_valid - " File exists and the tags are valid - " Check whether the file was modified after the last tags update - " If it is modified, then update the tags - if s:tlist_{fidx}_mtime == getftime(fname) - return - endif - else - " If the tags were removed previously based on a user request, - " as we are going to update the tags (based on the user request), - " remove the filename from the deleted list - call s:Tlist_Update_Remove_List(fname, 0) - endif - - " If the taglist window is opened, update it - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - " Taglist window is not present. Just update the taglist - " and return - call s:Tlist_Process_File(fname, a:ftype) - else - if g:Tlist_Show_One_File && s:tlist_cur_file_idx != -1 - " If tags for only one file are displayed and we are not - " updating the tags for that file, then no need to - " refresh the taglist window. Otherwise, the taglist - " window should be updated. - if s:tlist_{s:tlist_cur_file_idx}_filename != fname - call s:Tlist_Process_File(fname, a:ftype) - return - endif - endif - - " Save the current window number - let save_winnr = winnr() - - " Goto the taglist window - call s:Tlist_Window_Goto_Window() - - " Save the cursor position - let save_line = line('.') - let save_col = col('.') - - " Update the taglist window - call s:Tlist_Window_Refresh_File(fname, a:ftype) - - " Restore the cursor position - if v:version >= 601 - call cursor(save_line, save_col) - else - exe save_line - exe 'normal! ' . save_col . '|' - endif - - if winnr() != save_winnr - " Go back to the original window - call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w') - endif - endif - - " Update the taglist menu - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(1) - endif -endfunction - -" Tlist_Window_Close -" Close the taglist window -function! s:Tlist_Window_Close() - call s:Tlist_Log_Msg('Tlist_Window_Close()') - " Make sure the taglist window exists - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - call s:Tlist_Warning_Msg('Error: Taglist window is not open') - return - endif - - if winnr() == winnum - " Already in the taglist window. Close it and return - if winbufnr(2) != -1 - " If a window other than the taglist window is open, - " then only close the taglist window. - close - endif - else - " Goto the taglist window, close it and then come back to the - " original window - let curbufnr = bufnr('%') - exe winnum . 'wincmd w' - close - " Need to jump back to the original window only if we are not - " already in that window - let winnum = bufwinnr(curbufnr) - if winnr() != winnum - exe winnum . 'wincmd w' - endif - endif -endfunction - -" Tlist_Window_Mark_File_Window -" Mark the current window as the file window to use when jumping to a tag. -" Only if the current window is a non-plugin, non-preview and non-taglist -" window -function! s:Tlist_Window_Mark_File_Window() - if getbufvar('%', '&buftype') == '' && !&previewwindow - let w:tlist_file_window = "yes" - endif -endfunction - -" Tlist_Window_Open -" Open and refresh the taglist window -function! s:Tlist_Window_Open() - call s:Tlist_Log_Msg('Tlist_Window_Open()') - " If the window is open, jump to it - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - " Jump to the existing window - if winnr() != winnum - exe winnum . 'wincmd w' - endif - return - endif - - if s:tlist_app_name == "winmanager" - " Taglist plugin is no longer part of the winmanager app - let s:tlist_app_name = "none" - endif - - " Get the filename and filetype for the specified buffer - let curbuf_name = fnamemodify(bufname('%'), ':p') - let curbuf_ftype = s:Tlist_Get_Buffer_Filetype('%') - let cur_lnum = line('.') - - " Mark the current window as the desired window to open a file when a tag - " is selected. - call s:Tlist_Window_Mark_File_Window() - - " Open the taglist window - call s:Tlist_Window_Create() - - call s:Tlist_Window_Refresh() - - if g:Tlist_Show_One_File - " Add only the current buffer and file - " - " If the file doesn't support tag listing, skip it - if !s:Tlist_Skip_File(curbuf_name, curbuf_ftype) - call s:Tlist_Window_Refresh_File(curbuf_name, curbuf_ftype) - endif - endif - - if g:Tlist_File_Fold_Auto_Close - " Open the fold for the current file, as all the folds in - " the taglist window are closed - let fidx = s:Tlist_Get_File_Index(curbuf_name) - if fidx != -1 - exe "silent! " . s:tlist_{fidx}_start . "," . - \ s:tlist_{fidx}_end . "foldopen!" - endif - endif - - " Highlight the current tag - call s:Tlist_Window_Highlight_Tag(curbuf_name, cur_lnum, 1, 1) -endfunction - -" Tlist_Window_Toggle() -" Open or close a taglist window -function! s:Tlist_Window_Toggle() - call s:Tlist_Log_Msg('Tlist_Window_Toggle()') - " If taglist window is open then close it. - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - call s:Tlist_Window_Close() - return - endif - - call s:Tlist_Window_Open() - - " Go back to the original window, if Tlist_GainFocus_On_ToggleOpen is not - " set - if !g:Tlist_GainFocus_On_ToggleOpen - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - endif - - " Update the taglist menu - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(0) - endif -endfunction - -" Tlist_Process_Filelist -" Process multiple files. Each filename is separated by "\n" -" Returns the number of processed files -function! s:Tlist_Process_Filelist(file_names) - let flist = a:file_names - - " Enable lazy screen updates - let old_lazyredraw = &lazyredraw - set lazyredraw - - " Keep track of the number of processed files - let fcnt = 0 - - " Process one file at a time - while flist != '' - let nl_idx = stridx(flist, "\n") - let one_file = strpart(flist, 0, nl_idx) - - " Remove the filename from the list - let flist = strpart(flist, nl_idx + 1) - - if one_file == '' - continue - endif - - " Skip directories - if isdirectory(one_file) - continue - endif - - let ftype = s:Tlist_Detect_Filetype(one_file) - - echon "\r " - echon "\rProcessing tags for " . fnamemodify(one_file, ':p:t') - - let fcnt = fcnt + 1 - - call Tlist_Update_File(one_file, ftype) - endwhile - - " Clear the displayed informational messages - echon "\r " - - " Restore the previous state - let &lazyredraw = old_lazyredraw - - return fcnt -endfunction - -" Tlist_Process_Dir -" Process the files in a directory matching the specified pattern -function! s:Tlist_Process_Dir(dir_name, pat) - let flist = glob(a:dir_name . '/' . a:pat) . "\n" - - let fcnt = s:Tlist_Process_Filelist(flist) - - let len = strlen(a:dir_name) - if a:dir_name[len - 1] == '\' || a:dir_name[len - 1] == '/' - let glob_expr = a:dir_name . '*' - else - let glob_expr = a:dir_name . '/*' - endif - let all_files = glob(glob_expr) . "\n" - - while all_files != '' - let nl_idx = stridx(all_files, "\n") - let one_file = strpart(all_files, 0, nl_idx) - - let all_files = strpart(all_files, nl_idx + 1) - if one_file == '' - continue - endif - - " Skip non-directory names - if !isdirectory(one_file) - continue - endif - - echon "\r " - echon "\rProcessing files in directory " . fnamemodify(one_file, ':t') - let fcnt = fcnt + s:Tlist_Process_Dir(one_file, a:pat) - endwhile - - return fcnt -endfunction - -" Tlist_Add_Files_Recursive -" Add files recursively from a directory -function! s:Tlist_Add_Files_Recursive(dir, ...) - let dir_name = fnamemodify(a:dir, ':p') - if !isdirectory(dir_name) - call s:Tlist_Warning_Msg('Error: ' . dir_name . ' is not a directory') - return - endif - - if a:0 == 1 - " User specified file pattern - let pat = a:1 - else - " Default file pattern - let pat = '*' - endif - - echon "\r " - echon "\rProcessing files in directory " . fnamemodify(dir_name, ':t') - let fcnt = s:Tlist_Process_Dir(dir_name, pat) - - echon "\rAdded " . fcnt . " files to the taglist" -endfunction - -" Tlist_Add_Files -" Add the specified list of files to the taglist -function! s:Tlist_Add_Files(...) - let flist = '' - let i = 1 - - " Get all the files matching the file patterns supplied as argument - while i <= a:0 - let flist = flist . glob(a:{i}) . "\n" - let i = i + 1 - endwhile - - if flist == '' - call s:Tlist_Warning_Msg('Error: No matching files are found') - return - endif - - let fcnt = s:Tlist_Process_Filelist(flist) - echon "\rAdded " . fcnt . " files to the taglist" -endfunction - -" Tlist_Extract_Tagtype -" Extract the tag type from the tag text -function! s:Tlist_Extract_Tagtype(tag_line) - " The tag type is after the tag prototype field. The prototype field - " ends with the /;"\t string. We add 4 at the end to skip the characters - " in this special string.. - let start = strridx(a:tag_line, '/;"' . "\t") + 4 - let end = strridx(a:tag_line, 'line:') - 1 - let ttype = strpart(a:tag_line, start, end - start) - - return ttype -endfunction - -" Tlist_Extract_Tag_Scope -" Extract the tag scope from the tag text -function! s:Tlist_Extract_Tag_Scope(tag_line) - let start = strridx(a:tag_line, 'line:') - let end = strridx(a:tag_line, "\t") - if end <= start - return '' - endif - - let tag_scope = strpart(a:tag_line, end + 1) - let tag_scope = strpart(tag_scope, stridx(tag_scope, ':') + 1) - - return tag_scope -endfunction - -" Tlist_Refresh() -" Refresh the taglist -function! s:Tlist_Refresh() - call s:Tlist_Log_Msg('Tlist_Refresh (Skip_Refresh = ' . - \ s:Tlist_Skip_Refresh . ', ' . bufname('%') . ')') - " If we are entering the buffer from one of the taglist functions, then - " no need to refresh the taglist window again. - if s:Tlist_Skip_Refresh - " We still need to update the taglist menu - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(0) - endif - return - endif - - " If part of the winmanager plugin and not configured to process - " tags always and not configured to display the tags menu, then return - if (s:tlist_app_name == 'winmanager') && !g:Tlist_Process_File_Always - \ && !g:Tlist_Show_Menu - return - endif - - " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help - if &buftype != '' - return - endif - - let filename = fnamemodify(bufname('%'), ':p') - let ftype = s:Tlist_Get_Buffer_Filetype('%') - - " If the file doesn't support tag listing, skip it - if s:Tlist_Skip_File(filename, ftype) - return - endif - - let tlist_win = bufwinnr(g:TagList_title) - - " If the taglist window is not opened and not configured to process - " tags always and not displaying the tags menu, then return - if tlist_win == -1 && !g:Tlist_Process_File_Always && !g:Tlist_Show_Menu - return - endif - - let fidx = s:Tlist_Get_File_Index(filename) - if fidx == -1 - " Check whether this file is removed based on user request - " If it is, then don't display the tags for this file - if s:Tlist_User_Removed_File(filename) - return - endif - - " If the taglist should not be auto updated, then return - if !g:Tlist_Auto_Update - return - endif - endif - - let cur_lnum = line('.') - - if fidx == -1 - " Update the tags for the file - let fidx = s:Tlist_Process_File(filename, ftype) - else - let mtime = getftime(filename) - if s:tlist_{fidx}_mtime != mtime - " Invalidate the tags listed for this file - let s:tlist_{fidx}_valid = 0 - - " Update the taglist and the window - call Tlist_Update_File(filename, ftype) - - " Store the new file modification time - let s:tlist_{fidx}_mtime = mtime - endif - endif - - " Update the taglist window - if tlist_win != -1 - " Disable screen updates - let old_lazyredraw = &lazyredraw - set nolazyredraw - - " Save the current window number - let save_winnr = winnr() - - " Goto the taglist window - call s:Tlist_Window_Goto_Window() - - if !g:Tlist_Auto_Highlight_Tag || !g:Tlist_Highlight_Tag_On_BufEnter - " Save the cursor position - let save_line = line('.') - let save_col = col('.') - endif - - " Update the taglist window - call s:Tlist_Window_Refresh_File(filename, ftype) - - " Open the fold for the file - exe "silent! " . s:tlist_{fidx}_start . "," . - \ s:tlist_{fidx}_end . "foldopen!" - - if g:Tlist_Highlight_Tag_On_BufEnter && g:Tlist_Auto_Highlight_Tag - if g:Tlist_Show_One_File && s:tlist_cur_file_idx != fidx - " If displaying tags for only one file in the taglist - " window and about to display the tags for a new file, - " then center the current tag line for the new file - let center_tag_line = 1 - else - let center_tag_line = 0 - endif - - " Highlight the current tag - call s:Tlist_Window_Highlight_Tag(filename, cur_lnum, 1, center_tag_line) - else - " Restore the cursor position - if v:version >= 601 - call cursor(save_line, save_col) - else - exe save_line - exe 'normal! ' . save_col . '|' - endif - endif - - " Jump back to the original window - if save_winnr != winnr() - call s:Tlist_Exe_Cmd_No_Acmds(save_winnr . 'wincmd w') - endif - - " Restore screen updates - let &lazyredraw = old_lazyredraw - endif - - " Update the taglist menu - if g:Tlist_Show_Menu - call s:Tlist_Menu_Update_File(0) - endif -endfunction - -" Tlist_Change_Sort() -" Change the sort order of the tag listing -" caller == 'cmd', command used in the taglist window -" caller == 'menu', taglist menu -" action == 'toggle', toggle sort from name to order and vice versa -" action == 'set', set the sort order to sort_type -function! s:Tlist_Change_Sort(caller, action, sort_type) - call s:Tlist_Log_Msg('Tlist_Change_Sort (caller = ' . a:caller . - \ ', action = ' . a:action . ', sort_type = ' . a:sort_type . ')') - if a:caller == 'cmd' - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) - if fidx == -1 - return - endif - - " Remove the previous highlighting - match none - elseif a:caller == 'menu' - let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) - if fidx == -1 - return - endif - endif - - if a:action == 'toggle' - let sort_type = s:tlist_{fidx}_sort_type - - " Toggle the sort order from 'name' to 'order' and vice versa - if sort_type == 'name' - let s:tlist_{fidx}_sort_type = 'order' - else - let s:tlist_{fidx}_sort_type = 'name' - endif - else - let s:tlist_{fidx}_sort_type = a:sort_type - endif - - " Invalidate the tags listed for this file - let s:tlist_{fidx}_valid = 0 - - if a:caller == 'cmd' - " Save the current line for later restoration - let curline = '\V\^' . getline('.') . '\$' - - call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename, - \ s:tlist_{fidx}_filetype) - - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!' - - " Go back to the cursor line before the tag list is sorted - call search(curline, 'w') - - call s:Tlist_Menu_Update_File(1) - else - call s:Tlist_Menu_Remove_File() - - call s:Tlist_Refresh() - endif -endfunction - -" Tlist_Update_Current_File() -" Update taglist for the current buffer by regenerating the tag list -" Contributed by WEN Guopeng. -function! s:Tlist_Update_Current_File() - call s:Tlist_Log_Msg('Tlist_Update_Current_File()') - if winnr() == bufwinnr(g:TagList_title) - " In the taglist window. Update the current file - call s:Tlist_Window_Update_File() - else - " Not in the taglist window. Update the current buffer - let filename = fnamemodify(bufname('%'), ':p') - let fidx = s:Tlist_Get_File_Index(filename) - if fidx != -1 - let s:tlist_{fidx}_valid = 0 - endif - let ft = s:Tlist_Get_Buffer_Filetype('%') - call Tlist_Update_File(filename, ft) - endif -endfunction - -" Tlist_Window_Update_File() -" Update the tags displayed in the taglist window -function! s:Tlist_Window_Update_File() - call s:Tlist_Log_Msg('Tlist_Window_Update_File()') - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) - if fidx == -1 - return - endif - - " Remove the previous highlighting - match none - - " Save the current line for later restoration - let curline = '\V\^' . getline('.') . '\$' - - let s:tlist_{fidx}_valid = 0 - - " Update the taglist window - call s:Tlist_Window_Refresh_File(s:tlist_{fidx}_filename, - \ s:tlist_{fidx}_filetype) - - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'foldopen!' - - " Go back to the tag line before the list is updated - call search(curline, 'w') -endfunction - -" Tlist_Window_Get_Tag_Type_By_Linenum() -" Return the tag type index for the specified line in the taglist window -function! s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum) - let ftype = s:tlist_{a:fidx}_filetype - - " Determine to which tag type the current line number belongs to using the - " tag type start line number and the number of tags in a tag type - let i = 1 - while i <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{i}_name - let start_lnum = - \ s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset - let end = start_lnum + s:tlist_{a:fidx}_{ttype}_count - if a:lnum >= start_lnum && a:lnum <= end - break - endif - let i = i + 1 - endwhile - - " Current line doesn't belong to any of the displayed tag types - if i > s:tlist_{ftype}_count - return '' - endif - - return ttype -endfunction - -" Tlist_Window_Get_Tag_Index() -" Return the tag index for the specified line in the taglist window -function! s:Tlist_Window_Get_Tag_Index(fidx, lnum) - let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(a:fidx, a:lnum) - - " Current line doesn't belong to any of the displayed tag types - if ttype == '' - return 0 - endif - - " Compute the index into the displayed tags for the tag type - let ttype_lnum = s:tlist_{a:fidx}_start + s:tlist_{a:fidx}_{ttype}_offset - let tidx = a:lnum - ttype_lnum - if tidx == 0 - return 0 - endif - - " Get the corresponding tag line and return it - return s:tlist_{a:fidx}_{ttype}_{tidx} -endfunction - -" Tlist_Window_Highlight_Line -" Highlight the current line -function! s:Tlist_Window_Highlight_Line() - " Clear previously selected name - match none - - " Highlight the current line - if g:Tlist_Display_Prototype == 0 - let pat = '/\%' . line('.') . 'l\s\+\zs.*/' - else - let pat = '/\%' . line('.') . 'l.*/' - endif - - exe 'match TagListTagName ' . pat -endfunction - -" Tlist_Window_Open_File -" Open the specified file in either a new window or an existing window -" and place the cursor at the specified tag pattern -function! s:Tlist_Window_Open_File(win_ctrl, filename, tagpat) - call s:Tlist_Log_Msg('Tlist_Window_Open_File (' . a:filename . ',' . - \ a:win_ctrl . ')') - let prev_Tlist_Skip_Refresh = s:Tlist_Skip_Refresh - let s:Tlist_Skip_Refresh = 1 - - if s:tlist_app_name == "winmanager" - " Let the winmanager edit the file - call WinManagerFileEdit(a:filename, a:win_ctrl == 'newwin') - else - - if a:win_ctrl == 'newtab' - " Create a new tab - exe 'tabnew ' . escape(a:filename, ' ') - " Open the taglist window in the new tab - call s:Tlist_Window_Open() - endif - - if a:win_ctrl == 'checktab' - " Check whether the file is present in any of the tabs. - " If the file is present in the current tab, then use the - " current tab. - if bufwinnr(a:filename) != -1 - let file_present_in_tab = 1 - let i = tabpagenr() - else - let i = 1 - let bnum = bufnr(a:filename) - let file_present_in_tab = 0 - while i <= tabpagenr('$') - if index(tabpagebuflist(i), bnum) != -1 - let file_present_in_tab = 1 - break - endif - let i += 1 - endwhile - endif - - if file_present_in_tab - " Goto the tab containing the file - exe 'tabnext ' . i - else - " Open a new tab - exe 'tabnew ' . escape(a:filename, ' ') - - " Open the taglist window - call s:Tlist_Window_Open() - endif - endif - - let winnum = -1 - if a:win_ctrl == 'prevwin' - " Open the file in the previous window, if it is usable - let cur_win = winnr() - wincmd p - if &buftype == '' && !&previewwindow - exe "edit " . escape(a:filename, ' ') - let winnum = winnr() - else - " Previous window is not usable - exe cur_win . 'wincmd w' - endif - endif - - " Goto the window containing the file. If the window is not there, open a - " new window - if winnum == -1 - let winnum = bufwinnr(a:filename) - endif - - if winnum == -1 - " Locate the previously used window for opening a file - let fwin_num = 0 - let first_usable_win = 0 - - let i = 1 - let bnum = winbufnr(i) - while bnum != -1 - if getwinvar(i, 'tlist_file_window') == 'yes' - let fwin_num = i - break - endif - if first_usable_win == 0 && - \ getbufvar(bnum, '&buftype') == '' && - \ !getwinvar(i, '&previewwindow') - " First non-taglist, non-plugin and non-preview window - let first_usable_win = i - endif - let i = i + 1 - let bnum = winbufnr(i) - endwhile - - " If a previously used window is not found, then use the first - " non-taglist window - if fwin_num == 0 - let fwin_num = first_usable_win - endif - - if fwin_num != 0 - " Jump to the file window - exe fwin_num . "wincmd w" - - " If the user asked to jump to the tag in a new window, then split - " the existing window into two. - if a:win_ctrl == 'newwin' - split - endif - exe "edit " . escape(a:filename, ' ') - else - " Open a new window - if g:Tlist_Use_Horiz_Window - exe 'leftabove split ' . escape(a:filename, ' ') - else - if winbufnr(2) == -1 - " Only the taglist window is present - if g:Tlist_Use_Right_Window - exe 'leftabove vertical split ' . - \ escape(a:filename, ' ') - else - exe 'rightbelow vertical split ' . - \ escape(a:filename, ' ') - endif - - " Go to the taglist window to change the window size to - " the user configured value - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - if g:Tlist_Use_Horiz_Window - exe 'resize ' . g:Tlist_WinHeight - else - exe 'vertical resize ' . g:Tlist_WinWidth - endif - " Go back to the file window - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - else - " A plugin or help window is also present - wincmd w - exe 'leftabove split ' . escape(a:filename, ' ') - endif - endif - endif - " Mark the window, so that it can be reused. - call s:Tlist_Window_Mark_File_Window() - else - if v:version >= 700 - " If the file is opened in more than one window, then check - " whether the last accessed window has the selected file. - " If it does, then use that window. - let lastwin_bufnum = winbufnr(winnr('#')) - if bufnr(a:filename) == lastwin_bufnum - let winnum = winnr('#') - endif - endif - exe winnum . 'wincmd w' - - " If the user asked to jump to the tag in a new window, then split the - " existing window into two. - if a:win_ctrl == 'newwin' - split - endif - endif - endif - - " Jump to the tag - if a:tagpat != '' - " Add the current cursor position to the jump list, so that user can - " jump back using the ' and ` marks. - mark ' - silent call search(a:tagpat, 'w') - - " Bring the line to the middle of the window - normal! z. - - " If the line is inside a fold, open the fold - if foldclosed('.') != -1 - .foldopen - endif - endif - - " If the user selects to preview the tag then jump back to the - " taglist window - if a:win_ctrl == 'preview' - " Go back to the taglist window - let winnum = bufwinnr(g:TagList_title) - exe winnum . 'wincmd w' - else - " If the user has selected to close the taglist window, when a - " tag is selected, close the taglist window - if g:Tlist_Close_On_Select - call s:Tlist_Window_Goto_Window() - close - - " Go back to the window displaying the selected file - let wnum = bufwinnr(a:filename) - if wnum != -1 && wnum != winnr() - call s:Tlist_Exe_Cmd_No_Acmds(wnum . 'wincmd w') - endif - endif - endif - - let s:Tlist_Skip_Refresh = prev_Tlist_Skip_Refresh -endfunction - -" Tlist_Window_Jump_To_Tag() -" Jump to the location of the current tag -" win_ctrl == useopen - Reuse the existing file window -" win_ctrl == newwin - Open a new window -" win_ctrl == preview - Preview the tag -" win_ctrl == prevwin - Open in previous window -" win_ctrl == newtab - Open in new tab -function! s:Tlist_Window_Jump_To_Tag(win_ctrl) - call s:Tlist_Log_Msg('Tlist_Window_Jump_To_Tag(' . a:win_ctrl . ')') - " Do not process comment lines and empty lines - let curline = getline('.') - if curline =~ '^\s*$' || curline[0] == '"' - return - endif - - " If inside a closed fold, then use the first line of the fold - " and jump to the file. - let lnum = foldclosed('.') - if lnum == -1 - " Jump to the selected tag or file - let lnum = line('.') - else - " Open the closed fold - .foldopen! - endif - - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum) - if fidx == -1 - return - endif - - " Get the tag output for the current tag - let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum) - if tidx != 0 - let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, tidx) - - " Highlight the tagline - call s:Tlist_Window_Highlight_Line() - else - " Selected a line which is not a tag name. Just edit the file - let tagpat = '' - endif - - call s:Tlist_Window_Open_File(a:win_ctrl, s:tlist_{fidx}_filename, tagpat) -endfunction - -" Tlist_Window_Show_Info() -" Display information about the entry under the cursor -function! s:Tlist_Window_Show_Info() - call s:Tlist_Log_Msg('Tlist_Window_Show_Info()') - - " Clear the previously displayed line - echo - - " Do not process comment lines and empty lines - let curline = getline('.') - if curline =~ '^\s*$' || curline[0] == '"' - return - endif - - " If inside a fold, then don't display the prototype - if foldclosed('.') != -1 - return - endif - - let lnum = line('.') - - " Get the file index - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(lnum) - if fidx == -1 - return - endif - - if lnum == s:tlist_{fidx}_start - " Cursor is on a file name - let fname = s:tlist_{fidx}_filename - if strlen(fname) > 50 - let fname = fnamemodify(fname, ':t') - endif - echo fname . ', Filetype=' . s:tlist_{fidx}_filetype . - \ ', Tag count=' . s:tlist_{fidx}_tag_count - return - endif - - " Get the tag output line for the current tag - let tidx = s:Tlist_Window_Get_Tag_Index(fidx, lnum) - if tidx == 0 - " Cursor is on a tag type - let ttype = s:Tlist_Window_Get_Tag_Type_By_Linenum(fidx, lnum) - if ttype == '' - return - endif - - let ttype_name = '' - - let ftype = s:tlist_{fidx}_filetype - let i = 1 - while i <= s:tlist_{ftype}_count - if ttype == s:tlist_{ftype}_{i}_name - let ttype_name = s:tlist_{ftype}_{i}_fullname - break - endif - let i = i + 1 - endwhile - - echo 'Tag type=' . ttype_name . - \ ', Tag count=' . s:tlist_{fidx}_{ttype}_count - return - endif - - " Get the tag search pattern and display it - echo s:Tlist_Get_Tag_Prototype(fidx, tidx) -endfunction - -" Tlist_Find_Nearest_Tag_Idx -" Find the tag idx nearest to the supplied line number -" Returns -1, if a tag couldn't be found for the specified line number -function! s:Tlist_Find_Nearest_Tag_Idx(fidx, linenum) - let sort_type = s:tlist_{a:fidx}_sort_type - - let left = 1 - let right = s:tlist_{a:fidx}_tag_count - - if sort_type == 'order' - " Tags sorted by order, use a binary search. - " The idea behind this function is taken from the ctags.vim script (by - " Alexey Marinichev) available at the Vim online website. - - " If the current line is the less than the first tag, then no need to - " search - let first_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, 1) - - if a:linenum < first_lnum - return -1 - endif - - while left < right - let middle = (right + left + 1) / 2 - let middle_lnum = s:Tlist_Get_Tag_Linenum(a:fidx, middle) - - if middle_lnum == a:linenum - let left = middle - break - endif - - if middle_lnum > a:linenum - let right = middle - 1 - else - let left = middle - endif - endwhile - else - " Tags sorted by name, use a linear search. (contributed by Dave - " Eggum). - " Look for a tag with a line number less than or equal to the supplied - " line number. If multiple tags are found, then use the tag with the - " line number closest to the supplied line number. IOW, use the tag - " with the highest line number. - let closest_lnum = 0 - let final_left = 0 - while left <= right - let lnum = s:Tlist_Get_Tag_Linenum(a:fidx, left) - - if lnum < a:linenum && lnum > closest_lnum - let closest_lnum = lnum - let final_left = left - elseif lnum == a:linenum - let closest_lnum = lnum - let final_left = left - break - else - let left = left + 1 - endif - endwhile - if closest_lnum == 0 - return -1 - endif - if left >= right - let left = final_left - endif - endif - - return left -endfunction - -" Tlist_Window_Highlight_Tag() -" Highlight the current tag -" cntx == 1, Called by the taglist plugin itself -" cntx == 2, Forced by the user through the TlistHighlightTag command -" center = 1, move the tag line to the center of the taglist window -function! s:Tlist_Window_Highlight_Tag(filename, cur_lnum, cntx, center) - " Highlight the current tag only if the user configured the - " taglist plugin to do so or if the user explictly invoked the - " command to highlight the current tag. - if !g:Tlist_Auto_Highlight_Tag && a:cntx == 1 - return - endif - - if a:filename == '' - return - endif - - " Make sure the taglist window is present - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - call s:Tlist_Warning_Msg('Error: Taglist window is not open') - return - endif - - let fidx = s:Tlist_Get_File_Index(a:filename) - if fidx == -1 - return - endif - - " If the file is currently not displayed in the taglist window, then retrn - if !s:tlist_{fidx}_visible - return - endif - - " If there are no tags for this file, then no need to proceed further - if s:tlist_{fidx}_tag_count == 0 - return - endif - - " Ignore all autocommands - let old_ei = &eventignore - set eventignore=all - - " Save the original window number - let org_winnr = winnr() - - if org_winnr == winnum - let in_taglist_window = 1 - else - let in_taglist_window = 0 - endif - - " Go to the taglist window - if !in_taglist_window - exe winnum . 'wincmd w' - endif - - " Clear previously selected name - match none - - let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, a:cur_lnum) - if tidx == -1 - " Make sure the current tag line is visible in the taglist window. - " Calling the winline() function makes the line visible. Don't know - " of a better way to achieve this. - let lnum = line('.') - - if lnum < s:tlist_{fidx}_start || lnum > s:tlist_{fidx}_end - " Move the cursor to the beginning of the file - exe s:tlist_{fidx}_start - endif - - if foldclosed('.') != -1 - .foldopen - endif - - call winline() - - if !in_taglist_window - exe org_winnr . 'wincmd w' - endif - - " Restore the autocommands - let &eventignore = old_ei - return - endif - - " Extract the tag type - let ttype = s:Tlist_Get_Tag_Type_By_Tag(fidx, tidx) - - " Compute the line number - " Start of file + Start of tag type + offset - let lnum = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset + - \ s:tlist_{fidx}_{tidx}_ttype_idx - - " Goto the line containing the tag - exe lnum - - " Open the fold - if foldclosed('.') != -1 - .foldopen - endif - - if a:center - " Move the tag line to the center of the taglist window - normal! z. - else - " Make sure the current tag line is visible in the taglist window. - " Calling the winline() function makes the line visible. Don't know - " of a better way to achieve this. - call winline() - endif - - " Highlight the tag name - call s:Tlist_Window_Highlight_Line() - - " Go back to the original window - if !in_taglist_window - exe org_winnr . 'wincmd w' - endif - - " Restore the autocommands - let &eventignore = old_ei - return -endfunction - -" Tlist_Get_Tag_Prototype_By_Line -" Get the prototype for the tag on or before the specified line number in the -" current buffer -function! Tlist_Get_Tag_Prototype_By_Line(...) - if a:0 == 0 - " Arguments are not supplied. Use the current buffer name - " and line number - let filename = bufname('%') - let linenr = line('.') - elseif a:0 == 2 - " Filename and line number are specified - let filename = a:1 - let linenr = a:2 - if linenr !~ '\d\+' - " Invalid line number - return "" - endif - else - " Sufficient arguments are not supplied - let msg = 'Usage: Tlist_Get_Tag_Prototype_By_Line ' . - \ '' - call s:Tlist_Warning_Msg(msg) - return "" - endif - - " Expand the file to a fully qualified name - let filename = fnamemodify(filename, ':p') - if filename == '' - return "" - endif - - let fidx = s:Tlist_Get_File_Index(filename) - if fidx == -1 - return "" - endif - - " If there are no tags for this file, then no need to proceed further - if s:tlist_{fidx}_tag_count == 0 - return "" - endif - - " Get the tag text using the line number - let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr) - if tidx == -1 - return "" - endif - - return s:Tlist_Get_Tag_Prototype(fidx, tidx) -endfunction - -" Tlist_Get_Tagname_By_Line -" Get the tag name on or before the specified line number in the -" current buffer -function! Tlist_Get_Tagname_By_Line(...) - if a:0 == 0 - " Arguments are not supplied. Use the current buffer name - " and line number - let filename = bufname('%') - let linenr = line('.') - elseif a:0 == 2 - " Filename and line number are specified - let filename = a:1 - let linenr = a:2 - if linenr !~ '\d\+' - " Invalid line number - return "" - endif - else - " Sufficient arguments are not supplied - let msg = 'Usage: Tlist_Get_Tagname_By_Line ' - call s:Tlist_Warning_Msg(msg) - return "" - endif - - " Make sure the current file has a name - let filename = fnamemodify(filename, ':p') - if filename == '' - return "" - endif - - let fidx = s:Tlist_Get_File_Index(filename) - if fidx == -1 - return "" - endif - - " If there are no tags for this file, then no need to proceed further - if s:tlist_{fidx}_tag_count == 0 - return "" - endif - - " Get the tag name using the line number - let tidx = s:Tlist_Find_Nearest_Tag_Idx(fidx, linenr) - if tidx == -1 - return "" - endif - - return s:tlist_{fidx}_{tidx}_tag_name -endfunction - -" Tlist_Window_Move_To_File -" Move the cursor to the beginning of the current file or the next file -" or the previous file in the taglist window -" dir == -1, move to start of current or previous function -" dir == 1, move to start of next function -function! s:Tlist_Window_Move_To_File(dir) - if foldlevel('.') == 0 - " Cursor is on a non-folded line (it is not in any of the files) - " Move it to a folded line - if a:dir == -1 - normal! zk - else - " While moving down to the start of the next fold, - " no need to do go to the start of the next file. - normal! zj - return - endif - endif - - let fidx = s:Tlist_Window_Get_File_Index_By_Linenum(line('.')) - if fidx == -1 - return - endif - - let cur_lnum = line('.') - - if a:dir == -1 - if cur_lnum > s:tlist_{fidx}_start - " Move to the beginning of the current file - exe s:tlist_{fidx}_start - return - endif - - if fidx != 0 - " Move to the beginning of the previous file - let fidx = fidx - 1 - else - " Cursor is at the first file, wrap around to the last file - let fidx = s:tlist_file_count - 1 - endif - - exe s:tlist_{fidx}_start - return - else - " Move to the beginning of the next file - let fidx = fidx + 1 - - if fidx >= s:tlist_file_count - " Cursor is at the last file, wrap around to the first file - let fidx = 0 - endif - - if s:tlist_{fidx}_start != 0 - exe s:tlist_{fidx}_start - endif - return - endif -endfunction - -" Tlist_Session_Load -" Load a taglist session (information about all the displayed files -" and the tags) from the specified file -function! s:Tlist_Session_Load(...) - if a:0 == 0 || a:1 == '' - call s:Tlist_Warning_Msg('Usage: TlistSessionLoad ') - return - endif - - let sessionfile = a:1 - - if !filereadable(sessionfile) - let msg = 'Taglist: Error - Unable to open file ' . sessionfile - call s:Tlist_Warning_Msg(msg) - return - endif - - " Mark the current window as the file window - call s:Tlist_Window_Mark_File_Window() - - " Source the session file - exe 'source ' . sessionfile - - let new_file_count = g:tlist_file_count - unlet! g:tlist_file_count - - let i = 0 - while i < new_file_count - let ftype = g:tlist_{i}_filetype - unlet! g:tlist_{i}_filetype - - if !exists('s:tlist_' . ftype . '_count') - if s:Tlist_FileType_Init(ftype) == 0 - let i = i + 1 - continue - endif - endif - - let fname = g:tlist_{i}_filename - unlet! g:tlist_{i}_filename - - let fidx = s:Tlist_Get_File_Index(fname) - if fidx != -1 - let s:tlist_{fidx}_visible = 0 - let i = i + 1 - continue - else - " As we are loading the tags from the session file, if this - " file was previously deleted by the user, now we need to - " add it back. So remove the file from the deleted list. - call s:Tlist_Update_Remove_List(fname, 0) - endif - - let fidx = s:Tlist_Init_File(fname, ftype) - - let s:tlist_{fidx}_filename = fname - - let s:tlist_{fidx}_sort_type = g:tlist_{i}_sort_type - unlet! g:tlist_{i}_sort_type - - let s:tlist_{fidx}_filetype = ftype - let s:tlist_{fidx}_mtime = getftime(fname) - - let s:tlist_{fidx}_start = 0 - let s:tlist_{fidx}_end = 0 - - let s:tlist_{fidx}_valid = 1 - - let s:tlist_{fidx}_tag_count = g:tlist_{i}_tag_count - unlet! g:tlist_{i}_tag_count - - let j = 1 - while j <= s:tlist_{fidx}_tag_count - let s:tlist_{fidx}_{j}_tag = g:tlist_{i}_{j}_tag - let s:tlist_{fidx}_{j}_tag_name = g:tlist_{i}_{j}_tag_name - let s:tlist_{fidx}_{j}_ttype_idx = g:tlist_{i}_{j}_ttype_idx - unlet! g:tlist_{i}_{j}_tag - unlet! g:tlist_{i}_{j}_tag_name - unlet! g:tlist_{i}_{j}_ttype_idx - let j = j + 1 - endwhile - - let j = 1 - while j <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{j}_name - - if exists('g:tlist_' . i . '_' . ttype) - let s:tlist_{fidx}_{ttype} = g:tlist_{i}_{ttype} - unlet! g:tlist_{i}_{ttype} - let s:tlist_{fidx}_{ttype}_offset = 0 - let s:tlist_{fidx}_{ttype}_count = g:tlist_{i}_{ttype}_count - unlet! g:tlist_{i}_{ttype}_count - - let k = 1 - while k <= s:tlist_{fidx}_{ttype}_count - let s:tlist_{fidx}_{ttype}_{k} = g:tlist_{i}_{ttype}_{k} - unlet! g:tlist_{i}_{ttype}_{k} - let k = k + 1 - endwhile - else - let s:tlist_{fidx}_{ttype} = '' - let s:tlist_{fidx}_{ttype}_offset = 0 - let s:tlist_{fidx}_{ttype}_count = 0 - endif - - let j = j + 1 - endwhile - - let i = i + 1 - endwhile - - " If the taglist window is open, then update it - let winnum = bufwinnr(g:TagList_title) - if winnum != -1 - let save_winnr = winnr() - - " Goto the taglist window - call s:Tlist_Window_Goto_Window() - - " Refresh the taglist window - call s:Tlist_Window_Refresh() - - " Go back to the original window - if save_winnr != winnr() - call s:Tlist_Exe_Cmd_No_Acmds('wincmd p') - endif - endif -endfunction - -" Tlist_Session_Save -" Save a taglist session (information about all the displayed files -" and the tags) into the specified file -function! s:Tlist_Session_Save(...) - if a:0 == 0 || a:1 == '' - call s:Tlist_Warning_Msg('Usage: TlistSessionSave ') - return - endif - - let sessionfile = a:1 - - if s:tlist_file_count == 0 - " There is nothing to save - call s:Tlist_Warning_Msg('Warning: Taglist is empty. Nothing to save.') - return - endif - - if filereadable(sessionfile) - let ans = input('Do you want to overwrite ' . sessionfile . ' (Y/N)?') - if ans !=? 'y' - return - endif - - echo "\n" - endif - - let old_verbose = &verbose - set verbose&vim - - exe 'redir! > ' . sessionfile - - silent! echo '" Taglist session file. This file is auto-generated.' - silent! echo '" File information' - silent! echo 'let tlist_file_count = ' . s:tlist_file_count - - let i = 0 - - while i < s:tlist_file_count - " Store information about the file - silent! echo 'let tlist_' . i . "_filename = '" . - \ s:tlist_{i}_filename . "'" - silent! echo 'let tlist_' . i . '_sort_type = "' . - \ s:tlist_{i}_sort_type . '"' - silent! echo 'let tlist_' . i . '_filetype = "' . - \ s:tlist_{i}_filetype . '"' - silent! echo 'let tlist_' . i . '_tag_count = ' . - \ s:tlist_{i}_tag_count - " Store information about all the tags - let j = 1 - while j <= s:tlist_{i}_tag_count - let txt = escape(s:tlist_{i}_{j}_tag, '"\\') - silent! echo 'let tlist_' . i . '_' . j . '_tag = "' . txt . '"' - silent! echo 'let tlist_' . i . '_' . j . '_tag_name = "' . - \ s:tlist_{i}_{j}_tag_name . '"' - silent! echo 'let tlist_' . i . '_' . j . '_ttype_idx' . ' = ' . - \ s:tlist_{i}_{j}_ttype_idx - let j = j + 1 - endwhile - - " Store information about all the tags grouped by their type - let ftype = s:tlist_{i}_filetype - let j = 1 - while j <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{j}_name - if s:tlist_{i}_{ttype}_count != 0 - let txt = escape(s:tlist_{i}_{ttype}, '"\') - let txt = substitute(txt, "\n", "\\\\n", 'g') - silent! echo 'let tlist_' . i . '_' . ttype . ' = "' . - \ txt . '"' - silent! echo 'let tlist_' . i . '_' . ttype . '_count = ' . - \ s:tlist_{i}_{ttype}_count - let k = 1 - while k <= s:tlist_{i}_{ttype}_count - silent! echo 'let tlist_' . i . '_' . ttype . '_' . k . - \ ' = ' . s:tlist_{i}_{ttype}_{k} - let k = k + 1 - endwhile - endif - let j = j + 1 - endwhile - - silent! echo - - let i = i + 1 - endwhile - - redir END - - let &verbose = old_verbose -endfunction - -" Tlist_Buffer_Removed -" A buffer is removed from the Vim buffer list. Remove the tags defined -" for that file -function! s:Tlist_Buffer_Removed(filename) - call s:Tlist_Log_Msg('Tlist_Buffer_Removed (' . a:filename . ')') - - " Make sure a valid filename is supplied - if a:filename == '' - return - endif - - " Get tag list index of the specified file - let fidx = s:Tlist_Get_File_Index(a:filename) - if fidx == -1 - " File not present in the taglist - return - endif - - " Remove the file from the list - call s:Tlist_Remove_File(fidx, 0) -endfunction - -" When a buffer is deleted, remove the file from the taglist -autocmd BufDelete * silent call s:Tlist_Buffer_Removed(expand(':p')) - -" Tlist_Window_Open_File_Fold -" Open the fold for the specified file and close the fold for all the -" other files -function! s:Tlist_Window_Open_File_Fold(acmd_bufnr) - call s:Tlist_Log_Msg('Tlist_Window_Open_File_Fold (' . a:acmd_bufnr . ')') - - " Make sure the taglist window is present - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - call s:Tlist_Warning_Msg('Taglist: Error - Taglist window is not open') - return - endif - - " Save the original window number - let org_winnr = winnr() - if org_winnr == winnum - let in_taglist_window = 1 - else - let in_taglist_window = 0 - endif - - if in_taglist_window - " When entering the taglist window, no need to update the folds - return - endif - - " Go to the taglist window - if !in_taglist_window - call s:Tlist_Exe_Cmd_No_Acmds(winnum . 'wincmd w') - endif - - " Close all the folds - silent! %foldclose - - " Get tag list index of the specified file - let fname = fnamemodify(bufname(a:acmd_bufnr + 0), ':p') - if filereadable(fname) - let fidx = s:Tlist_Get_File_Index(fname) - if fidx != -1 - " Open the fold for the file - exe "silent! " . s:tlist_{fidx}_start . "," . - \ s:tlist_{fidx}_end . "foldopen" - endif - endif - - " Go back to the original window - if !in_taglist_window - call s:Tlist_Exe_Cmd_No_Acmds(org_winnr . 'wincmd w') - endif -endfunction - -" Tlist_Window_Check_Auto_Open -" Open the taglist window automatically on Vim startup. -" Open the window only when files present in any of the Vim windows support -" tags. -function! s:Tlist_Window_Check_Auto_Open() - let open_window = 0 - - let i = 1 - let buf_num = winbufnr(i) - while buf_num != -1 - let filename = fnamemodify(bufname(buf_num), ':p') - let ft = s:Tlist_Get_Buffer_Filetype(buf_num) - if !s:Tlist_Skip_File(filename, ft) - let open_window = 1 - break - endif - let i = i + 1 - let buf_num = winbufnr(i) - endwhile - - if open_window - call s:Tlist_Window_Toggle() - endif -endfunction - -" Tlist_Refresh_Folds -" Remove and create the folds for all the files displayed in the taglist -" window. Used after entering a tab. If this is not done, then the folds -" are not properly created for taglist windows displayed in multiple tabs. -function! s:Tlist_Refresh_Folds() - let winnum = bufwinnr(g:TagList_title) - if winnum == -1 - return - endif - - let save_wnum = winnr() - exe winnum . 'wincmd w' - - " First remove all the existing folds - normal! zE - - " Create the folds for each in the tag list - let fidx = 0 - while fidx < s:tlist_file_count - let ftype = s:tlist_{fidx}_filetype - - " Create the folds for each tag type in a file - let j = 1 - while j <= s:tlist_{ftype}_count - let ttype = s:tlist_{ftype}_{j}_name - if s:tlist_{fidx}_{ttype}_count - let s = s:tlist_{fidx}_start + s:tlist_{fidx}_{ttype}_offset - let e = s + s:tlist_{fidx}_{ttype}_count - exe s . ',' . e . 'fold' - endif - let j = j + 1 - endwhile - - exe s:tlist_{fidx}_start . ',' . s:tlist_{fidx}_end . 'fold' - exe 'silent! ' . s:tlist_{fidx}_start . ',' . - \ s:tlist_{fidx}_end . 'foldopen!' - let fidx = fidx + 1 - endwhile - - exe save_wnum . 'wincmd w' -endfunction - -function! s:Tlist_Menu_Add_Base_Menu() - call s:Tlist_Log_Msg('Adding the base menu') - - " Add the menu - anoremenu T&ags.Refresh\ menu :call Tlist_Menu_Refresh() - anoremenu T&ags.Sort\ menu\ by.Name - \ :call Tlist_Change_Sort('menu', 'set', 'name') - anoremenu T&ags.Sort\ menu\ by.Order - \ :call Tlist_Change_Sort('menu', 'set', 'order') - anoremenu T&ags.-SEP1- : - - if &mousemodel =~ 'popup' - anoremenu PopUp.T&ags.Refresh\ menu - \ :call Tlist_Menu_Refresh() - anoremenu PopUp.T&ags.Sort\ menu\ by.Name - \ :call Tlist_Change_Sort('menu', 'set', 'name') - anoremenu PopUp.T&ags.Sort\ menu\ by.Order - \ :call Tlist_Change_Sort('menu', 'set', 'order') - anoremenu PopUp.T&ags.-SEP1- : - endif -endfunction - -let s:menu_char_prefix = - \ '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' - -" Tlist_Menu_Get_Tag_Type_Cmd -" Get the menu command for the specified tag type -" fidx - File type index -" ftype - File Type -" add_ttype_name - To add or not to add the tag type name to the menu entries -" ttype_idx - Tag type index -function! s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, ttype_idx) - " Curly brace variable name optimization - let ftype_ttype_idx = a:ftype . '_' . a:ttype_idx - - let ttype = s:tlist_{ftype_ttype_idx}_name - if a:add_ttype_name - " If the tag type name contains space characters, escape it. This - " will be used to create the menu entries. - let ttype_fullname = escape(s:tlist_{ftype_ttype_idx}_fullname, ' ') - endif - - " Curly brace variable name optimization - let fidx_ttype = a:fidx . '_' . ttype - - " Number of tag entries for this tag type - let tcnt = s:tlist_{fidx_ttype}_count - if tcnt == 0 " No entries for this tag type - return '' - endif - - let mcmd = '' - - " Create the menu items for the tags. - " Depending on the number of tags of this type, split the menu into - " multiple sub-menus, if needed. - if tcnt > g:Tlist_Max_Submenu_Items - let j = 1 - while j <= tcnt - let final_index = j + g:Tlist_Max_Submenu_Items - 1 - if final_index > tcnt - let final_index = tcnt - endif - - " Extract the first and last tag name and form the - " sub-menu name - let tidx = s:tlist_{fidx_ttype}_{j} - let first_tag = s:tlist_{a:fidx}_{tidx}_tag_name - - let tidx = s:tlist_{fidx_ttype}_{final_index} - let last_tag = s:tlist_{a:fidx}_{tidx}_tag_name - - " Truncate the names, if they are greater than the - " max length - let first_tag = strpart(first_tag, 0, g:Tlist_Max_Tag_Length) - let last_tag = strpart(last_tag, 0, g:Tlist_Max_Tag_Length) - - " Form the menu command prefix - let m_prefix = 'anoremenu T\&ags.' - if a:add_ttype_name - let m_prefix = m_prefix . ttype_fullname . '.' - endif - let m_prefix = m_prefix . first_tag . '\.\.\.' . last_tag . '.' - - " Character prefix used to number the menu items (hotkey) - let m_prefix_idx = 0 - - while j <= final_index - let tidx = s:tlist_{fidx_ttype}_{j} - - let tname = s:tlist_{a:fidx}_{tidx}_tag_name - - let mcmd = mcmd . m_prefix . '\&' . - \ s:menu_char_prefix[m_prefix_idx] . '\.' . - \ tname . ' :call Tlist_Menu_Jump_To_Tag(' . - \ tidx . ')|' - - let m_prefix_idx = m_prefix_idx + 1 - let j = j + 1 - endwhile - endwhile - else - " Character prefix used to number the menu items (hotkey) - let m_prefix_idx = 0 - - let m_prefix = 'anoremenu T\&ags.' - if a:add_ttype_name - let m_prefix = m_prefix . ttype_fullname . '.' - endif - let j = 1 - while j <= tcnt - let tidx = s:tlist_{fidx_ttype}_{j} - - let tname = s:tlist_{a:fidx}_{tidx}_tag_name - - let mcmd = mcmd . m_prefix . '\&' . - \ s:menu_char_prefix[m_prefix_idx] . '\.' . - \ tname . ' :call Tlist_Menu_Jump_To_Tag(' . tidx - \ . ')|' - - let m_prefix_idx = m_prefix_idx + 1 - let j = j + 1 - endwhile - endif - - return mcmd -endfunction - -" Update the taglist menu with the tags for the specified file -function! s:Tlist_Menu_File_Refresh(fidx) - call s:Tlist_Log_Msg('Refreshing the tag menu for ' . s:tlist_{a:fidx}_filename) - " The 'B' flag is needed in the 'cpoptions' option - let old_cpoptions = &cpoptions - set cpoptions&vim - - exe s:tlist_{a:fidx}_menu_cmd - - " Update the popup menu (if enabled) - if &mousemodel =~ 'popup' - let cmd = substitute(s:tlist_{a:fidx}_menu_cmd, ' T\\&ags\.', - \ ' PopUp.T\\\&ags.', "g") - exe cmd - endif - - " The taglist menu is not empty now - let s:tlist_menu_empty = 0 - - " Restore the 'cpoptions' settings - let &cpoptions = old_cpoptions -endfunction - -" Tlist_Menu_Update_File -" Add the taglist menu -function! s:Tlist_Menu_Update_File(clear_menu) - if !has('gui_running') - " Not running in GUI mode - return - endif - - call s:Tlist_Log_Msg('Updating the tag menu, clear_menu = ' . a:clear_menu) - - " Remove the tags menu - if a:clear_menu - call s:Tlist_Menu_Remove_File() - - endif - - " Skip buffers with 'buftype' set to nofile, nowrite, quickfix or help - if &buftype != '' - return - endif - - let filename = fnamemodify(bufname('%'), ':p') - let ftype = s:Tlist_Get_Buffer_Filetype('%') - - " If the file doesn't support tag listing, skip it - if s:Tlist_Skip_File(filename, ftype) - return - endif - - let fidx = s:Tlist_Get_File_Index(filename) - if fidx == -1 || !s:tlist_{fidx}_valid - " Check whether this file is removed based on user request - " If it is, then don't display the tags for this file - if s:Tlist_User_Removed_File(filename) - return - endif - - " Process the tags for the file - let fidx = s:Tlist_Process_File(filename, ftype) - if fidx == -1 - return - endif - endif - - let fname = escape(fnamemodify(bufname('%'), ':t'), '.') - if fname != '' - exe 'anoremenu T&ags.' . fname . ' ' - anoremenu T&ags.-SEP2- : - endif - - if !s:tlist_{fidx}_tag_count - return - endif - - if s:tlist_{fidx}_menu_cmd != '' - " Update the menu with the cached command - call s:Tlist_Menu_File_Refresh(fidx) - - return - endif - - " We are going to add entries to the tags menu, so the menu won't be - " empty - let s:tlist_menu_empty = 0 - - let cmd = '' - - " Determine whether the tag type name needs to be added to the menu - " If more than one tag type is present in the taglisting for a file, - " then the tag type name needs to be present - let add_ttype_name = -1 - let i = 1 - while i <= s:tlist_{ftype}_count && add_ttype_name < 1 - let ttype = s:tlist_{ftype}_{i}_name - if s:tlist_{fidx}_{ttype}_count - let add_ttype_name = add_ttype_name + 1 - endif - let i = i + 1 - endwhile - - " Process the tags by the tag type and get the menu command - let i = 1 - while i <= s:tlist_{ftype}_count - let mcmd = s:Tlist_Menu_Get_Tag_Type_Cmd(fidx, ftype, add_ttype_name, i) - if mcmd != '' - let cmd = cmd . mcmd - endif - - let i = i + 1 - endwhile - - " Cache the menu command for reuse - let s:tlist_{fidx}_menu_cmd = cmd - - " Update the menu - call s:Tlist_Menu_File_Refresh(fidx) -endfunction - -" Tlist_Menu_Remove_File -" Remove the tags displayed in the tags menu -function! s:Tlist_Menu_Remove_File() - if !has('gui_running') || s:tlist_menu_empty - return - endif - - call s:Tlist_Log_Msg('Removing the tags menu for a file') - - " Cleanup the Tags menu - silent! unmenu T&ags - if &mousemodel =~ 'popup' - silent! unmenu PopUp.T&ags - endif - - " Add a dummy menu item to retain teared off menu - noremenu T&ags.Dummy l - - silent! unmenu! T&ags - if &mousemodel =~ 'popup' - silent! unmenu! PopUp.T&ags - endif - - call s:Tlist_Menu_Add_Base_Menu() - - " Remove the dummy menu item - unmenu T&ags.Dummy - - let s:tlist_menu_empty = 1 -endfunction - -" Tlist_Menu_Refresh -" Refresh the taglist menu -function! s:Tlist_Menu_Refresh() - call s:Tlist_Log_Msg('Refreshing the tags menu') - let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) - if fidx != -1 - " Invalidate the cached menu command - let s:tlist_{fidx}_menu_cmd = '' - endif - - " Update the taglist, menu and window - call s:Tlist_Update_Current_File() -endfunction - -" Tlist_Menu_Jump_To_Tag -" Jump to the selected tag -function! s:Tlist_Menu_Jump_To_Tag(tidx) - let fidx = s:Tlist_Get_File_Index(fnamemodify(bufname('%'), ':p')) - if fidx == -1 - return - endif - - let tagpat = s:Tlist_Get_Tag_SearchPat(fidx, a:tidx) - if tagpat == '' - return - endif - - " Add the current cursor position to the jump list, so that user can - " jump back using the ' and ` marks. - mark ' - - silent call search(tagpat, 'w') - - " Bring the line to the middle of the window - normal! z. - - " If the line is inside a fold, open the fold - if foldclosed('.') != -1 - .foldopen - endif -endfunction - -" Tlist_Menu_Init -" Initialize the taglist menu -function! s:Tlist_Menu_Init() - call s:Tlist_Menu_Add_Base_Menu() - - " Automatically add the tags defined in the current file to the menu - augroup TagListMenuCmds - autocmd! - - if !g:Tlist_Process_File_Always - autocmd BufEnter * call s:Tlist_Refresh() - endif - autocmd BufLeave * call s:Tlist_Menu_Remove_File() - augroup end - - call s:Tlist_Menu_Update_File(0) -endfunction - -" Tlist_Vim_Session_Load -" Initialize the taglist window/buffer, which is created when loading -" a Vim session file. -function! s:Tlist_Vim_Session_Load() - call s:Tlist_Log_Msg('Tlist_Vim_Session_Load') - - " Initialize the taglist window - call s:Tlist_Window_Init() - - " Refresh the taglist window - call s:Tlist_Window_Refresh() -endfunction - -" Tlist_Set_App -" Set the name of the external plugin/application to which taglist -" belongs. -" Taglist plugin is part of another plugin like cream or winmanager. -function! Tlist_Set_App(name) - if a:name == "" - return - endif - - let s:tlist_app_name = a:name -endfunction - -" Winmanager integration - -" Initialization required for integration with winmanager -function! TagList_Start() - " If current buffer is not taglist buffer, then don't proceed - if bufname('%') != '__Tag_List__' - return - endif - - call Tlist_Set_App('winmanager') - - " Get the current filename from the winmanager plugin - let bufnum = WinManagerGetLastEditedFile() - if bufnum != -1 - let filename = fnamemodify(bufname(bufnum), ':p') - let ftype = s:Tlist_Get_Buffer_Filetype(bufnum) - endif - - " Initialize the taglist window, if it is not already initialized - if !exists('s:tlist_window_initialized') || !s:tlist_window_initialized - call s:Tlist_Window_Init() - call s:Tlist_Window_Refresh() - let s:tlist_window_initialized = 1 - endif - - " Update the taglist window - if bufnum != -1 - if !s:Tlist_Skip_File(filename, ftype) && g:Tlist_Auto_Update - call s:Tlist_Window_Refresh_File(filename, ftype) - endif - endif -endfunction - -function! TagList_IsValid() - return 0 -endfunction - -function! TagList_WrapUp() - return 0 -endfunction - -" restore 'cpo' -let &cpo = s:cpo_save -unlet s:cpo_save - diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim index 0093c8b0..568a4f25 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim @@ -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: 2013-09-25. -" @Revision: 0.0.92 +" @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 @@ -147,7 +125,16 @@ endf " :nodoc: function! s:prototype.ReduceFrontFilter(world) dict "{{{3 - let a:world.filter[0][0] = a:world.filter[0][0][0:-2] + let filter = a:world.filter[0][0] + " TLogVAR filter + let str = matchstr(filter, '\(\\\(\.\\{-}\|[.?*+$^]\)\|\)$') + if empty(str) + let filter = filter[0 : -2] + else + let filter = strpart(filter, 0, len(filter) - len(str)) + endif + " TLogVAR str, filter + let a:world.filter[0][0] = filter endf diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim index 0bac3c42..27f00fe1 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnfd.vim @@ -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: 2013-09-25. -" @Revision: 0.0.51 +" @Last Change: 2014-01-23. +" @Revision: 0.0.57 let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_cnfd'], 'name': 'cnfd'}) "{{{2 let s:prototype.highlight = g:tlib#input#higroup @@ -29,11 +29,7 @@ let s:Help = s:prototype.Help " :nodoc: function! s:prototype.Help(world) dict "{{{3 call call(s:Help, [a:world], self) - if self.name == 'cnfx' - call a:world.PushHelp(g:tlib#Filter_cnfx#expander, 'Any characters') - else - call a:world.PushHelp('.', 'Any characters') - endif + call a:world.PushHelp('.', 'Any characters') endf @@ -50,16 +46,6 @@ function! s:prototype.PushFrontFilter(world, char) dict "{{{3 endf -" :nodoc: -function! s:prototype.ReduceFrontFilter(world) dict "{{{3 - let flt = a:world.filter[0][0] - if flt =~ '\\\.\\{-}$' - let a:world.filter[0][0] = flt[0:-7] - else - let a:world.filter[0][0] = flt[0:-2] - endif -endf - " :nodoc: function! s:prototype.CleanFilter(filter) dict "{{{3 return substitute(a:filter, '\\.\\{-}', '.', 'g') diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim deleted file mode 100644 index 1f48c5f4..00000000 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnfx.vim +++ /dev/null @@ -1,42 +0,0 @@ -" @Author: Tom Link (mailto: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) -" @Created: 2008-11-25. -" @Last Change: 2013-09-25. -" @Revision: 0.0.62 - -let s:prototype = tlib#Filter_cnfd#New({'_class': ['Filter_cnfx'], 'name': 'cnfx'}) "{{{2 -let s:prototype.highlight = g:tlib#input#higroup - - -" A character that should be expanded to '\.\{-}'. -TLet g:tlib#Filter_cnfx#expander = '+' - - -" The same as |tlib#Filter_cnfd#New()| but a a customizable character -" |see tlib#Filter_cnfx#expander| is expanded to '\.\{-}'. -" The pattern is a '/\V' very no-'/magic' regexp pattern. -function! tlib#Filter_cnfx#New(...) "{{{3 - let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) - return object -endf - - -" :nodoc: -function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3 - let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_cnfx#expander, 'V'), '\\.\\{-}', 'g') - let a:world.filter[0] = reverse(split(pattern, '\s*|\s*')) + a:world.filter[0][1 : -1] -endf - - -" :nodoc: -function! s:prototype.PushFrontFilter(world, char) dict "{{{3 - let a:world.filter[0][0] .= a:char == char2nr(g:tlib#Filter_cnfx#expander) ? '\.\{-}' : nr2char(a:char) -endf - - -" :nodoc: -function! s:prototype.CleanFilter(filter) dict "{{{3 - return substitute(a:filter, '\\.\\{-}', g:tlib#Filter_cnfx#expander, 'g') -endf - diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_glob.vim b/sources_non_forked/tlib/autoload/tlib/Filter_glob.vim new file mode 100644 index 00000000..0ee55618 --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/Filter_glob.vim @@ -0,0 +1,68 @@ +" @Author: Tom Link (mailto: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) +" @Created: 2008-11-25. +" @Last Change: 2014-01-23. +" @Revision: 0.0.80 + +let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_glob'], 'name': 'glob'}) "{{{2 +let s:prototype.highlight = g:tlib#input#higroup + + +" A character that should be expanded to '\.\{-}'. +TLet g:tlib#Filter_glob#seq = '*' + + +" A character that should be expanded to '\.\?'. +TLet g:tlib#Filter_glob#char = '?' + + +" The same as |tlib#Filter_cnf#New()| but a a customizable character +" |see tlib#Filter_glob#seq| is expanded to '\.\{-}' and +" |g:tlib#Filter_glob#char| is expanded to '\.'. +" The pattern is a '/\V' very no-'/magic' regexp pattern. +function! tlib#Filter_glob#New(...) "{{{3 + let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) + return object +endf + + +let s:Help = s:prototype.Help + +" :nodoc: +function! s:prototype.Help(world) dict "{{{3 + call call(s:Help, [a:world], self) + call a:world.PushHelp(g:tlib#Filter_glob#seq, 'Any characters') + call a:world.PushHelp(g:tlib#Filter_glob#char, 'Single characters') +endf + + +" :nodoc: +function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3 + let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_glob#seq, 'V'), '\\.\\{-}', 'g') + let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_glob#char, 'V'), '\\.', 'g') + let a:world.filter[0] = reverse(split(pattern, '\s*|\s*')) + a:world.filter[0][1 : -1] +endf + + +" :nodoc: +function! s:prototype.PushFrontFilter(world, char) dict "{{{3 + " TLogVAR a:char, nr2char(a:char) + if a:char == char2nr(g:tlib#Filter_glob#seq) + let char = '\.\{-}' + elseif a:char == char2nr(g:tlib#Filter_glob#char) + let char = '\.' + else + let char = nr2char(a:char) + endif + let a:world.filter[0][0] .= char +endf + + +" :nodoc: +function! s:prototype.CleanFilter(filter) dict "{{{3 + let filter = substitute(a:filter, '\\.\\{-}', g:tlib#Filter_glob#seq, 'g') + let filter = substitute(filter, '\\.', g:tlib#Filter_glob#char, 'g') + return filter +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/World.vim b/sources_non_forked/tlib/autoload/tlib/World.vim index daedb559..b6a8581d 100644 --- a/sources_non_forked/tlib/autoload/tlib/World.vim +++ b/sources_non_forked/tlib/autoload/tlib/World.vim @@ -1,10 +1,7 @@ -" World.vim -- The World prototype for tlib#input#List() " @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) -" @Created: 2007-05-01. -" @Last Change: 2013-09-26. -" @Revision: 0.1.1297 +" @Revision: 1393 " :filedoc: " A prototype used by |tlib#input#List|. @@ -75,6 +72,7 @@ let s:prototype = tlib#Object#New({ \ 'resize_vertical': 0, \ 'restore_from_cache': [], \ 'filtered_items': [], + \ 'resume_state': '', \ 'retrieve_eval': '', \ 'return_agent': '', \ 'rv': '', @@ -92,6 +90,7 @@ let s:prototype = tlib#Object#New({ \ 'temp_prompt': [], \ 'timeout': 0, \ 'timeout_resolution': 2, + \ 'tabpagenr': -1, \ 'type': '', \ 'win_wnr': -1, \ 'win_height': -1, @@ -119,6 +118,22 @@ function! s:prototype.Set_display_format(value) dict "{{{3 endf +" :nodoc: +function! s:prototype.DisplayFormat(list) dict "{{{3 + let display_format = self.display_format + if !empty(display_format) + if has_key(self, 'InitFormatName') + call self.InitFormatName() + endif + let cache = self.fmt_display + " TLogVAR display_format, fmt_entries + return map(copy(a:list), 'self.FormatName(cache, display_format, v:val)') + else + return a:list + endif +endf + + " :nodoc: function! s:prototype.Set_highlight_filename() dict "{{{3 let self.tlib_UseInputListScratch = 'call world.Highlight_filename()' @@ -161,12 +176,14 @@ else let self.width_filename = min([ \ get(self, 'width_filename', &co), \ empty(g:tlib#input#filename_max_width) ? &co : eval(g:tlib#input#filename_max_width), - \ max(map(copy(self.base), 'strwidth(fnamemodify(v:val, ":t"))')) + \ max(map(copy(self.base), 'strwidth(matchstr(v:val, "[^\\/]*$"))')) \ ]) - " TLogVAR self.width_filename + " TLogVAR self.width_filename + exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs\(\(\a:\|\.\.\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename' + exec 'syntax match TLibMarker /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \S.*$/ contains=TLibDir' + " exec 'syntax match TLibDir /\(|\|\[.\{-}\]\) \zs\(\(\a:\|\.\.\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename' + " exec 'syntax match TLibMarker /\(|\|\[.\{-}\]\) \S.*$/ contains=TLibDir' exec 'syntax match TLibFilename /[^\/]\+$/ contained containedin=TLibDir' - exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs\(\(\a:\|\.\.\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename' - exec 'syntax match TLibMarker /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \S.*$/ contains=TLibDir' hi def link TLibMarker Special hi def link TLibDir Directory hi def link TLibFilename NonText @@ -178,6 +195,32 @@ else endf + " :nodoc: + function! s:prototype.UseFilenameIndicators() dict "{{{3 + return g:tlib_inputlist_filename_indicators || has_key(self, 'filename_indicators') + endf + + + " :nodoc: + function! s:prototype.InitFormatName() dict "{{{3 + if self.UseFilenameIndicators() + let self._buffers = {} + for bufnr in range(1, bufnr('$')) + let filename = fnamemodify(bufname(bufnr), ':p') + " TLogVAR filename + let bufdef = { + \ 'bufnr': bufnr, + \ } + " '&buflisted' + for opt in ['&modified', '&bufhidden'] + let bufdef[opt] = getbufvar(bufnr, opt) + endfor + let self._buffers[filename] = bufdef + endfor + endif + endf + + " :nodoc: function! s:prototype.FormatFilename(file) dict "{{{3 " TLogVAR a:file @@ -194,36 +237,34 @@ else if strwidth(fname) > width let fname = strpart(fname, 0, width - 3) .'...' endif - let dnmax = &co - max([width, strwidth(fname)]) - 10 - self.index_width - &fdc - if g:tlib_inputlist_filename_indicators - let dnmax -= 2 - endif - if strwidth(dname) > dnmax - let dname = '...'. strpart(dname, len(dname) - dnmax) - endif - let marker = [] - let use_indicators = g:tlib_inputlist_filename_indicators || has_key(self, 'filename_indicators') + let dnmax = &co - max([width, strwidth(fname)]) - 8 - self.index_width - &fdc + let use_indicators = self.UseFilenameIndicators() " TLogVAR use_indicators + let marker = [] if use_indicators call insert(marker, '[') - let bnr = bufnr(a:file) - " TLogVAR a:file, bnr, self.bufnr - if bnr != -1 - if bnr == self.bufnr - call add(marker, '%') - else - call add(marker, bnr) + if g:tlib_inputlist_filename_indicators + let bufdef = get(self._buffers, a:file, {}) + " let bnr = bufnr(a:file) + let bnr = get(bufdef, 'bufnr', -1) + " TLogVAR a:file, bnr, self.bufnr + if bnr != -1 + if bnr == self.bufnr + call add(marker, '%') + else + call add(marker, bnr) + endif + if get(bufdef, '&modified', 0) + call add(marker, '+') + endif + if get(bufdef, '&bufhidden', '') == 'hide' + call add(marker, 'h') + endif + " if !get(bufdef, '&buflisted', 1) + " call add(marker, 'u') + " endif + " echom "DBG" a:file string(get(self,'filename_indicators')) endif - if getbufvar(bnr, '&modified') - call add(marker, '+') - endif - if getbufvar(bnr, '&bufhidden') == 'hide' - call add(marker, 'h') - endif - " if !buflisted(bnr) - " call add(marker, 'u') - " endif - " echom "DBG" a:file string(get(self,'filename_indicators')) endif if has_key(self, 'filename_indicators') && has_key(self.filename_indicators, a:file) if len(marker) > 1 @@ -238,9 +279,16 @@ else else call add(marker, '|') endif + let markers = join(marker, '') + if !empty(markers) + let dnmax -= len(markers) + endif + if strwidth(dname) > dnmax + let dname = '...'. strpart(dname, len(dname) - dnmax) + endif return printf("%-*s %s %s", \ self.width_filename + len(fname) - strwidth(fname), - \ fname, join(marker, ''), dname) + \ fname, markers, dname) endf endif @@ -452,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) @@ -461,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 @@ -760,6 +810,7 @@ function! s:prototype.UseInputListScratch() dict "{{{3 if !exists('b:tlib_list_init') call tlib#autocmdgroup#Init() autocmd TLib VimResized call feedkeys("\", 't') + " autocmd TLib WinLeave let b:tlib_world_event = 'WinLeave' | call feedkeys("\", 't') let b:tlib_list_init = 1 endif if !exists('w:tlib_list_init') @@ -919,23 +970,24 @@ function! s:prototype.DisplayHelp() dict "{{{3 let self.temp_lines = self.InitHelp() call self.PushHelp('', self.key_mode == 'default' ? 'Abort' : 'Reset keymap') call self.PushHelp('Enter, ', 'Pick the current item') - call self.PushHelp('', 'Pick an item') call self.PushHelp('Mouse', 'L: Pick item, R: Show menu') + call self.PushHelp('', 'Select an item') call self.PushHelp(', ', 'Reduce filter') call self.PushHelp(', ', 'Enter command') if self.key_mode == 'default' - call self.PushHelp('', 'Reset the display') + call self.PushHelp('', 'Reset the display') call self.PushHelp('Up/Down', 'Next/previous item') - call self.PushHelp('', 'Edit top filter string') + call self.PushHelp('', 'Edit top filter string') call self.PushHelp('Page Up/Down', 'Scroll') + call self.PushHelp('', 'Enter * Wildcard') if self.allow_suspend call self.PushHelp('', 'Suspend/Resume') call self.PushHelp('', 'Switch to origin') endif if stridx(self.type, 'm') != -1 call self.PushHelp('', '(Un)Select items') - call self.PushHelp('#, ', '(Un)Select the current item') + call self.PushHelp('#', '(Un)Select the current item') call self.PushHelp('', '(Un)Select all items') call self.PushHelp('', '(Un)Restrict view to selection') " \ ' ... Show only selected', @@ -1160,7 +1212,7 @@ function! s:prototype.Query() dict "{{{3 if g:tlib_inputlist_shortmessage let query = 'Filter: '. self.DisplayFilter() else - let query = self.query .' (filter: '. self.DisplayFilter() .'; press "?" for help)' + let query = self.query .' (filter: '. self.DisplayFilter() .'; press for help)' endif return query endf @@ -1232,6 +1284,9 @@ endf " :nodoc: function! s:prototype.SwitchWindow(where) dict "{{{3 " TLogDBG string(tlib#win#List()) + if self.tabpagenr != tabpagenr() + call tlib#tab#Set(self.tabpagenr) + endif let wnr = get(self, a:where.'_wnr') " TLogVAR self, wnr return tlib#win#Set(wnr) @@ -1308,3 +1363,8 @@ function! s:prototype.RestoreOrigin(...) dict "{{{3 " TLogDBG "RestoreOrigin1 ". string(tlib#win#List()) endf + +function! s:prototype.Suspend() dict "{{{3 + call tlib#agent#Suspend(self, self.rv) +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/agent.vim b/sources_non_forked/tlib/autoload/tlib/agent.vim index c0d9566a..766c5b33 100644 --- a/sources_non_forked/tlib/autoload/tlib/agent.vim +++ b/sources_non_forked/tlib/autoload/tlib/agent.vim @@ -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: 2007-06-24. -" @Last Change: 2013-09-26. -" @Revision: 0.1.240 +" @Last Change: 2014-02-06. +" @Revision: 0.1.251 " :filedoc: @@ -55,6 +55,20 @@ function! tlib#agent#PageDown(world, selected) "{{{3 endf +function! tlib#agent#Home(world, selected) "{{{3 + let a:world.prefidx = 1 + let a:world.state = 'redisplay' + return a:world +endf + + +function! tlib#agent#End(world, selected) "{{{3 + let a:world.prefidx = len(a:world.list) + let a:world.state = 'redisplay' + return a:world +endf + + function! tlib#agent#Up(world, selected, ...) "{{{3 TVarArg ['lines', 1] let a:world.idx = '' @@ -444,6 +458,7 @@ endf function! tlib#agent#EditFileInTab(world, selected) "{{{3 + " TLogVAR a:selected call a:world.CloseScratch() call tlib#file#With('tabedit', 'tab sbuffer', a:selected, a:world) return tlib#agent#Exit(a:world, a:selected) @@ -462,7 +477,7 @@ function! tlib#agent#ShowInfo(world, selected) for f in a:selected if filereadable(f) let desc = [getfperm(f), strftime('%c', getftime(f)), getfsize(f) .' bytes', getftype(f)] - call add(lines, fnamemodify(f, ':t') .':') + call add(lines, fnamemodify(f, ':p')) call add(lines, ' '. join(desc, '; ')) endif endfor @@ -560,7 +575,7 @@ endf function! tlib#agent#ExecAgentByName(world, selected) "{{{3 let s:agent_names_world = a:world - let agent_names = {} + let agent_names = {'Help': 'tlib#agent#Help'} for def in values(a:world.key_map[a:world.key_mode]) if has_key(def, 'help') && !empty(def.help) && has_key(def, 'agent') && !empty(def.agent) let agent_names[def.help] = def.agent diff --git a/sources_non_forked/tlib/autoload/tlib/arg.vim b/sources_non_forked/tlib/autoload/tlib/arg.vim index e7f1315b..96d5dc5b 100644 --- a/sources_non_forked/tlib/autoload/tlib/arg.vim +++ b/sources_non_forked/tlib/autoload/tlib/arg.vim @@ -1,15 +1,8 @@ -" arg.vim " @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) -" @Created: 2007-06-30. -" @Last Change: 2009-02-15. -" @Revision: 0.0.50 - -if &cp || exists("loaded_tlib_arg_autoload") - finish -endif -let loaded_tlib_arg_autoload = 1 +" @Last Change: 2014-07-01. +" @Revision: 63 " :def: function! tlib#arg#Get(n, var, ?default="", ?test='') @@ -50,32 +43,40 @@ function! tlib#arg#Key(list, ...) "{{{3 endf -" :def: function! tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0) +" :def: function! tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0, ?sep=':') function! tlib#arg#StringAsKeyArgs(string, ...) "{{{1 - TVarArg ['keys', {}], ['evaluate', 0] + TVarArg ['keys', {}], ['evaluate', 0], ['sep', ':'] let keyargs = {} let args = split(a:string, '\\\@ g:tlib#cache#max_filename - let shortfilename = pathshorten(file) .'_'. tlib#hash#Adler32(file) + if v:version >= 704 + let shortfilename = pathshorten(file) .'_'. sha256(file) + else + let shortfilename = pathshorten(file) .'_'. tlib#hash#Adler32(file) + endif let cache_file = tlib#cache#Filename(a:type, shortfilename, mkdir, dir0) else if mkdir && !isdirectory(dir) @@ -108,14 +112,45 @@ function! tlib#cache#Filename(type, ...) "{{{3 endf -function! tlib#cache#Save(cfile, dictionary) "{{{3 - call tlib#persistent#Save(a:cfile, a:dictionary) +let s:timestamps = {} + + +function! s:SetTimestamp(cfile, type) "{{{3 + if !has_key(s:timestamps, a:cfile) + let s:timestamps[a:cfile] = {} + endif + let s:timestamps[a:cfile].atime = getftime(a:cfile) + let s:timestamps[a:cfile][a:type] = s:timestamps[a:cfile].atime endf -function! tlib#cache#Get(cfile) "{{{3 +function! tlib#cache#Save(cfile, dictionary) "{{{3 + " TLogVAR a:cfile, a:dictionary + if !empty(a:cfile) + " TLogVAR a:dictionary + call writefile([string(a:dictionary)], a:cfile, 'b') + call s:SetTimestamp(a:cfile, 'write') + endif +endf + + +function! tlib#cache#MTime(cfile) "{{{3 + let mtime = {'mtime': getftime(a:cfile)} + let mtime = extend(mtime, get(s:timestamps, a:cfile, {})) + return mtime +endf + + +function! tlib#cache#Get(cfile, ...) "{{{3 call tlib#cache#MaybePurge() - return tlib#persistent#Get(a:cfile) + if !empty(a:cfile) && filereadable(a:cfile) + let val = readfile(a:cfile, 'b') + call s:SetTimestamp(a:cfile, 'read') + return eval(join(val, "\n")) + else + let default = a:0 >= 1 ? a:1 : {} + return default + endif endf @@ -124,9 +159,12 @@ endf function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3 if !filereadable(a:cfile) || (a:ftime != 0 && getftime(a:cfile) < a:ftime) let args = a:0 >= 1 ? a:1 : [] + " TLogVAR a:generator, args let val = call(a:generator, args) - " TLogVAR a:generator, args, val - call tlib#cache#Save(a:cfile, {'val': val}) + " TLogVAR val + let cval = {'val': val} + " TLogVAR cval + call tlib#cache#Save(a:cfile, cval) return val else let val = tlib#cache#Get(a:cfile) diff --git a/sources_non_forked/tlib/autoload/tlib/char.vim b/sources_non_forked/tlib/autoload/tlib/char.vim index 2efb47bb..277716d3 100644 --- a/sources_non_forked/tlib/autoload/tlib/char.vim +++ b/sources_non_forked/tlib/autoload/tlib/char.vim @@ -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: 2007-06-30. -" @Last Change: 2009-02-15. -" @Revision: 0.0.30 +" @Last Change: 2014-01-20. +" @Revision: 0.0.37 if &cp || exists("loaded_tlib_char_autoload") finish @@ -19,13 +19,22 @@ let loaded_tlib_char_autoload = 1 " echo tlib#char#Get() " echo tlib#char#Get(5) function! tlib#char#Get(...) "{{{3 - TVarArg ['timeout', 0], ['resolution', 0] + TVarArg ['timeout', 0], ['resolution', 0], ['getmod', 0] + let char = -1 + let mode = 0 if timeout == 0 || !has('reltime') - return getchar() + let char = getchar() else - return tlib#char#GetWithTimeout(timeout, resolution) + let char = tlib#char#GetWithTimeout(timeout, resolution) + endif + if getmod + if char != -1 + let mode = getcharmod() + endif + return [char, mode] + else + return char endif - return -1 endf diff --git a/sources_non_forked/tlib/autoload/tlib/cmd.vim b/sources_non_forked/tlib/autoload/tlib/cmd.vim index e6ab3e88..01975b60 100644 --- a/sources_non_forked/tlib/autoload/tlib/cmd.vim +++ b/sources_non_forked/tlib/autoload/tlib/cmd.vim @@ -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: 2007-08-23. -" @Last Change: 2013-05-14. -" @Revision: 0.0.46 +" @Last Change: 2014-02-05. +" @Revision: 0.0.53 if &cp || exists("loaded_tlib_cmd_autoload") finish @@ -58,10 +58,12 @@ endf " call tlib#cmd#BrowseOutputWithCallback('tlib#cmd#ParseScriptname', 'scriptnames') function! tlib#cmd#BrowseOutputWithCallback(callback, command) "{{{3 let list = tlib#cmd#OutputAsList(a:command) - let cmd = tlib#input#List('s', 'Output of: '. a:command, list) - if !empty(cmd) - let Callback = function(a:callback) - call call(Callback, [cmd]) + let cmds = tlib#input#List('m', 'Output of: '. a:command, list) + if !empty(cmds) + for cmd in cmds + let Callback = function(a:callback) + call call(Callback, [cmd]) + endfor endif endf @@ -70,8 +72,9 @@ function! tlib#cmd#DefaultBrowseOutput(cmd) "{{{3 endf function! tlib#cmd#ParseScriptname(line) "{{{3 - let parsedValue = substitute(a:line, '^.\{-}\/', '/', '') - exe ':e '. parsedValue + " let parsedValue = substitute(a:line, '^.\{-}\/', '/', '') + let parsedValue = matchstr(a:line, '^\s*\d\+:\s*\zs.*$') + exe 'drop '. fnameescape(parsedValue) endf " :def: function! tlib#cmd#UseVertical(?rx='') diff --git a/sources_non_forked/tlib/autoload/tlib/dir.vim b/sources_non_forked/tlib/autoload/tlib/dir.vim index c3902972..758ab7d9 100644 --- a/sources_non_forked/tlib/autoload/tlib/dir.vim +++ b/sources_non_forked/tlib/autoload/tlib/dir.vim @@ -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: 2007-06-30. -" @Last Change: 2013-09-25. -" @Revision: 0.0.37 +" @Last Change: 2014-07-07. +" @Revision: 0.0.38 if &cp || exists("loaded_tlib_dir_autoload") finish @@ -21,10 +21,11 @@ let s:dir_stack = [] " tlib#dir#CanonicName('foo/bar') " => 'foo/bar/' function! tlib#dir#CanonicName(dirname) "{{{3 - if a:dirname !~ '[/\\]$' - return a:dirname . g:tlib#dir#sep + let dirname = tlib#file#Canonic(a:dirname) + if dirname !~ '[/\\]$' + return dirname . g:tlib#dir#sep endif - return a:dirname + return dirname endf diff --git a/sources_non_forked/tlib/autoload/tlib/file.vim b/sources_non_forked/tlib/autoload/tlib/file.vim index e7ea855a..b4a4d9e6 100644 --- a/sources_non_forked/tlib/autoload/tlib/file.vim +++ b/sources_non_forked/tlib/autoload/tlib/file.vim @@ -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: 2007-06-30. -" @Last Change: 2013-09-25. -" @Revision: 0.0.141 +" @Last Change: 2014-07-07. +" @Revision: 0.0.150 if &cp || exists("loaded_tlib_file_autoload") finish @@ -36,12 +36,12 @@ function! tlib#file#Split(filename) "{{{3 endf -" :display: tlib#file#Join(filename_parts, ?strip_slashes=0) +" :display: tlib#file#Join(filename_parts, ?strip_slashes=1) " EXAMPLES: > " tlib#file#Join(['foo', 'bar', 'filename.txt']) " => 'foo/bar/filename.txt' function! tlib#file#Join(filename_parts, ...) "{{{3 - TVarArg 'strip_slashes' + TVarArg ['strip_slashes', 1] " TLogVAR a:filename_parts, strip_slashes if strip_slashes " let rx = tlib#rx#Escape(g:tlib#dir#sep) .'$' @@ -103,6 +103,25 @@ function! tlib#file#Absolute(filename, ...) "{{{3 endf +function! tlib#file#Canonic(filename, ...) "{{{3 + TVarArg ['mode', ''] + if a:filename =~ '^\\\\' + let mode = 'windows' + elseif a:filename =~ '^\(file\|ftp\|http\)s\?:' + let mode = 'url' + elseif (empty(mode) && g:tlib#sys#windows) + let mode = 'windows' + endif + let filename = a:filename + if mode == 'windows' + let filename = substitute(filename, '/', '\\', 'g') + else + let filename = substitute(filename, '\\', '/', 'g') + endif + return filename +endf + + function! s:SetScrollBind(world) "{{{3 let sb = get(a:world, 'scrollbind', &scrollbind) if sb != &scrollbind diff --git a/sources_non_forked/tlib/autoload/tlib/input.vim b/sources_non_forked/tlib/autoload/tlib/input.vim index b756f783..6cd57f5e 100644 --- a/sources_non_forked/tlib/autoload/tlib/input.vim +++ b/sources_non_forked/tlib/autoload/tlib/input.vim @@ -1,10 +1,7 @@ -" input.vim " @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) -" @Created: 2007-06-30. -" @Last Change: 2013-09-30. -" @Revision: 0.0.1262 +" @Revision: 1317 " :filedoc: @@ -23,16 +20,15 @@ TLet g:tlib#input#livesearch_threshold = 1000 " Determine how |tlib#input#List()| and related functions work. -" Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See: -" cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted -" as a wildcard (this is the default method) -" - A plus character ("+") acts as a wildcard as if ".\{-}" (see -" |/\{-|) were entered. +" Can be "glob", "cnf", "cnfd", "seq", or "fuzzy". See: +" glob ... Like cnf but "*" and "?" (see |g:tlib#Filter_glob#seq|, +" |g:tlib#Filter_glob#char|) are interpreted as glob-like +" |wildcards| (this is the default method) " - Examples: -" - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match +" - "f*o" matches "fo", "fxo", and "fxxxoo", but doesn't match " "far". " - Otherwise it is a derivate of the cnf method (see below). -" - See also |tlib#Filter_cnfx#New()|. +" - See also |tlib#Filter_glob#New()|. " cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is " expanded to "\.\{-}" " - A period character (".") acts as a wildcard as if ".\{-}" (see @@ -60,7 +56,7 @@ TLet g:tlib#input#livesearch_threshold = 1000 " - |tlib#Filter_seq#New()| " fuzzy .. Match fuzzy character sequences " - |tlib#Filter_fuzzy#New()| -TLet g:tlib#input#filter_mode = 'cnfx' +TLet g:tlib#input#filter_mode = 'glob' " The highlight group to use for showing matches in the input list @@ -126,6 +122,8 @@ TLet g:tlib#input#numeric_chars = { TLet g:tlib#input#keyagents_InputList_s = { \ "\": 'tlib#agent#PageUp', \ "\": 'tlib#agent#PageDown', + \ "\": 'tlib#agent#Home', + \ "\": 'tlib#agent#End', \ "\": 'tlib#agent#Up', \ "\": 'tlib#agent#Down', \ "\": 'tlib#agent#UpN', @@ -140,7 +138,6 @@ TLet g:tlib#input#keyagents_InputList_s = { \ 26: 'tlib#agent#Suspend', \ 250: 'tlib#agent#Suspend', \ 15: 'tlib#agent#SuspendToParentWindow', - \ 63: 'tlib#agent#Help', \ "\": 'tlib#agent#Help', \ "\": 'tlib#agent#ExecAgentByName', \ "\": 'tlib#agent#ExecAgentByName', @@ -155,6 +152,7 @@ TLet g:tlib#input#keyagents_InputList_s = { \ char2nr(g:tlib#input#or): 'tlib#agent#OR', \ char2nr(g:tlib#input#and): 'tlib#agent#AND', \ } + " \ 63: 'tlib#agent#Help', " :nodefault: @@ -327,6 +325,8 @@ function! tlib#input#ListW(world, ...) "{{{3 " TLogVAR world.state, world.sticky, world.initial_index " let statusline = &l:statusline " let laststatus = &laststatus + let showmode = &showmode + set noshowmode let lastsearch = @/ let scrolloff = &l:scrolloff let &l:scrolloff = 0 @@ -345,6 +345,16 @@ function! tlib#input#ListW(world, ...) "{{{3 try call s:RunStateHandlers(world) + " if exists('b:tlib_world_event') + " let event = b:tlib_world_event + " unlet! b:tlib_world_event + " if event == 'WinLeave' + " " let world.resume_state = world.state + " let world = tlib#agent#Suspend(world, world.rv) + " break + " endif + " endif + " let time02 = str2float(reltimestr(reltime())) " DBG " TLogVAR time02, time02 - time0 if world.state =~ '\' @@ -443,14 +453,7 @@ function! tlib#input#ListW(world, ...) "{{{3 " TLogDBG 5 " TLogDBG len(world.list) " TLogVAR world.list - let dlist = copy(world.list) - " TLogVAR world.display_format - if !empty(world.display_format) - let display_format = world.display_format - let cache = world.fmt_display - " TLogVAR display_format, fmt_entries - call map(dlist, 'world.FormatName(cache, display_format, v:val)') - endif + let dlist = world.DisplayFormat(world.list) " TLogVAR world.prefidx " TLogDBG 6 " let time6 = str2float(reltimestr(reltime())) " DBG @@ -545,20 +548,15 @@ function! tlib#input#ListW(world, ...) "{{{3 exec exec_cmd endif elseif has('gui_gtk') || has('gui_gtk2') - let c = getchar() - let cmod = getcharmod() - " TLogVAR c, cmod - if c !~ '\D' && c > 0 && cmod != 0 - let c = printf("<%s-%s>", cmod, c) - endif + let c = s:GetModdedChar(world) + " TLogVAR c endif else " TLogVAR world.timeout - let c = tlib#char#Get(world.timeout, world.timeout_resolution) + let c = s:GetModdedChar(world) " TLogVAR c, has_key(world.key_map[world.key_mode],c) - let cmod = getcharmod() endif - " TLogVAR c, cmod + " TLogVAR c " TLogDBG string(sort(keys(world.key_map[world.key_mode]))) " TLogVAR world.next_agent, world.next_eval @@ -602,7 +600,7 @@ function! tlib#input#ListW(world, ...) "{{{3 " let world.offset = world.prefidx if empty(world.prefidx) " call feedkeys(c, 't') - let c = tlib#char#Get(world.timeout) + let c = s:GetModdedChar(world) let world.state = 'help' continue endif @@ -783,6 +781,9 @@ function! tlib#input#ListW(world, ...) "{{{3 " TLogVAR statusline " let &l:statusline = statusline " let &laststatus = laststatus + if &showmode != showmode + let &showmode = showmode + endif silent! let @/ = lastsearch let &l:scrolloff = scrolloff if s:PopupmenuExists() == 1 @@ -829,6 +830,16 @@ function! tlib#input#ListW(world, ...) "{{{3 endf +function! s:GetModdedChar(world) "{{{3 + let [char, mode] = tlib#char#Get(a:world.timeout, a:world.timeout_resolution, 1) + if char !~ '\D' && char > 0 && mode != 0 + return printf("<%s-%s>", mode, char) + else + return char + endif +endf + + function! s:Init(world, cmd) "{{{3 " TLogVAR a:cmd let a:world.initial_display = 1 @@ -844,6 +855,9 @@ function! s:Init(world, cmd) "{{{3 else call a:world.Retrieve(1) endif + " if !empty(a:world.resume_state) + " let a:world.state = a:world.resume_state + " endif elseif !a:world.initialized " TLogVAR a:world.initialized, a:world.win_wnr, a:world.bufnr let a:world.filetype = &filetype diff --git a/sources_non_forked/tlib/autoload/tlib/list.vim b/sources_non_forked/tlib/autoload/tlib/list.vim index ec756bd0..31696fae 100644 --- a/sources_non_forked/tlib/autoload/tlib/list.vim +++ b/sources_non_forked/tlib/autoload/tlib/list.vim @@ -4,7 +4,7 @@ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. " @Last Change: 2011-03-18. -" @Revision: 36 +" @Revision: 57 """ List related functions {{{1 @@ -140,25 +140,41 @@ endf function! tlib#list#Uniq(list, ...) "{{{3 - TVarArg ['get_value', ''] - let s:uniq_values = {} + TVarArg ['get_value', ''], ['remove_empty', 0] + if remove_empty + call filter(a:list, 'type(v:val) == 0 || !empty(v:val)') + endif + " CREDITS: Based on syntastic#util#unique(list) by scrooloose + let seen = {} + let uniques = [] if empty(get_value) - call filter(a:list, 's:UniqValue(v:val)') + for e in a:list + if !has_key(seen, e) + let seen[e] = 1 + call add(uniques, e) + endif + endfor else - call filter(a:list, 's:UniqValue(eval(printf(get_value, string(v:val))))') + for e in a:list + let v = eval(printf(get_value, string(e))) + if !has_key(seen, v) + let seen[v] = 1 + call add(uniques, e) + endif + endfor endif - unlet s:uniq_values - return a:list + return uniques endf -function! s:UniqValue(value) "{{{3 - if get(s:uniq_values, a:value, 0) - return 0 - else - let s:uniq_values[a:value] = 1 - return 1 - endif +function! tlib#list#ToDictionary(list, default, ...) "{{{3 + TVarArg ['generator', ''] + let dict = {} + for item in a:list + if !empty(item) + let dict[item] = empty(generator) ? a:default : call(generator, [item, a:default]) + endif + endfor + return dict endf - diff --git a/sources_non_forked/tlib/autoload/tlib/persistent.vim b/sources_non_forked/tlib/autoload/tlib/persistent.vim index b5791744..de3d4878 100644 --- a/sources_non_forked/tlib/autoload/tlib/persistent.vim +++ b/sources_non_forked/tlib/autoload/tlib/persistent.vim @@ -3,7 +3,7 @@ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-05-11. " @Last Change: 2012-05-11. -" @Revision: 7 +" @Revision: 12 " The directory for persistent data files. If empty, use " |tlib#dir#MyRuntime|.'/share'. @@ -29,13 +29,12 @@ function! tlib#persistent#Filename(type, ...) "{{{3 return tlib#cache#Filename(a:type, file, mkdir, tlib#persistent#Dir()) endf -function! tlib#persistent#Get(cfile) "{{{3 - if !empty(a:cfile) && filereadable(a:cfile) - let val = readfile(a:cfile, 'b') - return eval(join(val, "\n")) - else - return {} - endif +function! tlib#persistent#Get(...) "{{{3 + return call('tlib#cache#Get', a:000) +endf + +function! tlib#persistent#MTime(cfile) "{{{3 + return tlib#cache#MTime(a:cfile) endf function! tlib#persistent#Value(...) "{{{3 @@ -43,9 +42,6 @@ function! tlib#persistent#Value(...) "{{{3 endf function! tlib#persistent#Save(cfile, dictionary) "{{{3 - if !empty(a:cfile) - " TLogVAR a:dictionary - call writefile([string(a:dictionary)], a:cfile, 'b') - endif + call tlib#cache#Save(a:cfile, a:dictionary) endf diff --git a/sources_non_forked/tlib/autoload/tlib/progressbar.vim b/sources_non_forked/tlib/autoload/tlib/progressbar.vim index 6ff5a77f..6ca0ce9b 100644 --- a/sources_non_forked/tlib/autoload/tlib/progressbar.vim +++ b/sources_non_forked/tlib/autoload/tlib/progressbar.vim @@ -4,7 +4,7 @@ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-09-30. " @Last Change: 2010-01-07. -" @Revision: 0.0.66 +" @Revision: 0.0.69 if &cp || exists("loaded_tlib_progressbar_autoload") finish @@ -57,6 +57,7 @@ function! tlib#progressbar#Display(value, ...) "{{{3 let pbr = repeat('.', s:width[0] - val) let txt = printf(s:format[0], '['.pbl.pbr.']') . extra let &l:statusline = txt + " TLogDBG txt redrawstatus " redraw " call tlib#notify#Echo(txt) diff --git a/sources_non_forked/tlib/autoload/tlib/scratch.vim b/sources_non_forked/tlib/autoload/tlib/scratch.vim index bb6e4be2..e64eb9e6 100644 --- a/sources_non_forked/tlib/autoload/tlib/scratch.vim +++ b/sources_non_forked/tlib/autoload/tlib/scratch.vim @@ -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: 2007-07-18. -" @Last Change: 2013-10-16. -" @Revision: 0.0.242 +" @Last Change: 2014-02-06. +" @Revision: 0.0.252 if &cp || exists("loaded_tlib_scratch_autoload") finish @@ -65,7 +65,7 @@ function! tlib#scratch#UseScratch(...) "{{{3 else let cmd = 'buffer!' endif - " TLogVAR cmd + " TLogVAR cmd, bn silent exec 'noautocmd keepalt keepj' cmd bn endif else @@ -77,7 +77,7 @@ function! tlib#scratch#UseScratch(...) "{{{3 else let cmd = 'edit' endif - " TLogVAR cmd + " TLogVAR cmd, id silent exec 'noautocmd keepalt keepj' cmd escape(id, '%#\ ') " silent exec 'split '. id endif @@ -100,7 +100,9 @@ function! tlib#scratch#UseScratch(...) "{{{3 endif endif let keyargs.scratch = bufnr('%') - " TLogVAR 2, winnr(), bufnr('%'), bufname("%") + let keyargs.scratch_tabpagenr = tabpagenr() + let keyargs.scratch_winnr = winnr() + " TLogVAR 2, winnr(), bufnr('%'), bufname("%"), keyargs.scratch return keyargs.scratch endf diff --git a/sources_non_forked/tlib/autoload/tlib/string.vim b/sources_non_forked/tlib/autoload/tlib/string.vim index 8c077cd4..d2ca319b 100644 --- a/sources_non_forked/tlib/autoload/tlib/string.vim +++ b/sources_non_forked/tlib/autoload/tlib/string.vim @@ -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 diff --git a/sources_non_forked/tlib/autoload/tlib/sys.vim b/sources_non_forked/tlib/autoload/tlib/sys.vim new file mode 100644 index 00000000..7808153d --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/sys.vim @@ -0,0 +1,127 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2014-06-30. +" @Revision: 25 + + +if !exists('g:tlib#sys#windows') + let g:tlib#sys#windows = &shell !~ 'sh' && (has('win16') || has('win32') || has('win64')) "{{{2 +endif + + +if !exists('g:tlib#sys#null') + let g:tlib#sys#null = g:tlib#sys#windows ? 'NUL' : (filereadable('/dev/null') ? '/dev/null' : '') "{{{2 +endif + + +let s:executables = {} + +function! tlib#sys#IsExecutable(cmd, ...) "{{{3 + " TLogVAR a:cmd + " echom "DBG has_key(s:executables, a:cmd)" has_key(s:executables, a:cmd) + if !has_key(s:executables, a:cmd) + let executable = executable(a:cmd) + " TLogVAR 1, executable + let ignore_cyg = a:0 >= 1 ? a:1 : !g:tlib#sys#windows + if !executable && !ignore_cyg + let executable = tlib#sys#IsCygwinBin(a:cmd) + " TLogVAR 2, executable + endif + let s:executables[a:cmd] = executable + endif + " echom "DBG s:executables[a:cmd]" s:executables[a:cmd] + return s:executables[a:cmd] +endf + + +if !exists('g:tlib#sys#check_cygpath') + " If true, check whether we have to convert a path via cyppath -- + " see |tlib#sys#MaybeUseCygpath| + let g:tlib#sys#check_cygpath = g:tlib#sys#windows && tlib#sys#IsExecutable('cygpath') "{{{2 +endif + + +if !exists('g:tlib#sys#cygwin_path_rx') + " If a full windows filename (with slashes instead of backslashes) + " matches this |regexp|, it is assumed to be a cygwin executable. + let g:tlib#sys#cygwin_path_rx = '/cygwin/' "{{{2 +endif + + +if !exists('g:tlib#sys#cygwin_expr') + " For cygwin binaries, convert command calls using this vim + " expression. + let g:tlib#sys#cygwin_expr = '"bash -c ''". escape(%s, "''\\") ."''"' "{{{2 +endif + + +let s:cygwin = {} + +function! tlib#sys#IsCygwinBin(cmd) "{{{3 + " TLogVAR a:cmd + if !g:tlib#sys#windows + return 0 + elseif has_key(s:cygwin, a:cmd) + let rv = s:cygwin[a:cmd] + else + if !tlib#sys#IsExecutable('cygpath', 1) || !tlib#sys#IsExecutable('which', 1) + let rv = 0 + else + let which = substitute(system('which '. shellescape(a:cmd)), '\n$', '', '') + " echom "DBG which:" which + if which =~ '^/' + let filename = system('cygpath -ma '. shellescape(which)) + " echom "DBG filename:" filename + let rv = filename =~ g:tlib#sys#cygwin_path_rx + else + let rv = 0 + endif + endif + let s:cygwin[a:cmd] = rv + endif + " TLogVAR rv + return rv +endf + + +function! tlib#sys#GetCmd(cmd) "{{{3 + if !empty(g:tlib#sys#cygwin_expr) && tlib#sys#IsCygwinBin(matchstr(a:cmd, '^\S\+')) + let cmd = eval(printf(g:tlib#sys#cygwin_expr, string(a:cmd))) + " TLogVAR cmd + return cmd + else + return a:cmd + endif +endf + + +" If cmd seems to be a cygwin executable, use cygpath to convert +" filenames. This assumes that cygwin's which command returns full +" filenames for non-cygwin executables. +function! tlib#sys#MaybeUseCygpath(cmd) "{{{3 + " echom "DBG" a:cmd + if g:tlib#sys#check_cygpath && tlib#sys#IsCygwinBin(a:cmd) + return 'cygpath -u "%s"' + endif + return '' +endf + + +function! tlib#sys#ConvertPath(converter, filename) "{{{3 + return tlib#string#Chomp(system(printf(a:converter, shellescape(a:filename)))) +endf + + +let s:native_filenames = {} + +function! tlib#sys#FileArgs(cmd, files) "{{{3 + let cygpath = tlib#sys#MaybeUseCygpath(a:cmd) + " TLogVAR cygpath + if empty(cygpath) + return a:files + else + let files = map(copy(a:files), 'has_key(s:native_filenames, v:val) ? s:native_filenames[v:val] : tlib#sys#CygPath(v:val)') + return files + endif +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/tab.vim b/sources_non_forked/tlib/autoload/tlib/tab.vim index c6159586..6fc3bd46 100644 --- a/sources_non_forked/tlib/autoload/tlib/tab.vim +++ b/sources_non_forked/tlib/autoload/tlib/tab.vim @@ -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: 2007-08-27. -" @Last Change: 2009-02-15. -" @Revision: 0.0.29 +" @Last Change: 2014-02-06. +" @Revision: 0.0.30 if &cp || exists("loaded_tlib_tab_autoload") finish @@ -50,6 +50,8 @@ endf function! tlib#tab#Set(tabnr) "{{{3 - exec a:tabnr .'tabnext' + if a:tabnr > 0 + exec a:tabnr .'tabnext' + endif endf diff --git a/sources_non_forked/tlib/autoload/tlib/var.vim b/sources_non_forked/tlib/autoload/tlib/var.vim index 0f44b8af..86c1350a 100644 --- a/sources_non_forked/tlib/autoload/tlib/var.vim +++ b/sources_non_forked/tlib/autoload/tlib/var.vim @@ -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: 2007-06-30. -" @Last Change: 2009-02-15. -" @Revision: 0.0.23 +" @Last Change: 2014-07-03. +" @Revision: 0.0.26 if &cp || exists("loaded_tlib_var_autoload") finish @@ -58,10 +58,12 @@ endf " echo tlib#var#Get('foo', 'bg') => 2 " echo tlib#var#Get('foo', 'wbg') => 3 function! tlib#var#Get(var, namespace, ...) "{{{3 + let var_ = substitute(a:var, '#', '_', 'g') for namespace in split(a:namespace, '\zs') - let var = namespace .':'. a:var + let vname = namespace == 'g' ? a:var : var_ + let var = namespace .':'. vname if exists(var) - return eval(var) + return {var} endif endfor return a:0 >= 1 ? a:1 : '' diff --git a/sources_non_forked/tlib/autoload/tlib/vcs.vim b/sources_non_forked/tlib/autoload/tlib/vcs.vim index 42bb0c25..6166db8c 100644 --- a/sources_non_forked/tlib/autoload/tlib/vcs.vim +++ b/sources_non_forked/tlib/autoload/tlib/vcs.vim @@ -2,8 +2,8 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-03-08. -" @Last Change: 2012-09-10. -" @Revision: 122 +" @Last Change: 2014-07-01. +" @Revision: 131 " A dictionarie of supported VCS (currently: git, hg, svn, bzr). @@ -49,16 +49,21 @@ if !empty(g:tlib#vcs#check) let g:tlib#vcs#executables[s:cmd] = executable(s:cmd1) ? s:cmd1 : '' endif endfor + unlet! s:cmd s:def s:cmd1 endif +function! tlib#vcs#Executable(type) "{{{3 + return get(g:tlib#vcs#executables, a:type, '') +endf + + function! tlib#vcs#FindVCS(filename) "{{{3 let type = '' let dir = '' - " let path = escape(fnamemodify(a:filename, ':p'), ',:') .';' - let filename = fnamemodify(a:filename, isdirectory(a:filename) ? ':p:h' : ':p') - let path = escape(filename, ';') .';' - " TLogVAR a:filename, path + let dirname = fnamemodify(a:filename, isdirectory(a:filename) ? ':p' : ':p:h') + let path = escape(dirname, ';') .';' + " TLogVAR a:filename, dirname, path let depth = -1 for vcs in keys(g:tlib#vcs#def) let subdir = g:tlib#vcs#def[vcs].dir diff --git a/sources_non_forked/tlib/autoload/tlib/vim.vim b/sources_non_forked/tlib/autoload/tlib/vim.vim index 150c4161..7154aeb1 100644 --- a/sources_non_forked/tlib/autoload/tlib/vim.vim +++ b/sources_non_forked/tlib/autoload/tlib/vim.vim @@ -4,7 +4,7 @@ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2010-07-19. " @Last Change: 2012-06-08. -" @Revision: 35 +" @Revision: 37 let s:restoreframecmd = '' @@ -120,3 +120,33 @@ function! s:RestoreFrameParams() "{{{3 endif endf + +" :display: tlib#vim##CopyFunction(old, new, overwrite=0) +function! tlib#vim#CopyFunction(old, new, ...) "{{{3 + let overwrite = a:0 >= 1 ? a:1 : 0 + redir => oldfn + exec 'silent function' a:old + redir END + if exists('*'. a:new) + if overwrite > 0 + exec 'delfunction' a:new + elseif overwrite < 0 + throw 'tlib#vim##CopyFunction: Function already exists: '. a:old .' -> '. a:new + else + return + endif + endif + let fn = split(oldfn, '\n') + let fn = map(fn, 'substitute(v:val, ''^\d\+'', "", "")') + let fn[0] = substitute(fn[0], '\V\^\s\*fu\%[nction]!\?\s\+\zs'. a:old, a:new, '') + let t = @t + try + let @t = join(fn, "\n") + redir => out + @t + redir END + finally + let @t = t + endtry +endf + diff --git a/sources_non_forked/tlib/doc/tlib.txt b/sources_non_forked/tlib/doc/tlib.txt index f12563aa..3d5fc3f3 100644 --- a/sources_non_forked/tlib/doc/tlib.txt +++ b/sources_non_forked/tlib/doc/tlib.txt @@ -38,6 +38,13 @@ Contents~ :TBrowseOutput ......................... |:TBrowseOutput| :TBrowseScriptnames .................... |:TBrowseScriptnames| :TTimeCommand .......................... |:TTimeCommand| + Add .................................... |Add()| + TestGetArg ............................. |TestGetArg()| + TestGetArg1 ............................ |TestGetArg1()| + TestArgs ............................... |TestArgs()| + TestArgs1 .............................. |TestArgs1()| + TestArgs2 .............................. |TestArgs2()| + TestArgs3 .............................. |TestArgs3()| g:tlib#debug ........................... |g:tlib#debug| tlib#notify#Echo ....................... |tlib#notify#Echo()| tlib#notify#TrimMessage ................ |tlib#notify#TrimMessage()| @@ -45,6 +52,7 @@ Contents~ tlib#persistent#Dir .................... |tlib#persistent#Dir()| tlib#persistent#Filename ............... |tlib#persistent#Filename()| tlib#persistent#Get .................... |tlib#persistent#Get()| + tlib#persistent#MTime .................. |tlib#persistent#MTime()| tlib#persistent#Value .................. |tlib#persistent#Value()| tlib#persistent#Save ................... |tlib#persistent#Save()| g:tlib#vim#simalt_maximize ............. |g:tlib#vim#simalt_maximize| @@ -53,6 +61,7 @@ Contents~ tlib#vim#Maximize ...................... |tlib#vim#Maximize()| tlib#vim#RestoreWindow ................. |tlib#vim#RestoreWindow()| g:tlib#vim#use_wmctrl .................. |g:tlib#vim#use_wmctrl| + tlib#vim#CopyFunction .................. |tlib#vim#CopyFunction()| tlib#progressbar#Init .................. |tlib#progressbar#Init()| tlib#progressbar#Display ............... |tlib#progressbar#Display()| tlib#progressbar#Restore ............... |tlib#progressbar#Restore()| @@ -68,6 +77,7 @@ Contents~ tlib#list#RemoveAll .................... |tlib#list#RemoveAll()| tlib#list#Zip .......................... |tlib#list#Zip()| tlib#list#Uniq ......................... |tlib#list#Uniq()| + tlib#list#ToDictionary ................. |tlib#list#ToDictionary()| tlib#cmd#OutputAsList .................. |tlib#cmd#OutputAsList()| tlib#cmd#BrowseOutput .................. |tlib#cmd#BrowseOutput()| tlib#cmd#BrowseOutputWithCallback ...... |tlib#cmd#BrowseOutputWithCallback()| @@ -83,12 +93,16 @@ Contents~ g:tlib#vcs#def ......................... |g:tlib#vcs#def| g:tlib#vcs#executables ................. |g:tlib#vcs#executables| g:tlib#vcs#check ....................... |g:tlib#vcs#check| + tlib#vcs#Executable .................... |tlib#vcs#Executable()| tlib#vcs#FindVCS ....................... |tlib#vcs#FindVCS()| tlib#vcs#Ls ............................ |tlib#vcs#Ls()| tlib#vcs#Diff .......................... |tlib#vcs#Diff()| tlib#char#Get .......................... |tlib#char#Get()| tlib#char#IsAvailable .................. |tlib#char#IsAvailable()| tlib#char#GetWithTimeout ............... |tlib#char#GetWithTimeout()| + g:tlib#Filter_glob#seq ................. |g:tlib#Filter_glob#seq| + g:tlib#Filter_glob#char ................ |g:tlib#Filter_glob#char| + tlib#Filter_glob#New ................... |tlib#Filter_glob#New()| g:tlib_scratch_pos ..................... |g:tlib_scratch_pos| g:tlib#scratch#hidden .................. |g:tlib#scratch#hidden| tlib#scratch#UseScratch ................ |tlib#scratch#UseScratch()| @@ -105,6 +119,7 @@ Contents~ tlib#cache#Dir ......................... |tlib#cache#Dir()| tlib#cache#Filename .................... |tlib#cache#Filename()| tlib#cache#Save ........................ |tlib#cache#Save()| + tlib#cache#MTime ....................... |tlib#cache#MTime()| tlib#cache#Get ......................... |tlib#cache#Get()| tlib#cache#Value ....................... |tlib#cache#Value()| tlib#cache#MaybePurge .................. |tlib#cache#MaybePurge()| @@ -124,6 +139,8 @@ Contents~ tlib#agent#CopyItems ................... |tlib#agent#CopyItems()| tlib#agent#PageUp ...................... |tlib#agent#PageUp()| tlib#agent#PageDown .................... |tlib#agent#PageDown()| + tlib#agent#Home ........................ |tlib#agent#Home()| + tlib#agent#End ......................... |tlib#agent#End()| tlib#agent#Up .......................... |tlib#agent#Up()| tlib#agent#Down ........................ |tlib#agent#Down()| tlib#agent#UpN ......................... |tlib#agent#UpN()| @@ -178,8 +195,6 @@ Contents~ tlib#bitwise#ShiftLeft ................. |tlib#bitwise#ShiftLeft()| tlib#bitwise#Add ....................... |tlib#bitwise#Add()| tlib#bitwise#Sub ....................... |tlib#bitwise#Sub()| - g:tlib#Filter_cnfx#expander ............ |g:tlib#Filter_cnfx#expander| - tlib#Filter_cnfx#New ................... |tlib#Filter_cnfx#New()| tlib#url#Decode ........................ |tlib#url#Decode()| tlib#url#DecodeChar .................... |tlib#url#DecodeChar()| tlib#url#EncodeChar .................... |tlib#url#EncodeChar()| @@ -226,7 +241,19 @@ Contents~ tlib#file#Join ......................... |tlib#file#Join()| tlib#file#Relative ..................... |tlib#file#Relative()| tlib#file#Absolute ..................... |tlib#file#Absolute()| + tlib#file#Canonic ...................... |tlib#file#Canonic()| tlib#file#With ......................... |tlib#file#With()| + g:tlib#sys#windows ..................... |g:tlib#sys#windows| + g:tlib#sys#null ........................ |g:tlib#sys#null| + tlib#sys#IsExecutable .................. |tlib#sys#IsExecutable()| + g:tlib#sys#check_cygpath ............... |g:tlib#sys#check_cygpath| + g:tlib#sys#cygwin_path_rx .............. |g:tlib#sys#cygwin_path_rx| + g:tlib#sys#cygwin_expr ................. |g:tlib#sys#cygwin_expr| + tlib#sys#IsCygwinBin ................... |tlib#sys#IsCygwinBin()| + tlib#sys#GetCmd ........................ |tlib#sys#GetCmd()| + tlib#sys#MaybeUseCygpath ............... |tlib#sys#MaybeUseCygpath()| + tlib#sys#ConvertPath ................... |tlib#sys#ConvertPath()| + tlib#sys#FileArgs ...................... |tlib#sys#FileArgs()| tlib#paragraph#GetMetric ............... |tlib#paragraph#GetMetric()| tlib#paragraph#Move .................... |tlib#paragraph#Move()| g:tlib_inputlist_pct ................... |g:tlib_inputlist_pct| @@ -235,6 +262,7 @@ Contents~ g:tlib_inputlist_shortmessage .......... |g:tlib_inputlist_shortmessage| tlib#World#New ......................... |tlib#World#New()| prototype.PrintLines + prototype.Suspend tlib#tab#BufMap ........................ |tlib#tab#BufMap()| tlib#tab#TabWinNr ...................... |tlib#tab#TabWinNr()| tlib#tab#Set ........................... |tlib#tab#Set()| @@ -255,6 +283,7 @@ Contents~ tlib#arg#Let ........................... |tlib#arg#Let()| tlib#arg#Key ........................... |tlib#arg#Key()| tlib#arg#StringAsKeyArgs ............... |tlib#arg#StringAsKeyArgs()| + tlib#arg#StringAsKeyArgsEqual .......... |tlib#arg#StringAsKeyArgsEqual()| tlib#arg#Ex ............................ |tlib#arg#Ex()| tlib#fixes#Winpos ...................... |tlib#fixes#Winpos()| g:tlib#dir#sep ......................... |g:tlib#dir#sep| @@ -409,6 +438,33 @@ plugin/02tlib.vim~ Time the execution time of CMD. +======================================================================== +test/tlib.vim~ + + *Add()* +Add(a,b) + List + + *TestGetArg()* +TestGetArg(...) + Optional arguments + + *TestGetArg1()* +TestGetArg1(...) + + *TestArgs()* +TestArgs(...) + + *TestArgs1()* +TestArgs1(...) + + *TestArgs2()* +TestArgs2(...) + + *TestArgs3()* +TestArgs3(...) + + ======================================================================== autoload/tlib.vim~ @@ -451,7 +507,10 @@ tlib#persistent#Dir(?mode = 'bg') tlib#persistent#Filename(type, ?file=%, ?mkdir=0) *tlib#persistent#Get()* -tlib#persistent#Get(cfile) +tlib#persistent#Get(...) + + *tlib#persistent#MTime()* +tlib#persistent#MTime(cfile) *tlib#persistent#Value()* tlib#persistent#Value(...) @@ -500,6 +559,9 @@ g:tlib#vim#use_wmctrl (default: executable('wmctrl')) default method of setting 'lines' and 'columns' to a large value. + *tlib#vim#CopyFunction()* +tlib#vim##CopyFunction(old, new, overwrite=0) + ======================================================================== autoload/tlib/progressbar.vim~ @@ -611,6 +673,9 @@ tlib#list#Zip(lists, ?default='') *tlib#list#Uniq()* tlib#list#Uniq(list, ...) + *tlib#list#ToDictionary()* +tlib#list#ToDictionary(list, default, ...) + ======================================================================== autoload/tlib/cmd.vim~ @@ -700,6 +765,9 @@ g:tlib#vcs#check (default: has('win16') || has('win32') || has('wi If non-empty, use it as a format string to check whether a VCS is installed on your computer. + *tlib#vcs#Executable()* +tlib#vcs#Executable(type) + *tlib#vcs#FindVCS()* tlib#vcs#FindVCS(filename) @@ -731,6 +799,25 @@ tlib#char#IsAvailable() tlib#char#GetWithTimeout(timeout, ...) +======================================================================== +autoload/tlib/Filter_glob.vim~ + + *g:tlib#Filter_glob#seq* +g:tlib#Filter_glob#seq (default: '*') + A character that should be expanded to '\.\{-}'. + + *g:tlib#Filter_glob#char* +g:tlib#Filter_glob#char (default: '?') + A character that should be expanded to '\.\?'. + + *tlib#Filter_glob#New()* +tlib#Filter_glob#New(...) + The same as |tlib#Filter_cnf#New()| but a a customizable character + |see tlib#Filter_glob#seq| is expanded to '\.\{-}' and + |g:tlib#Filter_glob#char| is expanded to '\.'. + The pattern is a '/\V' very no-'/magic' regexp pattern. + + ======================================================================== autoload/tlib/scratch.vim~ @@ -828,8 +915,11 @@ tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='') *tlib#cache#Save()* tlib#cache#Save(cfile, dictionary) + *tlib#cache#MTime()* +tlib#cache#MTime(cfile) + *tlib#cache#Get()* -tlib#cache#Get(cfile) +tlib#cache#Get(cfile, ...) *tlib#cache#Value()* tlib#cache#Value(cfile, generator, ftime, ...) @@ -939,6 +1029,12 @@ tlib#agent#PageUp(world, selected) *tlib#agent#PageDown()* tlib#agent#PageDown(world, selected) + *tlib#agent#Home()* +tlib#agent#Home(world, selected) + + *tlib#agent#End()* +tlib#agent#End(world, selected) + *tlib#agent#Up()* tlib#agent#Up(world, selected, ...) @@ -1116,20 +1212,6 @@ tlib#bitwise#Add(num1, num2, ...) tlib#bitwise#Sub(num1, num2, ...) -======================================================================== -autoload/tlib/Filter_cnfx.vim~ - - *g:tlib#Filter_cnfx#expander* -g:tlib#Filter_cnfx#expander (default: '+') - A character that should be expanded to '\.\{-}'. - - *tlib#Filter_cnfx#New()* -tlib#Filter_cnfx#New(...) - The same as |tlib#Filter_cnfd#New()| but a a customizable character - |see tlib#Filter_cnfx#expander| is expanded to '\.\{-}'. - The pattern is a '/\V' very no-'/magic' regexp pattern. - - ======================================================================== autoload/tlib/url.vim~ @@ -1274,18 +1356,17 @@ g:tlib#input#livesearch_threshold (default: 1000) filter. This is useful on slower machines or with very long lists. *g:tlib#input#filter_mode* -g:tlib#input#filter_mode (default: 'cnfx') +g:tlib#input#filter_mode (default: 'glob') Determine how |tlib#input#List()| and related functions work. - Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See: - cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted - as a wildcard (this is the default method) - - A plus character ("+") acts as a wildcard as if ".\{-}" (see - |/\{-|) were entered. + Can be "glob", "cnf", "cnfd", "seq", or "fuzzy". See: + glob ... Like cnf but "*" and "?" (see |g:tlib#Filter_glob#seq|, + |g:tlib#Filter_glob#char|) are interpreted as glob-like + |wildcards| (this is the default method) - Examples: - - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match + - "f*o" matches "fo", "fxo", and "fxxxoo", but doesn't match "far". - Otherwise it is a derivate of the cnf method (see below). - - See also |tlib#Filter_cnfx#New()|. + - See also |tlib#Filter_glob#New()|. cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is expanded to "\.\{-}" - A period character (".") acts as a wildcard as if ".\{-}" (see @@ -1495,7 +1576,7 @@ tlib#file#Split(filename) < *tlib#file#Join()* -tlib#file#Join(filename_parts, ?strip_slashes=0) +tlib#file#Join(filename_parts, ?strip_slashes=1) EXAMPLES: > tlib#file#Join(['foo', 'bar', 'filename.txt']) => 'foo/bar/filename.txt' @@ -1511,10 +1592,59 @@ tlib#file#Relative(filename, basedir) *tlib#file#Absolute()* tlib#file#Absolute(filename, ...) + *tlib#file#Canonic()* +tlib#file#Canonic(filename, ...) + *tlib#file#With()* tlib#file#With(fcmd, bcmd, files, ?world={}) +======================================================================== +autoload/tlib/sys.vim~ + + *g:tlib#sys#windows* +g:tlib#sys#windows (default: &shell !~ 'sh' && (has('win16') || has('win32') || has('win64'))) + + *g:tlib#sys#null* +g:tlib#sys#null (default: g:tlib#sys#windows ? 'NUL' : (filereadable('/dev/null') ? '/dev/null' : '')) + + *tlib#sys#IsExecutable()* +tlib#sys#IsExecutable(cmd, ...) + + *g:tlib#sys#check_cygpath* +g:tlib#sys#check_cygpath (default: g:tlib#sys#windows && tlib#sys#IsExecutable('cygpath')) + If true, check whether we have to convert a path via cyppath -- + see |tlib#sys#MaybeUseCygpath| + + *g:tlib#sys#cygwin_path_rx* +g:tlib#sys#cygwin_path_rx (default: '/cygwin/') + If a full windows filename (with slashes instead of backslashes) + matches this |regexp|, it is assumed to be a cygwin executable. + + *g:tlib#sys#cygwin_expr* +g:tlib#sys#cygwin_expr (default: '"bash -c ''". escape(%s, "''\\") ."''"') + For cygwin binaries, convert command calls using this vim + expression. + + *tlib#sys#IsCygwinBin()* +tlib#sys#IsCygwinBin(cmd) + + *tlib#sys#GetCmd()* +tlib#sys#GetCmd(cmd) + + *tlib#sys#MaybeUseCygpath()* +tlib#sys#MaybeUseCygpath(cmd) + If cmd seems to be a cygwin executable, use cygpath to convert + filenames. This assumes that cygwin's which command returns full + filenames for non-cygwin executables. + + *tlib#sys#ConvertPath()* +tlib#sys#ConvertPath(converter, filename) + + *tlib#sys#FileArgs()* +tlib#sys#FileArgs(cmd, files) + + ======================================================================== autoload/tlib/paragraph.vim~ @@ -1568,6 +1698,8 @@ tlib#World#New(...) prototype.PrintLines +prototype.Suspend + ======================================================================== autoload/tlib/tab.vim~ @@ -1672,7 +1804,10 @@ tlib#arg#Key(dict, list, ?default='') See |:TKeyArg|. *tlib#arg#StringAsKeyArgs()* -tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0) +tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0, ?sep=':') + + *tlib#arg#StringAsKeyArgsEqual()* +tlib#arg#StringAsKeyArgsEqual(string) *tlib#arg#Ex()* tlib#arg#Ex(arg, ?chars='%#! ') @@ -2004,7 +2139,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) @@ -2030,4 +2165,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: diff --git a/sources_non_forked/tlib/plugin/02tlib.vim b/sources_non_forked/tlib/plugin/02tlib.vim index 2cfe155a..cadec3ea 100644 --- a/sources_non_forked/tlib/plugin/02tlib.vim +++ b/sources_non_forked/tlib/plugin/02tlib.vim @@ -1,11 +1,11 @@ -" tlib.vim -- Some utility functions " @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) " @Created: 2007-04-10. -" @Last Change: 2013-09-25. -" @Revision: 746 +" @Last Change: 2014-07-03. +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Revision: 753 +" @Website: http://www.vim.org/account/profile.php?user_id=4037 " GetLatestVimScripts: 1863 1 tlib.vim +" tlib.vim -- Some utility functions if &cp || exists("loaded_tlib") finish @@ -14,7 +14,7 @@ if v:version < 700 "{{{2 echoerr "tlib requires Vim >= 7" finish endif -let loaded_tlib = 106 +let loaded_tlib = 112 let s:save_cpo = &cpo set cpo&vim diff --git a/sources_non_forked/vim-airline/LICENSE b/sources_non_forked/vim-airline/LICENSE index 46977354..9a5a8b73 100644 --- a/sources_non_forked/vim-airline/LICENSE +++ b/sources_non_forked/vim-airline/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (C) 2013 Bailey Ling +Copyright (C) 2013-2014 Bailey Ling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/sources_non_forked/vim-airline/README.md b/sources_non_forked/vim-airline/README.md index dd59b889..b98e3485 100644 --- a/sources_non_forked/vim-airline/README.md +++ b/sources_non_forked/vim-airline/README.md @@ -7,10 +7,10 @@ Lean & mean status/tabline for vim that's light as air. # Features * Tiny core written with extensibility in mind ([open/closed principle][8]). -* Integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [vim-signify][30], [syntastic][5], [eclim][34], [lawrencium][21] and [virtualenv][31]. +* Integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [vim-gitgutter][29], [vim-signify][30], [syntastic][5], [eclim][34], [lawrencium][21], [virtualenv][31], [tmuxline][35]. * Looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols. * Optimized for speed; it loads in under a millisecond. -* Extensive suite of themes for popular colorschemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others; have a look at the [screenshots][14] in the wiki. +* Extensive suite of themes for popular color schemes including [solarized][23] (dark and light), [tomorrow][24] (all variants), [base16][32] (all variants), [molokai][25], [jellybeans][26] and others; have a look at the [screenshots][14] in the wiki. * Supports 7.2 as the minimum Vim version. * The master branch tries to be as stable as possible, and new features are merged in only after they have gone through a [full regression test][33]. * Unit testing suite. @@ -67,6 +67,12 @@ vim-airline integrates with a variety of plugins out of the box. These extensio #### [virtualenv][31] ![image](https://f.cloud.github.com/assets/390964/1022566/cf81f830-0d98-11e3-904f-cf4fe3ce201e.png) +#### [tmuxline][35] +![image](https://f.cloud.github.com/assets/1532071/1559276/4c28fbac-4fc7-11e3-90ef-7e833d980f98.gif) + +#### [promptline][36] +![airline-promptline-sc](https://f.cloud.github.com/assets/1532071/1871900/7d4b28a0-789d-11e3-90e4-16f37269981b.gif) + ## Extras vim-airline also supplies some supplementary stand-alone extensions. In addition to the tabline extension mentioned earlier, there is also: @@ -115,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 @@ -125,6 +131,9 @@ This plugin follows the standard runtime path structure, and as such it can be i `:help airline` +The default setting of 'laststatus' is for the statusline to not appear until a split is created. If you want it to appear all the time, add the following to your vimrc: +`set laststatus=2` + # Integrating with powerline fonts For the nice looking powerline symbols to appear, you will need to install a patched font. Instructions can be found in the official powerline [documentation][20]. Prepatched fonts can be found in the [powerline-fonts][3] repository. @@ -158,7 +167,7 @@ Contributions and pull requests are welcome. Please take note of the following # License -MIT License. Copyright (c) 2013 Bailey Ling. +MIT License. Copyright (c) 2013-2014 Bailey Ling. [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/bling/vim-airline/trend.png)](https://bitdeli.com/free "Bitdeli Badge") @@ -197,3 +206,5 @@ MIT License. Copyright (c) 2013 Bailey Ling. [32]: https://github.com/chriskempson/base16-vim [33]: https://github.com/bling/vim-airline/wiki/Test-Plan [34]: http://eclim.org +[35]: https://github.com/edkolev/tmuxline.vim +[36]: https://github.com/edkolev/promptline.vim diff --git a/sources_non_forked/vim-airline/autoload/airline.vim b/sources_non_forked/vim-airline/autoload/airline.vim index 664c78e6..b4a88817 100644 --- a/sources_non_forked/vim-airline/autoload/airline.vim +++ b/sources_non_forked/vim-airline/autoload/airline.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let g:airline_statusline_funcrefs = get(g:, 'airline_statusline_funcrefs', []) @@ -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) diff --git a/sources_non_forked/vim-airline/autoload/airline/builder.vim b/sources_non_forked/vim-airline/autoload/airline/builder.vim index c1658974..d03af12e 100644 --- a/sources_non_forked/vim-airline/autoload/airline/builder.vim +++ b/sources_non_forked/vim-airline/autoload/airline/builder.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:prototype = {} diff --git a/sources_non_forked/vim-airline/autoload/airline/debug.vim b/sources_non_forked/vim-airline/autoload/airline/debug.vim index 04d7e59c..28424a65 100644 --- a/sources_non_forked/vim-airline/autoload/airline/debug.vim +++ b/sources_non_forked/vim-airline/autoload/airline/debug.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 function! airline#debug#profile1() diff --git a/sources_non_forked/vim-airline/autoload/airline/deprecation.vim b/sources_non_forked/vim-airline/autoload/airline/deprecation.vim index dd0567fc..cf7e7872 100644 --- a/sources_non_forked/vim-airline/autoload/airline/deprecation.vim +++ b/sources_non_forked/vim-airline/autoload/airline/deprecation.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 function! airline#deprecation#check() diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions.vim b/sources_non_forked/vim-airline/autoload/airline/extensions.vim index 8707dbd7..64560738 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:ext = {} @@ -20,7 +20,6 @@ endfunction let s:script_path = tolower(resolve(expand(':p:h'))) let s:filetype_overrides = { - \ 'netrw': [ 'netrw', '%f' ], \ 'nerdtree': [ 'NERD', '' ], \ 'gundo': [ 'Gundo', '' ], \ 'diff': [ 'diff', '' ], @@ -128,6 +127,10 @@ function! airline#extensions#load() call airline#extensions#unite#init(s:ext) endif + if exists(':NetrwSettings') + call airline#extensions#netrw#init(s:ext) + endif + if get(g:, 'loaded_vimfiler', 0) let g:vimfiler_force_overwrite_statusline = 0 endif @@ -145,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 @@ -165,7 +168,8 @@ function! airline#extensions#load() endif if (get(g:, 'airline#extensions#branch#enabled', 1) && get(g:, 'airline_enable_branch', 1)) - \ && (exists('*fugitive#head') || exists('*lawrencium#statusline')) + \ && (exists('*fugitive#head') || exists('*lawrencium#statusline') || + \ (get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine'))) call airline#extensions#branch#init(s:ext) endif @@ -195,21 +199,40 @@ function! airline#extensions#load() call airline#extensions#tabline#init(s:ext) endif - " load all other extensions not part of the default distribution - 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#tmuxline#enabled', 1) && exists(':Tmuxline') + call airline#extensions#tmuxline#init(s:ext) + endif + + if get(g:, 'airline#extensions#promptline#enabled', 1) && exists(':PromptlineSnapshot') && len(get(g:, 'airline#extensions#promptline#snapshot_file', '')) + call airline#extensions#promptline#init(s:ext) + endif + + if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2 + call airline#extensions#nrrwrgn#init(s:ext) + endif + + if (get(g:, 'airline#extensions#capslock#enabled', 1) && exists('*CapsLockStatusline')) + call airline#extensions#capslock#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 diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim index 87a70693..954b0f68 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/branch.vim @@ -1,8 +1,7 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:has_fugitive = exists('*fugitive#head') -let s:has_fugitive_detect = exists('*fugitive#detect') let s:has_lawrencium = exists('*lawrencium#statusline') let s:has_vcscommand = get(g:, 'airline#extensions#branch#use_vcscommand', 0) && exists('*VCSCommandGetStatusLine') @@ -10,46 +9,86 @@ if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand finish endif -let s:empty_message = get(g:, 'airline#extensions#branch#empty_message', - \ get(g:, 'airline_branch_empty_message', '')) -let s:symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) +let s:git_dirs = {} +function! s:get_git_branch(path) + if has_key(s:git_dirs, a:path) + return s:git_dirs[a:path] + endif -function! airline#extensions#branch#get_head() - let head = '' + let dir = fugitive#extract_git_dir(a:path) + if empty(dir) + let name = '' + else + try + let line = join(readfile(dir . '/HEAD')) + let name = strpart(line, 16) + catch + let name = '' + endtry + endif + + let s:git_dirs[a:path] = name + return name +endfunction + +function! airline#extensions#branch#head() + if exists('b:airline_head') && !empty(b:airline_head) + return b:airline_head + endif + + let b:airline_head = '' if s:has_fugitive && !exists('b:mercurial_dir') - let head = fugitive#head() + let b:airline_head = fugitive#head() - if empty(head) && s:has_fugitive_detect && !exists('b:git_dir') - call fugitive#detect(getcwd()) - let head = fugitive#head() + if empty(b:airline_head) && !exists('b:git_dir') + let b:airline_head = s:get_git_branch(expand("%:p:h")) endif endif - if empty(head) + if empty(b:airline_head) if s:has_lawrencium - let head = lawrencium#statusline() + let b:airline_head = lawrencium#statusline() endif endif - if empty(head) + if empty(b:airline_head) if s:has_vcscommand call VCSCommandEnableBufferSetup() if exists('b:VCSCommandBufferInfo') - let head = get(b:VCSCommandBufferInfo, 0, '') + let b:airline_head = get(b:VCSCommandBufferInfo, 0, '') endif endif endif - return empty(head) || !s:check_in_path() - \ ? s:empty_message - \ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.(g:airline_symbols.space), head) + if empty(b:airline_head) || !s:check_in_path() + 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 + +function! airline#extensions#branch#get_head() + let head = airline#extensions#branch#head() + let empty_message = get(g:, 'airline#extensions#branch#empty_message', + \ get(g:, 'airline_branch_empty_message', '')) + let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) + return empty(head) + \ ? empty_message + \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head) endfunction function! s:check_in_path() if !exists('b:airline_branch_path') let root = get(b:, 'git_dir', get(b:, 'mercurial_dir', '')) - let bufferpath = resolve(fnamemodify(expand('%'), ':p:h')) + let bufferpath = resolve(fnamemodify(expand('%'), ':p')) if !filereadable(root) "not a file " if .git is a directory, it's the old submodule format @@ -72,5 +111,5 @@ function! airline#extensions#branch#init(ext) call airline#parts#define_function('branch', 'airline#extensions#branch#get_head') autocmd BufReadPost * unlet! b:airline_file_in_root + autocmd CursorHold,ShellCmdPost,CmdwinLeave * unlet! b:airline_head endfunction - diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/bufferline.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/bufferline.vim index 0c6013ce..6dc97fe7 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/bufferline.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/bufferline.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists('*bufferline#get_status_string') diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/capslock.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/capslock.vim new file mode 100644 index 00000000..689b5617 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/capslock.vim @@ -0,0 +1,14 @@ +" MIT License. Copyright (c) 2014 Mathias Andersson. +" vim: et ts=2 sts=2 sw=2 +if !exists('*CapsLockStatusline') + finish +endif + +function! airline#extensions#capslock#status() + return CapsLockStatusline() == '[caps]' ? 'CAPS' : '' +endfunction + +function! airline#extensions#capslock#init(ext) + call airline#parts#define_function('capslock', 'airline#extensions#capslock#status') +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/commandt.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/commandt.vim index 1353940b..e549f27b 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/commandt.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/commandt.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'command_t_loaded', 0) diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/csv.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/csv.vim index d3a8cc84..2c296ab3 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/csv.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/csv.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'loaded_csv', 0) && !exists(':Table') diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/ctrlp.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/ctrlp.vim index 64e28854..11a89220 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/ctrlp.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/ctrlp.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'loaded_ctrlp', 0) diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/default.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/default.vim index 5d21996f..d01349df 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/default.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/default.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:section_truncate_width = get(g:, 'airline#extensions#default#section_truncate_width', { diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/eclim.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/eclim.vim index ff6a84fe..18cbae5e 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/eclim.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/eclim.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':ProjectCreate') @@ -17,12 +17,18 @@ endfunction function! airline#extensions#eclim#get_warnings() let eclimList = eclim#display#signs#GetExisting() + if !empty(eclimList) - let errorsLine = eclimList[0]['line'] - let errorsNumber = len(eclimList) - let errors = "[Eclim: line:".string(errorsLine)." (".string(errorsNumber).")]" - if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' - return errors.(g:airline_symbols.space) + " Remove any non-eclim signs (see eclim#display#signs#Update) + call filter(eclimList, 'v:val.name =~ "^\\(qf_\\)\\?\\(error\\|info\\|warning\\)$"') + + if !empty(eclimList) + let errorsLine = eclimList[0]['line'] + let errorsNumber = len(eclimList) + let errors = "[Eclim: line:".string(errorsLine)." (".string(errorsNumber).")]" + if !exists(':SyntasticCheck') || SyntasticStatuslineFlag() == '' + return errors.(g:airline_symbols.space) + endif endif endif return '' diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/example.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/example.vim index 0c64f2c8..4a1932d8 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/example.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/example.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 " we don't actually want this loaded :P diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim index 73c0e2ea..968fd66f 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/hunks.vim @@ -1,7 +1,7 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" 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 @@ -16,13 +16,30 @@ function! s:get_hunks_signify() return [] endfunction +function! s:is_branch_empty() + return exists('*airline#extensions#branch#head') && empty(airline#extensions#branch#head()) +endfunction + function! s:get_hunks_gitgutter() - if !get(g:, 'gitgutter_enabled', 0) + if !get(g:, 'gitgutter_enabled', 0) || s:is_branch_empty() return '' endif 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 @@ -34,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 diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/netrw.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/netrw.vim new file mode 100644 index 00000000..debb0888 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/netrw.vim @@ -0,0 +1,32 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':NetrwSettings') + finish +endif + +function! airline#extensions#netrw#apply(...) + if &ft == 'netrw' + let spc = g:airline_symbols.space + + call a:1.add_section('airline_a', spc.'netrw'.spc) + if exists('*airline#extensions#branch#get_head') + call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) + endif + call a:1.add_section('airline_c', spc.'%f'.spc) + call a:1.split() + call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc) + return 1 + endif +endfunction + +function! airline#extensions#netrw#init(ext) + let g:netrw_force_overwrite_statusline = 0 + call a:ext.add_statusline_func('airline#extensions#netrw#apply') +endfunction + + +function! airline#extensions#netrw#sortstring() + let order = (g:netrw_sort_direction =~ 'n') ? '+' : '-' + return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']' +endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/nrrwrgn.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/nrrwrgn.vim new file mode 100644 index 00000000..338f6e05 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/nrrwrgn.vim @@ -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 diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/promptline.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/promptline.vim new file mode 100644 index 00000000..50b9708f --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/promptline.vim @@ -0,0 +1,33 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':PromptlineSnapshot') + finish +endif + +if !exists('airline#extensions#promptline#snapshot_file') || !len('airline#extensions#promptline#snapshot_file') + finish +endif + +let s:prompt_snapshot_file = get(g:, 'airline#extensions#promptline#snapshot_file', '') +let s:color_template = get(g:, 'airline#extensions#promptline#color_template', 'normal') + +function! airline#extensions#promptline#init(ext) + call a:ext.add_theme_func('airline#extensions#promptline#set_prompt_colors') +endfunction + +function! airline#extensions#promptline#set_prompt_colors(palette) + let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' + let mode_palette = a:palette[color_template] + + if !has_key(g:, 'promptline_symbols') + let g:promptline_symbols = { + \ 'left' : g:airline_left_sep, + \ 'right' : g:airline_right_sep, + \ 'left_alt' : g:airline_left_alt_sep, + \ 'right_alt' : g:airline_right_alt_sep} + endif + + let promptline_theme = promptline#api#create_theme_from_airline(mode_palette) + call promptline#api#create_snapshot_with_theme(s:prompt_snapshot_file, promptline_theme) +endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/quickfix.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/quickfix.vim index 7afad864..8efc5275 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/quickfix.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/quickfix.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let g:airline#extensions#quickfix#quickfix_text = 'Quickfix' @@ -24,7 +24,7 @@ function! s:get_text() let nr = bufnr('%') for buf in split(buffers, '\n') - if match(buf, '\v^\s+'.nr) > -1 + if match(buf, '\v^\s*'.nr) > -1 if match(buf, '\[Quickfix List\]') > -1 return g:airline#extensions#quickfix#quickfix_text else diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/syntastic.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/syntastic.vim index 3ecc1eb1..f7179af8 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/syntastic.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/syntastic.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':SyntasticCheck') diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim index b80d16e6..ec75db75 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline.vim @@ -1,10 +1,13 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:formatter = get(g:, 'airline#extensions#tabline#formatter', 'default') let s:excludes = get(g:, 'airline#extensions#tabline#excludes', []) let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) let s:show_buffers = get(g:, 'airline#extensions#tabline#show_buffers', 1) +let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1) +let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) +let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X') let s:builder_context = { \ 'active' : 1, @@ -30,6 +33,7 @@ function! airline#extensions#tabline#init(ext) autocmd User AirlineToggledOn call s:toggle_on() autocmd User AirlineToggledOff call s:toggle_off() + autocmd BufDelete * let s:current_bufnr = -1 call s:toggle_on() call a:ext.add_theme_func('airline#extensions#tabline#load_theme') @@ -103,7 +107,7 @@ function! airline#extensions#tabline#title(n) endfunction function! airline#extensions#tabline#get_buffer_name(nr) - return airline#extensions#tabline#formatters#{s:formatter}(a:nr, get(s:, 'current_buffer_list', [])) + return airline#extensions#tabline#{s:formatter}#format(a:nr, get(s:, 'current_buffer_list', s:get_buffer_list())) endfunction function! s:get_buffer_list() @@ -179,9 +183,19 @@ function! s:get_visible_buffers() return buffers endfunction +let s:current_bufnr = -1 +let s:current_tabnr = -1 +let s:current_tabline = '' +let s:current_modified = 0 function! s:get_buffers() - let b = airline#builder#new(s:builder_context) let cur = bufnr('%') + if cur == s:current_bufnr + if !g:airline_detect_modified || getbufvar(cur, '&modified') == s:current_modified + return s:current_tabline + endif + endif + + let b = airline#builder#new(s:builder_context) let tab_bufs = tabpagebuflist(tabpagenr()) for nr in s:get_visible_buffers() if nr < 0 @@ -194,6 +208,7 @@ function! s:get_buffers() else let group = 'airline_tabsel' endif + let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 else if index(tab_bufs, nr) > -1 let group = 'airline_tab' @@ -207,13 +222,24 @@ function! s:get_buffers() call b.add_section('airline_tabfill', '') call b.split() call b.add_section('airline_tabtype', ' buffers ') - return b.build() + + let s:current_bufnr = cur + let s:current_tabline = b.build() + return s:current_tabline endfunction function! s:get_tabs() + let curbuf = bufnr('%') + let curtab = tabpagenr() + if curbuf == s:current_bufnr && curtab == s:current_tabnr + if !g:airline_detect_modified || getbufvar(curbuf, '&modified') == s:current_modified + return s:current_tabline + endif + endif + let b = airline#builder#new(s:builder_context) for i in range(1, tabpagenr('$')) - if i == tabpagenr() + if i == curtab let group = 'airline_tabsel' if g:airline_detect_modified for bi in tabpagebuflist(i) @@ -222,22 +248,31 @@ function! s:get_tabs() endif endfor endif + let s:current_modified = (group == 'airline_tabmod') ? 1 : 0 else let group = 'airline_tab' endif let val = '%(' - if s:tab_nr_type == 0 - let val .= ' %{len(tabpagebuflist('.i.'))}' - else - let val .= (g:airline_symbols.space).i + if s:show_tab_nr + if s:tab_nr_type == 0 + let val .= ' %{len(tabpagebuflist('.i.'))}' + else + let val .= (g:airline_symbols.space).i + endif endif call b.add_section(group, val.'%'.i.'T %{airline#extensions#tabline#title('.i.')} %)') endfor + call b.add_raw('%T') call b.add_section('airline_tabfill', '') call b.split() - call b.add_section('airline_tab', ' %999XX ') - call b.add_section('airline_tabtype', ' tabs ') - return b.build() -endfunction + call b.add_section('airline_tab', ' %999X'.s:close_symbol.' ') + if s:show_tab_type + call b.add_section('airline_tabtype', ' tabs ') + endif + let s:current_bufnr = curbuf + let s:current_tabnr = curtab + let s:current_tabline = b.build() + return s:current_tabline +endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/formatters.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/default.vim similarity index 51% rename from sources_non_forked/vim-airline/autoload/airline/extensions/tabline/formatters.vim rename to sources_non_forked/vim-airline/autoload/airline/extensions/tabline/default.vim index 656ba225..4f1ed40e 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/formatters.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/default.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.') @@ -7,7 +7,7 @@ let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0) let s:buf_modified_symbol = g:airline_symbols.modified -function! airline#extensions#tabline#formatters#default(bufnr, buffers) +function! airline#extensions#tabline#default#format(bufnr, buffers) let _ = '' let name = bufname(a:bufnr) @@ -21,40 +21,15 @@ function! airline#extensions#tabline#formatters#default(bufnr, buffers) endif endif - return s:wrap_name(a:bufnr, _) + return airline#extensions#tabline#default#wrap_name(a:bufnr, _) endfunction -function! airline#extensions#tabline#formatters#unique_tail(bufnr, buffers) - let duplicates = {} - let tails = {} - let map = {} - for nr in a:buffers - let name = bufname(nr) - if empty(name) - let map[nr] = '[No Name]' - else - let tail = fnamemodify(name, ':t') - if has_key(tails, tail) - let duplicates[nr] = nr - endif - let tails[tail] = 1 - let map[nr] = s:wrap_name(nr, tail) - endif - endfor - - for nr in values(duplicates) - let map[nr] = s:wrap_name(nr, fnamemodify(bufname(nr), ':p:.')) - endfor - - return map[a:bufnr] -endfunction - -function! s:wrap_name(bufnr, buffer_name) +function! airline#extensions#tabline#default#wrap_name(bufnr, buffer_name) let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : '' - let _ .= a:buffer_name + let _ .= substitute(a:buffer_name, '\\', '/', 'g') + if getbufvar(a:bufnr, '&modified') == 1 let _ .= s:buf_modified_symbol endif return _ endfunction - diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail.vim new file mode 100644 index 00000000..e4a790d9 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail.vim @@ -0,0 +1,27 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +function! airline#extensions#tabline#unique_tail#format(bufnr, buffers) + let duplicates = {} + let tails = {} + let map = {} + for nr in a:buffers + let name = bufname(nr) + if empty(name) + let map[nr] = '[No Name]' + else + let tail = fnamemodify(name, ':t') + if has_key(tails, tail) + let duplicates[nr] = nr + endif + let tails[tail] = 1 + let map[nr] = airline#extensions#tabline#default#wrap_name(nr, tail) + endif + endfor + + for nr in values(duplicates) + let map[nr] = airline#extensions#tabline#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.')) + endfor + + return map[a:bufnr] +endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim new file mode 100644 index 00000000..3590fbb5 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tabline/unique_tail_improved.vim @@ -0,0 +1,89 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +let s:skip_symbol = '…' + +function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers) + if len(a:buffers) <= 1 " don't need to compare bufnames if has less than one buffer opened + return airline#extensions#tabline#default#format(a:bufnr, a:buffers) + endif + + let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t') + let do_deduplicate = 0 + let path_tokens = {} + + for nr in a:buffers + let name = bufname(nr) + if !empty(name) && nr != a:bufnr && fnamemodify(name, ':t') == curbuf_tail " only perform actions if curbuf_tail isn't unique + let do_deduplicate = 1 + let tokens = reverse(split(substitute(fnamemodify(name, ':p:h'), '\\', '/', 'g'), '/')) + let token_index = 0 + for token in tokens + if token == '' | continue | endif + if token == '.' | break | endif + if !has_key(path_tokens, token_index) + let path_tokens[token_index] = {} + endif + let path_tokens[token_index][token] = 1 + let token_index += 1 + endfor + endif + endfor + + if do_deduplicate == 1 + let path = [] + let token_index = 0 + for token in reverse(split(substitute(fnamemodify(bufname(a:bufnr), ':p:h'), '\\', '/', 'g'), '/')) + if token == '.' | break | endif + let duplicated = 0 + let uniq = 1 + let single = 1 + if has_key(path_tokens, token_index) + let duplicated = 1 + if len(keys(path_tokens[token_index])) > 1 | let single = 0 | endif + if has_key(path_tokens[token_index], token) | let uniq = 0 | endif + endif + call insert(path, {'token': token, 'duplicated': duplicated, 'uniq': uniq, 'single': single}) + let token_index += 1 + endfor + + let buf_name = [curbuf_tail] + let has_uniq = 0 + let has_skipped = 0 + for token1 in reverse(path) + if !token1['duplicated'] && len(buf_name) > 1 + call insert(buf_name, s:skip_symbol) + let has_skipped = 0 + break + endif + + if has_uniq == 1 + call insert(buf_name, s:skip_symbol) + let has_skipped = 0 + break + endif + + if token1['uniq'] == 0 && token1['single'] == 1 + let has_skipped = 1 + else + if has_skipped == 1 + call insert(buf_name, s:skip_symbol) + let has_skipped = 0 + endif + call insert(buf_name, token1['token']) + endif + + if token1['uniq'] == 1 + let has_uniq = 1 + endif + endfor + + if has_skipped == 1 + call insert(buf_name, s:skip_symbol) + endif + + return airline#extensions#tabline#default#wrap_name(a:bufnr, join(buf_name, '/')) + else + return airline#extensions#tabline#default#format(a:bufnr, a:buffers) + endif +endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tagbar.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tagbar.vim index 061a47f2..56919a85 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/tagbar.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tagbar.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':TagbarToggle') @@ -23,9 +23,15 @@ function! airline#extensions#tagbar#inactive_apply(...) endif endfunction +let s:airline_tagbar_last_lookup_time = 0 +let s:airline_tagbar_last_lookup_val = '' function! airline#extensions#tagbar#currenttag() if get(w:, 'airline_active', 0) - return tagbar#currenttag('%s', '', s:flags) + if s:airline_tagbar_last_lookup_time != localtime() + let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags) + let s:airline_tagbar_last_lookup_time = localtime() + endif + return s:airline_tagbar_last_lookup_val endif return '' endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/tmuxline.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/tmuxline.vim new file mode 100644 index 00000000..363709bc --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/tmuxline.vim @@ -0,0 +1,26 @@ +" MIT License. Copyright (c) 2013-2014 Bailey Ling. +" vim: et ts=2 sts=2 sw=2 + +if !exists(':Tmuxline') + finish +endif + +let s:tmuxline_snapshot_file = get(g:, 'airline#extensions#tmuxline#snapshot_file', '') +let s:color_template = get(g:, 'airline#extensions#tmuxline#color_template', 'normal') + +function! airline#extensions#tmuxline#init(ext) + call a:ext.add_theme_func('airline#extensions#tmuxline#set_tmux_colors') +endfunction + +function! airline#extensions#tmuxline#set_tmux_colors(palette) + let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal' + let mode_palette = a:palette[color_template] + + let tmuxline_theme = tmuxline#api#create_theme_from_airline(mode_palette) + call tmuxline#api#set_theme(tmuxline_theme) + + if strlen(s:tmuxline_snapshot_file) + call tmuxline#api#snapshot(s:tmuxline_snapshot_file) + endif +endfunction + diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/undotree.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/undotree.vim index d897f041..f577ffd8 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/undotree.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/undotree.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !exists(':UndotreeToggle') diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/unite.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/unite.vim index 4db38584..d230b6fb 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/unite.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/unite.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'loaded_unite', 0) diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/virtualenv.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/virtualenv.vim index c052282c..f070c472 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/virtualenv.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/virtualenv.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if !get(g:, 'virtualenv_loaded', 0) diff --git a/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim b/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim index c8910af6..86574129 100644 --- a/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim +++ b/sources_non_forked/vim-airline/autoload/airline/extensions/whitespace.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 " http://got-ravings.blogspot.com/2008/10/vim-pr0n-statusline-whitespace-flags.html @@ -15,11 +15,28 @@ let s:default_checks = ['indent', 'trailing'] let s:trailing_format = get(g:, 'airline#extensions#whitespace#trailing_format', 'trailing[%s]') let s:mixed_indent_format = get(g:, 'airline#extensions#whitespace#mixed_indent_format', 'mixed-indent[%s]') +let s:indent_algo = get(g:, 'airline#extensions#whitespace#mixed_indent_algo', 0) -let s:enabled = 1 +let s:max_lines = get(g:, 'airline#extensions#whitespace#max_lines', 20000) + +let s:enabled = get(g:, 'airline#extensions#whitespace#enabled', 1) + +function! s:check_mixed_indent() + if s:indent_algo == 1 + " [] + " spaces before or between tabs are not allowed + let t_s_t = '(^\t* +\t\s*\S)' + " ( x count) + " count of spaces at the end of tabs should be less then tabstop value + let t_l_s = '(^\t+ {' . &ts . ',}' . '\S)' + return search('\v' . t_s_t . '|' . t_l_s, 'nw') + else + return search('\v(^\t+ +)|(^ +\t+)', 'nw') + endif +endfunction function! airline#extensions#whitespace#check() - if &readonly || !&modifiable || !s:enabled + if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines return '' endif @@ -29,24 +46,22 @@ function! airline#extensions#whitespace#check() let trailing = 0 if index(checks, 'trailing') > -1 - let trailing = search(' $', 'nw') + let trailing = search('\s$', 'nw') endif let mixed = 0 if index(checks, 'indent') > -1 - let indents = [search('^ \{2,}', 'nb'), search('^ \{2,}', 'n'), search('^\t', 'nb'), search('^\t', 'n')] - let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0 + let mixed = s:check_mixed_indent() endif - if trailing != 0 || mixed + if trailing != 0 || mixed != 0 let b:airline_whitespace_check = s:symbol if s:show_message if trailing != 0 let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing) endif - if mixed - let mixnr = indents[0] == indents[1] ? indents[0] : indents[2] - let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixnr) + if mixed != 0 + let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixed) endif endif endif @@ -56,13 +71,23 @@ endfunction! function! airline#extensions#whitespace#toggle() if s:enabled - autocmd! airline_whitespace CursorHold,BufWritePost + augroup airline_whitespace + autocmd! + augroup END augroup! airline_whitespace let s:enabled = 0 else call airline#extensions#whitespace#init() let s:enabled = 1 endif + + if exists("g:airline#extensions#whitespace#enabled") + let g:airline#extensions#whitespace#enabled = s:enabled + if s:enabled && match(g:airline_section_warning, '#whitespace#check') < 0 + let g:airline_section_warning .= airline#section#create(['whitespace']) + call airline#update_statusline() + endif + endif echo 'Whitespace checking: '.(s:enabled ? 'Enabled' : 'Disabled') endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/highlighter.vim b/sources_non_forked/vim-airline/autoload/airline/highlighter.vim index f5e68465..17a6cf51 100644 --- a/sources_non_forked/vim-airline/autoload/airline/highlighter.vim +++ b/sources_non_forked/vim-airline/autoload/airline/highlighter.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running') @@ -42,7 +42,10 @@ endfunction function! airline#highlighter#get_highlight(group, ...) let fg = s:get_syn(a:group, 'fg') let bg = s:get_syn(a:group, 'bg') - let reverse = synIDattr(synIDtrans(hlID(a:group)), 'reverse', has('gui_running') ? 'gui' : 'term') + let reverse = has('gui_running') + \ ? synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'gui') + \ : synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'cterm') + \|| synIDattr(synIDtrans(hlID(a:group)), 'reverse', 'term') return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000) endfunction diff --git a/sources_non_forked/vim-airline/autoload/airline/init.vim b/sources_non_forked/vim-airline/autoload/airline/init.vim index 558b3f23..539f2c49 100644 --- a/sources_non_forked/vim-airline/autoload/airline/init.vim +++ b/sources_non_forked/vim-airline/autoload/airline/init.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 function! s:check_defined(variable, default) @@ -79,6 +79,7 @@ function! airline#init#bootstrap() call airline#parts#define_raw('linenr', '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#') call airline#parts#define_function('ffenc', 'airline#parts#ffenc') call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace']) + call airline#parts#define_text('capslock', '') unlet g:airline#init#bootstrapping endfunction @@ -86,7 +87,7 @@ endfunction function! airline#init#sections() let spc = g:airline_symbols.space if !exists('g:airline_section_a') - let g:airline_section_a = airline#section#create_left(['mode', 'paste', 'iminsert']) + let g:airline_section_a = airline#section#create_left(['mode', 'paste', 'capslock', 'iminsert']) endif if !exists('g:airline_section_b') let g:airline_section_b = airline#section#create(['hunks', 'branch']) diff --git a/sources_non_forked/vim-airline/autoload/airline/parts.vim b/sources_non_forked/vim-airline/autoload/airline/parts.vim index bec4504f..b0356b1d 100644 --- a/sources_non_forked/vim-airline/autoload/airline/parts.vim +++ b/sources_non_forked/vim-airline/autoload/airline/parts.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 let s:parts = {} diff --git a/sources_non_forked/vim-airline/autoload/airline/section.vim b/sources_non_forked/vim-airline/autoload/airline/section.vim index 4562bacd..0baf0779 100644 --- a/sources_non_forked/vim-airline/autoload/airline/section.vim +++ b/sources_non_forked/vim-airline/autoload/airline/section.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 call airline#init#bootstrap() diff --git a/sources_non_forked/vim-airline/autoload/airline/themes.vim b/sources_non_forked/vim-airline/autoload/airline/themes.vim index 110a9dc3..07e03241 100644 --- a/sources_non_forked/vim-airline/autoload/airline/themes.vim +++ b/sources_non_forked/vim-airline/autoload/airline/themes.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 " generates a dictionary which defines the colors for each highlight group diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim b/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim index d18e0324..b941eae7 100644 --- a/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim +++ b/sources_non_forked/vim-airline/autoload/airline/themes/bubblegum.vim @@ -54,7 +54,7 @@ let g:airline#themes#bubblegum#palette.visual = airline#themes#generate_color_ma let g:airline#themes#bubblegum#palette.visual_modified = copy(g:airline#themes#bubblegum#palette.insert_modified) " Inactive window -let s:IA = [s:gui_dark_gray, s:gui_med_gray_hi, s:cterm_dark_gray, s:cterm_med_gray_hi, ''] +let s:IA = [s:gui_light_gray, s:gui_med_gray_hi, s:cterm_light_gray, s:cterm_med_gray_hi, ''] let g:airline#themes#bubblegum#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#bubblegum#palette.inactive_modified = { \ 'airline_c': [s:gui_orange, '', s:cterm_orange, '', ''], diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/hybrid.vim b/sources_non_forked/vim-airline/autoload/airline/themes/hybrid.vim new file mode 100644 index 00000000..b0df8441 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/hybrid.vim @@ -0,0 +1,58 @@ +" vim-airline companion theme of Hybrid +" (https://github.com/w0ng/vim-hybrid) + +let g:airline#themes#hybrid#palette = {} + +function! airline#themes#hybrid#refresh() + let s:N1 = airline#themes#get_highlight('DiffAdd') + let s:N2 = airline#themes#get_highlight('CursorLine') + let s:N3 = airline#themes#get_highlight('PMenu') + let g:airline#themes#hybrid#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + + let modified_group = airline#themes#get_highlight2(['Text', 'fg'], ['SpellRare', 'bg'], 'bold') + let g:airline#themes#hybrid#palette.normal_modified = { + \ 'airline_c': airline#themes#get_highlight2(['Text', 'fg'], ['SpellRare', 'bg'], 'bold') + \ } + + let warning_group = airline#themes#get_highlight('SpellRare') + let g:airline#themes#hybrid#palette.normal.airline_warning = warning_group + let g:airline#themes#hybrid#palette.normal_modified.airline_warning = warning_group + + let s:I1 = airline#themes#get_highlight2(['Text', 'fg'], ['DiffText', 'bg'], 'bold') + let s:I2 = airline#themes#get_highlight2(['Text', 'fg'], ['SpellLocal', 'bg'], 'bold') + let s:I3 = airline#themes#get_highlight2(['Text', 'fg'], ['SpellCap', 'bg'], 'bold') + let g:airline#themes#hybrid#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#hybrid#palette.insert_modified = g:airline#themes#hybrid#palette.normal_modified + let g:airline#themes#hybrid#palette.insert.airline_warning = g:airline#themes#hybrid#palette.normal.airline_warning + let g:airline#themes#hybrid#palette.insert_modified.airline_warning = g:airline#themes#hybrid#palette.normal_modified.airline_warning + + let s:R1 = airline#themes#get_highlight('DiffChange') + let s:R2 = s:N2 + let s:R3 = s:N3 + let g:airline#themes#hybrid#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + let replace_group = airline#themes#get_highlight('SpellRare') + let g:airline#themes#hybrid#palette.replace_modified = g:airline#themes#hybrid#palette.normal_modified + let g:airline#themes#hybrid#palette.replace.airline_warning = g:airline#themes#hybrid#palette.normal.airline_warning + let g:airline#themes#hybrid#palette.replace_modified.airline_warning = g:airline#themes#hybrid#palette.replace_modified.airline_warning + + let s:V1 = airline#themes#get_highlight2(['Text', 'fg'], ['Folded', 'bg'], 'bold') + let s:V2 = airline#themes#get_highlight2(['Text', 'fg'], ['DiffDelete', 'bg'], 'bold') + let s:V3 = airline#themes#get_highlight2(['Text', 'fg'], ['Error', 'bg'], 'bold') + let g:airline#themes#hybrid#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#hybrid#palette.visual_modified = g:airline#themes#hybrid#palette.normal_modified + let g:airline#themes#hybrid#palette.visual.airline_warning = g:airline#themes#hybrid#palette.normal.airline_warning + let g:airline#themes#hybrid#palette.visual_modified.airline_warning = g:airline#themes#hybrid#palette.normal_modified.airline_warning + + let s:IA = airline#themes#get_highlight('StatusLineNC') + let g:airline#themes#hybrid#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#hybrid#palette.inactive_modified = { + \ 'airline_c': [ modified_group[0], '', modified_group[2], '', '' ] + \ } + + let g:airline#themes#hybrid#palette.accents = { + \ 'red': airline#themes#get_highlight('Constant'), + \ } + +endfunction + +call airline#themes#hybrid#refresh() diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/kalisi.vim b/sources_non_forked/vim-airline/autoload/airline/themes/kalisi.vim new file mode 100644 index 00000000..4ff94f57 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/kalisi.vim @@ -0,0 +1,57 @@ +" +" Colorscheme: Kalisi for airline. Inspired by powerline. +" 06.02.2014 Arthur Jaron +" hifreeo@gmail.com +" + +" Insert mode +let s:I1 = [ '#ffffff' , '#e80000' , 23 , 231 ] +let s:I2 = [ '#c5c5c5' , '#901010' , 74 , 31 ] +let s:I3 = [ '#c5c5c5' , '#500000' , 117 , 24 ] + +" Visual mode +let s:V1 = [ '#005f5f' , '#ffffff' , 23 , 231 ] +let s:V2 = [ '#5fafd7' , '#0087af' , 74 , 31 ] +let s:V3 = [ '#87d7ff' , '#005f87' , 117 , 24 ] + +" Replace mode +let s:R1 = [ '#8e00da' , '#ffffff' , 23 , 231 ] +let s:R2 = [ '#8e00da' , '#ce99ff' , 74 , 31 ] +let s:R3 = [ '#ce99ff' , '#8e00da' , 117 , 24 ] + +let g:airline#themes#kalisi#palette = {} + +function! airline#themes#kalisi#refresh() + + " Normal mode + let s:N1 = [ '#005f00' , '#afd700' , 22 , 148 ] + let s:N2 = [ '#afd700' , '#005f00' , 247 , 236 ] + let s:N3 = airline#themes#get_highlight('StatusLine') + + " Tabline Plugin + let g:airline#themes#kalisi#palette.tabline = { + \ 'airline_tab': ['#A6DB29', '#005f00', 231, 29, ''], + \ 'airline_tabsel': ['#404042', '#A6DB29', 231, 36, ''], + \ 'airline_tabtype': ['#afd700', '#005f00', 231, 36, ''], + \ 'airline_tabfill': ['#ffffff', '#000000', 231, 23, ''], + \ 'airline_tabhid': ['#c5c5c5', '#404042', 231, 88, ''], + \ 'airline_tabmod': ['#ffffff', '#F1266F', 231, 88, ''], + \ } + + let g:airline#themes#kalisi#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + let g:airline#themes#kalisi#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) + let g:airline#themes#kalisi#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) + let g:airline#themes#kalisi#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) + + " Inactive Mode + " let s:IA = [ '#c5c5c5' , '#505052' , 239 , 234 , '' ] + let s:IA = airline#themes#get_highlight('StatusLineNC') + let g:airline#themes#kalisi#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) + let g:airline#themes#kalisi#palette.inactive_modified = { + \ 'statusline': [ '#F1266F' , '' , '53' , '' , '' ] , + \ } + +endfunction + +call airline#themes#kalisi#refresh() + diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/kolor.vim b/sources_non_forked/vim-airline/autoload/airline/themes/kolor.vim new file mode 100644 index 00000000..e61f56f2 --- /dev/null +++ b/sources_non_forked/vim-airline/autoload/airline/themes/kolor.vim @@ -0,0 +1,59 @@ +let g:airline#themes#kolor#palette = {} + +let s:N1 = [ '#e2e2e2' , '#4f3598' , 254 , 56 ] +let s:N2 = [ '#ff5fd7' , '#242322' , 206 , 234 ] +let s:N3 = [ '#e2e2e2' , '#4a4a4a' , 254 , 238 ] + +let g:airline#themes#kolor#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) + +let g:airline#themes#kolor#palette.normal_modified = { + \ 'airline_c': [ '#e2e2e2' , '#4f3598' , 254 , 56 , '' ] , + \ } + + +let s:I1 = [ '#242322' , '#7eaefd' , 234 , 111 ] +let s:I2 = [ '#75d7d8' , '#242322' , 80 , 234 ] +let s:I3 = [ '#e2e2e2' , '#4a4a4a' , 254 , 238 ] +let g:airline#themes#kolor#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) +let g:airline#themes#kolor#palette.insert_modified = { + \ 'airline_c': [ '#242322' , '#7eaefd' , 234 , 111 , '' ] , + \ } + + +let g:airline#themes#kolor#palette.replace = copy(g:airline#themes#kolor#palette.insert) +let g:airline#themes#kolor#palette.replace.airline_a = [ s:I2[0] , '#005154' , s:I2[2] , 23 , '' ] +let g:airline#themes#kolor#palette.replace_modified = { + \ 'airline_c': [ '#e2e2e2' , '#005154' , 254 , 23 , '' ] , + \ } + + +let s:V1 = [ '#242322' , '#e6987a' , 234 , 180 ] +let s:V2 = [ '#dbc570' , '#242322' , 186 , 234 ] +let s:V3 = [ '#e2e2e2' , '#4a4a4a' , 254 , 238 ] +let g:airline#themes#kolor#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) +let g:airline#themes#kolor#palette.visual_modified = { + \ 'airline_c': [ '#242322' , '#e6987a' , 234 , 180 , '' ] , + \ } + + +let s:IA1 = [ '#b2b2b2' , '#4a4a4a' , 247 , 238 , '' ] +let s:IA2 = [ '#b2b2b2' , '#4a4a4a' , 247 , 238 ] +let s:IA3 = [ '#b2b2b2' , '#4a4a4a' , 247 , 238 , '' ] +let g:airline#themes#kolor#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) +let g:airline#themes#kolor#palette.inactive_modified = { + \ 'airline_c': [ '#875faf' , '' , 97 , '' , '' ] , + \ } + + +let g:airline#themes#kolor#palette.accents = { + \ 'red': [ '#d96e8a' , '' , 168 , '' ] + \ } + + +if !get(g:, 'loaded_ctrlp', 0) + finish +endif +let g:airline#themes#kolor#palette.ctrlp = airline#extensions#ctrlp#generate_color_map( + \ [ '#e2e2e2' , '#4a4a4a' , 254 , 238 , '' ], + \ [ '#e2e2e2' , '#242322' , 254 , 234 , '' ], + \ [ '#e2e2e2' , '#4f3598' , 254 , 56 , 'bold' ]) diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/luna.vim b/sources_non_forked/vim-airline/autoload/airline/themes/luna.vim index 0024188f..879d8623 100644 --- a/sources_non_forked/vim-airline/autoload/airline/themes/luna.vim +++ b/sources_non_forked/vim-airline/autoload/airline/themes/luna.vim @@ -44,7 +44,7 @@ let g:airline#themes#luna#palette.visual_modified = { let s:IA = [ '#4e4e4e' , '#002b2b' , 59 , 23 , '' ] let g:airline#themes#luna#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA) let g:airline#themes#luna#palette.inactive_modified = { - \ 'airline_c': [ '#450000' , '' , 52 , '' , '' ] , + \ 'airline_c': [ '#e20000' , '' , 166 , '' , '' ] , \ } let g:airline#themes#luna#palette.tabline = { diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/sol.vim b/sources_non_forked/vim-airline/autoload/airline/themes/sol.vim index 31aa34fc..89ea5058 100644 --- a/sources_non_forked/vim-airline/autoload/airline/themes/sol.vim +++ b/sources_non_forked/vim-airline/autoload/airline/themes/sol.vim @@ -12,7 +12,7 @@ let s:N2 = [ '#343434' , '#b3b3b3' , 237 , 250 ] let s:N3 = [ '#343434' , '#c7c7c7' , 237 , 252 ] let g:airline#themes#sol#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) let g:airline#themes#sol#palette.normal_modified = { - \ 'airline_c': [ '#ffffff' , '#ff3535' , 231 , 203 , '' ] , + \ 'airline_c': [ '#ffffff' , '#ff6868' , 237 , 209 , '' ] , \ } @@ -21,7 +21,7 @@ let s:I2 = [ '#343434' , '#a3a3a3' , 237 , 249 ] let s:I3 = [ '#343434' , '#b0b0b0' , 237 , 250 ] let g:airline#themes#sol#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) let g:airline#themes#sol#palette.insert_modified = { - \ 'airline_c': [ '#ffffff' , '#ff6868' , 225 , 167 , '' ] , + \ 'airline_c': [ '#343434' , '#ffdbc7' , 237 , 216 , '' ] , \ } let g:airline#themes#sol#palette.insert_paste = { \ 'airline_a': [ s:I1[0] , '#09643f' , s:I1[2] , 30 , '' ] , @@ -38,7 +38,7 @@ let s:V2 = [ '#343434' , '#a3a3a3' , 237 , 249 ] let s:V3 = [ '#343434' , '#b0b0b0' , 237 , 250 ] let g:airline#themes#sol#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) let g:airline#themes#sol#palette.visual_modified = { - \ 'airline_c': [ '#ffffff' , '#ff3535' , 231 , 203 , '' ] , + \ 'airline_c': [ '#343434' , '#ffdbc7' , 237 , 216 , '' ] , \ } let s:IA = [ '#777777' , '#c7c7c7' , 244 , 251 , '' ] @@ -52,10 +52,10 @@ let g:airline#themes#sol#palette.tabline = { \ 'airline_tabsel': ['#ffffff', '#004b9a', 231, 31 , ''], \ 'airline_tabtype': ['#343434', '#a0a0a0', 237, 248, ''], \ 'airline_tabfill': ['#343434', '#c7c7c7', 237, 251, ''], - \ 'airline_tabmod': ['#ffffff', '#ff6868', 231, 167, ''], + \ 'airline_tabmod': ['#343434', '#ffdbc7', 237, 216, ''], \ } -let s:WI = [ '#eeeeee', '#ff0f38', 255, 201 ] +let s:WI = [ '#eeeeee', '#e33900', 255, 166 ] let g:airline#themes#sol#palette.normal.airline_warning = [ \ s:WI[0], s:WI[1], s:WI[2], s:WI[3] \ ] diff --git a/sources_non_forked/vim-airline/autoload/airline/themes/solarized.vim b/sources_non_forked/vim-airline/autoload/airline/themes/solarized.vim index db52bcf8..30ba47e6 100644 --- a/sources_non_forked/vim-airline/autoload/airline/themes/solarized.vim +++ b/sources_non_forked/vim-airline/autoload/airline/themes/solarized.vim @@ -48,8 +48,10 @@ function! airline#themes#solarized#refresh() let s:NW = [s:base3, s:orange, ''] if s:background == 'dark' let s:NM = [s:base1, s:N3[1], ''] + let s:NMi = [s:base2, s:N3[1], ''] else let s:NM = [s:base01, s:N3[1], ''] + let s:NMi = [s:base02, s:N3[1], ''] endif " Insert mode @@ -73,11 +75,12 @@ function! airline#themes#solarized#refresh() let s:RM = s:NM let s:RF = s:NF - " Inactive + " Inactive, according to VertSplit in solarized + " (bg dark: base00; bg light: base0) if s:background == 'dark' - let s:IA = [s:base00, s:base02, ''] + let s:IA = [s:base02, s:base00, ''] else - let s:IA = [s:base1, s:base2, ''] + let s:IA = [s:base2, s:base0, ''] endif """""""""""""""""""""""""""""""""""""""""""""""" @@ -98,7 +101,7 @@ function! airline#themes#solarized#refresh() \ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]], \ [s:IA[0].g, s:IA[1].g, s:IA[0].t, s:IA[1].t, s:IA[2]]) let g:airline#themes#solarized#palette.inactive_modified = { - \ 'airline_c': [s:NM[0].g, '', s:NM[0].t, '', s:NM[2]]} + \ 'airline_c': [s:NMi[0].g, '', s:NMi[0].t, '', s:NMi[2]]} let g:airline#themes#solarized#palette.normal = airline#themes#generate_color_map( \ [s:N1[0].g, s:N1[1].g, s:N1[0].t, s:N1[1].t, s:N1[2]], diff --git a/sources_non_forked/vim-airline/autoload/airline/util.vim b/sources_non_forked/vim-airline/autoload/airline/util.vim index b97c0866..a04bd0bf 100644 --- a/sources_non_forked/vim-airline/autoload/airline/util.vim +++ b/sources_non_forked/vim-airline/autoload/airline/util.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 call airline#init#bootstrap() diff --git a/sources_non_forked/vim-airline/doc/airline.txt b/sources_non_forked/vim-airline/doc/airline.txt index 2816c290..cd2a17c5 100644 --- a/sources_non_forked/vim-airline/doc/airline.txt +++ b/sources_non_forked/vim-airline/doc/airline.txt @@ -139,7 +139,7 @@ COMMANDS *airline-commands* Toggles between the standard 'statusline' and airline. :AirlineRefresh *:AirlineRefresh* - Refreshes all highlight groups. + Refreshes all highlight groups and redraws the statusline. ============================================================================== CUSTOMIZATION *airline-customization* @@ -217,6 +217,14 @@ EXTENSIONS *airline-extensions* Most extensions are enabled by default and lazily loaded when the corresponding plugin (if any) is detected. +By default, airline will attempt to load any extension it can find in the +'runtimepath'. On some systems this can result in an undersirable startup +cost. You can disable the check with the following flag. > + let g:airline#extensions#disable_rtp_load = 1 +< + Note: Third party plugins that rely on this behavior will be affected. You + will need to manually load them. + ------------------------------------- *airline-default* The default extension understands all of the `g:` variables in the |airline-configuration| section, however it also has some more fine-tuned @@ -228,7 +236,7 @@ configuration values that you can use. \ 'x': 60, \ 'y': 88, \ 'z': 45, - \ }) + \ } " Note: set to an empty dictionary to disable truncation. let g:airline#extensions#default#section_truncate_width = {} @@ -238,9 +246,8 @@ configuration values that you can use. let g:airline#extensions#default#layout = [ \ [ 'a', 'b', 'c' ], \ [ 'x', 'y', 'z', 'warning' ] - \ ]) + \ ] < - ------------------------------------- *airline-quickfix* The quickfix extension is a simple built-in extension which determines whether the buffer is a quickfix or location list buffer, and adjusts the @@ -275,7 +282,10 @@ vcscommand * use vcscommand.vim if available > let g:airline#extensions#branch#use_vcscommand = 0 -< + +* truncate long branch names to a fixed length > + let g:airline#extensions#branch#displayed_head_limit = 10 + ------------------------------------- *airline-syntastic* syntastic @@ -283,13 +293,13 @@ syntastic let g:airline#extensions#syntastic#enabled = 1 < ------------------------------------- *airline-tagbar* -tagbar +tagbar * enable/disable tagbar integration > let g:airline#extensions#tagbar#enabled = 1 < * change how tags are displayed (:help tagbar-statusline) > - let g:airline#extensions#tagbar#flags = '' "default + let g:airline#extensions#tagbar#flags = '' (default) let g:airline#extensions#tagbar#flags = 'f' let g:airline#extensions#tagbar#flags = 's' let g:airline#extensions#tagbar#flags = 'p' @@ -307,6 +317,7 @@ csv.vim ------------------------------------- *airline-hunks* vim-gitgutter vim-signify +changesPlugin * enable/disable showing a summary of changed hunks under source control. > let g:airline#extensions#hunks#enabled = 1 @@ -349,12 +360,23 @@ eclim * enable/disable detection of whitespace errors. > let g:airline#extensions#whitespace#enabled = 1 < +* customize the type of mixed indent checking to perform. > + " must be all spaces or all tabs before the first non-whitespace character + let g:airline#extensions#whitespace#mixed_indent_algo = 0 (default) + + " certain number of spaces are allowed after tabs, but not in between + " this algorithm works well for /** */ style comments in a tab-indented file + let g:airline#extensions#whitespace#mixed_indent_algo = 1 +< * customize the whitespace symbol. > let g:airline#extensions#whitespace#symbol = '!' < * configure which whitespace checks to enable. > let g:airline#extensions#whitespace#checks = [ 'indent', 'trailing' ] < +* configure the maximum number of lines where whitespace checking is enabled. > + let g:airline#extensions#whitespace#max_lines = 20000 +< * configure whether a message should be displayed. > let g:airline#extensions#whitespace#show_message = 1 < @@ -376,11 +398,17 @@ eclim let g:airline#extensions#tabline#tab_nr_type = 0 " # of splits (default) let g:airline#extensions#tabline#tab_nr_type = 1 " tab number < +* enable/disable displaying tab number in tabs mode. > + let g:airline#extensions#tabline#show_tab_nr = 1 + +* enable/disable displaying tab type (far right) + let g:airline#extensions#tabline#show_tab_type = 1 + * defines the name of a formatter for how buffer names are displayed. > let g:airline#extensions#tabline#formatter = 'default' " here is how you can define a 'foo' formatter: - function! airline#extensions#tabline#formatters#foo(bufnr, buffers) + function! airline#extensions#tabline#foo#format(bufnr, buffers) return fnamemodify(bufname(a:bufnr), ':t') endfunction let g:airline#extensions#tabline#formatter = 'foo' @@ -403,6 +431,10 @@ eclim " there is another file of the same name, in which it will display it along " with the containing parent directory. let g:airline#extensions#tabline#formatter = 'unique_tail' + + " The `unique_tail_improved` - another algorithm, that will smartly uniquify + " buffers names with similar filename, suppressing common parts of paths. + let g:airline#extensions#tabline#formatter = 'unique_tail_improved' < * configure the minimum number of buffers needed to show the tabline. > let g:airline#extensions#tabline#buffer_min_count = 0 @@ -420,9 +452,62 @@ eclim let g:airline#extensions#tabline#left_alt_sep = '' let g:airline#extensions#tabline#right_sep = '' let g:airline#extensions#tabline#right_alt_sep = '' + +* configure symbol used to represent close button + let g:airline#extensions#tabline#close_symbol = 'X' + < Note: Enabling this extension will modify 'showtabline' and 'guioptions'. +------------------------------------- *airline-tmuxline* +tmuxline + +* enable/disable tmuxline integration > + let g:airline#extensions#tmuxline#enabled = 0 +< +* configure which mode colors should be used in tmux statusline > + let airline#extensions#tmuxline#color_template = 'normal' (default) + let airline#extensions#tmuxline#color_template = 'insert' + let airline#extensions#tmuxline#color_template = 'visual' + let airline#extensions#tmuxline#color_template = 'replace' +< +* if specified, setting this option will trigger writing to the file whenever the + airline theme is applied, i.e. when :AirlineTheme is executed and on vim + startup > + airline#extensions#tmuxline#snapshot_file = "~/.tmux-statusline-colors.conf" +< +------------------------------------- *airline-promptline* +promptline + +* configure the path to the snapshot .sh file. Mandatory option. The created + file should be sourced by the shell on login > + " in .vimrc + airline#extensions#promptline#snapshot_file = "~/.shell_prompt.sh" + + " in .bashrc/.zshrc + [ -f ~/.shell_prompt.sh ] && source ~/.shell_prompt.sh +< +* enable/disable promptline integration > + let g:airline#extensions#promptline#enabled = 0 +< +* configure which mode colors should be used in prompt > + let airline#extensions#promptline#color_template = 'normal' (default) + let airline#extensions#promptline#color_template = 'insert' + let airline#extensions#promptline#color_template = 'visual' + let airline#extensions#promptline#color_template = 'replace' +< +------------------------------------- *airline-nrrwrgn* +NrrwRgn + +* enable/disable NrrwRgn integration > + let g:airline#extensions#nrrwrgn#enabled = 1 + +------------------------------------- *airline-capslock* +vim-capslock + +* enable/disable vim-capslock integration > + let g:airline#extensions#capslock#enabled = 1 +< ============================================================================== ADVANCED CUSTOMIZATION *airline-advanced-customization* @@ -568,7 +653,7 @@ to your liking. Here is an example: > return 1 endfunction < -The above example uses various some example highlight groups to demonstrate +The above example uses various example highlight groups to demonstrate that you can use any combination from the loaded colorscheme. However, if you want colors to change between modes, you should use one of the section highlight groups, e.g. `airline_a` and `airline_b`. @@ -671,7 +756,7 @@ Contributions and pull requests are welcome. ============================================================================== LICENSE *airline-license* -MIT License. Copyright © 2013 Bailey Ling. +MIT License. Copyright © 2013-2014 Bailey Ling. vim:tw=78:ts=8:ft=help:norl: diff --git a/sources_non_forked/vim-airline/plugin/airline.vim b/sources_non_forked/vim-airline/plugin/airline.vim index f1d3d386..d53c4929 100644 --- a/sources_non_forked/vim-airline/plugin/airline.vim +++ b/sources_non_forked/vim-airline/plugin/airline.vim @@ -1,4 +1,4 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. +" MIT License. Copyright (c) 2013-2014 Bailey Ling. " vim: et ts=2 sts=2 sw=2 if &cp || v:version < 702 || (exists('g:loaded_airline') && g:loaded_airline) @@ -103,7 +103,7 @@ endfunction command! -nargs=? -complete=customlist,get_airline_themes AirlineTheme call airline_theme() command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle() command! AirlineToggle call airline_toggle() -command! AirlineRefresh call airline#load_theme() +command! AirlineRefresh call airline#load_theme() | call airline#update_statusline() call airline_toggle() diff --git a/sources_non_forked/vim-bundle-mako/ftplugin/mako.vim b/sources_non_forked/vim-bundle-mako/ftplugin/mako.vim new file mode 100644 index 00000000..41be4705 --- /dev/null +++ b/sources_non_forked/vim-bundle-mako/ftplugin/mako.vim @@ -0,0 +1,11 @@ +" Vim filetype plugin file +" Language: Mako +" Maintainer: Randy Stauner +" Last Change: 2014-02-07 +" Version: 0.1 + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +setlocal comments=:## +setlocal commentstring=##%s diff --git a/sources_non_forked/vim-bundle-mako/indent/mako.vim b/sources_non_forked/vim-bundle-mako/indent/mako.vim index bd85ac5e..8f6b97b6 100644 --- a/sources_non_forked/vim-bundle-mako/indent/mako.vim +++ b/sources_non_forked/vim-bundle-mako/indent/mako.vim @@ -257,6 +257,7 @@ endif " [-- --] call MakoIndentPush('%def') +call MakoIndentPush('%block') call MakoIndentPush('%call') call MakoIndentPush('%doc') call MakoIndentPush('%text') diff --git a/sources_non_forked/vim-bundle-mako/syntax/mako.vim b/sources_non_forked/vim-bundle-mako/syntax/mako.vim index 8fc489ba..36bc4a7c 100644 --- a/sources_non_forked/vim-bundle-mako/syntax/mako.vim +++ b/sources_non_forked/vim-bundle-mako/syntax/mako.vim @@ -60,6 +60,9 @@ syn region makoAttributeValue containedin=MakoTag contained start=/'/ skip=/\\'/ syn region makoTag matchgroup=makoDelim start="<%\(def\|call\|page\|include\|namespace\|inherit\|block\|[a-zA-Z_][a-zA-Z0-9_]*:[a-zA-Z_][a-zA-Z0-9_]*\)\>" end="/\?>" syn match makoDelim "" +syn region makoJavaScript matchgroup=makoDelim start=+<%block .*js.*>+ keepend end=++ contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc,makoLine,makoBlock,makoVariable +syn region makoCssStyle matchgroup=makoDelim start=+<%block .*css.*>+ keepend end=++ contains=@htmlCss,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc,makoLine,makoBlock,makoVariable + " Newline Escapes syn match makoEscape /\\$/ diff --git a/sources_non_forked/vim-coffee-script/compiler/coffee.vim b/sources_non_forked/vim-coffee-script/compiler/coffee.vim index a70fa64c..9a91d354 100644 --- a/sources_non_forked/vim-coffee-script/compiler/coffee.vim +++ b/sources_non_forked/vim-coffee-script/compiler/coffee.vim @@ -75,8 +75,8 @@ augroup CoffeeUpdateMakePrg " Set autocmd locally if compiler was set locally. if &l:makeprg =~ s:pat - autocmd BufFilePost,BufWritePost call s:UpdateMakePrg() + autocmd BufWritePre,BufFilePost call s:UpdateMakePrg() else - autocmd BufFilePost,BufWritePost call s:UpdateMakePrg() + autocmd BufWritePre,BufFilePost call s:UpdateMakePrg() endif augroup END diff --git a/sources_non_forked/vim-commentary/.gitignore b/sources_non_forked/vim-commentary/.gitignore new file mode 100644 index 00000000..0a56e3fc --- /dev/null +++ b/sources_non_forked/vim-commentary/.gitignore @@ -0,0 +1 @@ +/doc/tags diff --git a/sources_non_forked/vim-commentary/CONTRIBUTING.markdown b/sources_non_forked/vim-commentary/CONTRIBUTING.markdown new file mode 100644 index 00000000..b3f00951 --- /dev/null +++ b/sources_non_forked/vim-commentary/CONTRIBUTING.markdown @@ -0,0 +1 @@ +See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown). diff --git a/sources_non_forked/vim-commentary/README.markdown b/sources_non_forked/vim-commentary/README.markdown new file mode 100644 index 00000000..a39b19c7 --- /dev/null +++ b/sources_non_forked/vim-commentary/README.markdown @@ -0,0 +1,51 @@ +# commentary.vim + +Comment stuff out. Use `gcc` to comment out a line (takes a count), +`gc` to comment out the target of a motion (for example, `gcap` to +comment out a paragraph), `gc` in visual mode to comment out the selection, +and `gc` in operator pending mode to target a comment. You can also use +it as a command, either with a range like `:7,17Commentary`, or as part of a +`:global` invocation like with `:g/TODO/Commentary`. That's it. + +I wrote this because 5 years after Vim added support for mapping an +operator, I still couldn't find a commenting plugin that leveraged that +feature (I overlooked +[tcomment.vim](https://github.com/tomtom/tcomment_vim)). Striving for +minimalism, it weighs in at under 100 lines of code. + +Oh, and it uncomments, too. The above maps actually toggle, and `gcgc` +uncomments a set of adjacent commented lines. + +## Installation + +If you don't have a preferred installation method, I recommend +installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and +then simply copy and paste: + + cd ~/.vim/bundle + git clone git://github.com/tpope/vim-commentary.git + +Once help tags have been generated, you can view the manual with +`:help commentary`. + +## FAQ + +> My favorite file type isn't supported! + +Relax! You just have to adjust `'commentstring'`: + + autocmd FileType apache set commentstring=#\ %s + +## Self-Promotion + +Like commentary.vim? Follow the repository on +[GitHub](https://github.com/tpope/vim-commentary) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=3695). And if +you're feeling especially charitable, follow [tpope](http://tpo.pe/) on +[Twitter](http://twitter.com/tpope) and +[GitHub](https://github.com/tpope). + +## License + +Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/sources_non_forked/vim-commentary/doc/commentary.txt b/sources_non_forked/vim-commentary/doc/commentary.txt new file mode 100644 index 00000000..d6deed05 --- /dev/null +++ b/sources_non_forked/vim-commentary/doc/commentary.txt @@ -0,0 +1,35 @@ +*commentary.txt* Comment stuff out + +Author: Tim Pope +License: Same terms as Vim itself (see |license|) + +Comment stuff out. Then uncomment it later. Relies on 'commentstring' to be +correctly set, or uses b:commentary_format if it is set. + +The gc mappings are preferred, while the \\ mappings are provided for +backwards compatibility. + + *gc* +gc{motion} Comment or uncomment lines that {motion} moves over. + + *gcc* +gcc Comment or uncomment [count] lines. + + *v_gc* +{Visual}gc Comment or uncomment the highlighted lines. + + *o_gc* +gc Text object for a comment (operator pending mode + only.) + + *gcgc* *gcu* +gcgc Uncomment the current and adjacent commented lines. +gcu + + *:Commentary* +:[range]Commentary Comment or uncomment [range] lines + +The |User| CommentaryPost autocommand fires after a successful operation and +can be used for advanced customization. + + vim:tw=78:et:ft=help:norl: diff --git a/sources_non_forked/vim-commentary/plugin/commentary.vim b/sources_non_forked/vim-commentary/plugin/commentary.vim new file mode 100644 index 00000000..cce7b8ac --- /dev/null +++ b/sources_non_forked/vim-commentary/plugin/commentary.vim @@ -0,0 +1,100 @@ +" commentary.vim - Comment stuff out +" Maintainer: Tim Pope +" Version: 1.2 +" GetLatestVimScripts: 3695 1 :AutoInstall: commentary.vim + +if exists("g:loaded_commentary") || &cp || v:version < 700 + finish +endif +let g:loaded_commentary = 1 + +function! s:surroundings() abort + return split(substitute(substitute( + \ get(b:, 'commentary_format', &commentstring) + \ ,'\S\zs%s',' %s','') ,'%s\ze\S', '%s ', ''), '%s', 1) +endfunction + +function! s:go(type,...) abort + if a:0 + let [lnum1, lnum2] = [a:type, a:1] + else + let [lnum1, lnum2] = [line("'["), line("']")] + endif + + let [l, r] = s:surroundings() + let uncomment = 2 + for lnum in range(lnum1,lnum2) + let line = matchstr(getline(lnum),'\S.*\s\@ 2 && l.r !~# '\\' + let line = substitute(line, + \'\M'.r[0:-2].'\zs\d\*\ze'.r[-1:-1].'\|'.l[0].'\zs\d\*\ze'.l[1:-1], + \'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g') + endif + if uncomment + let line = substitute(line,'\S.*\s\@ Commentary :call go(line("'<"),line("'>")) +nnoremap Commentary :set opfunc=gog@ +nnoremap CommentaryLine :set opfunc=goexe 'norm! 'v:count1.'g@_' +onoremap Commentary :call textobject(0) +nnoremap ChangeCommentary c:call textobject(1) +nmap CommentaryUndo CommentaryCommentary +command! -range -bar Commentary call s:go(,) + +if 1 || !hasmapto('Commentary') || maparg('gc','n') ==# '' + xmap gc Commentary + nmap gc Commentary + omap gc Commentary + nmap gcc CommentaryLine + nmap cgc ChangeCommentary + nmap gcu CommentaryCommentary +endif + +if maparg('\\','n') ==# '' && maparg('\','n') ==# '' && get(g:, 'commentary_map_backslash', 1) + xmap \\ Commentary:echomsg '\\ is deprecated. Use gc' + nmap \\ :echomsg '\\ is deprecated. Use gc'Commentary + nmap \\\ CommentaryLine:echomsg '\\ is deprecated. Use gc' + nmap \\u CommentaryUndo:echomsg '\\ is deprecated. Use gc' +endif + +" vim:set et sw=2: diff --git a/sources_non_forked/vim-expand-region/doc/tags b/sources_non_forked/vim-expand-region/doc/tags deleted file mode 100644 index 402a0c43..00000000 --- a/sources_non_forked/vim-expand-region/doc/tags +++ /dev/null @@ -1,10 +0,0 @@ -expand-region-about expand_region.txt /*expand-region-about* -expand-region-contents expand_region.txt /*expand-region-contents* -expand-region-global-options expand_region.txt /*expand-region-global-options* -expand-region-intro expand_region.txt /*expand-region-intro* -expand-region-mappings expand_region.txt /*expand-region-mappings* -expand-region-usage expand_region.txt /*expand-region-usage* -expand_region_text_objects expand_region.txt /*expand_region_text_objects* -expand_region_use_select_mode expand_region.txt /*expand_region_use_select_mode* -vim-expand-region.txt expand_region.txt /*vim-expand-region.txt* -vim-expand-regions expand_region.txt /*vim-expand-regions* diff --git a/sources_non_forked/vim-fugitive/CONTRIBUTING.markdown b/sources_non_forked/vim-fugitive/CONTRIBUTING.markdown index 8583e1e4..e651dcae 100644 --- a/sources_non_forked/vim-fugitive/CONTRIBUTING.markdown +++ b/sources_non_forked/vim-fugitive/CONTRIBUTING.markdown @@ -3,13 +3,13 @@ and removing other plugins. The sad truth about VimScript is that it is fraught with incompatibilities waiting to happen. I'm happy to work around them where I can, but it's up to you to isolate the conflict. -If your [commit message sucks](http://stopwritingramblingcommitmessages.com/), -I'm not going to accept your pull request. I've explained very politely -dozens of times that -[my general guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) -are absolute rules on my own repositories, so I may lack the energy to explain -it to you yet another time. And please, if I ask you to change something, -`git commit --amend`. +Fugitive is particularly prone to regressions due to Git version issues, +platform issues, and interactions with other plugins. I end up bisecting a +lot more than other projects, and thus I'm especially meticulous here about +maintaining a clean, readable, history. Squash and force push any requested +changes to a pull request. And if your [commit message +sucks](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), +I'm not going to accept it. Period. Beyond that, don't be shy about asking before patching. What takes you hours might take me minutes simply because I have both domain knowledge and a diff --git a/sources_non_forked/vim-fugitive/README.markdown b/sources_non_forked/vim-fugitive/README.markdown index 68a61e6a..71b8bc47 100644 --- a/sources_non_forked/vim-fugitive/README.markdown +++ b/sources_non_forked/vim-fugitive/README.markdown @@ -11,8 +11,8 @@ Vim's diff handling capabilities to stage a subset of the file's changes. Bring up the output of `git status` with `:Gstatus`. Press `-` to -`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch` that -mofo. And guess what `:Gcommit` does! +`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch`. And guess +what `:Gcommit` does! `:Gblame` brings up an interactive vertical split with `git blame` output. Press enter on a line to edit the commit where the line @@ -55,15 +55,13 @@ and `Git!` to open the output of a command in a temp file. ## Installation -If you don't have a preferred installation method, I recommend -installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and -then simply copy and paste: +If you don't have a preferred installation method, one option is to install +[pathogen.vim](https://github.com/tpope/vim-pathogen), and then copy +and paste: cd ~/.vim/bundle git clone git://github.com/tpope/vim-fugitive.git - -Once help tags have been generated, you can view the manual with -`:help fugitive`. + vim -u NONE -c "helptags vim-fugitive/doc" -c q If your Vim version is below 7.2, I recommend also installing [vim-git](https://github.com/tpope/vim-git) for syntax highlighting and diff --git a/sources_non_forked/vim-fugitive/doc/fugitive.txt b/sources_non_forked/vim-fugitive/doc/fugitive.txt index f40afcfb..0d186bff 100644 --- a/sources_non_forked/vim-fugitive/doc/fugitive.txt +++ b/sources_non_forked/vim-fugitive/doc/fugitive.txt @@ -34,6 +34,7 @@ that are part of Git repositories). window. The following maps, which work on the cursor line file where sensible, are provided: + g? show this help next file previous file |:Gedit| @@ -54,7 +55,7 @@ that are part of Git repositories). p |:Git| add --patch p |:Git| reset --patch (staged files) q close status - R reload status + r reload status S |:Gvsplit| *fugitive-:Gcommit* @@ -62,12 +63,32 @@ that are part of Git repositories). to commit, |:Gstatus| is called instead. Unless the arguments given would skip the invocation of an editor (e.g., -m), a split window will be used to obtain a - commit message. Write and close that window (:wq or - |:Gwrite|) to finish the commit. Unlike when running - the actual git-commit command, it is possible (but - unadvisable) to muck with the index with commands like - git-add and git-reset while a commit message is - pending. + commit message, or a new tab if -v is given. Write + and close that window (:wq or |:Gwrite|) to finish the + commit. Unlike when running the actual git-commit + command, it is possible (but unadvisable) to alter the + index with commands like git-add and git-reset while a + commit message is pending. + + *fugitive-:Gmerge* +:Gmerge [args] Calls git-merge and loads errors and conflicted files + into the quickfix list. Opens a |:Gcommit| style + split window for the commit message if the merge + succeeds. If called during a merge conflict, the + conflicted files from the current index are loaded + into the quickfix list. + + *fugitive-:Gpull* +:Gpull [args] Like |:Gmerge|, but for git-pull. + + *fugitive-:Gpush* +:Gpush [args] Invoke git-push, load the results into the quickfix + list, and invoke |:cwindow| to reveal any errors. + |:Dispatch| is used if available for asynchronous + invocation. + + *fugitive-:Gfetch* +:Gfetch [args] Like |:Gpush|, but for git-fetch. *fugitive-:Ggrep* :Ggrep [args] |:grep| with git-grep as 'grepprg'. @@ -83,6 +104,11 @@ that are part of Git repositories). previous commits rather than previous file revisions are loaded. +:{range}Glog [args] Use git-log -L to load previous revisions of the given + range of the current file into the quickfix list. The + cursor is positioned on the first line of the first + diff hunk for each commit. + *fugitive-:Gllog* :Gllog [args] Like |:Glog|, but use the location list instead of the quickfix list. @@ -148,14 +174,16 @@ that are part of Git repositories). index is used (which means a three-way diff during a merge conflict, making it a git-mergetool alternative). The newer of the two files is placed - to the right. Use |do| and |dp| and write to the - index file to simulate "git add --patch". + to the right or bottom, depending on 'diffopt' and + the width of the window relative to 'textwidth'. Use + |do| and |dp| and write to the index file to simulate + "git add --patch". *fugitive-:Gsdiff* -:Gsdiff [revision] Like |:Gdiff|, but split horizontally. +:Gsdiff [revision] Like |:Gdiff|, but always split horizontally. *fugitive-:Gvdiff* -:Gvdiff [revision] Identical to |:Gdiff|. For symmetry with |:Gsdiff|. +:Gvdiff [revision] Like |:Gdiff|, but always split vertically. *fugitive-:Gmove* :Gmove {destination} Wrapper around git-mv that renames the buffer @@ -171,12 +199,12 @@ that are part of Git repositories). *fugitive-:Gblame* :Gblame [flags] Run git-blame on the file and open the results in a - scroll bound vertical split. Press enter on a line to - reblame the file as it was in that commit. You can - give any of ltfnsewMC as flags and they will be passed - along to git-blame. The following maps, which work on - the cursor line commit where sensible, are provided: + scroll bound vertical split. You can give any of + ltfnsewMC as flags and they will be passed along to + git-blame. The following maps, which work on the + cursor line commit where sensible, are provided: + g? show this help A resize to end of author column C resize to end of commit column D resize to end of date/time column diff --git a/sources_non_forked/vim-fugitive/plugin/fugitive.vim b/sources_non_forked/vim-fugitive/plugin/fugitive.vim index 51e52d88..b5a204b2 100644 --- a/sources_non_forked/vim-fugitive/plugin/fugitive.vim +++ b/sources_non_forked/vim-fugitive/plugin/fugitive.vim @@ -1,6 +1,6 @@ " fugitive.vim - A Git wrapper so awesome, it should be illegal " Maintainer: Tim Pope -" Version: 2.0 +" Version: 2.1 " GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim if exists('g:loaded_fugitive') || &cp @@ -12,7 +12,7 @@ if !exists('g:fugitive_git_executable') let g:fugitive_git_executable = 'git' endif -" Utility {{{1 +" Section: Utility function! s:function(name) abort return function(substitute(a:name,'^s:',matchstr(expand(''), '\d\+_'),'')) @@ -26,10 +26,14 @@ function! s:gsub(str,pat,rep) abort return substitute(a:str,'\v\C'.a:pat,a:rep,'g') endfunction +function! s:winshell() abort + return &shell =~? 'cmd' || exists('+shellslash') && !&shellslash +endfunction + function! s:shellesc(arg) abort if a:arg =~ '^[A-Za-z0-9_/.-]\+$' return a:arg - elseif &shell =~# 'cmd' + elseif s:winshell() return '"'.s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"').'"' else return shellescape(a:arg) @@ -49,15 +53,15 @@ function! s:throw(string) abort throw v:errmsg endfunction -function! s:warn(str) +function! s:warn(str) abort echohl WarningMsg echomsg a:str echohl None let v:warningmsg = a:str endfunction -function! s:shellslash(path) - if exists('+shellslash') && !&shellslash +function! s:shellslash(path) abort + if s:winshell() return s:gsub(a:path,'\\','/') else return a:path @@ -73,7 +77,7 @@ function! fugitive#git_version(...) abort return s:git_versions[g:fugitive_git_executable] endfunction -function! s:recall() +function! s:recall() abort let rev = s:sub(s:buffer().rev(), '^/', '') if rev ==# ':' return matchstr(getline('.'),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.\{-\}\ze\%( ([^()[:digit:]]\+)\)\=$\|^\d\{6} \x\{40\} \d\t\zs.*') @@ -102,7 +106,7 @@ function! s:command(definition) abort let s:commands += [a:definition] endfunction -function! s:define_commands() +function! s:define_commands() abort for command in s:commands exe 'command! -buffer '.command endfor @@ -115,8 +119,7 @@ augroup END let s:abstract_prototype = {} -" }}}1 -" Initialization {{{1 +" Section: Initialization function! fugitive#is_git_dir(path) abort let path = s:sub(a:path, '[\/]$', '') . '/' @@ -130,6 +133,18 @@ function! fugitive#extract_git_dir(path) abort let root = s:shellslash(simplify(fnamemodify(a:path, ':p:s?[\/]$??'))) let previous = "" while root !=# previous + if root =~# '\v^//%([^/]+/?)?$' + " This is for accessing network shares from Cygwin Vim. There won't be + " any git directory called //.git or //serverName/.git so let's avoid + " checking for them since such checks are extremely slow. + break + endif + if index(split($GIT_CEILING_DIRECTORIES, ':'), root) >= 0 + break + endif + if root ==# $GIT_WORK_TREE && fugitive#is_git_dir($GIT_DIR) + return $GIT_DIR + endif let dir = s:sub(root, '[\/]$', '') . '/.git' let type = getftype(dir) if type ==# 'dir' && fugitive#is_git_dir(dir) @@ -152,7 +167,7 @@ function! fugitive#extract_git_dir(path) abort return '' endfunction -function! fugitive#detect(path) +function! fugitive#detect(path) abort if exists('b:git_dir') && (b:git_dir ==# '' || b:git_dir =~# '/$') unlet b:git_dir endif @@ -163,19 +178,22 @@ function! fugitive#detect(path) endif endif if exists('b:git_dir') - silent doautocmd User Fugitive + silent doautocmd User FugitiveBoot cnoremap fnameescape(recall()) nnoremap y :call setreg(v:register, recall()) let buffer = fugitive#buffer() if expand('%:p') =~# '//' call buffer.setvar('&path', s:sub(buffer.getvar('&path'), '^\.%(,|$)', '')) endif - if stridx(buffer.getvar('&tags'), escape(b:git_dir.'/tags', ', ')) == -1 - call buffer.setvar('&tags', escape(b:git_dir.'/tags', ', ').','.buffer.getvar('&tags')) - if &filetype !=# '' + if stridx(buffer.getvar('&tags'), escape(b:git_dir, ', ')) == -1 + if filereadable(b:git_dir.'/tags') + call buffer.setvar('&tags', escape(b:git_dir.'/tags', ', ').','.buffer.getvar('&tags')) + endif + if &filetype !=# '' && filereadable(b:git_dir.'/'.&filetype.'.tags') call buffer.setvar('&tags', escape(b:git_dir.'/'.&filetype.'.tags', ', ').','.buffer.getvar('&tags')) endif endif + silent doautocmd User Fugitive endif endfunction @@ -185,11 +203,11 @@ augroup fugitive autocmd FileType netrw call fugitive#detect(expand('%:p')) autocmd User NERDTreeInit,NERDTreeNewRoot call fugitive#detect(b:NERDTreeRoot.path.str()) autocmd VimEnter * if expand('')==''|call fugitive#detect(getcwd())|endif + autocmd CmdWinEnter * call fugitive#detect(expand('#:p')) autocmd BufWinLeave * execute getwinvar(+bufwinnr(+expand('')), 'fugitive_leave') augroup END -" }}}1 -" Repository {{{1 +" Section: Repository let s:repo_prototype = {} let s:repos = {} @@ -208,7 +226,7 @@ function! s:repo(...) abort call s:throw('not a git repository: '.expand('%:p')) endfunction -function! fugitive#repo(...) +function! fugitive#repo(...) abort return call('s:repo', a:000) endfunction @@ -309,6 +327,8 @@ function! s:repo_head(...) dict abort " truncate hash to a:1 characters if we're in detached head mode let len = a:0 ? a:1 : 0 let branch = len ? head[0:len-1] : '' + else + return '' endif return branch @@ -426,8 +446,7 @@ endfunction call s:add_methods('repo',['keywordprg']) -" }}}1 -" Buffer {{{1 +" Section: Buffer let s:buffer_prototype = {} @@ -453,7 +472,7 @@ function! s:buffer_setvar(var,value) dict abort endfunction function! s:buffer_getline(lnum) dict abort - return getbufline(self['#'],a:lnum)[0] + return get(getbufline(self['#'], a:lnum), 0, '') endfunction function! s:buffer_repo() dict abort @@ -602,8 +621,7 @@ endfunction call s:add_methods('buffer',['getvar','setvar','getline','repo','type','spec','name','commit','path','rev','sha1','expand','containing_commit','up']) -" }}}1 -" Git {{{1 +" Section: Git call s:command("-bang -nargs=? -complete=customlist,s:GitComplete Git :execute s:Git(0,)") @@ -618,36 +636,37 @@ function! s:ExecuteInTree(cmd) abort endtry endfunction -function! s:Git(bang,cmd) abort +function! s:Git(bang, args) abort if a:bang - return s:Edit('edit',1,a:cmd) + return s:Edit('edit', 1, a:args) endif - let git = s:repo().git_command() + let git = g:fugitive_git_executable if has('gui_running') && !has('win32') let git .= ' --no-pager' endif - let cmd = matchstr(a:cmd,'\v\C.{-}%($|\\@ `=s:repo().bare() ? s:repo().dir() : s:repo().tree()`") call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Glcd :lcd `=s:repo().bare() ? s:repo().dir() : s:repo().tree()`") -" }}}1 -" Gstatus {{{1 +" Section: Gstatus call s:command("-bar Gstatus :execute s:Status()") augroup fugitive_status @@ -726,26 +744,28 @@ function! s:stage_info(lnum) abort endwhile if !lnum return ['', ''] - elseif getline(lnum+1) =~# '^# .*\$' return 'CtrlP '.fnameescape(s:repo().tree()) else for i in range(a:count) @@ -755,7 +775,7 @@ function! s:StagePrevious(count) endif endfunction -function! s:StageReloadSeek(target,lnum1,lnum2) +function! s:StageReloadSeek(target,lnum1,lnum2) abort let jump = a:target let f = matchstr(getline(a:lnum1-1),'^#\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\zs.*') if f !=# '' | let jump = f | endif @@ -767,6 +787,28 @@ function! s:StageReloadSeek(target,lnum1,lnum2) call search('^#\t\%([[:alpha:] ]\+: *\|.*\%uff1a *\)\=\V'.jump.'\%( ([^()[:digit:]]\+)\)\=\$','W') endfunction +function! s:StageUndo() abort + let [filename, section] = s:stage_info(line('.')) + if empty(filename) + return '' + endif + let repo = s:repo() + let hash = repo.git_chomp('hash-object', '-w', filename) + if !empty(hash) + if section ==# 'untracked' + call delete(s:repo().tree(filename)) + elseif section ==# 'unstaged' + call repo.git_chomp_in_tree('checkout', '--', filename) + else + call repo.git_chomp_in_tree('checkout', 'HEAD', '--', filename) + endif + call s:StageReloadSeek(filename, line('.'), line('.')) + let @" = hash + return 'checktime|redraw|echomsg ' . + \ string('To restore, :Git cat-file blob '.hash[0:6].' > '.filename) + endif +endfunction + function! s:StageDiff(diff) abort let [filename, section] = s:stage_info(line('.')) if filename ==# '' && section ==# 'staged' @@ -846,9 +888,6 @@ function! s:StageToggle(lnum1,lnum2) abort if filename ==# '' continue endif - if !exists('first_filename') - let first_filename = filename - endif execute lnum if filename =~ ' -> ' let cmd = ['mv','--'] + reverse(split(filename,' -> ')) @@ -862,6 +901,9 @@ function! s:StageToggle(lnum1,lnum2) abort else let cmd = ['add','-A','--',filename] endif + if !exists('first_filename') + let first_filename = filename + endif let output .= call(repo.git_chomp_in_tree,cmd,s:repo())."\n" endfor if exists('first_filename') @@ -920,31 +962,31 @@ function! s:StagePatch(lnum1,lnum2) abort return 'checktime' endfunction -" }}}1 -" Gcommit {{{1 +" Section: Gcommit call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit()") -function! s:Commit(args) abort +function! s:Commit(args, ...) abort + let repo = a:0 ? a:1 : s:repo() let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' let dir = getcwd() - let msgfile = s:repo().dir('COMMIT_EDITMSG') + let msgfile = repo.dir('COMMIT_EDITMSG') let outfile = tempname() let errorfile = tempname() try try - execute cd.s:fnameescape(s:repo().tree()) - if &shell =~# 'cmd' + execute cd.s:fnameescape(repo.tree()) + if s:winshell() let command = '' let old_editor = $GIT_EDITOR let $GIT_EDITOR = 'false' else let command = 'env GIT_EDITOR=false ' endif - let command .= s:repo().git_command('commit').' '.a:args + let command .= repo.git_command('commit').' '.a:args if &shell =~# 'csh' noautocmd silent execute '!('.command.' > '.outfile.') >& '.errorfile - elseif a:args =~# '\%(^\| \)--interactive\>' + elseif a:args =~# '\%(^\| \)-\%(-interactive\|p\|-patch\)\>' noautocmd execute '!'.command.' 2> '.errorfile else noautocmd silent execute '!'.command.' > '.outfile.' 2> '.errorfile @@ -967,15 +1009,18 @@ function! s:Commit(args) abort let error = get(errors,-2,get(errors,-1,'!')) if error =~# 'false''\=\.$' let args = a:args - let args = s:gsub(args,'%(%(^| )-- )@' let args = '--cleanup=strip '.args endif if bufname('%') == '' && line('$') == 1 && getline(1) == '' && !&mod execute 'keepalt edit '.s:fnameescape(msgfile) + elseif a:args =~# '\%(^\| \)-\%(-verbose\|\w*v\)\>' + execute 'keepalt tabedit '.s:fnameescape(msgfile) elseif s:buffer().type() ==# 'index' execute 'keepalt edit '.s:fnameescape(msgfile) execute (search('^#','n')+1).'wincmd+' @@ -1013,22 +1058,135 @@ function! s:CommitComplete(A,L,P) abort endif endfunction -function! s:FinishCommit() +function! s:FinishCommit() abort let args = getbufvar(+expand(''),'fugitive_commit_arguments') if !empty(args) call setbufvar(+expand(''),'fugitive_commit_arguments','') - return s:Commit(args) + return s:Commit(args, s:repo(getbufvar(+expand(''),'git_dir'))) endif return '' endfunction -augroup fugitive_commit - autocmd! - autocmd VimLeavePre,BufDelete COMMIT_EDITMSG execute s:sub(s:FinishCommit(), '^echoerr (.*)', 'echohl ErrorMsg|echo \1|echohl NONE') -augroup END +" Section: Gmerge, Gpull -" }}}1 -" Ggrep, Glog {{{1 +call s:command("-nargs=? -bang -complete=custom,s:RevisionComplete Gmerge " . + \ "execute s:Merge('merge', 0, )") +call s:command("-nargs=? -bang -complete=custom,s:RemoteComplete Gpull " . + \ "execute s:Merge('pull --progress', 0, )") + +function! s:RevisionComplete(A, L, P) abort + return s:repo().git_chomp('rev-parse', '--symbolic', '--branches', '--tags', '--remotes') + \ . "\nHEAD\nFETCH_HEAD\nORIG_HEAD" +endfunction + +function! s:RemoteComplete(A, L, P) abort + let remote = matchstr(a:L, ' \zs\S\+\ze ') + if !empty(remote) + let matches = split(s:repo().git_chomp('ls-remote', remote), "\n") + call filter(matches, 'v:val =~# "\t" && v:val !~# "{"') + call map(matches, 's:sub(v:val, "^.*\t%(refs/%(heads/|tags/)=)=", "")') + else + let matches = split(s:repo().git_chomp('remote'), "\n") + endif + return join(matches, "\n") +endfunction + +function! fugitive#cwindow() abort + if &buftype == 'quickfix' + cwindow + else + botright cwindow + if &buftype == 'quickfix' + wincmd p + endif + endif +endfunction + +let s:common_efm = '' + \ . '%+Egit:%.%#,' + \ . '%+Eusage:%.%#,' + \ . '%+Eerror:%.%#,' + \ . '%+Efatal:%.%#,' + \ . '%-G%.%#%\e[K%.%#,' + \ . '%-G%.%#%\r%.%\+' + +function! s:Merge(cmd, bang, args) abort + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' + let cwd = getcwd() + let [mp, efm] = [&l:mp, &l:efm] + let had_merge_msg = filereadable(s:repo().dir('MERGE_MSG')) + try + let &l:errorformat = '' + \ . '%-Gerror:%.%#false''.,' + \ . '%-G%.%# ''git commit'' %.%#,' + \ . '%+Emerge:%.%#,' + \ . s:common_efm . ',' + \ . '%+ECannot %.%#: You have unstaged changes.,' + \ . '%+ECannot %.%#: Your index contains uncommitted changes.,' + \ . '%+EThere is no tracking information for the current branch.,' + \ . '%+EYou are not currently on a branch. Please specify which,' + \ . 'CONFLICT (%m): %f deleted in %.%#,' + \ . 'CONFLICT (%m): Merge conflict in %f,' + \ . 'CONFLICT (%m): Rename \"%f\"->%.%#,' + \ . 'CONFLICT (%m): Rename %.%#->%f %.%#,' + \ . 'CONFLICT (%m): There is a directory with name %f in %.%#,' + \ . '%+ECONFLICT %.%#,' + \ . '%+EKONFLIKT %.%#,' + \ . '%+ECONFLIT %.%#,' + \ . "%+EXUNG \u0110\u1ed8T %.%#," + \ . "%+E\u51b2\u7a81 %.%#," + \ . 'U%\t%f' + if a:cmd =~# '^merge' && empty(a:args) && + \ (had_merge_msg || isdirectory(s:repo().dir('rebase-apply')) || + \ !empty(s:repo().git_chomp('diff-files', '--diff-filter=U'))) + let &l:makeprg = g:fugitive_git_executable.' diff-files --name-status --diff-filter=U' + else + let &l:makeprg = s:sub(g:fugitive_git_executable.' -c core.editor=false '. + \ a:cmd . (a:args =~# ' \%(--no-edit\|--abort\|-m\)\>' ? '' : ' --edit') . ' ' . a:args, + \ ' *$', '') + endif + if !empty($GIT_EDITOR) + let old_editor = $GIT_EDITOR + let $GIT_EDITOR = 'false' + endif + execute cd fnameescape(s:repo().tree()) + silent noautocmd make! + catch /^Vim\%((\a\+)\)\=:E211/ + let err = v:exception + finally + redraw! + let [&l:mp, &l:efm] = [mp, efm] + if exists('old_editor') + let $GIT_EDITOR = old_editor + endif + execute cd fnameescape(cwd) + endtry + call fugitive#reload_status() + if empty(filter(getqflist(),'v:val.valid')) + if !had_merge_msg && filereadable(s:repo().dir('MERGE_MSG')) + cclose + return 'Gcommit --no-status -n -t '.s:shellesc(s:repo().dir('MERGE_MSG')) + endif + endif + let qflist = getqflist() + let found = 0 + for e in qflist + if !empty(e.bufnr) + let found = 1 + let e.pattern = '^<<<<<<<' + endif + endfor + call fugitive#cwindow() + if found + call setqflist(qflist, 'r') + if !a:bang + return 'cfirst' + endif + endif + return exists('err') ? 'echoerr '.string(err) : '' +endfunction + +" Section: Ggrep, Glog if !exists('g:fugitive_summary_format') let g:fugitive_summary_format = '%s' @@ -1036,8 +1194,8 @@ endif call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Ggrep :execute s:Grep('grep',0,)") call s:command("-bang -nargs=? -complete=customlist,s:EditComplete Glgrep :execute s:Grep('lgrep',0,)") -call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Glog :execute s:Log('grep',)") -call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gllog :execute s:Log('lgrep',)") +call s:command("-bar -bang -nargs=* -range=0 -complete=customlist,s:EditComplete Glog :call s:Log('grep',,,)") +call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gllog :call s:Log('lgrep',,,)") function! s:Grep(cmd,bang,arg) abort let grepprg = &grepprg @@ -1054,14 +1212,16 @@ function! s:Grep(cmd,bang,arg) abort if bufname(entry.bufnr) =~ ':' let entry.filename = s:repo().translate(bufname(entry.bufnr)) unlet! entry.bufnr + let changed = 1 elseif a:arg =~# '\%(^\| \)--cached\>' let entry.filename = s:repo().translate(':0:'.bufname(entry.bufnr)) unlet! entry.bufnr + let changed = 1 endif endfor - if a:cmd =~# '^l' + if a:cmd =~# '^l' && exists('changed') call setloclist(0, list, 'r') - else + elseif exists('changed') call setqflist(list, 'r') endif if !a:bang && !empty(list) @@ -1076,7 +1236,7 @@ function! s:Grep(cmd,bang,arg) abort endtry endfunction -function! s:Log(cmd,...) +function! s:Log(cmd, line1, line2, ...) abort let path = s:buffer().path('/') if path =~# '^/\.git\%(/\|$\)' || index(a:000,'--') != -1 let path = '' @@ -1092,7 +1252,11 @@ function! s:Log(cmd,...) end let cmd += map(copy(a:000),'s:sub(v:val,"^\\%(%(:\\w)*)","\\=fnamemodify(s:buffer().path(),submatch(1))")') if path =~# '/.' - let cmd += ['--',path[1:-1]] + if a:line2 + let cmd += ['-L', a:line1 . ',' . a:line2 . ':' . path[1:-1]] + else + let cmd += ['--', path[1:-1]] + endif endif let grepformat = &grepformat let grepprg = &grepprg @@ -1101,7 +1265,7 @@ function! s:Log(cmd,...) try execute cd.'`=s:repo().tree()`' let &grepprg = escape(call(s:repo().git_command,cmd,s:repo()),'%#') - let &grepformat = '%f::%m' + let &grepformat = '%Cdiff %.%#,%C--- %.%#,%C+++ %.%#,%Z@@ -%\d%\+\,%\d%\+ +%l\,%\d%\+ @@,%-G-%.%#,%-G+%.%#,%-G %.%#,%A%f::%m,%-G%.%#' exe a:cmd finally let &grepformat = grepformat @@ -1110,8 +1274,7 @@ function! s:Log(cmd,...) endtry endfunction -" }}}1 -" Gedit, Gpedit, Gsplit, Gvsplit, Gtabedit, Gread {{{1 +" Section: Gedit, Gpedit, Gsplit, Gvsplit, Gtabedit, Gread function! s:Edit(cmd,bang,...) abort let buffer = s:buffer() @@ -1124,7 +1287,9 @@ function! s:Edit(cmd,bang,...) abort if winnr != mywinnr && getwinvar(winnr,'&diff') execute winnr.'wincmd w' close - wincmd p + if winnr('$') > 1 + wincmd p + endif endif endfor endif @@ -1132,7 +1297,8 @@ function! s:Edit(cmd,bang,...) abort endif if a:bang - let args = s:gsub(join(a:000, ' '), '\\@0,)") call s:command("-bar -bang -nargs=* -count -complete=customlist,s:EditRunComplete Gread :execute s:Edit((! && ? '' : ).'read',0,)") -" }}}1 -" Gwrite, Gwq {{{1 +" Section: Gwrite, Gwq call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gwrite :execute s:Write(0,)") call s:command("-bar -bang -nargs=* -complete=customlist,s:EditComplete Gw :execute s:Write(0,)") @@ -1295,9 +1460,9 @@ function! s:Write(force,...) abort endif if a:force - let error = s:repo().git_chomp_in_tree('add', '--force', file) + let error = s:repo().git_chomp_in_tree('add', '--force', '--', path) else - let error = s:repo().git_chomp_in_tree('add', file) + let error = s:repo().git_chomp_in_tree('add', '--', path) endif if v:shell_error let v:errmsg = 'fugitive: '.error @@ -1364,20 +1529,82 @@ function! s:Wq(force,...) abort endif endfunction -" }}}1 -" Gdiff {{{1 +augroup fugitive_commit + autocmd! + autocmd VimLeavePre,BufDelete COMMIT_EDITMSG execute s:sub(s:FinishCommit(), '^echoerr (.*)', 'echohl ErrorMsg|echo \1|echohl NONE') +augroup END -call s:command("-bang -bar -nargs=* -complete=customlist,s:EditComplete Gdiff :execute s:Diff(0,)") -call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gvdiff :execute s:Diff(0,)") -call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execute s:Diff(1,)") +" Section: Gpush, Gfetch + +call s:command("-nargs=? -bang -complete=custom,s:RemoteComplete Gpush execute s:Dispatch('', 'push '.)") +call s:command("-nargs=? -bang -complete=custom,s:RemoteComplete Gfetch execute s:Dispatch('', 'fetch '.)") + +function! s:Dispatch(bang, args) + let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' + let cwd = getcwd() + let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')] + try + let b:current_compiler = 'git' + let &l:errorformat = s:common_efm + let &l:makeprg = g:fugitive_git_executable . ' ' . a:args + execute cd fnameescape(s:repo().tree()) + if exists(':Make') == 2 + noautocmd Make + else + silent noautocmd make! + redraw! + return 'call fugitive#cwindow()' + endif + return '' + finally + let [&l:mp, &l:efm, b:current_compiler] = [mp, efm, cc] + if empty(cc) | unlet! b:current_compiler | endif + execute cd fnameescape(cwd) + endtry +endfunction + +" Section: Gdiff + +call s:command("-bang -bar -nargs=* -complete=customlist,s:EditComplete Gdiff :execute s:Diff('',)") +call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gvdiff :execute s:Diff('keepalt vert ',)") +call s:command("-bar -nargs=* -complete=customlist,s:EditComplete Gsdiff :execute s:Diff('keepalt ',)") augroup fugitive_diff autocmd! - autocmd BufWinLeave * if s:diff_window_count() == 2 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | call s:diffoff_all(getbufvar(+expand(''), 'git_dir')) | endif - autocmd BufWinEnter * if s:diff_window_count() == 1 && &diff && getbufvar(+expand(''), 'git_dir') !=# '' | call s:diffoff() | endif + autocmd BufWinLeave * + \ if s:can_diffoff(+expand('')) && s:diff_window_count() == 2 | + \ call s:diffoff_all(getbufvar(+expand(''), 'git_dir')) | + \ endif + autocmd BufWinEnter * + \ if s:can_diffoff(+expand('')) && s:diff_window_count() == 1 | + \ call s:diffoff() | + \ endif augroup END -function! s:diff_window_count() +function! s:can_diffoff(buf) abort + return getwinvar(bufwinnr(a:buf), '&diff') && + \ !empty(getbufvar(a:buf, 'git_dir')) && + \ !empty(getwinvar(bufwinnr(a:buf), 'fugitive_diff_restore')) +endfunction + +function! fugitive#can_diffoff(buf) abort + return s:can_diffoff(a:buf) +endfunction + +function! s:diff_modifier(count) abort + let fdc = matchstr(&diffopt, 'foldcolumn:\zs\d\+') + if &diffopt =~# 'horizontal' && &diffopt !~# 'vertical' + return 'keepalt ' + elseif &diffopt =~# 'vertical' + return 'keepalt vert ' + elseif winwidth(0) <= a:count * ((&tw ? &tw : 80) + (empty(fdc) ? 2 : fdc)) + return 'keepalt ' + else + return 'keepalt vert ' + endif +endfunction + +function! s:diff_window_count() abort let c = 0 for nr in range(1,winnr('$')) let c += getwinvar(nr,'&diff') @@ -1385,27 +1612,29 @@ function! s:diff_window_count() return c endfunction -function! s:diff_restore() +function! s:diff_restore() abort let restore = 'setlocal nodiff noscrollbind' \ . ' scrollopt=' . &l:scrollopt \ . (&l:wrap ? ' wrap' : ' nowrap') + \ . ' foldlevel=999' \ . ' foldmethod=' . &l:foldmethod \ . ' foldcolumn=' . &l:foldcolumn \ . ' foldlevel=' . &l:foldlevel + \ . (&l:foldenable ? ' foldenable' : ' nofoldenable') if has('cursorbind') let restore .= (&l:cursorbind ? ' ' : ' no') . 'cursorbind' endif return restore endfunction -function! s:diffthis() +function! s:diffthis() abort if !&diff let w:fugitive_diff_restore = s:diff_restore() diffthis endif endfunction -function! s:diffoff() +function! s:diffoff() abort if exists('w:fugitive_diff_restore') execute w:fugitive_diff_restore unlet w:fugitive_diff_restore @@ -1414,7 +1643,7 @@ function! s:diffoff() endif endfunction -function! s:diffoff_all(dir) +function! s:diffoff_all(dir) abort for nr in range(1,winnr('$')) if getwinvar(nr,'&diff') if nr != winnr() @@ -1450,11 +1679,12 @@ endfunction call s:add_methods('buffer',['compare_age']) -function! s:Diff(bang,...) - let vert = a:bang ? '' : 'vertical ' +function! s:Diff(vert,...) abort + let vert = empty(a:vert) ? s:diff_modifier(2) : a:vert if exists(':DiffGitCached') return 'DiffGitCached' elseif (!a:0 || a:1 == ':') && s:buffer().commit() =~# '^[0-1]\=$' && s:repo().git_chomp_in_tree('ls-files', '--unmerged', '--', s:buffer().path()) !=# '' + let vert = empty(a:vert) ? s:diff_modifier(3) : a:vert let nr = bufnr('') execute 'leftabove '.vert.'split `=fugitive#buffer().repo().translate(s:buffer().expand('':2''))`' execute 'nnoremap dp :diffput '.nr.'diffupdate' @@ -1492,24 +1722,31 @@ function! s:Diff(bang,...) try let spec = s:repo().translate(file) let commit = matchstr(spec,'\C[^:/]//\zs\x\+') - if s:buffer().compare_age(commit) < 0 - execute 'rightbelow '.vert.'split '.s:fnameescape(spec) - else - execute 'leftabove '.vert.'split '.s:fnameescape(spec) + let restore = s:diff_restore() + if exists('+cursorbind') + setlocal cursorbind + endif + let w:fugitive_diff_restore = restore + if s:buffer().compare_age(commit) < 0 + execute 'rightbelow '.vert.'diffsplit '.s:fnameescape(spec) + else + execute 'leftabove '.vert.'diffsplit '.s:fnameescape(spec) + endif + let w:fugitive_diff_restore = restore + let winnr = winnr() + if getwinvar('#', '&diff') + wincmd p + call feedkeys("\p", 'n') endif - call s:diffthis() - wincmd p - call s:diffthis() return '' catch /^fugitive:/ return 'echoerr v:errmsg' endtry endfunction -" }}}1 -" Gmove, Gremove {{{1 +" Section: Gmove, Gremove -function! s:Move(force,destination) +function! s:Move(force,destination) abort if a:destination =~# '^/' let destination = a:destination[1:-1] else @@ -1543,7 +1780,7 @@ function! s:Move(force,destination) endif endfunction -function! s:MoveComplete(A,L,P) +function! s:MoveComplete(A,L,P) abort if a:A =~ '^/' return s:repo().superglob(a:A) else @@ -1553,7 +1790,7 @@ function! s:MoveComplete(A,L,P) endif endfunction -function! s:Remove(force) +function! s:Remove(force) abort if s:buffer().commit() ==# '' let cmd = ['rm'] elseif s:buffer().commit() ==# '0' @@ -1583,8 +1820,7 @@ augroup fugitive_remove \ endif augroup END -" }}}1 -" Gblame {{{1 +" Section: Gblame augroup fugitive_blame autocmd! @@ -1592,9 +1828,10 @@ augroup fugitive_blame autocmd FileType fugitiveblame setlocal nomodeline | if exists('b:git_dir') | let &l:keywordprg = s:repo().keywordprg() | endif autocmd Syntax fugitiveblame call s:BlameSyntax() autocmd User Fugitive if s:buffer().type('file', 'blob') | exe "command! -buffer -bar -bang -range=0 -nargs=* Gblame :execute s:Blame(0,,,,[])" | endif + autocmd ColorScheme,GUIEnter * call s:RehighlightBlame() augroup END -function! s:linechars(pattern) +function! s:linechars(pattern) abort let chars = strlen(s:gsub(matchstr(getline('.'), a:pattern), '.', '.')) if exists('*synconcealed') && &conceallevel > 1 for col in range(1, chars) @@ -1605,6 +1842,9 @@ function! s:linechars(pattern) endfunction function! s:Blame(bang,line1,line2,count,args) abort + if exists('b:fugitive_blamed_bufnr') + return 'bdelete' + endif try if s:buffer().path() == '' call s:throw('file or blob required') @@ -1619,7 +1859,8 @@ function! s:Blame(bang,line1,line2,count,args) abort else let cmd += ['--contents', '-'] endif - let basecmd = escape(call(s:repo().git_command,cmd+['--',s:buffer().path()],s:repo()),'!') + let cmd += ['--', s:buffer().path()] + let basecmd = escape(call(s:repo().git_command,cmd,s:repo()),'!') try let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' if !s:repo().bare() @@ -1645,12 +1886,18 @@ function! s:Blame(bang,line1,line2,count,args) abort endif for winnr in range(winnr('$'),1,-1) call setwinvar(winnr, '&scrollbind', 0) + if exists('+cursorbind') + call setwinvar(winnr, '&cursorbind', 0) + endif if getbufvar(winbufnr(winnr), 'fugitive_blamed_bufnr') execute winbufnr(winnr).'bdelete' endif endfor let bufnr = bufnr('') let restore = 'call setwinvar(bufwinnr('.bufnr.'),"&scrollbind",0)' + if exists('+cursorbind') + let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&cursorbind",0)' + endif if &l:wrap let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&wrap",1)' endif @@ -1658,9 +1905,12 @@ function! s:Blame(bang,line1,line2,count,args) abort let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&foldenable",1)' endif setlocal scrollbind nowrap nofoldenable + if exists('+cursorbind') + setlocal cursorbind + endif let top = line('w0') + &scrolloff let current = line('.') - let s:temp_files[temp] = s:repo().dir() + let s:temp_files[tolower(temp)] = { 'dir': s:repo().dir(), 'args': cmd } exe 'keepalt leftabove vsplit '.temp let b:fugitive_blamed_bufnr = bufnr let w:fugitive_leave = restore @@ -1668,7 +1918,10 @@ function! s:Blame(bang,line1,line2,count,args) abort execute top normal! zt execute current - setlocal nomodified nomodifiable nonumber scrollbind nowrap foldcolumn=0 nofoldenable filetype=fugitiveblame + if exists('+cursorbind') + setlocal cursorbind + endif + setlocal nomodified nomodifiable nonumber scrollbind nowrap foldcolumn=0 nofoldenable winfixwidth filetype=fugitiveblame if exists('+concealcursor') setlocal concealcursor=nc conceallevel=2 endif @@ -1676,6 +1929,8 @@ function! s:Blame(bang,line1,line2,count,args) abort setlocal norelativenumber endif execute "vertical resize ".(s:linechars('.\{-\}\ze\s\+\d\+)')+1) + nnoremap :help fugitive-:Gblame + nnoremap g? :help fugitive-:Gblame nnoremap q :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdelete','^-1','','') nnoremap gq :exe substitute(bufwinnr(b:fugitive_blamed_bufnr).' wincmd w'.bufnr('').'bdeleteif expand("%:p") =~# "^fugitive:[\\/][\\/]"Geditendif','^-1','','') nnoremap :exe BlameCommit("exe 'norm q'edit") @@ -1734,7 +1989,7 @@ function! s:BlameCommit(cmd) abort let offset -= 1 endif endwhile - return 'if foldlevel(".")|foldopen!|endif' + return 'normal! zv' endif endwhile execute head @@ -1777,6 +2032,8 @@ function! s:BlameJump(suffix) abort return '' endfunction +let s:hash_colors = {} + function! s:BlameSyntax() abort let b:current_syntax = 'fugitiveblame' let conceal = has('conceal') ? ' conceal' : '' @@ -1795,7 +2052,7 @@ function! s:BlameSyntax() abort syn match FugitiveblameNotCommittedYet "(\@<=Not Committed Yet\>" contained containedin=FugitiveblameAnnotation hi def link FugitiveblameBoundary Keyword hi def link FugitiveblameHash Identifier - hi def link FugitiveblameUncommitted Function + hi def link FugitiveblameUncommitted Ignore hi def link FugitiveblameTime PreProc hi def link FugitiveblameLineNumber Number hi def link FugitiveblameOriginalFile String @@ -1803,10 +2060,40 @@ function! s:BlameSyntax() abort hi def link FugitiveblameShort FugitiveblameDelimiter hi def link FugitiveblameDelimiter Delimiter hi def link FugitiveblameNotCommittedYet Comment + let seen = {} + for lnum in range(1, line('$')) + let hash = matchstr(getline(lnum), '^\^\=\zs\x\{6\}') + if hash ==# '' || hash ==# '000000' || has_key(seen, hash) + continue + endif + let seen[hash] = 1 + if &t_Co > 16 && exists('g:CSApprox_loaded') + \ && empty(get(s:hash_colors, hash)) + let [s, r, g, b; __] = map(matchlist(hash, '\(\x\x\)\(\x\x\)\(\x\x\)'), 'str2nr(v:val,16)') + let color = csapprox#per_component#Approximate(r, g, b) + if color == 16 && &background ==# 'dark' + let color = 8 + endif + let s:hash_colors[hash] = ' ctermfg='.color + else + let s:hash_colors[hash] = '' + endif + exe 'syn match FugitiveblameHash'.hash.' "\%(^\^\=\)\@<='.hash.'\x\{1,34\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite' + endfor + call s:RehighlightBlame() endfunction -" }}}1 -" Gbrowse {{{1 +function! s:RehighlightBlame() abort + for [hash, cterm] in items(s:hash_colors) + if !empty(cterm) || has('gui_running') + exe 'hi FugitiveblameHash'.hash.' guifg=#'.hash.get(s:hash_colors, hash, '') + else + exe 'hi link FugitiveblameHash'.hash.' Identifier' + endif + endfor +endfunction + +" Section: Gbrowse call s:command("-bar -bang -range -nargs=* -complete=customlist,s:EditComplete Gbrowse :execute s:Browse(0,,,)") @@ -1888,44 +2175,61 @@ function! s:Browse(bang,line1,count,...) abort let raw = remote endif - let url = s:github_url(s:repo(),raw,rev,commit,path,type,a:line1,a:count) - if url == '' - let url = s:instaweb_url(s:repo(),rev,commit,path,type,a:count > 0 ? a:line1 : 0) - endif + for Handler in g:fugitive_browse_handlers + let url = call(Handler, [{ + \ 'repo': s:repo(), + \ 'remote': raw, + \ 'revision': rev, + \ 'commit': commit, + \ 'path': path, + \ 'type': type, + \ 'line1': a:count > 0 ? a:line1 : 0, + \ 'line2': a:count > 0 ? a:count : 0}]) + if !empty(url) + break + endif + endfor - if url == '' - call s:throw("Instaweb failed to start and '".remote."' is not a GitHub remote") + if empty(url) + call s:throw("Instaweb failed to start and '".remote."' is not a supported remote") endif if a:bang - let @* = url + if has('clipboard') + let @* = url + endif return 'echomsg '.string(url) + elseif exists(':Browse') == 2 + return 'echomsg '.string(url).'|Browse '.url else - return 'echomsg '.string(url).'|call fugitive#buffer().repo().git_chomp("web--browse",'.string(url).')' + return 'echomsg '.string(url).'|call netrw#NetrwBrowseX('.string(url).', 0)' endif catch /^fugitive:/ return 'echoerr v:errmsg' endtry endfunction -function! s:github_url(repo,url,rev,commit,path,type,line1,line2) abort - let path = a:path +function! s:github_url(opts, ...) abort + if a:0 || type(a:opts) != type({}) + return '' + endif let domain_pattern = 'github\.com' let domains = exists('g:fugitive_github_domains') ? g:fugitive_github_domains : [] for domain in domains let domain_pattern .= '\|' . escape(split(domain, '://')[-1], '.') endfor - let repo = matchstr(a:url,'^\%(https\=://\|git://\|git@\)\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=$') + let repo = matchstr(get(a:opts, 'remote'), '^\%(https\=://\|git://\|git@\)\=\zs\('.domain_pattern.'\)[/:].\{-\}\ze\%(\.git\)\=$') if repo ==# '' return '' endif + let path = a:opts.path if index(domains, 'http://' . matchstr(repo, '^[^:/]*')) >= 0 let root = 'http://' . s:sub(repo,':','/') else let root = 'https://' . s:sub(repo,':','/') endif if path =~# '^\.git/refs/heads/' - let branch = a:repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1] + let branch = a:opts.repo.git_chomp('config','branch.'.path[16:-1].'.merge')[11:-1] if branch ==# '' return root . '/commits/' . path[16:-1] else @@ -1938,27 +2242,27 @@ function! s:github_url(repo,url,rev,commit,path,type,line1,line2) abort elseif path =~# '^\.git\>' return root endif - if a:rev =~# '^[[:alnum:]._-]\+:' - let commit = matchstr(a:rev,'^[^:]*') - elseif a:commit =~# '^\d\=$' - let local = matchstr(a:repo.head_ref(),'\ 0 && a:line1 == a:line2 - let url .= '#L' . a:line1 - elseif a:line2 > 0 - let url .= '#L' . a:line1 . '-' . a:line2 + if get(a:opts, 'line2') && a:opts.line1 == a:opts.line2 + let url .= '#L' . a:opts.line1 + elseif get(a:opts, 'line2') + let url .= '#L' . a:opts.line1 . '-' . a:opts.line2 endif - elseif a:type == 'tag' + elseif a:opts.type == 'tag' let commit = matchstr(getline(3),'^tag \zs.*') let url = root . '/tree/' . commit else @@ -1967,49 +2271,55 @@ function! s:github_url(repo,url,rev,commit,path,type,line1,line2) abort return url endfunction -function! s:instaweb_url(repo,rev,commit,path,type,...) abort - let output = a:repo.git_chomp('instaweb','-b','unknown') +function! s:instaweb_url(opts) abort + let output = a:opts.repo.git_chomp('instaweb','-b','unknown') if output =~# 'http://' - let root = matchstr(output,'http://.*').'/?p='.fnamemodify(a:repo.dir(),':t') + let root = matchstr(output,'http://.*').'/?p='.fnamemodify(a:opts.repo.opts.dir(),':t') else return '' endif - if a:path =~# '^\.git/refs/.' - return root . ';a=shortlog;h=' . matchstr(a:path,'^\.git/\zs.*') - elseif a:path =~# '^\.git\>' + if a:opts.path =~# '^\.git/refs/.' + return root . ';a=shortlog;h=' . matchstr(a:opts.path,'^\.git/\zs.*') + elseif a:opts.path =~# '^\.git\>' return root endif let url = root - if a:commit =~# '^\x\{40\}$' - if a:type ==# 'commit' + if a:opts.commit =~# '^\x\{40\}$' + if a:opts.type ==# 'commit' let url .= ';a=commit' endif - let url .= ';h=' . a:repo.rev_parse(a:commit . (a:path == '' ? '' : ':' . a:path)) + let url .= ';h=' . a:opts.repo.rev_parse(a:opts.commit . (a:opts.path == '' ? '' : ':' . a:opts.path)) else - if a:type ==# 'blob' + if a:opts.type ==# 'blob' let tmp = tempname() - silent execute 'write !'.a:repo.git_command('hash-object','-w','--stdin').' > '.tmp + silent execute 'write !'.a:opts.repo.git_command('hash-object','-w','--stdin').' > '.tmp let url .= ';h=' . readfile(tmp)[0] else try - let url .= ';h=' . a:repo.rev_parse((a:commit == '' ? 'HEAD' : ':' . a:commit) . ':' . a:path) + let url .= ';h=' . a:opts.repo.rev_parse((a:opts.commit == '' ? 'HEAD' : ':' . a:opts.commit) . ':' . a:opts.path) catch /^fugitive:/ call s:throw('fugitive: cannot browse uncommitted file') endtry endif - let root .= ';hb=' . matchstr(a:repo.head_ref(),'[^ ]\+$') + let root .= ';hb=' . matchstr(a:opts.repo.head_ref(),'[^ ]\+$') endif - if a:path !=# '' - let url .= ';f=' . a:path + if a:opts.path !=# '' + let url .= ';f=' . a:opts.path endif - if a:0 && a:1 - let url .= '#l' . a:1 + if get(a:opts, 'line1') + let url .= '#l' . a:opts.line1 endif return url endfunction -" }}}1 -" File access {{{1 +if !exists('g:fugitive_browse_handlers') + let g:fugitive_browse_handlers = [] +endif + +call extend(g:fugitive_browse_handlers, + \ [s:function('s:github_url'), s:function('s:instaweb_url')]) + +" Section: File access function! s:ReplaceCmd(cmd,...) abort let fn = expand('%:p') @@ -2017,14 +2327,14 @@ function! s:ReplaceCmd(cmd,...) abort let prefix = '' try if a:0 && a:1 != '' - if &shell =~# 'cmd' + if s:winshell() let old_index = $GIT_INDEX_FILE let $GIT_INDEX_FILE = a:1 else let prefix = 'env GIT_INDEX_FILE='.s:shellesc(a:1).' ' endif endif - if &shell =~# 'cmd' + if s:winshell() let cmd_escape_char = &shellxquote == '(' ? '^' : '^^^' call system('cmd /c "'.prefix.s:gsub(a:cmd,'[<>]', cmd_escape_char.'&').' > '.tmp.'"') else @@ -2039,7 +2349,10 @@ function! s:ReplaceCmd(cmd,...) abort try silent edit! finally - silent exe 'keepalt file '.s:fnameescape(fn) + try + silent exe 'keepalt file '.s:fnameescape(fn) + catch /^Vim\%((\a\+)\)\=:E302/ + endtry call delete(tmp) if fnamemodify(bufname('$'), ':p') ==# tmp silent execute 'bwipeout '.bufnr('$') @@ -2048,7 +2361,7 @@ function! s:ReplaceCmd(cmd,...) abort endtry endfunction -function! s:BufReadIndex() +function! s:BufReadIndex() abort if !exists('b:fugitive_display_format') let b:fugitive_display_format = filereadable(expand('%').'.lock') endif @@ -2068,12 +2381,13 @@ function! s:BufReadIndex() else let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' let dir = getcwd() - if fugitive#git_version() =~# '^0\|1\.[1-7]\.' + if fugitive#git_version() =~# '^0\|^1\.[1-7]\.' let cmd = s:repo().git_command('status') else let cmd = s:repo().git_command( \ '-c', 'status.displayCommentPrefix=true', \ '-c', 'color.status=false', + \ '-c', 'status.short=false', \ 'status') endif try @@ -2104,8 +2418,8 @@ function! s:BufReadIndex() nnoremap cc :Gcommit nnoremap cva :Gcommit --amend --verbose nnoremap cvc :Gcommit --verbose - nnoremap D :execute StageDiff('Gvdiff') - nnoremap dd :execute StageDiff('Gvdiff') + nnoremap D :execute StageDiff('Gdiff') + nnoremap dd :execute StageDiff('Gdiff') nnoremap dh :execute StageDiff('Gsdiff') nnoremap ds :execute StageDiff('Gsdiff') nnoremap dp :execute StageDiffEdit() @@ -2113,13 +2427,17 @@ function! s:BufReadIndex() nnoremap p :execute StagePatch(line('.'),line('.')+v:count1-1) xnoremap p :execute StagePatch(line("'<"),line("'>")) nnoremap q :if bufnr('$') == 1quitelsebdeleteendif + nnoremap r :edit nnoremap R :edit + nnoremap U :execute StageUndo() + nnoremap g? :help fugitive-:Gstatus + nnoremap :help fugitive-:Gstatus catch /^fugitive:/ return 'echoerr v:errmsg' endtry endfunction -function! s:FileRead() +function! s:FileRead() abort try let repo = s:repo(fugitive#extract_git_dir(expand(''))) let path = s:sub(s:sub(matchstr(expand(''),'fugitive://.\{-\}//\zs.*'),'/',':'),'^\d:',':&') @@ -2136,7 +2454,7 @@ function! s:FileRead() endtry endfunction -function! s:BufReadIndexFile() +function! s:BufReadIndexFile() abort try let b:fugitive_type = 'blob' let b:git_dir = s:repo().dir() @@ -2146,6 +2464,7 @@ function! s:BufReadIndexFile() if &bufhidden ==# '' setlocal bufhidden=delete endif + setlocal noswapfile endtry return '' catch /^fugitive: rev-parse/ @@ -2156,7 +2475,7 @@ function! s:BufReadIndexFile() endtry endfunction -function! s:BufWriteIndexFile() +function! s:BufWriteIndexFile() abort let tmp = tempname() try let path = matchstr(expand(''),'//\d/\zs.*') @@ -2169,7 +2488,7 @@ function! s:BufWriteIndexFile() endif let info = old_mode.' '.sha1.' '.stage."\t".path call writefile([info],tmp) - if &shell =~# 'cmd' + if s:winshell() let error = system('type '.s:gsub(tmp,'/','\\').'|'.s:repo().git_command('update-index','--index-info')) else let error = system(s:repo().git_command('update-index','--index-info').' < '.tmp) @@ -2187,7 +2506,7 @@ function! s:BufWriteIndexFile() endtry endfunction -function! s:BufReadObject() +function! s:BufReadObject() abort try setlocal noro ma let b:git_dir = s:repo().dir() @@ -2208,7 +2527,7 @@ function! s:BufReadObject() endif let pos = getpos('.') - silent %delete + silent keepjumps %delete_ setlocal endofline try @@ -2232,28 +2551,30 @@ function! s:BufReadObject() call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash)) else call s:ReplaceCmd(s:repo().git_command('show','--no-color','--pretty=format:tree %T%nparent %P%nauthor %an <%ae> %ad%ncommitter %cn <%ce> %cd%nencoding %e%n%n%s%n%n%b',hash)) - call search('^parent ') + keepjumps call search('^parent ') if getline('.') ==# 'parent ' - silent delete_ + silent keepjumps delete_ else - silent s/\%(^parent\)\@\)\=$','W',line('.')+3) - silent delete_ + keepjumps let lnum = search('^encoding \%(\)\=$','W',line('.')+3) + if lnum + silent keepjumps delete_ end - 1 + keepjumps 1 endif elseif b:fugitive_type ==# 'blob' call s:ReplaceCmd(s:repo().git_command('cat-file',b:fugitive_type,hash)) + setlocal nomodeline endif finally - call setpos('.',pos) - setlocal ro noma nomod + keepjumps call setpos('.',pos) + setlocal ro noma nomod noswapfile if &bufhidden ==# '' setlocal bufhidden=delete endif if b:fugitive_type !=# 'blob' - set filetype=git + setlocal filetype=git foldmethod=syntax nnoremap a :let b:fugitive_display_format += v:count1exe BufReadObject() nnoremap i :let b:fugitive_display_format -= v:count1exe BufReadObject() else @@ -2287,8 +2608,7 @@ augroup fugitive_files \ endif augroup END -" }}}1 -" Temp files {{{1 +" Section: Temp files if !exists('s:temp_files') let s:temp_files = {} @@ -2297,24 +2617,21 @@ endif augroup fugitive_temp autocmd! autocmd BufNewFile,BufReadPost * - \ if has_key(s:temp_files,expand(':p')) | - \ let b:git_dir = s:temp_files[expand(':p')] | + \ if has_key(s:temp_files,tolower(expand(':p'))) | + \ let b:git_dir = s:temp_files[tolower(expand(':p'))].dir | \ let b:git_type = 'temp' | + \ let b:git_args = s:temp_files[tolower(expand(':p'))].args | \ call fugitive#detect(expand(':p')) | - \ setlocal bufhidden=delete | + \ setlocal bufhidden=delete nobuflisted | \ nnoremap q :bdelete| \ endif augroup END -" }}}1 -" Go to file {{{1 +" Section: Go to file function! s:JumpInit() abort nnoremap :exe GF("edit") if !&modifiable - if exists(':CtrlP') - nnoremap :exe 'CtrlP '.fnameescape(repo().tree()) - endif nnoremap o :exe GF("split") nnoremap S :exe GF("vsplit") nnoremap O :exe GF("tabedit") @@ -2442,7 +2759,7 @@ function! s:GF(mode) abort endwhile let offset += matchstr(getline(lnum), type.'\zs\d\+') let ref = getline(search('^'.type.'\{3\} [ab]/','bnW'))[4:-1] - let dcmd = '+'.offset.'|if foldlevel(".")|foldopen!|endif' + let dcmd = '+'.offset.'|normal! zv' let dref = '' elseif getline('.') =~# '^rename from ' @@ -2463,6 +2780,10 @@ function! s:GF(mode) abort elseif line('$') == 1 && getline('.') =~ '^\x\{40\}$' let ref = getline('.') + + elseif expand('') =~# '^\x\{7,40\}\>' + return s:Edit(a:mode,0,expand('')) + else let ref = '' endif @@ -2499,16 +2820,18 @@ function! s:GF(mode) abort endtry endfunction -" }}}1 -" Statusline {{{1 +" Section: Statusline function! s:repo_head_ref() dict abort + if !filereadable(self.dir('HEAD')) + return '' + endif return readfile(self.dir('HEAD'))[0] endfunction call s:add_methods('repo',['head_ref']) -function! fugitive#statusline(...) +function! fugitive#statusline(...) abort if !exists('b:git_dir') return '' endif @@ -2524,7 +2847,7 @@ function! fugitive#statusline(...) endif endfunction -function! fugitive#head(...) +function! fugitive#head(...) abort if !exists('b:git_dir') return '' endif @@ -2532,8 +2855,7 @@ function! fugitive#head(...) return s:repo().head(a:0 ? a:1 : 0) endfunction -" }}}1 -" Folding {{{1 +" Section: Folding function! fugitive#foldtext() abort if &foldmethod !=# 'syntax' @@ -2581,7 +2903,3 @@ augroup fugitive_foldtext \ set foldtext=fugitive#foldtext() | \ endif augroup END - -" }}}1 - -" vim:set et sw=2: diff --git a/sources_non_forked/vim-golang/autoload/go/complete.vim b/sources_non_forked/vim-golang/autoload/go/complete.vim new file mode 100644 index 00000000..a4fa6b66 --- /dev/null +++ b/sources_non_forked/vim-golang/autoload/go/complete.vim @@ -0,0 +1,103 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" This file provides a utility function that performs auto-completion of +" package names, for use by other commands. + +let s:goos = $GOOS +let s:goarch = $GOARCH + +if len(s:goos) == 0 + if exists('g:golang_goos') + let s:goos = g:golang_goos + elseif has('win32') || has('win64') + let s:goos = 'windows' + elseif has('macunix') + let s:goos = 'darwin' + else + let s:goos = '*' + endif +endif + +if len(s:goarch) == 0 + if exists('g:golang_goarch') + let s:goarch = g:golang_goarch + else + let s:goarch = '*' + endif +endif + +function! go#complete#PackageMembers(package, member) + silent! let content = system('godoc ' . a:package) + if v:shell_error || !len(content) + return [] + endif + let lines = filter(split(content, "\n"),"v:val !~ '^\\s\\+$'") + try + let mx1 = '^\s\+\(\S+\)\s\+=\s\+.*' + let mx2 = '^\%(const\|var\|type\|func\) \([A-Z][^ (]\+\).*' + let candidates = + \ map(filter(copy(lines), 'v:val =~ mx1'), 'substitute(v:val, mx1, "\\1", "")') + \ + map(filter(copy(lines), 'v:val =~ mx2'), 'substitute(v:val, mx2, "\\1", "")') + return filter(candidates, '!stridx(v:val, a:member)') + catch + return [] + endtry +endfunction + +function! go#complete#Package(ArgLead, CmdLine, CursorPos) + let dirs = [] + + let words = split(a:CmdLine, '\s\+', 1) + if len(words) > 2 + " Complete package members + return go#complete#PackageMembers(words[1], words[2]) + endif + + if executable('go') + let goroot = substitute(system('go env GOROOT'), '\n', '', 'g') + if v:shell_error + echomsg '''go env GOROOT'' failed' + endif + else + let goroot = $GOROOT + endif + + if len(goroot) != 0 && isdirectory(goroot) + let dirs += [goroot] + endif + + let pathsep = ':' + if s:goos == 'windows' + let pathsep = ';' + endif + let workspaces = split($GOPATH, pathsep) + if workspaces != [] + let dirs += workspaces + endif + + if len(dirs) == 0 + " should not happen + return [] + endif + + let ret = {} + for dir in dirs + " this may expand to multiple lines + let root = split(expand(dir . '/pkg/' . s:goos . '_' . s:goarch), "\n") + call add(root, expand(dir . '/src')) + for r in root + for i in split(globpath(r, a:ArgLead.'*'), "\n") + if isdirectory(i) + let i .= '/' + elseif i !~ '\.a$' + continue + endif + let i = substitute(substitute(i[len(r)+1:], '[\\]', '/', 'g'), '\.a$', '', 'g') + let ret[i] = i + endfor + endfor + endfor + return sort(keys(ret)) +endfunction diff --git a/sources_non_forked/vim-golang/compiler/go.vim b/sources_non_forked/vim-golang/compiler/go.vim new file mode 100644 index 00000000..2c8cce49 --- /dev/null +++ b/sources_non_forked/vim-golang/compiler/go.vim @@ -0,0 +1,30 @@ +" Copyright 2013 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" compiler/go.vim: Vim compiler file for Go. + +if exists("current_compiler") + finish +endif +let current_compiler = "go" + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal +endif + +let s:save_cpo = &cpo +set cpo-=C + +CompilerSet makeprg=go\ build +CompilerSet errorformat= + \%-G#\ %.%#, + \%A%f:%l:%c:\ %m, + \%A%f:%l:\ %m, + \%C%*\\s%m, + \%-G%.%# + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:ts=4:sw=4:et diff --git a/sources_non_forked/vim-golang/ftdetect/gofiletype.vim b/sources_non_forked/vim-golang/ftdetect/gofiletype.vim new file mode 100644 index 00000000..b658f6b0 --- /dev/null +++ b/sources_non_forked/vim-golang/ftdetect/gofiletype.vim @@ -0,0 +1,23 @@ +" We take care to preserve the user's fileencodings and fileformats, +" because those settings are global (not buffer local), yet we want +" to override them for loading Go files, which are defined to be UTF-8. +let s:current_fileformats = '' +let s:current_fileencodings = '' + +" define fileencodings to open as utf-8 encoding even if it's ascii. +function! s:gofiletype_pre() + let s:current_fileformats = &g:fileformats + let s:current_fileencodings = &g:fileencodings + set fileencodings=utf-8 fileformats=unix + setlocal filetype=go +endfunction + +" restore fileencodings as others +function! s:gofiletype_post() + let &g:fileformats = s:current_fileformats + let &g:fileencodings = s:current_fileencodings +endfunction + +au BufNewFile *.go setlocal filetype=go fileencoding=utf-8 fileformat=unix +au BufRead *.go call s:gofiletype_pre() +au BufReadPost *.go call s:gofiletype_post() diff --git a/sources_non_forked/vim-golang/ftplugin/go.vim b/sources_non_forked/vim-golang/ftplugin/go.vim new file mode 100644 index 00000000..532fb172 --- /dev/null +++ b/sources_non_forked/vim-golang/ftplugin/go.vim @@ -0,0 +1,19 @@ +" Copyright 2013 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" go.vim: Vim filetype plugin for Go. + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal formatoptions-=t + +setlocal comments=s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s + +let b:undo_ftplugin = "setl fo< com< cms<" + +" vim:ts=4:sw=4:et diff --git a/sources_non_forked/vim-golang/ftplugin/go/fmt.vim b/sources_non_forked/vim-golang/ftplugin/go/fmt.vim new file mode 100644 index 00000000..359545bd --- /dev/null +++ b/sources_non_forked/vim-golang/ftplugin/go/fmt.vim @@ -0,0 +1,69 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" fmt.vim: Vim command to format Go files with gofmt. +" +" This filetype plugin add a new commands for go buffers: +" +" :Fmt +" +" Filter the current Go buffer through gofmt. +" It tries to preserve cursor position and avoids +" replacing the buffer with stderr output. +" +" Options: +" +" g:go_fmt_commands [default=1] +" +" Flag to indicate whether to enable the commands listed above. +" +" g:gofmt_command [default="gofmt"] +" +" Flag naming the gofmt executable to use. +" +if exists("b:did_ftplugin_go_fmt") + finish +endif + +if !exists("g:go_fmt_commands") + let g:go_fmt_commands = 1 +endif + +if !exists("g:gofmt_command") + let g:gofmt_command = "gofmt" +endif + +if g:go_fmt_commands + command! -buffer Fmt call s:GoFormat() +endif + +function! s:GoFormat() + let view = winsaveview() + silent execute "%!" . g:gofmt_command + if v:shell_error + let errors = [] + for line in getline(1, line('$')) + let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)') + if !empty(tokens) + call add(errors, {"filename": @%, + \"lnum": tokens[2], + \"col": tokens[3], + \"text": tokens[4]}) + endif + endfor + if empty(errors) + % | " Couldn't detect gofmt error format, output errors + endif + undo + if !empty(errors) + call setqflist(errors, 'r') + endif + echohl Error | echomsg "Gofmt returned error" | echohl None + endif + call winrestview(view) +endfunction + +let b:did_ftplugin_go_fmt = 1 + +" vim:ts=4:sw=4:et diff --git a/sources_non_forked/vim-golang/ftplugin/go/import.vim b/sources_non_forked/vim-golang/ftplugin/go/import.vim new file mode 100644 index 00000000..91c8697a --- /dev/null +++ b/sources_non_forked/vim-golang/ftplugin/go/import.vim @@ -0,0 +1,250 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" import.vim: Vim commands to import/drop Go packages. +" +" This filetype plugin adds three new commands for go buffers: +" +" :Import {path} +" +" Import ensures that the provided package {path} is imported +" in the current Go buffer, using proper style and ordering. +" If {path} is already being imported, an error will be +" displayed and the buffer will be untouched. +" +" :ImportAs {localname} {path} +" +" Same as Import, but uses a custom local name for the package. +" +" :Drop {path} +" +" Remove the import line for the provided package {path}, if +" present in the current Go buffer. If {path} is not being +" imported, an error will be displayed and the buffer will be +" untouched. +" +" If you would like to add shortcuts, you can do so by doing the following: +" +" Import fmt +" au Filetype go nnoremap f :Import fmt +" +" Drop fmt +" au Filetype go nnoremap F :Drop fmt +" +" Import the word under your cursor +" au Filetype go nnoremap k +" \ :exe 'Import ' . expand('') +" +" The backslash '\' is the default maplocalleader, so it is possible that +" your vim is set to use a different character (:help maplocalleader). +" +" Options: +" +" g:go_import_commands [default=1] +" +" Flag to indicate whether to enable the commands listed above. +" +if exists("b:did_ftplugin_go_import") + finish +endif + +if !exists("g:go_import_commands") + let g:go_import_commands = 1 +endif + +if g:go_import_commands + command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', ) + command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', ) + command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, ) +endif + +function! s:SwitchImport(enabled, localname, path) + let view = winsaveview() + let path = a:path + + " Quotes are not necessary, so remove them if provided. + if path[0] == '"' + let path = strpart(path, 1) + endif + if path[len(path)-1] == '"' + let path = strpart(path, 0, len(path) - 1) + endif + if path == '' + call s:Error('Import path not provided') + return + endif + + " Extract any site prefix (e.g. github.com/). + " If other imports with the same prefix are grouped separately, + " we will add this new import with them. + " Only up to and including the first slash is used. + let siteprefix = matchstr(path, "^[^/]*/") + + let qpath = '"' . path . '"' + if a:localname != '' + let qlocalpath = a:localname . ' ' . qpath + else + let qlocalpath = qpath + endif + let indentstr = 0 + let packageline = -1 " Position of package name statement + let appendline = -1 " Position to introduce new import + let deleteline = -1 " Position of line with existing import + let linesdelta = 0 " Lines added/removed + + " Find proper place to add/remove import. + let line = 0 + while line <= line('$') + let linestr = getline(line) + + if linestr =~# '^package\s' + let packageline = line + let appendline = line + + elseif linestr =~# '^import\s\+(' + let appendstr = qlocalpath + let indentstr = 1 + let appendline = line + let firstblank = -1 + let lastprefix = "" + while line <= line("$") + let line = line + 1 + let linestr = getline(line) + let m = matchlist(getline(line), '^\()\|\(\s\+\)\(\S*\s*\)"\(.\+\)"\)') + if empty(m) + if siteprefix == "" && a:enabled + " must be in the first group + break + endif + " record this position, but keep looking + if firstblank < 0 + let firstblank = line + endif + continue + endif + if m[1] == ')' + " if there's no match, add it to the first group + if appendline < 0 && firstblank >= 0 + let appendline = firstblank + endif + break + endif + let lastprefix = matchstr(m[4], "^[^/]*/") + if a:localname != '' && m[3] != '' + let qlocalpath = printf('%-' . (len(m[3])-1) . 's %s', a:localname, qpath) + endif + let appendstr = m[2] . qlocalpath + let indentstr = 0 + if m[4] == path + let appendline = -1 + let deleteline = line + break + elseif m[4] < path + " don't set candidate position if we have a site prefix, + " we've passed a blank line, and this doesn't share the same + " site prefix. + if siteprefix == "" || firstblank < 0 || match(m[4], "^" . siteprefix) >= 0 + let appendline = line + endif + elseif siteprefix != "" && match(m[4], "^" . siteprefix) >= 0 + " first entry of site group + let appendline = line - 1 + break + endif + endwhile + break + + elseif linestr =~# '^import ' + if appendline == packageline + let appendstr = 'import ' . qlocalpath + let appendline = line - 1 + endif + let m = matchlist(linestr, '^import\(\s\+\)\(\S*\s*\)"\(.\+\)"') + if !empty(m) + if m[3] == path + let appendline = -1 + let deleteline = line + break + endif + if m[3] < path + let appendline = line + endif + if a:localname != '' && m[2] != '' + let qlocalpath = printf("%s %" . len(m[2])-1 . "s", a:localname, qpath) + endif + let appendstr = 'import' . m[1] . qlocalpath + endif + + elseif linestr =~# '^\(var\|const\|type\|func\)\>' + break + + endif + let line = line + 1 + endwhile + + " Append or remove the package import, as requested. + if a:enabled + if deleteline != -1 + call s:Error(qpath . ' already being imported') + elseif appendline == -1 + call s:Error('No package line found') + else + if appendline == packageline + call append(appendline + 0, '') + call append(appendline + 1, 'import (') + call append(appendline + 2, ')') + let appendline += 2 + let linesdelta += 3 + let appendstr = qlocalpath + let indentstr = 1 + endif + call append(appendline, appendstr) + execute appendline + 1 + if indentstr + execute 'normal >>' + endif + let linesdelta += 1 + endif + else + if deleteline == -1 + call s:Error(qpath . ' not being imported') + else + execute deleteline . 'd' + let linesdelta -= 1 + + if getline(deleteline-1) =~# '^import\s\+(' && getline(deleteline) =~# '^)' + " Delete empty import block + let deleteline -= 1 + execute deleteline . "d" + execute deleteline . "d" + let linesdelta -= 2 + endif + + if getline(deleteline) == '' && getline(deleteline - 1) == '' + " Delete spacing for removed line too. + execute deleteline . "d" + let linesdelta -= 1 + endif + endif + endif + + " Adjust view for any changes. + let view.lnum += linesdelta + let view.topline += linesdelta + if view.topline < 0 + let view.topline = 0 + endif + + " Put buffer back where it was. + call winrestview(view) + +endfunction + +function! s:Error(s) + echohl Error | echo a:s | echohl None +endfunction + +let b:did_ftplugin_go_import = 1 + +" vim:ts=4:sw=4:et diff --git a/sources_non_forked/vim-golang/ftplugin/go/test.sh b/sources_non_forked/vim-golang/ftplugin/go/test.sh new file mode 100644 index 00000000..d8a5b895 --- /dev/null +++ b/sources_non_forked/vim-golang/ftplugin/go/test.sh @@ -0,0 +1,78 @@ +#!/bin/bash -e +# +# Copyright 2012 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. +# +# Tests for import.vim. + +cd $(dirname $0) + +cat > base.go <&1 -n "$1: " + vim -e -s -u /dev/null -U /dev/null --noplugin -c "source import.vim" \ + -c "$1" -c 'wq! test.go' base.go + # ensure blank lines are treated correctly + if ! gofmt test.go | cmp test.go -; then + echo 2>&1 "gofmt conflict" + gofmt test.go | diff -u test.go - | sed "s/^/ /" 2>&1 + fail=1 + return + fi + if ! [[ $(cat test.go) =~ $2 ]]; then + echo 2>&1 "$2 did not match" + cat test.go | sed "s/^/ /" 2>&1 + fail=1 + return + fi + echo 2>&1 "ok" +} + +# Tests for Import + +test_one "Import baz" '"baz".*"bytes"' +test_one "Import io/ioutil" '"io".*"io/ioutil".*"net"' +test_one "Import myc" '"io".*"myc".*"net"' # prefix of a site prefix +test_one "Import nat" '"io".*"nat".*"net"' +test_one "Import net/http" '"net".*"net/http".*"mycorp/foo"' +test_one "Import zoo" '"net".*"zoo".*"mycorp/foo"' +test_one "Import mycorp/bar" '"net".*"mycorp/bar".*"mycorp/foo"' +test_one "Import mycorp/goo" '"net".*"mycorp/foo".*"mycorp/goo"' + +# Tests for Drop + +cat > base.go <&1 "FAIL" + exit 1 +fi +echo 2>&1 "PASS" diff --git a/sources_non_forked/vim-golang/indent/go.vim b/sources_non_forked/vim-golang/indent/go.vim new file mode 100644 index 00000000..e3d6e841 --- /dev/null +++ b/sources_non_forked/vim-golang/indent/go.vim @@ -0,0 +1,77 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" indent/go.vim: Vim indent file for Go. +" +" TODO: +" - function invocations split across lines +" - general line splits (line ends in an operator) + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" C indentation is too far off useful, mainly due to Go's := operator. +" Let's just define our own. +setlocal nolisp +setlocal autoindent +setlocal indentexpr=GoIndent(v:lnum) +setlocal indentkeys+=<:>,0=},0=) + +if exists("*GoIndent") + finish +endif + +" The shiftwidth() function is relatively new. +" Don't require it to exist. +if exists('*shiftwidth') + func s:sw() + return shiftwidth() + endfunc +else + func s:sw() + return &shiftwidth + endfunc +endif + +function! GoIndent(lnum) + let prevlnum = prevnonblank(a:lnum-1) + if prevlnum == 0 + " top of file + return 0 + endif + + " grab the previous and current line, stripping comments. + let prevl = substitute(getline(prevlnum), '//.*$', '', '') + let thisl = substitute(getline(a:lnum), '//.*$', '', '') + let previ = indent(prevlnum) + + let ind = previ + + if prevl =~ '[({]\s*$' + " previous line opened a block + let ind += s:sw() + endif + if prevl =~# '^\s*\(case .*\|default\):$' + " previous line is part of a switch statement + let ind += s:sw() + endif + " TODO: handle if the previous line is a label. + + if thisl =~ '^\s*[)}]' + " this line closed a block + let ind -= s:sw() + endif + + " Colons are tricky. + " We want to outdent if it's part of a switch ("case foo:" or "default:"). + " We ignore trying to deal with jump labels because (a) they're rare, and + " (b) they're hard to disambiguate from a composite literal key. + if thisl =~# '^\s*\(case .*\|default\):$' + let ind -= s:sw() + endif + + return ind +endfunction diff --git a/sources_non_forked/vim-golang/mirror.txt b/sources_non_forked/vim-golang/mirror.txt new file mode 100644 index 00000000..7fc4f60f --- /dev/null +++ b/sources_non_forked/vim-golang/mirror.txt @@ -0,0 +1,6 @@ +This is a mirror of the misc/vim portion of the official Go repository. It is +automatically updated. + +Any contributions or issues should be made to the official repository. + +http://golang.org/doc/contribute.html diff --git a/sources_non_forked/vim-golang/plugin/godoc.vim b/sources_non_forked/vim-golang/plugin/godoc.vim new file mode 100644 index 00000000..a145d313 --- /dev/null +++ b/sources_non_forked/vim-golang/plugin/godoc.vim @@ -0,0 +1,130 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" godoc.vim: Vim command to see godoc. +" +" +" Commands: +" +" :Godoc +" +" Open the relevant Godoc for either the word[s] passed to the command or +" the, by default, the word under the cursor. +" +" Options: +" +" g:go_godoc_commands [default=1] +" +" Flag to indicate whether to enable the commands listed above. + +if exists("g:loaded_godoc") + finish +endif +let g:loaded_godoc = 1 + +let s:buf_nr = -1 +let s:last_word = '' + +if !exists('g:go_godoc_commands') + let g:go_godoc_commands = 1 +endif + +if g:go_godoc_commands + command! -nargs=* -range -complete=customlist,go#complete#Package Godoc :call s:Godoc() +endif + +nnoremap (godoc-keyword) :call Godoc('') + +function! s:GodocView() + if !bufexists(s:buf_nr) + leftabove new + file `="[Godoc]"` + let s:buf_nr = bufnr('%') + elseif bufwinnr(s:buf_nr) == -1 + leftabove split + execute s:buf_nr . 'buffer' + delete _ + elseif bufwinnr(s:buf_nr) != bufwinnr('%') + execute bufwinnr(s:buf_nr) . 'wincmd w' + endif + + setlocal filetype=godoc + setlocal bufhidden=delete + setlocal buftype=nofile + setlocal noswapfile + setlocal nobuflisted + setlocal modifiable + setlocal nocursorline + setlocal nocursorcolumn + setlocal iskeyword+=: + setlocal iskeyword-=- + + nnoremap K :Godoc + + au BufHidden call let buf_nr = -1 +endfunction + +function! s:GodocWord(word) + if !executable('godoc') + echohl WarningMsg + echo "godoc command not found." + echo " install with: go get code.google.com/p/go.tools/cmd/godoc" + echohl None + return 0 + endif + let word = a:word + silent! let content = system('godoc ' . word) + if v:shell_error || !len(content) + if len(s:last_word) + silent! let content = system('godoc ' . s:last_word.'/'.word) + if v:shell_error || !len(content) + echo 'No documentation found for "' . word . '".' + return 0 + endif + let word = s:last_word.'/'.word + else + echo 'No documentation found for "' . word . '".' + return 0 + endif + endif + let s:last_word = word + silent! call s:GodocView() + setlocal modifiable + silent! %d _ + silent! put! =content + silent! normal gg + setlocal nomodifiable + setfiletype godoc + return 1 +endfunction + +function! s:Godoc(...) + if !len(a:000) + let oldiskeyword = &iskeyword + setlocal iskeyword+=. + let word = expand('') + let &iskeyword = oldiskeyword + let word = substitute(word, '[^a-zA-Z0-9\\/._~-]', '', 'g') + let words = split(word, '\.\ze[^./]\+$') + else + let words = a:000 + endif + if !len(words) + return + endif + if s:GodocWord(words[0]) + if len(words) > 1 + if search('^\%(const\|var\|type\|\s\+\) ' . words[1] . '\s\+=\s') + return + endif + if search('^func ' . words[1] . '(') + silent! normal zt + return + endif + echo 'No documentation found for "' . words[1] . '".' + endif + endif +endfunction + +" vim:ts=4:sw=4:et diff --git a/sources_non_forked/vim-golang/readme.txt b/sources_non_forked/vim-golang/readme.txt new file mode 100644 index 00000000..9a9e2287 --- /dev/null +++ b/sources_non_forked/vim-golang/readme.txt @@ -0,0 +1,103 @@ +Vim plugins for Go (http://golang.org) +====================================== + +To use all the Vim plugins, add these lines to your $HOME/.vimrc. + + " Some Linux distributions set filetype in /etc/vimrc. + " Clear filetype flags before changing runtimepath to force Vim to reload them. + if exists("g:did_load_filetypes") + filetype off + filetype plugin indent off + endif + set runtimepath+=$GOROOT/misc/vim " replace $GOROOT with the output of: go env GOROOT + filetype plugin indent on + syntax on + +If you want to select fewer plugins, use the instructions in the rest of +this file. + +A popular configuration is to gofmt Go source files when they are saved. +To do that, add this line to the end of your $HOME/.vimrc. + + autocmd FileType go autocmd BufWritePre Fmt + + +Vim syntax highlighting +----------------------- + +To install automatic syntax highlighting for GO programs: + + 1. Copy or link the filetype detection script to the ftdetect directory + underneath your vim runtime directory (normally $HOME/.vim/ftdetect) + 2. Copy or link syntax/go.vim to the syntax directory underneath your vim + runtime directory (normally $HOME/.vim/syntax). Linking this file rather + than just copying it will ensure any changes are automatically reflected + in your syntax highlighting. + 3. Add the following line to your .vimrc file (normally $HOME/.vimrc): + + syntax on + +In a typical unix environment you might accomplish this using the following +commands: + + mkdir -p $HOME/.vim/ftdetect + mkdir -p $HOME/.vim/syntax + mkdir -p $HOME/.vim/autoload/go + ln -s $GOROOT/misc/vim/ftdetect/gofiletype.vim $HOME/.vim/ftdetect/ + ln -s $GOROOT/misc/vim/syntax/go.vim $HOME/.vim/syntax + ln -s $GOROOT/misc/vim/autoload/go/complete.vim $HOME/.vim/autoload/go + echo "syntax on" >> $HOME/.vimrc + + +Vim filetype plugins +-------------------- + +To install one of the available filetype plugins: + + 1. Same as 1 above. + 2. Copy or link ftplugin/go.vim to the ftplugin directory underneath your vim + runtime directory (normally $HOME/.vim/ftplugin). Copy or link one or more + additional plugins from ftplugin/go/*.vim to the Go-specific subdirectory + in the same place ($HOME/.vim/ftplugin/go/*.vim). + 3. Add the following line to your .vimrc file (normally $HOME/.vimrc): + + filetype plugin on + + +Vim indentation plugin +---------------------- + +To install automatic indentation: + + 1. Same as 1 above. + 2. Copy or link indent/go.vim to the indent directory underneath your vim + runtime directory (normally $HOME/.vim/indent). + 3. Add the following line to your .vimrc file (normally $HOME/.vimrc): + + filetype indent on + + +Vim compiler plugin +------------------- + +To install the compiler plugin: + + 1. Same as 1 above. + 2. Copy or link compiler/go.vim to the compiler directory underneath your vim + runtime directory (normally $HOME/.vim/compiler). + 3. Activate the compiler plugin with ":compiler go". To always enable the + compiler plugin in Go source files add an autocommand to your .vimrc file + (normally $HOME/.vimrc): + + autocmd FileType go compiler go + + +Godoc plugin +------------ + +To install godoc plugin: + + 1. Same as 1 above. + 2. Copy or link plugin/godoc.vim to $HOME/.vim/plugin/godoc, + syntax/godoc.vim to $HOME/.vim/syntax/godoc.vim, + and autoload/go/complete.vim to $HOME/.vim/autoload/go/complete.vim. diff --git a/sources_non_forked/vim-golang/syntax/go.vim b/sources_non_forked/vim-golang/syntax/go.vim new file mode 100644 index 00000000..1ce6cb27 --- /dev/null +++ b/sources_non_forked/vim-golang/syntax/go.vim @@ -0,0 +1,207 @@ +" Copyright 2009 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. +" +" go.vim: Vim syntax file for Go. +" +" Options: +" There are some options for customizing the highlighting; the recommended +" settings are the default values, but you can write: +" let OPTION_NAME = 0 +" in your ~/.vimrc file to disable particular options. You can also write: +" let OPTION_NAME = 1 +" to enable particular options. At present, all options default to on. +" +" - go_highlight_array_whitespace_error +" Highlights white space after "[]". +" - go_highlight_chan_whitespace_error +" Highlights white space around the communications operator that don't follow +" the standard style. +" - go_highlight_extra_types +" Highlights commonly used library types (io.Reader, etc.). +" - go_highlight_space_tab_error +" Highlights instances of tabs following spaces. +" - go_highlight_trailing_whitespace_error +" Highlights trailing white space. + +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +if !exists("go_highlight_array_whitespace_error") + let go_highlight_array_whitespace_error = 1 +endif +if !exists("go_highlight_chan_whitespace_error") + let go_highlight_chan_whitespace_error = 1 +endif +if !exists("go_highlight_extra_types") + let go_highlight_extra_types = 1 +endif +if !exists("go_highlight_space_tab_error") + let go_highlight_space_tab_error = 1 +endif +if !exists("go_highlight_trailing_whitespace_error") + let go_highlight_trailing_whitespace_error = 1 +endif + +syn case match + +syn keyword goDirective package import +syn keyword goDeclaration var const type +syn keyword goDeclType struct interface + +hi def link goDirective Statement +hi def link goDeclaration Keyword +hi def link goDeclType Keyword + +" Keywords within functions +syn keyword goStatement defer go goto return break continue fallthrough +syn keyword goConditional if else switch select +syn keyword goLabel case default +syn keyword goRepeat for range + +hi def link goStatement Statement +hi def link goConditional Conditional +hi def link goLabel Label +hi def link goRepeat Repeat + +" Predefined types +syn keyword goType chan map bool string error +syn keyword goSignedInts int int8 int16 int32 int64 rune +syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr +syn keyword goFloats float32 float64 +syn keyword goComplexes complex64 complex128 + +hi def link goType Type +hi def link goSignedInts Type +hi def link goUnsignedInts Type +hi def link goFloats Type +hi def link goComplexes Type + +" Treat func specially: it's a declaration at the start of a line, but a type +" elsewhere. Order matters here. +syn match goType /\/ +syn match goDeclaration /^func\>/ + +" Predefined functions and values +syn keyword goBuiltins append cap close complex copy delete imag len +syn keyword goBuiltins make new panic print println real recover +syn keyword goConstants iota true false nil + +hi def link goBuiltins Keyword +hi def link goConstants Keyword + +" Comments; their contents +syn keyword goTodo contained TODO FIXME XXX BUG +syn cluster goCommentGroup contains=goTodo +syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell +syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell + +hi def link goComment Comment +hi def link goTodo Todo + +" Go escapes +syn match goEscapeOctal display contained "\\[0-7]\{3}" +syn match goEscapeC display contained +\\[abfnrtv\\'"]+ +syn match goEscapeX display contained "\\x\x\{2}" +syn match goEscapeU display contained "\\u\x\{4}" +syn match goEscapeBigU display contained "\\U\x\{8}" +syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+ + +hi def link goEscapeOctal goSpecialString +hi def link goEscapeC goSpecialString +hi def link goEscapeX goSpecialString +hi def link goEscapeU goSpecialString +hi def link goEscapeBigU goSpecialString +hi def link goSpecialString Special +hi def link goEscapeError Error + +" Strings and their contents +syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError +syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup +syn region goRawString start=+`+ end=+`+ + +hi def link goString String +hi def link goRawString String + +" Characters; their contents +syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU +syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup + +hi def link goCharacter Character + +" Regions +syn region goBlock start="{" end="}" transparent fold +syn region goParen start='(' end=')' transparent + +" Integers +syn match goDecimalInt "\<\d\+\([Ee]\d\+\)\?\>" +syn match goHexadecimalInt "\<0x\x\+\>" +syn match goOctalInt "\<0\o\+\>" +syn match goOctalError "\<0\o*[89]\d*\>" + +hi def link goDecimalInt Integer +hi def link goHexadecimalInt Integer +hi def link goOctalInt Integer +hi def link Integer Number + +" Floating point +syn match goFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" +syn match goFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>" +syn match goFloat "\<\d\+[Ee][-+]\d\+\>" + +hi def link goFloat Float + +" Imaginary literals +syn match goImaginary "\<\d\+i\>" +syn match goImaginary "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary "\<\.\d\+\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary "\<\d\+[Ee][-+]\d\+i\>" + +hi def link goImaginary Number + +" Spaces after "[]" +if go_highlight_array_whitespace_error != 0 + syn match goSpaceError display "\(\[\]\)\@<=\s\+" +endif + +" Spacing errors around the 'chan' keyword +if go_highlight_chan_whitespace_error != 0 + " receive-only annotation on chan type + syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@=" + " send-only annotation on chan type + syn match goSpaceError display "\(\/ + syn match goExtraType /\/ + syn match goExtraType /\/ + syn match goExtraType /\/ +endif + +" Space-tab error +if go_highlight_space_tab_error != 0 + syn match goSpaceError display " \+\t"me=e-1 +endif + +" Trailing white space error +if go_highlight_trailing_whitespace_error != 0 + syn match goSpaceError display excludenl "\s\+$" +endif + +hi def link goExtraType Type +hi def link goSpaceError Error + +" Search backwards for a global declaration to start processing the syntax. +"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/ + +" There's a bug in the implementation of grouphere. For now, use the +" following as a more expensive/less precise workaround. +syn sync minlines=500 + +let b:current_syntax = "go" diff --git a/sources_non_forked/vim-golang/syntax/godoc.vim b/sources_non_forked/vim-golang/syntax/godoc.vim new file mode 100644 index 00000000..bd4443f7 --- /dev/null +++ b/sources_non_forked/vim-golang/syntax/godoc.vim @@ -0,0 +1,20 @@ +" Copyright 2011 The Go Authors. All rights reserved. +" Use of this source code is governed by a BSD-style +" license that can be found in the LICENSE file. + +if exists("b:current_syntax") + finish +endif + +syn case match +syn match godocTitle "^\([A-Z][A-Z ]*\)$" + +command -nargs=+ HiLink hi def link + +HiLink godocTitle Title + +delcommand HiLink + +let b:current_syntax = "godoc" + +" vim:ts=4 sts=2 sw=2: diff --git a/sources_non_forked/vim-less/README.md b/sources_non_forked/vim-less/README.md index 697ad124..e9d9b5f7 100644 --- a/sources_non_forked/vim-less/README.md +++ b/sources_non_forked/vim-less/README.md @@ -35,7 +35,7 @@ in `after/syntax/css.vim` or `after/syntax/css/*.vim`. ### Map .less to .css , lessc is required. - nnoremap ,m :w !lessc % > %:t:r.css + nnoremap m :w !lessc % > %:t:r.css ## Credits diff --git a/sources_non_forked/vim-less/indent/less.vim b/sources_non_forked/vim-less/indent/less.vim index fea8846d..556c2d08 100644 --- a/sources_non_forked/vim-less/indent/less.vim +++ b/sources_non_forked/vim-less/indent/less.vim @@ -1,11 +1,10 @@ " Vim indent file -" Language: LessCSS -" Maintainer: Leonard Ehrenfried -" Last Change: 2011 Sep 26 +" Language: LessCSS +" Maintainer: Leonard Ehrenfried +" Last Change: 2011 Sep 26 if exists("b:did_indent") finish endif -runtime! indent/css.vim - +runtime! indent/css.vim \ No newline at end of file diff --git a/sources_non_forked/vim-less/syntax/less.vim b/sources_non_forked/vim-less/syntax/less.vim index fa5a247e..44bf470e 100644 --- a/sources_non_forked/vim-less/syntax/less.vim +++ b/sources_non_forked/vim-less/syntax/less.vim @@ -35,7 +35,7 @@ syn match lessClass "[[:alnum:]_-]\+" contained " string functions syn keyword lessFunction escape e % containedin=cssDefinition contained " misc functions -syn keyword lessFunction color unit containedin=cssDefinition contained +syn keyword lessFunction unit containedin=cssDefinition contained " math functions syn keyword lessFunction ceil floor percentage round containedin=cssDefinition contained " color definition diff --git a/sources_non_forked/vim-markdown/README.markdown b/sources_non_forked/vim-markdown/README.markdown new file mode 100644 index 00000000..055b8de2 --- /dev/null +++ b/sources_non_forked/vim-markdown/README.markdown @@ -0,0 +1,17 @@ +# Vim Markdown runtime files + +This is the development version of Vim's included syntax highlighting and +filetype plugins for Markdown. Generally you don't need to install these if +you are running a recent version of Vim. + +One difference between this repository and the upstream files in Vim is that +the former forces `*.md` as Markdown, while the latter detects it as Modula-2, +with an exception for `README.md`. If you'd like to force Markdown without +installing from this repository, add the following to your vimrc: + + autocmd BufNewFile,BufReadPost *.md set filetype=markdown + +## License + +Copyright © Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/sources_non_forked/vim-markdown/ftplugin/markdown.vim b/sources_non_forked/vim-markdown/ftplugin/markdown.vim index 022da06e..e8627ccc 100644 --- a/sources_non_forked/vim-markdown/ftplugin/markdown.vim +++ b/sources_non_forked/vim-markdown/ftplugin/markdown.vim @@ -1,6 +1,7 @@ " Vim filetype plugin " Language: Markdown " Maintainer: Tim Pope +" Last Change: 2013 May 30 if exists("b:did_ftplugin") finish @@ -10,7 +11,7 @@ runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim setlocal comments=fb:*,fb:-,fb:+,n:> commentstring=>\ %s setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o -setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+ +setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]: if exists('b:undo_ftplugin') let b:undo_ftplugin .= "|setl cms< com< fo< flp<" @@ -18,4 +19,32 @@ else let b:undo_ftplugin = "setl cms< com< fo< flp<" endif +function! MarkdownFold() + let line = getline(v:lnum) + + " Regular headers + let depth = match(line, '\(^#\+\)\@<=\( .*$\)\@=') + if depth > 0 + return ">" . depth + endif + + " Setext style headings + let nextline = getline(v:lnum + 1) + if (line =~ '^.\+$') && (nextline =~ '^=\+$') + return ">1" + endif + + if (line =~ '^.\+$') && (nextline =~ '^-\+$') + return ">2" + endif + + return "=" +endfunction + +if has("folding") && exists("g:markdown_folding") + setlocal foldexpr=MarkdownFold() + setlocal foldmethod=expr + let b:undo_ftplugin .= " foldexpr< foldmethod<" +endif + " vim:set sw=2: diff --git a/sources_non_forked/vim-markdown/syntax/markdown.vim b/sources_non_forked/vim-markdown/syntax/markdown.vim index 3024f2f7..8c981bbe 100644 --- a/sources_non_forked/vim-markdown/syntax/markdown.vim +++ b/sources_non_forked/vim-markdown/syntax/markdown.vim @@ -2,6 +2,7 @@ " Language: Markdown " Maintainer: Tim Pope " Filenames: *.markdown +" Last Change: 2013 May 30 if exists("b:current_syntax") finish @@ -69,21 +70,26 @@ syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+"+ end=+ syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained -syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" keepend nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart +syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline -syn region markdownItalic start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart -syn region markdownItalic start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart -syn region markdownBold start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic -syn region markdownBold start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic -syn region markdownBoldItalic start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart -syn region markdownBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart +let s:concealends = has('conceal') ? ' concealends' : '' +exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends +exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends +exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends +exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends +exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart' . s:concealends +exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart' . s:concealends + syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend +syn match markdownFootnote "\[^[^\]]\+\]" +syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:" + if main_syntax ==# 'markdown' for s:type in g:markdown_fenced_languages exe 'syn region markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*```\s*'.matchstr(s:type,'[^=]*').'\>.*$" end="^\s*```\ze\s*$" keepend contains=@markdownHighlight'.substitute(matchstr(s:type,'[^=]*$'),'\.','','g') @@ -107,6 +113,9 @@ hi def link markdownListMarker htmlTagName hi def link markdownBlockquote Comment hi def link markdownRule PreProc +hi def link markdownFootnote Typedef +hi def link markdownFootnoteDefinition Typedef + hi def link markdownLinkText htmlLink hi def link markdownIdDeclaration Typedef hi def link markdownId Type @@ -118,8 +127,11 @@ hi def link markdownUrlDelimiter htmlTag hi def link markdownUrlTitleDelimiter Delimiter hi def link markdownItalic htmlItalic +hi def link markdownItalicDelimiter markdownItalic hi def link markdownBold htmlBold +hi def link markdownBoldDelimiter markdownBold hi def link markdownBoldItalic htmlBoldItalic +hi def link markdownBoldItalicDelimiter markdownBoldItalic hi def link markdownCodeDelimiter Delimiter hi def link markdownEscape Special diff --git a/sources_non_forked/vim-multiple-cursors/doc/tags b/sources_non_forked/vim-multiple-cursors/doc/tags deleted file mode 100644 index 5efd6085..00000000 --- a/sources_non_forked/vim-multiple-cursors/doc/tags +++ /dev/null @@ -1,21 +0,0 @@ -MultipleCursorsFind multiple_cursors.txt /*MultipleCursorsFind* -g:multi_cursor_exit_from_insert_mode multiple_cursors.txt /*g:multi_cursor_exit_from_insert_mode* -g:multi_cursor_exit_from_visual_mode multiple_cursors.txt /*g:multi_cursor_exit_from_visual_mode* -g:multi_cursor_next_key multiple_cursors.txt /*g:multi_cursor_next_key* -g:multi_cursor_prev_key multiple_cursors.txt /*g:multi_cursor_prev_key* -g:multi_cursor_quit_key multiple_cursors.txt /*g:multi_cursor_quit_key* -g:multi_cursor_skip_key multiple_cursors.txt /*g:multi_cursor_skip_key* -g:multi_cursor_start_key multiple_cursors.txt /*g:multi_cursor_start_key* -g:multi_cursor_use_default_mapping multiple_cursors.txt /*g:multi_cursor_use_default_mapping* -multiple-cursors-contents multiple_cursors.txt /*multiple-cursors-contents* -multiple-cursors-contributing multiple_cursors.txt /*multiple-cursors-contributing* -multiple-cursors-credit multiple_cursors.txt /*multiple-cursors-credit* -multiple-cursors-global-options multiple_cursors.txt /*multiple-cursors-global-options* -multiple-cursors-intro multiple_cursors.txt /*multiple-cursors-intro* -multiple-cursors-issues multiple_cursors.txt /*multiple-cursors-issues* -multiple-cursors-license multiple_cursors.txt /*multiple-cursors-license* -multiple-cursors-mappings multiple_cursors.txt /*multiple-cursors-mappings* -multiple-cursors-references multiple_cursors.txt /*multiple-cursors-references* -multiple-cursors-usage multiple_cursors.txt /*multiple-cursors-usage* -vim-multiple-cursors multiple_cursors.txt /*vim-multiple-cursors* -vim-multiple-cursors.txt multiple_cursors.txt /*vim-multiple-cursors.txt* diff --git a/sources_non_forked/vim-repeat/README.markdown b/sources_non_forked/vim-repeat/README.markdown new file mode 100644 index 00000000..d9141317 --- /dev/null +++ b/sources_non_forked/vim-repeat/README.markdown @@ -0,0 +1,53 @@ +repeat.vim +========== + +If you've ever tried using the `.` command after a plugin map, you were +likely disappointed to discover it only repeated the last native command +inside that map, rather than the map as a whole. That disappointment +ends today. Repeat.vim remaps `.` in a way that plugins can tap into +it. + +The following plugins support repeat.vim: + +* [surround.vim](https://github.com/tpope/vim-surround) +* [speeddating.vim](https://github.com/tpope/vim-speeddating) +* [abolish.vim](https://github.com/tpope/vim-abolish) +* [unimpaired.vim](https://github.com/tpope/vim-unimpaired) +* [commentary.vim](https://github.com/tpope/vim-commentary) + +Adding support to a plugin is generally as simple as the following +command at the end of your map functions. + + silent! call repeat#set("\MyWonderfulMap", v:count) + +Installation +------------ + +If you don't have a preferred installation method, I recommend +installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and +then simply copy and paste: + + cd ~/.vim/bundle + git clone git://github.com/tpope/vim-repeat.git + +Contributing +------------ + +See the contribution guidelines for +[pathogen.vim](https://github.com/tpope/vim-pathogen#readme). + +Self-Promotion +-------------- + +Like repeat.vim? Follow the repository on +[GitHub](https://github.com/tpope/vim-repeat) and vote for it on +[vim.org](http://www.vim.org/scripts/script.php?script_id=2136). And if +you're feeling especially charitable, follow [tpope](http://tpo.pe/) on +[Twitter](http://twitter.com/tpope) and +[GitHub](https://github.com/tpope). + +License +------- + +Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. +See `:help license`. diff --git a/sources_non_forked/vim-repeat/autoload/repeat.vim b/sources_non_forked/vim-repeat/autoload/repeat.vim new file mode 100644 index 00000000..18b12800 --- /dev/null +++ b/sources_non_forked/vim-repeat/autoload/repeat.vim @@ -0,0 +1,119 @@ +" repeat.vim - Let the repeat command repeat plugin maps +" Maintainer: Tim Pope +" Version: 1.1 +" GetLatestVimScripts: 2136 1 :AutoInstall: repeat.vim + +" Installation: +" Place in either ~/.vim/plugin/repeat.vim (to load at start up) or +" ~/.vim/autoload/repeat.vim (to load automatically as needed). +" +" License: +" Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. +" See :help license +" +" Developers: +" Basic usage is as follows: +" +" silent! call repeat#set("\MappingToRepeatCommand",3) +" +" The first argument is the mapping that will be invoked when the |.| key is +" pressed. Typically, it will be the same as the mapping the user invoked. +" This sequence will be stuffed into the input queue literally. Thus you must +" encode special keys by prefixing them with a backslash inside double quotes. +" +" The second argument is the default count. This is the number that will be +" prefixed to the mapping if no explicit numeric argument was given. The +" value of the v:count variable is usually correct and it will be used if the +" second parameter is omitted. If your mapping doesn't accept a numeric +" argument and you never want to receive one, pass a value of -1. +" +" Make sure to call the repeat#set function _after_ making changes to the +" file. +" +" For mappings that use a register and want the same register used on +" repetition, use: +" +" silent! call repeat#setreg("\MappingToRepeatCommand", v:register) +" +" This function can (and probably needs to be) called before making changes to +" the file (as those typically clear v:register). Therefore, the call sequence +" in your mapping will look like this: +" +" nnoremap MyMap +" \ :execute 'silent! call repeat#setreg("\Plug>MyMap", v:register)' +" \ call MyFunction(v:register, ...) +" \ silent! call repeat#set("\Plug>MyMap") + +if exists("g:loaded_repeat") || &cp || v:version < 700 + finish +endif +let g:loaded_repeat = 1 + +let g:repeat_tick = -1 +let g:repeat_reg = ['', ''] + +" Special function to avoid spurious repeats in a related, naturally repeating +" mapping when your repeatable mapping doesn't increase b:changedtick. +function! repeat#invalidate() + let g:repeat_tick = -1 +endfunction + +function! repeat#set(sequence,...) + let g:repeat_sequence = a:sequence + let g:repeat_count = a:0 ? a:1 : v:count + let g:repeat_tick = b:changedtick + augroup repeat_custom_motion + autocmd! + autocmd CursorMoved let g:repeat_tick = b:changedtick | autocmd! repeat_custom_motion + augroup END +endfunction + +function! repeat#setreg(sequence,register) + let g:repeat_reg = [a:sequence, a:register] +endfunction + +function! repeat#run(count) + if g:repeat_tick == b:changedtick + let r = '' + if g:repeat_reg[0] ==# g:repeat_sequence && !empty(g:repeat_reg[1]) + if g:repeat_reg[1] ==# '=' + " This causes a re-evaluation of the expression on repeat, which + " is what we want. + let r = '"=' . getreg('=', 1) . "\" + else + let r = '"' . g:repeat_reg[1] + endif + endif + + let c = g:repeat_count + let s = g:repeat_sequence + let cnt = c == -1 ? "" : (a:count ? a:count : (c ? c : '')) + call feedkeys(r . cnt, 'n') + call feedkeys(s) + else + call feedkeys((a:count ? a:count : '') . '.', 'n') + endif +endfunction + +function! repeat#wrap(command,count) + let preserve = (g:repeat_tick == b:changedtick) + exe 'norm! '.(a:count ? a:count : '').a:command . (&foldopen =~# 'undo' ? 'zv' : '') + if preserve + let g:repeat_tick = b:changedtick + endif +endfunction + +nnoremap . :call repeat#run(v:count) +nnoremap u :call repeat#wrap('u',v:count) +if maparg('U','n') ==# '' + nnoremap U :call repeat#wrap('U',v:count) +endif +nnoremap :call repeat#wrap("\C-R>",v:count) + +augroup repeatPlugin + autocmd! + autocmd BufLeave,BufWritePre,BufReadPre * let g:repeat_tick = (g:repeat_tick == b:changedtick || g:repeat_tick == 0) ? 0 : -1 + autocmd BufEnter,BufWritePost * if g:repeat_tick == 0|let g:repeat_tick = b:changedtick|endif +augroup END + +" vim:set ft=vim et sw=4 sts=4: diff --git a/sources_non_forked/vim-snipmate/Contributors.md b/sources_non_forked/vim-snipmate/Contributors.md index 33380c1d..4e139e1a 100644 --- a/sources_non_forked/vim-snipmate/Contributors.md +++ b/sources_non_forked/vim-snipmate/Contributors.md @@ -8,11 +8,14 @@ It is currently maintained by [Rok Garbas](rok@garbas.si), [Marc Weber](marco-oweber@gmx.de), and [Adnan Zafar](https://github.com/ajzafar) with additional contributions from: +* [907th](https://github.com/907th) +* [adkron](https://github.com/adkron) * [alderz](https://github.com/alderz) * [asymmetric](https://github.com/asymmetric) * [bpugh](https://github.com/bpugh) * [bruno-](https://github.com/bruno-) * [darkwise](https://github.com/darkwise) +* [fish-face](https://github.com/fish-face) * [henrik](https://github.com/henrik) * [holizz](https://github.com/holizz) * [honza](https://github.com/honza) diff --git a/sources_non_forked/vim-snipmate/README.md b/sources_non_forked/vim-snipmate/README.md index 02718478..86d881a5 100644 --- a/sources_non_forked/vim-snipmate/README.md +++ b/sources_non_forked/vim-snipmate/README.md @@ -22,6 +22,8 @@ dependencies. SnipMate depends on [vim-addon-mw-utils][mw-utils] and [tlib][tlib]. Since SnipMate does not ship with any snippets, we suggest looking at the [vim-snippets][vim-snippets] repository. +* Using [VAM][vam], add `vim-snippets` to the list of packages to be installed. + * Using [Pathogen][pathogen], run the following commands: % cd ~/.vim/bundle @@ -32,8 +34,6 @@ looking at the [vim-snippets][vim-snippets] repository. # Optional: % git clone https://github.com/honza/vim-snippets.git -* Using [VAM][vam], add `vim-snippets` to the list of packages to be installed. - * Using [Vundle][vundle], add the following to your `vimrc` then run `:BundleInstall` @@ -44,6 +44,54 @@ looking at the [vim-snippets][vim-snippets] repository. " Optional: Bundle "honza/vim-snippets" +## FAQ ## + +> How does SnipMate determine which snippets to load? How can I separate, for +> example, my Rails snippets from my Ruby snippets? + +Primarily SnipMate looks at the `'filetype'` and `'syntax'` settings. Taking +"scopes" from these options, it looks in each `snippets/` directory in +`'runtimepath'` for files named `scope.snippets`, `scope/*.snippets`, or +`scope_*.snippets`. + +However we understand this may not allow for the flexibility desired by some +languages. For this we provide two options: scope aliases and the +`:SnipMateLoadScope` command. Scope aliases simply say "whenever this scope is +loaded, also load this other scope: + + let g:snipMate = {} + let g:snipMate.scope_aliases = {} + let g:snipMate.scope_aliases['ruby'] = 'ruby,rails' + +will load the `ruby-rails` scope whenever the `ruby` scope is active. The +`:SnipMateLoadScope foo` command will always load the foo scope in the current +buffer. The [vim-rails](https://github.com/tpope/vim-rails) plugin automatically +does `:SnipMateLoadScope rails` when editing a Rails project for example. + +## Release Notes ## + +### Master ### + +* Implement simple caching +* Remove expansion guards +* Fix bug with mirrors in the first column +* Fix bug with tabs in indents ([#143][143]) +* Fix bug with mirrors in placeholders +* Fix reading single snippet files +* Fix the use of the visual map at the end of a line +* Add `:SnipMateLoadScope` command and buffer-local scope aliases +* Load `_*.snippets` files + +### 0.87 - 2014-01-04 ### + +* Stop indenting empty lines when expanding snippets +* Support extends keyword in .snippets files +* Fix visual placeholder support +* Add zero tabstop support +* Support negative 'softtabstop' +* Add g:snipMate_no_default_aliases option +* Add snipMateTrigger for triggering an expansion inside a snippet +* Add snipMate#CanBeTriggered() function [ultisnips]: https://github.com/sirver/ultisnips [msanders]: https://github.com/msanders @@ -56,3 +104,5 @@ looking at the [vim-snippets][vim-snippets] repository. [vam]: https://github.com/marcweber/vim-addon-manager [pathogen]: https://github.com/tpope/vim-pathogen [vundle]: https://github.com/gmarik/vundle + +[143]: https://github.com/garbas/vim-snipmate/issues/143 diff --git a/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim index 668b2241..d7379c22 100644 --- a/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/after/plugin/snipMate.vim @@ -41,11 +41,6 @@ if !exists('g:snips_no_mappings') || !g:snips_no_mappings call s:map_if_not_mapped('', 'snipMateShow', 'i') endif -" FIXME: Without this map, in select mode deletes the current selection and -" returns to normal mode. This doesn't update placeholders. Ideally there's some -" way to update the placeholders without this otherwise useless map. -silent! snoremap b - let &cpo = s:save_cpo " vim:noet: diff --git a/sources_non_forked/vim-snipmate/autoload/snipMate.vim b/sources_non_forked/vim-snipmate/autoload/snipMate.vim index bb3ecdfd..15d4c300 100644 --- a/sources_non_forked/vim-snipmate/autoload/snipMate.vim +++ b/sources_non_forked/vim-snipmate/autoload/snipMate.vim @@ -2,7 +2,6 @@ if !exists('g:snipMate') let g:snipMate = {} endif -let s:c = g:snipMate try call tlib#input#List('mi', '', []) @@ -11,34 +10,7 @@ catch /.*/ endtry " match $ which doesn't follow a \ -let s:d = '\%([\\]\@" to make snipmate not swallow tab (make sure to not have -" expandtab set). Remember that you can always enter tabs by then -" you don't need this -let s:c['no_match_completion_feedkeys_chars'] = get(s:c, 'no_match_completion_feedkeys_chars', "\t") +let s:d = nr2char(31) fun! Filename(...) let filename = expand('%:t:r') @@ -47,6 +19,7 @@ fun! Filename(...) endf let s:state_proto = {} +let s:cache = {} fun! s:state_proto.remove() unlet! b:snip_state @@ -79,7 +52,7 @@ fun! snipMate#expandSnip(snip, col) endif " Insert snippet with proper indentation - let indent = indent(lnum) + 1 + let indent = match(line, '\S\|$') + 1 call setline(lnum, line . snipLines[0]) call append(lnum, map(snipLines[1:], "empty(v:val) ? v:val : '" . strpart(line, 0, indent - 1) . "' . v:val")) @@ -91,11 +64,20 @@ fun! snipMate#expandSnip(snip, col) if b:snip_state.stop_count aug snipmate_changes - au CursorMovedI,InsertEnter call b:snip_state.update_changes() + au CursorMoved,CursorMovedI if exists('b:snip_state') | + \ call b:snip_state.update_changes() | + \ else | + \ silent! au! snipmate_changes * | + \ endif aug END call b:snip_state.set_stop(0) + let ret = b:snip_state.select_word() - return b:snip_state.select_word() + if b:snip_state.stop_count == 1 + call b:snip_state.remove() + endif + + return ret else unlet b:snip_state " Place cursor at end of snippet if no tab stop is given @@ -121,6 +103,7 @@ endfunction " Prepare snippet to be processed by s:BuildTabStops fun! s:ProcessSnippet(snip) let snippet = a:snip + let esc_bslash = '\%(\\\@ self.start_col + let changed = pos[0] == curLine && pos[1] > self.cur_stop[1] let changedVars = 0 let endPlaceholder = pos[2] - 1 + pos[1] " Subtract changeLen from each tab stop that was after any of @@ -303,6 +287,10 @@ function! s:state_proto.update_stops() if exists('pos[3]') for nPos in pos[3] let changed = nPos[0] == curLine && nPos[1] > self.start_col + if changed && nPos[1] < self.start_col + self.cur_stop[2] + call remove(pos, index(pos, nPos)) + continue + endif for [lnum, col] in self.old_vars if lnum > nPos[0] | break | endif if nPos[0] == lnum && nPos[1] > col @@ -335,10 +323,13 @@ function! s:state_proto.update_changes() let self.end_col += change_len let col = col('.') - if line('.') != self.cur_stop[0] || col < self.start_col || col > self.end_col - call self.remove() - elseif self.has_vars - call self.update_vars(change_len) + if mode() == 'i' + if line('.') != self.cur_stop[0] + \ || col < self.start_col || col > self.end_col + call self.remove() + elseif self.has_vars + call self.update_vars(change_len) + endif endif let self.prev_len = col('$') @@ -350,6 +341,7 @@ function! s:state_proto.update_vars(change) let newWord = strpart(getline('.'), self.start_col - 1, newWordLen) let changeLen = a:change let curLine = line('.') + let curCol = col('.') let oldStartSnip = self.start_col let updateTabStops = changeLen != 0 let i = 0 @@ -375,58 +367,47 @@ function! s:state_proto.update_vars(change) let i += 1 endif + " Split the line into three parts: the mirror, what's before it, and + " what's after it. Then combine them using the new mirror string. + " Subtract one to go from column index to byte index let theline = getline(lnum) - " subtract -1 to go from column byte index to string byte index - " subtract another -1 to exclude the col'th element - call setline(lnum, theline[0:(col-2)] . newWord . theline[(col+self.end_col-self.start_col-a:change-1):]) + let update = strpart(theline, 0, col - 1) + let update .= newWord + let update .= strpart(theline, col + self.end_col - self.start_col - a:change - 1) + call setline(lnum, update) endfor " Reposition the cursor in case a var updates on the same line but before " the current tabstop - if oldStartSnip != self.start_col - call cursor(0, col('.') + self.start_col - oldStartSnip) + if oldStartSnip != self.start_col || mode() == 'i' + call cursor(0, curCol + self.start_col - oldStartSnip) endif endfunction -" should be moved to utils or such? -fun! snipMate#SetByPath(dict, path, value) - let d = a:dict - for p in a:path[:-2] - if !has_key(d,p) | let d[p] = {} | endif - let d = d[p] - endfor - let d[a:path[-1]] = a:value -endf - " reads a .snippets file " returns list of " ['triggername', 'name', 'contents'] " if triggername is not set 'default' is assumed +" TODO: better error checking fun! snipMate#ReadSnippetsFile(file) let result = [] let new_scopes = [] if !filereadable(a:file) | return [result, new_scopes] | endif - let r_guard = '^guard\s\+\zs.*' let inSnip = 0 - let guard = 1 + let line_no = 0 for line in readfile(a:file) + ["\n"] - if inSnip == 2 && line =~ r_guard - let guard = matchstr(line, r_guard) - elseif inSnip && (line[0] == "\t" || line == '') + let line_no += 1 + + if inSnip && (line[0] == "\t" || line == '') let content .= strpart(line, 1)."\n" continue elseif inSnip - call add(result, [trigger, name == '' ? 'default' : name, content[:-2], guard]) + call add(result, [trigger, name == '' ? 'default' : name, content[:-2]]) let inSnip = 0 - let guard = "1" endif - if inSnip == 2 - let inSnip = 1 - endif if line[:6] == 'snippet' - " 2 signals first line - let inSnip = 2 + let inSnip = 1 let trigger = strpart(line, 8) let name = '' let space = stridx(trigger, ' ') + 1 @@ -435,6 +416,10 @@ fun! snipMate#ReadSnippetsFile(file) let trigger = strpart(trigger, 0, space - 1) endif let content = '' + if trigger =~ '^\s*$' " discard snippets with empty triggers + echom 'Invalid snippet in' a:file 'near line' line_no + let inSnip = 0 + endif elseif line[:6] == 'extends' call extend(new_scopes, map(split(strpart(line, 8)), \ "substitute(v:val, ',*$', '', '')")) @@ -443,12 +428,26 @@ fun! snipMate#ReadSnippetsFile(file) return [result, new_scopes] endf +function! s:GetScopes() + let ret = exists('b:snipMate.scope_aliases') ? copy(b:snipMate.scope_aliases) : {} + let global = get(g:snipMate, 'scope_aliases', {}) + for alias in keys(global) + if has_key(ret, alias) + let ret[alias] = join(split(ret[alias], ',') + \ + split(global[alias], ','), ',') + else + let ret[alias] = global[alias] + endif + endfor + return ret +endfunction + " adds scope aliases to list. " returns new list " the aliases of aliases are added recursively fun! s:AddScopeAliases(list) let did = {} - let scope_aliases = get(s:c,'scope_aliases', {}) + let scope_aliases = s:GetScopes() let new = a:list let new2 = [] while !empty(new) @@ -464,16 +463,22 @@ fun! s:AddScopeAliases(list) return keys(did) endf -function! s:Glob(path, expr) - let res = [] - for p in split(a:path, ',') - let h = fnamemodify(a:expr, ':h') - if isdirectory(p . '/' . h) - call extend(res, split(glob(p . '/' . a:expr), "\n")) - endif - endfor - return filter(res, 'filereadable(v:val)') -endfunction +if v:version < 704 || has('win32') + function! s:Glob(path, expr) + let res = [] + for p in split(a:path, ',') + let h = split(fnamemodify(a:expr, ':h'), '/')[0] + if isdirectory(p . '/' . h) + call extend(res, split(glob(p . '/' . a:expr), "\n")) + endif + endfor + return filter(res, 'filereadable(v:val)') + endfunction +else + function! s:Glob(path, expr) + return split(globpath(a:path, a:expr), "\n") + endfunction +endif " returns dict of " { path: { 'type': one of 'snippet' 'snippets', @@ -483,12 +488,11 @@ endfunction " 'trigger': trigger of snippet " } " } -" use trigger = '*' to match all snippet files " use mustExist = 1 to return existing files only " " mustExist = 0 is used by OpenSnippetFiles function! snipMate#GetSnippetFiles(mustExist, scopes, trigger) - let paths = join(funcref#Call(s:c.snippet_dirs), ',') + let paths = join(funcref#Call(g:snipMate.snippet_dirs), ',') let result = {} let scopes = s:AddScopeAliases(a:scopes) let trigger = escape(a:trigger, "*[]?{}`'$") @@ -497,19 +501,22 @@ function! snipMate#GetSnippetFiles(mustExist, scopes, trigger) for scope in scopes for f in s:Glob(paths, 'snippets/' . scope . '.snippets') + + \ s:Glob(paths, 'snippets/' . scope . '_*.snippets') + \ s:Glob(paths, 'snippets/' . scope . '/*.snippets') let result[f] = { 'exists' : 1, 'type' : 'snippets', \ 'name_prefix' : fnamemodify(f, ':t:r') } endfor - for f in s:Glob(paths, 'snippets/'.scope.'/'.trigger.'.snippet') + " We check for trigger* in the next two loops. In the case of an exact + " match, that'll be handled in snipMate#GetSnippetsForWordBelowCursor. + for f in s:Glob(paths, 'snippets/' . scope . '/' . trigger . '*.snippet') let result[f] = {'exists': 1, 'type': 'snippet', 'name': 'default', - \ 'trigger': a:trigger, 'name_prefix' : scope } + \ 'trigger': fnamemodify(f, ':t:r'), 'name_prefix' : scope } endfor - for f in s:Glob(paths, 'snippets/'.scope.'/'.trigger.'/*.snippet') + for f in s:Glob(paths, 'snippets/' . scope . '/' . trigger . '*/*.snippet') let result[f] = {'exists': 1, 'type': 'snippet', 'name' : fnamemodify(f, ':t:r'), - \ 'trigger': a:trigger, 'name_prefix' : scope } + \ 'trigger': fnamemodify(f, ':h:t'), 'name_prefix' : scope } endfor if !a:mustExist @@ -523,43 +530,52 @@ function! snipMate#GetSnippetFiles(mustExist, scopes, trigger) return result endfunction -fun! snipMate#EvalGuard(guard) - " left: everything left of expansion - " word: the expanded word - " are guaranteed to be in scpe +" should be moved to utils or such? +function! snipMate#SetByPath(dict, trigger, path, snippet) abort + let d = a:dict + if !has_key(d, a:trigger) + let d[a:trigger] = {} + endif + let d[a:trigger][a:path] = a:snippet +endfunction - if a:guard == '1' | return 1 | endif - let word = s:c.word - " eval is evil, but backticks are allowed anyway. - let left = getline('.')[:col('.')-3 - len(word)] - exec 'return '.a:guard -endf +function! s:CachedSnips(file) + let mtime = getftime(a:file) + if has_key(s:cache, a:file) && s:cache[a:file].mtime >= mtime + return s:cache[a:file].contents + endif + let s:cache[a:file] = {} + let s:cache[a:file].mtime = mtime + let s:cache[a:file].contents = snipMate#ReadSnippetsFile(a:file) + return s:cache[a:file].contents +endfunction " default triggers based on paths -fun! snipMate#DefaultPool(scopes, trigger, result) - let triggerR = substitute(a:trigger,'*','.*','g') +function! snipMate#DefaultPool(scopes, trigger, result) let extra_scopes = [] for [f,opts] in items(snipMate#GetSnippetFiles(1, a:scopes, a:trigger)) - let opts.name_prefix = matchstr(f, '\v[^/]+\ze/snippets') . ' ' . opts.name_prefix + let opts.name_prefix = matchstr(f, '\v/\zs.{-}\ze/snippets') . ' ' . opts.name_prefix if opts.type == 'snippets' - let [snippets, extension] = cached_file_contents#CachedFileContents(f, s:c.read_snippets_cached, 0) - for [trigger, name, contents, guard] in snippets - if trigger !~ escape(triggerR,'~') | continue | endif - if snipMate#EvalGuard(guard) - call snipMate#SetByPath(a:result, [trigger, opts.name_prefix.' '.name], contents) + let [snippets, new_scopes] = s:CachedSnips(f) + call extend(extra_scopes, new_scopes) + for [trigger, name, contents] in snippets + if trigger =~ '\V\^' . escape(a:trigger, '\') + call snipMate#SetByPath(a:result, trigger, + \ opts.name_prefix . ' ' . name, contents) endif endfor - call extend(extra_scopes, extension) elseif opts.type == 'snippet' - call snipMate#SetByPath(a:result, [opts.trigger, opts.name_prefix.' '.opts.name], funcref#Function('return readfile('.string(f).')')) + call snipMate#SetByPath(a:result, opts.trigger, + \ opts.name_prefix . ' ' . opts.name, readfile(f)) else throw "unexpected" endif endfor + if !empty(extra_scopes) call snipMate#DefaultPool(extra_scopes, a:trigger, a:result) endif -endf +endfunction " return a dict of snippets found in runtimepath matching trigger " scopes: list of scopes. usually this is the filetype. eg ['c','cpp'] @@ -567,8 +583,6 @@ endf " fun! snipMate#GetSnippets(scopes, trigger) let result = {} - let triggerR = escape(substitute(a:trigger,'*','.*','g'), '~') " escape '~' for use as regexp - " let scopes = s:AddScopeAliases(a:scopes) for F in values(g:snipMateSources) call funcref#Call(F, [a:scopes, a:trigger, result]) @@ -637,46 +651,49 @@ endf fun! snipMate#ScopesByFile() " duplicates are removed in AddScopeAliases - return filter(funcref#Call(s:c.get_scopes), "v:val != ''") + return filter(funcref#Call(g:snipMate.get_scopes), "v:val != ''") endf " used by both: completion and insert snippet -fun! snipMate#GetSnippetsForWordBelowCursor(word, suffix, break_on_first_match) +fun! snipMate#GetSnippetsForWordBelowCursor(word, exact) " Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3] let parts = split(a:word, '\W\zs') if len(parts) > 2 let parts = parts[-2:] " max 2 additional items, this might become a setting endif - let lookups = [a:word.a:suffix] + let lookups = [a:word] let lookup = '' for w in reverse(parts) let lookup = w . lookup if index(lookups, lookup) == -1 - call add(lookups, lookup.a:suffix) + call add(lookups, lookup) endif endfor " allow matching '.' if a:word =~ '\.$' - call add(lookups, '.'.a:suffix) + call add(lookups, '.') endif - call filter(lookups, 'v:val != ""') - " echo lookups + " Remove empty lookup entries, but only if there are other nonempty lookups + if len(lookups) > 1 + call filter(lookups, 'v:val != ""') + endif let matching_snippets = [] let snippet = '' " prefer longest word for word in lookups - let s:c.word = word - " echomsg string(lookups).' current: '.word - for [k,snippetD] in items(funcref#Call(s:c['get_snippets'], [snipMate#ScopesByFile(), word])) - if a:suffix == '' - " hack: require exact match - if k !=# word | continue | endif + let g:snipMate.word = word + for [k,snippetD] in items(funcref#Call(g:snipMate['get_snippets'], [snipMate#ScopesByFile(), word])) + " hack: require exact match + if a:exact && k !=# word + continue endif call add(matching_snippets, [k, snippetD]) - if a:break_on_first_match | break| endif + if a:exact + break + endif endfor endfor return matching_snippets @@ -706,16 +723,29 @@ fun! s:ChooseSnippet(snippets) return funcref#Call(a:snippets[keys(a:snippets)[idx]]) endf -fun! snipMate#ShowAvailableSnips() - let col = col('.') - let word = matchstr(getline('.'), '\S\+\%'.col.'c') +fun! snipMate#WordBelowCursor() + return matchstr(getline('.'), '\S\+\%' . col('.') . 'c') +endf - let snippets = map(snipMate#GetSnippetsForWordBelowCursor(word, '*', 0),'v:val[0]') - let matches = filter(snippets, "v:val =~# '\\V\\^" . escape(word, '\') . "'") +fun! snipMate#GetSnippetsForWordBelowCursorForComplete(word) + let snippets = map(snipMate#GetSnippetsForWordBelowCursor(a:word, 0), 'v:val[0]') + return filter(snippets, 'v:val =~# "\\V\\^' . escape(a:word, '"\') . '"') +endf + +fun! snipMate#CanBeTriggered() + let word = snipMate#WordBelowCursor() + let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word) + return len(matches) > 0 +endf + +fun! snipMate#ShowAvailableSnips() + let col = col('.') + let word = snipMate#WordBelowCursor() + let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word) " Pretty hacky, but really can't have the tab swallowed! if len(matches) == 0 - call feedkeys(s:c['no_match_completion_feedkeys_chars'], 'n') + call feedkeys(g:snipMate['no_match_completion_feedkeys_chars'], 'n') return "" endif @@ -759,7 +789,7 @@ function! snipMate#TriggerSnippet(...) endif let word = matchstr(getline('.'), '\S\+\%'.col('.').'c') - let list = snipMate#GetSnippetsForWordBelowCursor(word, '', 1) + let list = snipMate#GetSnippetsForWordBelowCursor(word, 1) if empty(list) let snippet = '' else diff --git a/sources_non_forked/vim-snipmate/doc/snipMate.txt b/sources_non_forked/vim-snipmate/doc/snipMate.txt index a0f052d3..aa49586a 100644 --- a/sources_non_forked/vim-snipmate/doc/snipMate.txt +++ b/sources_non_forked/vim-snipmate/doc/snipMate.txt @@ -74,6 +74,14 @@ Commands~ files will be shown, with the existing files shown first. +:SnipMateLoadScope[!] scope [scope ...] + Load snippets from additional scopes. Without + [!] the additional scopes are loaded only in + the current buffer. For example > + :SnipMateLoadScopes rails +< will load all rails.snippets in the current + buffer. + *SnipMate-options* Options~ @@ -103,9 +111,13 @@ g:snipMate.scope_aliases A |Dictionary| associating certain filetypes addition to "ruby" snippets should be loaded when editing files with 'filetype' set to "ruby" or contains "ruby" as an entry in the - case of dotted filetypes. + case of dotted filetypes. A buffer local + variant b:snipMate_scope_aliases is merged + with the global variant. -g:snipMate_no_default_aliases +g:snipMate_no_default_aliases Note: This has been renamed to the following. + +g:snipMate.no_default_aliases When set to 1, prevents SnipMate from loading default scope aliases. The defaults are: Filetype Alias ~ @@ -118,6 +130,10 @@ g:snipMate_no_default_aliases php php,html,javascript ur html,javascript xhtml html + Individual defaults can be disabled by setting + them to an empty value: > + let g:snipMate.scope_aliases.php = '' +< will disable the default PHP alias. Note: Setting this option does not disable scope aliases entirely, only those made by SnipMate itself. Any scope aliases created by @@ -178,6 +194,7 @@ settings (taking into account the dotted syntax), the following files are read for snippets: > .../snippets/.snippets + .../snippets/_.snippets .../snippets//.snippets .../snippets//.snippet .../snippets///.snippet @@ -194,7 +211,6 @@ Multiple snippets can be defined in *.snippets files. Each snippet definition looks something like: > snippet trigger optional description - guard left_from_cursor='^\s*' expanded text more expanded text @@ -203,9 +219,6 @@ The description is optional. If it is left out and a second snippet inside the same .snippets file uses the same trigger, the second one will overwrite the first. Otherwise multisnip is used. -The guard condition line is also optional. It can be used to make a snippet -available only in some cases. The value should be a VimL expression. - Note: Hard tabs in the expansion text are required. When the snippet is expanded in the text and 'expandtab' is set, each tab will be replaced with spaces based on 'softtabstop' if nonzero or 'shiftwidth' otherwise. @@ -254,7 +267,7 @@ the tab stop. This text then can be copied throughout the snippet using "$#", given # is the same number as used before. So, to make a C for loop: > snippet for - for (${2:i}; $2 < ${1:count}; $1++) { + for (${2:i}=0; $2 < ${1:count}; $2++) { ${4} } @@ -404,6 +417,28 @@ Perhaps some of these features will be added in a later release. ============================================================================== CHANGELOG *SnipMate-changelog* +0.87 - 2014-01-04 +----------------- + +* Stop indenting empty lines when expanding snippets +* Support extends keyword in .snippets files +* Fix visual placeholder support +* Add zero tabstop support +* Support negative 'softtabstop' +* Add g:snipMate_no_default_aliases option +* Add snipMateTrigger for triggering an expansion inside a snippet +* Add snipMate#CanBeTriggered() function + +0.86 - 2013-06-15 +----------------- +* Use more idiomatic maps +* Remove most select mode mappings + +* Fix disappearing variables bug (hpesoj) +* Fix cursor position bug when a variable is on the same line as the stop +* Fix undo point creation causing problems with Supertab +* Fix bug where SnipMate would use a typed trigger as a regular expression + 0.85 - 2013-04-03 ----------------- diff --git a/sources_non_forked/vim-snipmate/plugin/snipMate.vim b/sources_non_forked/vim-snipmate/plugin/snipMate.vim index a4531b02..67a4d028 100644 --- a/sources_non_forked/vim-snipmate/plugin/snipMate.vim +++ b/sources_non_forked/vim-snipmate/plugin/snipMate.vim @@ -1,20 +1,18 @@ " File: snipMate.vim -" Author: Michael Sanders -" Version: 0.86 " Description: snipMate.vim implements some of TextMate's snippets features in " Vim. A snippet is a piece of often-typed text that you can " insert into your document using a trigger word followed by a "". " " For more help see snipMate.txt; you can do this by using: " :helptags ~/.vim/doc -" :h snipMate.txt +" :h SnipMate if exists('loaded_snips') || &cp || version < 700 finish endif let loaded_snips = 1 -if !exists('snips_author') | let snips_author = 'Me' | endif -" save and reset 'cpo' + +" Save and reset 'cpo' let s:save_cpo = &cpo set cpo&vim @@ -26,7 +24,7 @@ endtry if (!exists('g:snipMateSources')) let g:snipMateSources = {} - " default source: get snippets based on runtimepath: + " Default source: get snippets based on runtimepath let g:snipMateSources['default'] = funcref#Function('snipMate#DefaultPool') endif @@ -42,52 +40,89 @@ inoremap snipMateTrigger =snipMate#TriggerSnippet(1)< inoremap snipMateBack =snipMate#BackwardsSnippet() snoremap snipMateBack a=snipMate#BackwardsSnippet() inoremap snipMateShow =snipMate#ShowAvailableSnips() -xnoremap snipMateVisual :call grab_visual()i +xnoremap snipMateVisual :call grab_visual()gv"_c -" config which can be overridden (shared lines) -if !exists('g:snipMate') - let g:snipMate = {} +" config variables +if !exists('g:snips_author') + let g:snips_author = 'Me' +endif +if !exists('g:snipMate') + let g:snipMate = {} endif -let s:snipMate = g:snipMate -let s:snipMate['get_snippets'] = get(s:snipMate, 'get_snippets', funcref#Function("snipMate#GetSnippets")) +" SnipMate inserts this string when no snippet expansion can be done +let g:snipMate['no_match_completion_feedkeys_chars'] = + \ get(g:snipMate, 'no_match_completion_feedkeys_chars', "\t") -" old snippets_dir: function returning list of paths which is used to read -" snippets. You can replace it with your own implementation. Defaults to all -" directories in &rtp/snippets/* -let s:snipMate['snippet_dirs'] = get(s:snipMate, 'snippet_dirs', funcref#Function('return split(&runtimepath,",")')) -if type(s:snipMate['snippet_dirs']) == type([]) - call map(s:snipMate['snippet_dirs'], 'expand(v:val)') +" Add default scope aliases, without overriding user settings +let g:snipMate.scope_aliases = get(g:snipMate, 'scope_aliases', {}) +if exists('g:snipMate_no_default_aliases') + echom 'The g:snipMate_no_default_aliases option has been renamed.' + \ 'See :h snipMate-options.' +endif +if (!exists('g:snipMate_no_default_aliases') || !g:snipMate_no_default_aliases) + \ && (!exists('g:snipMate.no_default_aliases') + \ || !g:snipMate.no_default_aliases) + let g:snipMate.scope_aliases.objc = + \ get(g:snipMate.scope_aliases, 'objc', 'c') + let g:snipMate.scope_aliases.cpp = + \ get(g:snipMate.scope_aliases, 'cpp', 'c') + let g:snipMate.scope_aliases.cu = + \ get(g:snipMate.scope_aliases, 'cu', 'c') + let g:snipMate.scope_aliases.xhtml = + \ get(g:snipMate.scope_aliases, 'xhtml', 'html') + let g:snipMate.scope_aliases.html = + \ get(g:snipMate.scope_aliases, 'html', 'javascript') + let g:snipMate.scope_aliases.php = + \ get(g:snipMate.scope_aliases, 'php', 'php,html,javascript') + let g:snipMate.scope_aliases.ur = + \ get(g:snipMate.scope_aliases, 'ur', 'html,javascript') + let g:snipMate.scope_aliases.mxml = + \ get(g:snipMate.scope_aliases, 'mxml', 'actionscript') + let g:snipMate.scope_aliases.eruby = + \ get(g:snipMate.scope_aliases, 'eruby', 'eruby-rails,html') +endif + +let g:snipMate['get_snippets'] = get(g:snipMate, 'get_snippets', funcref#Function("snipMate#GetSnippets")) + +" List of paths where snippets/ dirs are located, or a function returning such +" a list +let g:snipMate['snippet_dirs'] = get(g:snipMate, 'snippet_dirs', funcref#Function('return split(&runtimepath,",")')) +if type(g:snipMate['snippet_dirs']) == type([]) + call map(g:snipMate['snippet_dirs'], 'expand(v:val)') endif " _ is default scope added always " " &ft honors multiple filetypes and syntax such as in set ft=html.javascript syntax=FOO -let s:snipMate['get_scopes'] = get(s:snipMate, 'get_scopes', funcref#Function('return split(&ft,"\\.")+[&syntax, "_"]')) - -" dummy for compatibility - will be removed -" moving to autoload to improve loading speed and debugging -fun! TriggerSnippet() - echoe "replace TriggerSnippet by snipMate#TriggerSnippet, please!" - return snipMate#TriggerSnippet() -endf -fun! BackwardSnippet() - echoe "replace BackwardSnippet by snipMate#BackwardsSnippet, please!" - return snipMate#BackwardsSnippet() -endf +let g:snipMate['get_scopes'] = get(g:snipMate, 'get_scopes', funcref#Function('return split(&ft,"\\.")+[&syntax, "_"]')) " Modified from Luc Hermitte's function on StackOverflow " function! s:grab_visual() let a_save = @a try - normal! gv"ad + normal! gv"ay let b:snipmate_content_visual = @a finally let @a = a_save endtry endfunction +" TODO: Allow specifying an arbitrary snippets file +function! s:load_scopes(bang, ...) + let gb = a:bang ? g: : b: + let gb.snipMate = get(gb, 'snipMate', {}) + let gb.snipMate.scope_aliases = get(gb.snipMate, 'scope_aliases', {}) + let gb.snipMate.scope_aliases['_'] = join(split(get(gb.snipMate.scope_aliases, '_', ''), ',') + a:000, ',') +endfunction + +command! -bang -bar -nargs=+ SnipMateLoadScope + \ call s:load_scopes(0, ) + +" Edit snippet files +command! SnipMateOpenSnippetFiles call snipMate#OpenSnippetFiles() + " restore 'cpo' let &cpo = s:save_cpo diff --git a/sources_non_forked/vim-snipmate/plugin/snipMateInterface.vim b/sources_non_forked/vim-snipmate/plugin/snipMateInterface.vim deleted file mode 100644 index e3e391d7..00000000 --- a/sources_non_forked/vim-snipmate/plugin/snipMateInterface.vim +++ /dev/null @@ -1,2 +0,0 @@ -" some useful commands -command! SnipMateOpenSnippetFiles call snipMate#OpenSnippetFiles() diff --git a/sources_non_forked/vim-snippets/.gitignore b/sources_non_forked/vim-snippets/.gitignore new file mode 100644 index 00000000..0d20b648 --- /dev/null +++ b/sources_non_forked/vim-snippets/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/sources_non_forked/vim-snippets/AUTHORS b/sources_non_forked/vim-snippets/AUTHORS deleted file mode 100644 index c5c68c6a..00000000 --- a/sources_non_forked/vim-snippets/AUTHORS +++ /dev/null @@ -1,45 +0,0 @@ -Aaron Broder -Adam Folmert -Alberto Pose -Angel Alonso -Ben Orenstein -Bill Casarin -Christopher Joslyn -Daniel Hahler -Elliot Murphy -Eustaquio Rangel -Henrik Nyh -Honza Pokorny -Iuri Fernandes Queiroz -Jakub Nawalaniec -James F. Herdman -Jon Bernard -Kozo NISHIDA -Leandro Pincini -Marc Weber -Marcin Kulik -Marjan.Hratson -Micah Elliott -Michael Sanders -Naveed Massjouni -Rob Hudson -Rok Garbas -Sebastian Schulze -Srushti Ambekallu -Stephen Tudor -Steven Oliver -Stuart Colville -Tom Adams -Zied ABID -fo60213 -marutanm -msanders -Povilas Balzaravičius Pawka -Dmitry Dementev -Travis Holton -Chrisyue -Erik Westrup -Matt Deacalion Stevens - -TODO: add contributors from github.com/SirVer/Ultisnip having contributed to -github.com/SirVer/Ultisnip/UltiSnips/* files diff --git a/sources_non_forked/vim-snippets/README.md b/sources_non_forked/vim-snippets/README.md index 27592c73..bf8b3346 100644 --- a/sources_non_forked/vim-snippets/README.md +++ b/sources_non_forked/vim-snippets/README.md @@ -1,5 +1,3 @@ -IMPORTANT: comment on: [What about merging with Ultisnip using its engine](https://github.com/garbas/vim-snipmate/issues/114) - Snipmate & UltiSnip Snippets ============================ @@ -9,50 +7,93 @@ It is community-maintained and many people have contributed snippet files and other improvements already. Contents -======== +-------- - snippets/*: snippets using snipmate format - UltiSnips/*: snippets using UltiSnips format +- `snippets/*`: snippets using snipmate format +- `UltiSnips/*`: snippets using UltiSnips format -Snippet engines -=============== +Snippet engines supporting vim-snippets +---------------------------------------- There are different forks of snippet engines which allow the user to insert -sippets by typing the name of a snippet hitting the expansion mapping. +snippets by typing the name of a snippet hitting the expansion mapping. - garbas/vim-snipmate [4]: - VimL, snipmate-snippets, engine sometimes behaves strange, supports - rewriting snippets on the fly (eg adding a second version with folding - markers) +- [github.com/SirVer/ultisnips](https://github.com/SirVer/ultisnips): + python, supports all snippets in this repo. +- [github.com/garbas/vim-snipmate](https://github.com/garbas/vim-snipmate): + VimL, snipmate-snippets, engine sometimes behaves strange. Supports + snippets/* +- [github.com/Shougo/neosnippet](https://github.com/Shougo/neosnippet.vim): + VimL, supports snippets/* with some configuration. +- [github.com/drmingdrmer/xptemplate](https://github.com/drmingdrmer/xptemplate): + Totally different syntax, does not read snippets contained in this file, but + it is also very powerful. It does not support vim-snippets (just listing it + here for completness) + +There tries to be a more comprehensive list (which still is incomplete) here: +http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html - MarcWeber/UltiSnips [6]: - python, snipmate-snippets and UltiSnips-snippets +UltiSnips has additional features such as high speed, nesting snippets, +expanding snippets in snippets and offers powerful transformations on text in +snippets (like visual selections or placeholder texts). - SirVer/ultisnips [7]: - python, UltiSnips-snippets - - github.com/Shougo/neosnippet [5]: - viml, has a compatible mode allowing to reuse most snipmate snippets ? - - XPTemplate: - totally different syntax, does not read snippets contained in this file, - but it is also very powerful - - ... there are some more, but they have less features which is why I don't - mention them here - -UltiSnips engine has additional features such as "nested snippets". - -Which one to use? If you have python give MarcWeber/UltiSnips a try because its -fast and supports all important features. You can prefer the UltiSnip versions -of the snippets by setting the "always_use_first_snippet" option to 1. +Which one to use? If you have python give +[SirVer/ultisnips](https://github.com/SirVer/ultisnips) a try because its fast +and has the most features. If you have VimL only (vim without python support) your best option is using -garbas/vim-snipmate and cope with the minor bugs found in the engine. +[garbas/vim-snipmate](https://github.com/garbas/vim-snipmate) and cope with the +minor bugs found in the engine. +Q: Should "snipmate be deprecated in favour of UltiSnips"? + +A: No, because snimpate is VimL, and UltiSnips requires Python. +Some people want to use snippets without having to install Vim with Python +support. Yes - this sucks. + +One solution would be: Use snippets if they are good enough, but allow overriding them +in UltiSnips. This would avoid most duplication while still serving most users. +AFAIK there is a nested-placeholder branch for snipmate too. snipmate is still +improved by Adnan Zafar. So maybe time is not ready to make a final decision yet. + +[github issue/discussion](https://github.com/honza/vim-snippets/issues/363) + +Installation +------------ + +First be aware that there are many options, see "Snippet engines" above. +Second be aware than there are [tons of plugin managers](http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html) +which is why Marc Weber thinks that it doesn't make sense to repeat the same +repetitive information everywhere. + +*Recommended way:* +[vim-addon-manager](vim-addon-manager) (because Marc Weber wrote it for exactly +this reason, it supports simple dependency management). Eg you're done by this +line in your .vimrc: + +``` +" assuming you want to use snipmate snippet engine +ActivateAddons vim-snippets snipmate +``` + +[vim-pi](https://bitbucket.org/vimcommunity/vim-pi/issue/90/we-really-need-a-web-interface) +Is the place to discuss plugin managers and repository resources. + +About how to install snipate see [snipmate@garbas](https://github.com/garbas/vim-snipmate) + +(Bundle, Pathogen, git clone - keywords to make people find this link by ctrl-f search) +I know that I should be reading the docs of the snippet engine, just let me copy paste into my .vimrc: +[See this pull request](https://github.com/honza/vim-snippets/pull/307/files). + +TROUBLE +======= +If you still have trouble getting this to work create a github ticket, ask on +irc or the mailinglist. + Policies / for contributors -=========================== +--------------------------- + Some snippets are useful for almost all languages, so let's try to have the same triggers for them: @@ -64,11 +105,7 @@ el : else .. wh : while (cond) ... ``` -If you're not satisfied with these defaults, open a ticket that we implement -aliasing. Then you can remap "else" to "el" or the like. - - -Don't add stupid placeholder default texts like +Don't add useless placeholder default texts like ``` if (${1:condition}){ ${2:some code here} @@ -93,9 +130,16 @@ What about one line if ee then .. else .. vs if \n .. then \n ... \n else \n .. Which additional policies to add? Discuss at: https://github.com/honza/vim-snippets/issues/230 +*folding markers*: +Until further work is done on `vim-snipmate`, please don't add folding markers +into snippets. `vim-snipmate` has some comments about how to patch all snippets +on the fly adding those. + +Currently all snippets from UltiSnips have been put into UltiSnips - some work +on merging should be done (dropping duplicates etc). Also see engines section above. Related repositories -==================== +-------------------- We also encourage people to maintain sets of snippets for particular use cases so that all users can benefit from them. People can list their snippet repositories here: @@ -106,15 +150,15 @@ so that all users can benefit from them. People can list their snippet reposito Installation using VAM: "github:rbonvall/snipmate-snippets-bib" - Future - ideas - examples -========================= +------------------------- + [overview snippet engines](http://vim-wiki.mawercer.de/wiki/topic/text-snippets-skeletons-templates.html) If you have ideas you can add them to that list of "snippet engine features by example". Historical notes -================ +---------------- [vim-snipmate][1] was originally started by [Michael Sanders][2] who has now unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a @@ -138,17 +182,6 @@ let g:snipMate.scope_aliases = {} let g:snipMate.scope_aliases['ruby'] = 'ruby,ruby-rails,ruby-1.9' ``` -or github.com/MarcWeber/UltiSnips this way: - - -```vim -let g:UltiSnips = {} - -let g:UltiSnips.snipmate_ft_filter = { - \ 'default' : {'filetypes': ["FILETYPE"] }, - \ 'ruby' : {'filetypes': ["ruby", "ruby-rails", "ruby-1.9"] }, -``` - If it happens that you work on a project requiring ruby-1.8 snippets instead, consider using vim-addon-local-vimrc and override the filetypes. @@ -160,16 +193,15 @@ ruby-library-version triplet. Sometimes postfixing a name such as will do it then if syntax has changed. + Language maintainers -------------------- No one can really be proficient in all programming languages. If you would like to maintain snippets for a language, please get in touch. -Notes: People are interested in snippets - and their interest may stop again -at will. So its ok if people maintain a language only for a short period of -time - or jump in and get things done - don't let the flow stop :) -vim-snippets is not like the "linux kernel". +Notes: People are interested in snippets - and their interest may wane again. +This list is kept up-to-date on a best effort basis. * Python - [honza](http://github.com/honza) * Javascript - [honza](http://github.com/honza) @@ -181,25 +213,6 @@ vim-snippets is not like the "linux kernel". * Falcon - [steveno](https://github.com/steveno) * Elixir - [iurifq](https://github.com/iurifq) -Contributing notes ------------------- - -Until further work is done on `vim-snipmate`, please don't add folding markers -into snippets. `vim-snipmate` has some comments about how to patch all snippets -on the fly adding those. - -Because MarcWeber/UltiSnips [6] supports also snipmate-snippets there is no -need to duplicate all snippets - only those snippets who use advanced UltiSnips -features should be duplicated in UltiSnips (?) - -Currently all snippets from UltiSnips have been put into UltiSnips - some work -on merging should be done (dropping duplicates etc) - -Authors -------- - -For a list of authors, please see the `AUTHORS` files. - License ------- @@ -211,6 +224,4 @@ terms of the MIT license. [2]: http://github.com/msanders [3]: http://github.com/garbas [4]: http://github.com/garbas/vim-snipmate -[5]: http://github.com/Shougo/neosnippet -[6]: http://github.com/MarcWeber/UltiSnips [7]: http://github.com/SirVer/ultisnips diff --git a/sources_non_forked/vim-snippets/UltiSnips/README b/sources_non_forked/vim-snippets/UltiSnips/README index eafd0866..41d85923 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/README +++ b/sources_non_forked/vim-snippets/UltiSnips/README @@ -1,4 +1,5 @@ -This directory contains the main scripts that come bundled with UltiSnips. +This directory contains the snippets for UltiSnips. +https://github.com/sirver/ultisnips Standing On The Shoulders of Giants =================================== @@ -10,12 +11,7 @@ two projects: TextMate: http://svn.textmate.org/trunk/Bundles/ SnipMate: http://code.google.com/p/snipmate/ -All snippets from those sources were copied and cleaned up, so that they are - - not using shell script, only python (so they are cross platform compatible) - - not using any feature that UltiSnips doesn't offer - -UltiSnips has seen contributions by various individuals. Those contributions -have been merged into this collection seamlessly and without further comments. +UltiSnips has seen contributions by many individuals. Those contributions have +been merged into this collection seamlessly and without further comments. -- vim:ft=rst:nospell: - diff --git a/sources_non_forked/vim-snippets/UltiSnips/all.snippets b/sources_non_forked/vim-snippets/UltiSnips/all.snippets index 8844e281..532010e7 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/all.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/all.snippets @@ -1,6 +1,11 @@ # This file contains snippets that are always defined. I personally # have snippets for signatures and often needed texts +# sligthly lower priority than everything else since specialized versions +# should overwrite. The user needs to adjust her priority in her snippets to +# ~-55 so that other filetypes will still overwrite. +priority -60 + ############## # NICE BOXES # ############## @@ -12,71 +17,62 @@ Automatically filled during usage""" _commentDict = { } def _parse_comments(s): - """ Parses vim's comments option to extract comment format """ - i = iter(s.split(",")) + """ Parses vim's comments option to extract comment format """ + i = iter(s.split(",")) - rv = [] - try: - while True: - # get the flags and text of a comment part - flags,text = i.next().split(':', 1) + rv = [] + try: + while True: + # get the flags and text of a comment part + flags, text = next(i).split(':', 1) - if len(flags) == 0: - if len(text) == 1: - rv.append((text,text,text, "")) - # parse 3-part comment, but ignore those with O flag - elif flags[0] == 's' and 'O' not in flags: - ctriple = [] - indent = "" + if len(flags) == 0: + rv.append((text, text, text, "")) + # parse 3-part comment, but ignore those with O flag + elif flags[0] == 's' and 'O' not in flags: + ctriple = [] + indent = "" - if flags[-1] in string.digits: - indent = " " * int(flags[-1]) - ctriple.append(text) + if flags[-1] in string.digits: + indent = " " * int(flags[-1]) + ctriple.append(text) - flags,text = i.next().split(':', 1) - assert(flags[0] == 'm') - ctriple.append(text) + flags,text = next(i).split(':', 1) + assert(flags[0] == 'm') + ctriple.append(text) - flags,text = i.next().split(':', 1) - assert(flags[0] == 'e') - ctriple.append(text) - ctriple.append(indent) + flags,text = next(i).split(':', 1) + assert(flags[0] == 'e') + ctriple.append(text) + ctriple.append(indent) - rv.append(ctriple) - - elif flags[0] == 'b': - if len(text) == 1: - rv.insert(0, (text,text,text, "")) - - except StopIteration: - return rv + rv.append(ctriple) + elif flags[0] == 'b': + if len(text) == 1: + rv.insert(0, (text,text,text, "")) + except StopIteration: + return rv def _get_comment_format(): - """ Returns a 4-element tuple representing the comment format for - the current file. """ - - ft = vim.eval("&filetype") - # check if the comment dict has the format for the current file - if _commentDict.has_key(ft): - return _commentDict[ft] - - # otherwise parse vim's comments and add it for later use - commentformat = _parse_comments(vim.eval("&comments"))[0] - _commentDict[ft] = commentformat - - return commentformat + """ Returns a 4-element tuple representing the comment format for + the current file. """ + return _parse_comments(vim.eval("&comments"))[0] -def make_box(twidth, bwidth = None): - if bwidth is None: - bwidth = twidth + 2 - b,m,e,i = _get_comment_format() - sline = b + m + bwidth*m + 2*m - nspaces = (bwidth - twidth)//2 - mlines = i + m + " " + " "*nspaces - mlinee = " " + " "*(bwidth-twidth-nspaces) + m - eline = i + 2*m + bwidth*m + m + e - return sline, mlines, mlinee, eline +def make_box(twidth, bwidth=None): + b, m, e, i = _get_comment_format() + bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2 + sline = b + m + bwidth_inner * m[0] + 2 * m[0] + nspaces = (bwidth_inner - twidth) // 2 + mlines = i + m + " " + " " * nspaces + mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m + eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e + return sline, mlines, mlinee, eline + +def foldmarker(): + "Return a tuple of (open fold marker, close fold marker)" + return vim.eval("&foldmarker").split(",") + endglobal snippet box "A nice box with the current comment symbol" b @@ -91,14 +87,29 @@ endsnippet snippet bbox "A nice box over the full width" b `!p -box = make_box(len(t[1]), 71) +width = int(vim.eval("&textwidth")) or 71 +box = make_box(len(t[1]), width) snip.rv = box[0] + '\n' + box[1] `${1:content}`!p -box = make_box(len(t[1]), 71) +box = make_box(len(t[1]), width) snip.rv = box[2] + '\n' + box[3]` $0 endsnippet +snippet fold "Insert a vim fold marker" b +`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = _get_comment_format()[2]` +endsnippet + +snippet foldc "Insert a vim fold close marker" b +`!p snip.rv = _get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = _get_comment_format()[2]` +endsnippet + +snippet foldp "Insert a vim fold marker pair" b +`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = _get_comment_format()[2]` +${2:${VISUAL:Content}} +`!p snip.rv = _get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = _get_comment_format()[2]` +endsnippet + ########################## # LOREM IPSUM GENERATORS # ########################## diff --git a/sources_non_forked/vim-snippets/UltiSnips/bib.snippets b/sources_non_forked/vim-snippets/UltiSnips/bib.snippets new file mode 100644 index 00000000..c9b8df5c --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/bib.snippets @@ -0,0 +1,52 @@ +priority -50 + +snippet online "Online resource" b +@online{${1:name}, + author={${2:author}}, + title={${3:title}}, + date={${4:date}}, + url={${5:url}} +} +$0 +endsnippet + +snippet article "Article reference" b +@article{${1:name}, + author={${2:author}}, + title={${3:title}}, + journaltitle={${4:journal}}, + volume={${5:NN}}, + number={${6:NN}}, + year={${7:YYYY}}, + pages={${8:NN}--${9:NN}} +} +$0 +endsnippet + +snippet book "Book reference" b +@book{${1:name}, + author={${2:author}}, + title={${3:title}}, + subtitle={${4:subtitle}}, + year={${5:YYYY}}, + location={${6:somewhere}}, + publisher={${7:publisher}}, + pages={${8:NN}--${9:NN}} +} +$0 +endsnippet + +snippet inb "In Book reference" b +@inbook{${1:name}, + author={${2:author}}, + title={${3:title}}, + subtitle={${4:subtitle}}, + booktitle={${5:book}}, + editor={${6:editor}}, + year={${7:YYYY}}, + location={${8:somewhere}}, + publisher={${9:publisher}}, + pages={${10:NN}--${11:NN}} +} +$0 +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/bindzone.snippets b/sources_non_forked/vim-snippets/UltiSnips/bindzone.snippets index 034ccdec..b8ab0dfd 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/bindzone.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/bindzone.snippets @@ -1,27 +1,29 @@ +priority -50 + global !p def newsoa(): - import datetime - now = datetime.datetime.now() - # return standard SOA formatted serial for today - return now.strftime("%Y%m%d00") + import datetime + now = datetime.datetime.now() + # return standard SOA formatted serial for today + return now.strftime("%Y%m%d00") endglobal snippet zone "Bootstrap a new Bind zonefile" b $TTL 86400 -@ IN SOA ${1:example.net}. ${2:hostmaster.$1}.( - `!p snip.rv = newsoa()`; serial - 21600; refresh every 6 hours - 3600; retry after one hour - 604800; expire after a week - 86400 ); minimum TTL of 1 day +@ IN SOA ${1:example.net}. ${2:hostmaster.$1}.( + `!p snip.rv = newsoa()`; serial + 21600; refresh every 6 hours + 3600; retry after one hour + 604800; expire after a week + 86400 ); minimum TTL of 1 day - IN NS ns01.$1. - IN MX 10 mail.$1. + IN NS ns01.$1. + IN MX 10 mail.$1. -ns01.$1 IN A -mail.$1 IN A +ns01.$1 IN A +mail.$1 IN A endsnippet snippet A "Insert A Record" b -${1:hostname} IN A ${2:ip} +${1:hostname} IN A ${2:ip} endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/c.snippets b/sources_non_forked/vim-snippets/UltiSnips/c.snippets index 062a36ae..e6ea2f9d 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/c.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/c.snippets @@ -2,6 +2,8 @@ # TextMate Snippets # ########################################################################### +priority -50 + snippet def "#define ..." #define ${1} endsnippet @@ -12,9 +14,9 @@ snippet ifndef "#ifndef ... #define ... #endif" #endif endsnippet -snippet #if "#if #endif" !b +snippet #if "#if #endif" b #if ${1:0} -${VISUAL:code}$0 +${VISUAL}${0} #endif endsnippet @@ -36,17 +38,24 @@ $0 endsnippet snippet main "main() (main)" -int main(int argc, char const *argv[]) +int main(int argc, char *argv[]) { - ${0:/* code */} + ${VISUAL}${0} return 0; } endsnippet -snippet for "for int loop (fori)" -for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +snippet for "for loop (for)" +for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${0:/* code */} + ${VISUAL}${0} +} +endsnippet + +snippet fori "for int loop (fori)" +for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +{ + ${VISUAL}${0} } endsnippet @@ -62,10 +71,10 @@ if not snip.c: rand = ''.join(random.sample(string.ascii_letters+string.digits, 8)) snip.rv = ('%s_%s' % (name,rand)).upper() else: - snip.rv = snip.c`} + snip.rv = snip.c`} #define $1 -${0} +${VISUAL}${0} #endif /* end of include guard: $1 */ @@ -75,9 +84,15 @@ snippet td "Typedef" typedef ${1:int} ${2:MyCustomType}; endsnippet +snippet wh "while loop" +while(${1:/* condition */}) { + ${VISUAL}${0} +} +endsnippet + snippet do "do...while loop (do)" do { - ${0:/* code */} + ${VISUAL}${0} } while(${1:/* condition */}); endsnippet @@ -88,18 +103,30 @@ endsnippet snippet if "if .. (if)" if (${1:/* condition */}) { - ${0:/* code */} + ${VISUAL}${0} +} +endsnippet + +snippet el "else .. (else)" +else { + ${VISUAL}${0} +} +endsnippet + +snippet eli "else if .. (eli)" +else if (${1:/* condition */}) { + ${VISUAL}${0} } endsnippet snippet ife "if .. else (ife)" if (${1:/* condition */}) { - ${2:/* code */} + ${2} } else { - ${3:/* else */} + ${3:/* else */} } endsnippet @@ -114,4 +141,15 @@ struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} }; endsnippet +snippet fun "function" b +${1:void} ${2:function_name}(${3}) +{ + ${VISUAL}${0} +} +endsnippet + +snippet fund "function declaration" b +${1:void} ${2:function_name}(${3}); +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/coffee.snippets b/sources_non_forked/vim-snippets/UltiSnips/coffee.snippets index 68d40349..467b2b57 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/coffee.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/coffee.snippets @@ -1,5 +1,4 @@ -# From the TextMate bundle -# with some modification +priority -50 snippet fun "Function" b ${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`-> @@ -10,52 +9,52 @@ snippet bfun "Function (bound)" i `!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr} endsnippet -snippet if "If" +snippet if "If" b if ${1:condition} ${0:# body...} endsnippet -snippet ife "If .. Else" +snippet ife "If .. Else" b if ${1:condition} ${2:# body...} else ${3:# body...} endsnippet -snippet eif "Else if" b +snippet elif "Else if" b else if ${1:condition} ${0:# body...} endsnippet -snippet ifte "Ternary if" +snippet ifte "Ternary if" b if ${1:condition} then ${2:value} else ${3:other} endsnippet -snippet unl "Unless" +snippet unl "Unless" b ${1:action} unless ${2:condition} endsnippet -snippet fora "Array Comprehension" +snippet fora "Array Comprehension" b for ${1:name} in ${2:array} ${0:# body...} endsnippet -snippet foro "Object Comprehension" +snippet foro "Object Comprehension" b for ${1:key}, ${2:value} of ${3:Object} ${0:# body...} endsnippet -snippet forr "Range Comprehension (inclusive)" +snippet forr "Range Comprehension (inclusive)" b for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} ${0:# body...} endsnippet -snippet forrex "Range Comprehension (exclusive)" +snippet forrex "Range Comprehension (exclusive)" b for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step} ${0:# body...} endsnippet -snippet swi "Switch" +snippet swi "Switch" b switch ${1:object} when ${2:value} ${3:# body...} @@ -63,7 +62,7 @@ switch ${1:object} $0 endsnippet -snippet swit "Switch when .. then" +snippet swit "Switch when .. then" b switch ${1:object} when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value} else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value} @@ -77,7 +76,7 @@ class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor} $0 endsnippet -snippet try "Try .. Catch" +snippet try "Try .. Catch" b try $1 catch ${2:error} @@ -95,4 +94,3 @@ endsnippet snippet log "Log" b console.log ${1:"${2:msg}"} endsnippet - diff --git a/sources_non_forked/vim-snippets/UltiSnips/coffee_jasmine.snippets b/sources_non_forked/vim-snippets/UltiSnips/coffee_jasmine.snippets index 47d1e6b5..0dd35cd6 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/coffee_jasmine.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/coffee_jasmine.snippets @@ -2,8 +2,12 @@ # CoffeeScript versions -- adapted from the JS TextMate bundle + additions # for some jasmine-jquery matchers # +priority -50 + extends coffee +priority -49 + snippet des "Describe (coffee)" b describe '${1:description}', -> $0 @@ -160,4 +164,3 @@ endsnippet snippet noscw "expect was not called with (coffee)" b expect(${1:target}).wasNotCalledWith(${2:arguments}) endsnippet - diff --git a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets index 6999c1f9..c2cb3d03 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/cpp.snippets @@ -1,3 +1,10 @@ +priority -50 + +extends c + +# We want to overwrite everything in parent ft. +priority -49 + ########################################################################### # TextMate Snippets # ########################################################################### @@ -20,7 +27,7 @@ endsnippet snippet ns "namespace .. (namespace)" namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} { - $0 + ${VISUAL}${0} }${1/.+/ \/* /m}$1${1/.+/ *\/ /m} endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/cs.snippets b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets new file mode 100644 index 00000000..aca245e5 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/cs.snippets @@ -0,0 +1,328 @@ +####################################################################### +# C# Snippets for UltiSnips # +####################################################################### + +priority -50 + +######################### +# classes and structs # +######################### + +snippet namespace "namespace" b +namespace ${1:MyNamespace} +{ + ${VISUAL}$0 +} +endsnippet + +snippet class "class" w +class ${1:MyClass} +{ + $0 +} +endsnippet + +snippet struct "struct" w +struct ${1:MyStruct} +{ + $0 +} +endsnippet + +snippet interface "interface" w +interface I${1:Interface} +{ + $0 +} +endsnippet + +snippet enum "enumeration" b +enum ${1:MyEnum} { ${2:Item} }; +endsnippet + + +############ +# Main() # +############ + +snippet sim "static int main" b +static int Main(string[] args) +{ + $0 +} +endsnippet + +snippet svm "static void main" b +static void Main(string[] args) +{ + $0 +} +endsnippet + + +################ +# properties # +################ + +snippet prop "Simple property declaration" b +public ${1:int} ${2:MyProperty} { get; set; } +endsnippet + +snippet propfull "Full property declaration" b +private ${1:int} ${2:_myProperty}; + +public $1 ${3:MyProperty} +{ + get { return $2; } + set { $2 = value; } +} +endsnippet + +snippet propg "Property with a private setter" b +public ${1:int} ${2:MyProperty} { get; private set; } +endsnippet + + +############ +# blocks # +############ + +snippet #if "#if #endif" b +#if ${1:DEBUG} +${VISUAL}$0 +#endif +endsnippet + +snippet #region "#region #endregion" b +#region ${1:Region} +${VISUAL}$0 +#endregion +endsnippet + + +########### +# loops # +########### + +snippet for "for loop" b +for (int ${1:i} = 0; $1 < ${2:10}; $1++) +{ + ${VISUAL}$0 +} +endsnippet + +snippet forr "for loop (reverse)" b +for (int ${1:i} = ${2:10}; $1 >= 0; $1--) +{ + ${VISUAL}$0 +} +endsnippet + +snippet foreach "foreach loop" b +foreach (${3:var} ${2:item} in ${1:items}) +{ + ${VISUAL}$0 +} +endsnippet + +snippet while "while loop" b +while (${1:true}) +{ + ${VISUAL}$0 +} +endsnippet + +snippet do "do loop" b +do +{ + ${VISUAL}$0 +} while (${1:true}); +endsnippet + + +############### +# branching # +############### + +snippet if "if statement" b +if ($1) +{ + ${VISUAL}$0 +} +endsnippet + +snippet ife "if else statement" b +if ($1) +{ + ${VISUAL}$0 +} +else +{ +} +endsnippet + +snippet elif "else if" b +else if ($1) +{ + $0 +} +endsnippet + +snippet elseif "else if" b +else if ($1) +{ + $0 +} +endsnippet + +snippet ifnn "if not null" b +if ($1 != null) +{ + ${VISUAL}$0 +} +endsnippet + +snippet switch "switch statement" b +switch (${1:statement}) +{ + case ${2:value}: + break; + + default: + $0break; +} +endsnippet + +snippet case "case" b +case ${1:value}: + $2 + break; +endsnippet + + +############## +# wrappers # +############## + +snippet using "using statement" b +using (${1:resource}) +{ + ${VISUAL}$0 +} +endsnippet + +snippet unchecked "unchecked block" b +unchecked +{ + ${VISUAL}$0 +} +endsnippet + +snippet checked "checked block" b +checked +{ + ${VISUAL}$0 +} +endsnippet + +snippet unsafe "unsafe" b +unsafe +{ + ${VISUAL}$0 +} +endsnippet + + +######################## +# exception handling # +######################## + +snippet try "try catch block" b +try +{ + ${VISUAL}$0 +} +catch (${1:Exception} ${2:e}) +{ + throw; +} +endsnippet + +snippet tryf "try finally block" b +try +{ + ${VISUAL}$0 +} +finally +{ +} +endsnippet + +snippet throw "throw" +throw new ${1}Exception("${2}"); +endsnippet + + +########## +# LINQ # +########## + +snippet from "LINQ syntax" b +var ${1:seq} = + from ${2:item1} in ${3:items1} + join ${4:item2} in ${5:items2} on $2.${6:prop1} equals $4.${7:prop2} + select ${8:$2.prop3} + where ${9:clause} +endsnippet + + +############################ +# feedback and debugging # +############################ + +snippet da "Debug.Assert" b +Debug.Assert(${1:true}); +endsnippet + +snippet cw "Console.WriteLine" b +Console.WriteLine("$1"); +endsnippet + +# as you first type comma-separated parameters on the right, {n} values appear in the format string +snippet cwp "Console.WriteLine with parameters" b +Console.WriteLine("${2:`!p +snip.rv = ' '.join(['{' + str(i) + '}' for i in range(t[1].count(','))]) +`}"${1:, something}); +endsnippet + +snippet mbox "Message box" b +MessageBox.Show("${1:message}"); +endsnippet + + +################## +# full methods # +################## + +snippet equals "Equals method" b +public override bool Equals(object obj) +{ + if (obj == null || GetType() != obj.GetType()) + { + return false; + } + $0 + return base.Equals(obj); +} +endsnippet + + +############## +# comments # +############## + +snippet /// "XML comment" b +/// +/// $1 +/// +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/css.snippets b/sources_non_forked/vim-snippets/UltiSnips/css.snippets index d14d51c0..32c3f217 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/css.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/css.snippets @@ -2,6 +2,8 @@ # Most of these came from TextMate # ########################################################################### +priority -50 + snippet ! "!important CSS (!)" ${1:!important} endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/d.snippets b/sources_non_forked/vim-snippets/UltiSnips/d.snippets index 7f38c6d8..9ce27513 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/d.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/d.snippets @@ -1,5 +1,7 @@ # Simple shortcuts +priority -50 + snippet imp "import (imp)" b import ${1:std.stdio}; endsnippet @@ -42,22 +44,22 @@ endsnippet snippet pub "public (pub)" b public: - ${1:/*members*/} + ${1:/*members*/} endsnippet snippet priv "private (priv)" b private: - ${1:/*members*/} + ${1:/*members*/} endsnippet snippet prot "protected (prot)" b protected: - ${1:/*members*/} + ${1:/*members*/} endsnippet snippet pack "package (pack)" b package: - ${1:/*members*/} + ${1:/*members*/} endsnippet snippet ret "return (ret)" @@ -96,7 +98,7 @@ endsnippet snippet enf "enforce (enf)" b enforce(${1:/*condition*/}, - new ${2}Exception(${3:/*args*/})); + new ${2}Exception(${3:/*args*/})); endsnippet # Branches @@ -104,67 +106,67 @@ endsnippet snippet if "if .. (if)" if(${1:/*condition*/}) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet ife "if .. else (ife)" b if(${1:/*condition*/}) { - ${2:/*code*/} + ${2} } else { - ${3:/*else*/} + ${3:/*else*/} } endsnippet snippet el "else (el)" b else { - ${VISUAL}${1:/*code*/} + ${VISUAL}${1} } endsnippet -snippet eif "else if (elif)" b +snippet elif "else if (elif)" b else if(${1:/*condition*/}) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet sw "switch (sw)" switch(${1:/*var*/}) { - case ${2:/*value*/}: - ${3:/*code*/} - break; - case ${4:/*value*/}: - ${5:/*code*/} - break; - ${7:/*more cases*/} - default: - ${6:assert(false);} + case ${2:/*value*/}: + ${3} + break; + case ${4:/*value*/}: + ${5} + break; + ${7:/*more cases*/} + default: + ${6:assert(false);} } endsnippet snippet fsw "final switch (fsw)" -switch(${1:/*var*/}) +final switch(${1:/*var*/}) { - case ${2:/*value*/}: - ${3:/*code*/} - break; - case ${4:/*value*/}: - ${5:/*code*/} - break; - ${7:/*more cases*/} + case ${2:/*value*/}: + ${3} + break; + case ${4:/*value*/}: + ${5} + break; + ${7:/*more cases*/} } endsnippet snippet case "case (case)" b case ${1:/*value*/}: - ${2:/*code*/} - break; + ${2} + break; endsnippet snippet ?: "ternary operator (?:)" @@ -176,42 +178,42 @@ endsnippet snippet do "do while (do)" b do { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } while(${1:/*condition*/}); endsnippet snippet wh "while (wh)" b while(${1:/*condition*/}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet snippet for "for (for)" b for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet forever "forever (forever)" b for(;;) { - ${VISUAL}${0:/*code*/} + ${VISUAL}${0} } endsnippet snippet fore "foreach (fore)" foreach(${1:/*elem*/}; ${2:/*range*/}) { - ${VISUAL}${3:/*code*/} + ${VISUAL}${3} } endsnippet snippet forif "foreach if (forif)" b foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/}) { - ${VISUAL}${4:/*code*/} + ${VISUAL}${4} } endsnippet @@ -219,8 +221,8 @@ endsnippet snippet in "in contract (in)" b in { - assert(${1:/*condition*/}, "${2:error message}"); - ${3} + assert(${1:/*condition*/}, "${2:error message}"); + ${3} } body endsnippet @@ -228,8 +230,8 @@ endsnippet snippet out "out contract (out)" b out${1:(result)} { - assert(${2:/*condition*/}, "${3:error message}"); - ${4} + assert(${2:/*condition*/}, "${3:error message}"); + ${4} } body endsnippet @@ -237,8 +239,8 @@ endsnippet snippet inv "invariant (inv)" b invariant() { - assert(${1:/*condition*/}, "${2:error message}"); - ${3} + assert(${1:/*condition*/}, "${2:error message}"); + ${3} } endsnippet @@ -247,29 +249,29 @@ endsnippet snippet fun "function definition (fun)" ${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow} { - ${VISUAL}${5:/*code*/} + ${VISUAL}${5} } endsnippet snippet void "void function definition (void)" void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow} { - ${VISUAL}${4:/*code*/} + ${VISUAL}${4} } endsnippet snippet this "ctor (this)" w this(${1:/*args*/}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet -snippet get "getter property (get)" ! +snippet get "getter property (get)" @property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};} endsnippet -snippet set "setter property (set)" ! +snippet set "setter property (set)" @property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;} endsnippet @@ -278,7 +280,7 @@ endsnippet snippet main "Main" b void main(string[] args) { - ${VISUAL}${0: /*code*/} + ${VISUAL}${0: /*code*/} } endsnippet @@ -293,7 +295,7 @@ endsnippet snippet scope "scope (scope)" b scope(${1:exit}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet @@ -302,7 +304,7 @@ endsnippet snippet with "with (with)" with(${1}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet @@ -311,33 +313,33 @@ endsnippet snippet try "try/catch (try)" b try { - ${VISUAL}${1:/*code to try*/} + ${VISUAL}${1:/*code to try*/} } catch(${2}Exception e) { - ${3:/*handle exception*/} + ${3:/*handle exception*/} } endsnippet snippet tryf "try/catch/finally (tryf)" b try { - ${VISUAL}${1:/*code to try*/} + ${VISUAL}${1:/*code to try*/} } catch(${2}Exception e) { - ${3:/*handle exception*/} + ${3:/*handle exception*/} } finally { - ${4:/*cleanup*/} + ${4:/*cleanup*/} } endsnippet snippet catch "catch (catch)" b catch(${1}Exception e) { - ${2:/*handle exception*/} + ${2:/*handle exception*/} } endsnippet @@ -351,35 +353,35 @@ endsnippet snippet struct "struct (struct)" struct ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + ${2} } endsnippet snippet union "union (union)" union ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + ${2} } endsnippet snippet class "class (class)" class ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + ${2} } endsnippet snippet inter "interface (inter)" interface ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + ${2} } endsnippet snippet enum "enum (enum)" enum ${1:`!p snip.rv = (snip.basename or "name")`} { - ${2} + ${2} } endsnippet @@ -388,12 +390,12 @@ endsnippet snippet exc "exception declaration (exc)" b /// ${3:/*documentation*/} -class ${1}Exception : ${2}Exception +class ${1}Exception : ${2}Exception { - public this(string msg, string file = __FILE__, int line = __LINE__) - { - super(msg, file, line); - } + public this(string msg, string file = __FILE__, int line = __LINE__) + { + super(msg, file, line); + } } endsnippet @@ -403,14 +405,14 @@ endsnippet snippet version "version (version)" b version(${1:/*version name*/}) { - ${VISUAL}${2:/*code*/} + ${VISUAL}${2} } endsnippet snippet debug "debug" b debug { - ${VISUAL}${1:/*code*/} + ${VISUAL}${1} } endsnippet @@ -420,7 +422,7 @@ endsnippet snippet temp "template (temp)" b template ${2:/*name*/}(${1:/*args*/}) { - ${3:/*code*/} + ${3} } endsnippet @@ -438,7 +440,7 @@ endsnippet snippet unittest "unittest (unittest)" b unittest { - ${1:/*code*/} + ${1} } endsnippet @@ -448,41 +450,41 @@ endsnippet snippet opDis "opDispatch (opDis)" b ${1:/*return type*/} opDispatch(string s)() { - ${2:/*code*/}; + ${2}; } endsnippet snippet op= "opAssign (op=)" b void opAssign(${1} rhs) ${2:@safe pure nothrow} { - ${2:/*code*/} + ${2} } endsnippet snippet opCmp "opCmp (opCmp)" b int opCmp(${1} rhs) @safe const pure nothrow { - ${2:/*code*/} + ${2} } endsnippet snippet opApply "opApply (opApply)" b int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg) { - int result = 0; - ${2:/*loop*/} - { - result = dg(${3:/*arg/s*/}); - if(result){break;} - } - return result; + int result = 0; + ${2:/*loop*/} + { + result = dg(${3:/*arg/s*/}); + if(result){break;} + } + return result; } endsnippet snippet toString "toString (toString)" b string toString() @safe const pure nothrow { - ${1:/*code*/} + ${1} } endsnippet @@ -490,12 +492,11 @@ endsnippet # Comments -snippet todo "TODO (todo)" ! +snippet todo "TODO (todo)" // TODO: ${1} endsnippet - # DDoc snippet doc "generic ddoc block (doc)" b @@ -508,7 +509,7 @@ snippet fdoc "function ddoc block (fdoc)" b /// ${1:description} /// /// ${2:Params: ${3:param} = ${4:param description} -/// ${5}} +/// ${5}} /// /// ${6:Returns: ${7:return value}} /// @@ -517,7 +518,7 @@ endsnippet snippet Par "Params (Par)" Params: ${1:param} = ${2:param description} -/// ${3} +/// ${3} endsnippet snippet Ret "Returns (Ret)" @@ -543,16 +544,16 @@ snippet gpl "GPL (gpl)" b // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// +// // Copyright (C) ${1:Author}, `!v strftime("%Y")` ${2} diff --git a/sources_non_forked/vim-snippets/UltiSnips/django.snippets b/sources_non_forked/vim-snippets/UltiSnips/django.snippets index 553babab..9d6ce279 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/django.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/django.snippets @@ -1,3 +1,5 @@ +priority -50 + # Generic Tags snippet % {% ${1} %}${2} @@ -5,7 +7,7 @@ endsnippet snippet %% {% ${1:tag_name} %} - ${2} + ${2} {% end$1 %} endsnippet @@ -17,14 +19,14 @@ endsnippet snippet autoescape {% autoescape ${1:off} %} - ${2} + ${2} {% endautoescape %} endsnippet snippet block {% block ${1} %} - ${2} -{% endblock %} + ${2} +{% endblock $1 %} endsnippet snippet # @@ -33,7 +35,7 @@ endsnippet snippet comment {% comment %} - ${1} + ${1} {% endcomment %} endsnippet @@ -51,7 +53,7 @@ endsnippet snippet filter {% filter ${1} %} - ${2} + ${2} {% endfilter %} endsnippet @@ -61,24 +63,24 @@ endsnippet snippet for {% for ${1} in ${2} %} - ${3} + ${3} {% endfor %} endsnippet snippet empty {% empty %} - ${1} + ${1} endsnippet snippet if {% if ${1} %} - ${2} + ${2} {% endif %} endsnippet -snippet el +snippet else {% else %} - ${1} + ${1} endsnippet snippet ifchanged @@ -87,13 +89,13 @@ endsnippet snippet ifequal {% ifequal ${1} ${2} %} - ${3} + ${3} {% endifequal %} endsnippet snippet ifnotequal {% ifnotequal ${1} ${2} %} - ${3} + ${3} {% endifnotequal %} endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/elixir.snippets b/sources_non_forked/vim-snippets/UltiSnips/elixir.snippets index ae7ea201..1f53edfb 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/elixir.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/elixir.snippets @@ -1,4 +1,4 @@ -# Credit: @iurifg +priority -50 snippet do do diff --git a/sources_non_forked/vim-snippets/UltiSnips/erlang.snippets b/sources_non_forked/vim-snippets/UltiSnips/erlang.snippets index 78231626..e27fbefa 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/erlang.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/erlang.snippets @@ -2,6 +2,8 @@ # TEXTMATE SNIPPETS # ########################################################################### +priority -50 + snippet pat "Case:Receive:Try Clause" ${1:pattern}${2: when ${3:guard}} ->; ${4:body} diff --git a/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets b/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets index 88f71791..ae58c9f2 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/eruby.snippets @@ -1,3 +1,7 @@ +extends html + +priority -50 + # TextMate added these variables to cope with changes in ERB handling # in different versions of Rails -- for instance, Rails 3 automatically # strips whitespace so that it's no longer necessary to use a form like @@ -11,19 +15,26 @@ # global !p def textmate_var(var, snip): - lookup = dict( - TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '), - TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'), - TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', '<% '), - TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'), - TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>' - ) - - snip.rv = lookup[var] - return + lookup = dict( + TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '), + TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'), + TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', '<% '), + TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'), + TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>' + ) + snip.rv = lookup[var] + return endglobal +snippet % "<% ${0} %>" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` +endsnippet + +snippet = "<%= ${0} %>" +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${0}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +endsnippet + ########################################################################### # GENERATED FROM get_tm_snippets.py + REGEX REPLACE # ########################################################################### @@ -34,7 +45,7 @@ endsnippet snippet ft "form_tag" `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => "${5:update}"}${6:, {:${8:class} => "${9:form}"\}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` - $0 + $0 `!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` endsnippet @@ -44,11 +55,11 @@ endsnippet snippet for "for loop (ERB)" <% if !${1:list}.blank? %> - <% for ${2:item} in ${1} %> - $3 - <% end %> + <% for ${2:item} in ${1} %> + $3 + <% end %> <% else %> - $4 + $4 <% end %> endsnippet @@ -66,7 +77,7 @@ snippet ffhf "form_for hidden_field 2" endsnippet snippet ffl "form_for label 2" -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute', snip)`${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet ffpf "form_for password_field 2" @@ -91,7 +102,7 @@ endsnippet snippet fields "fields_for" `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`fields_for :${1:model}, @${2:$1} do |$1|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` - $0 + $0 `!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` endsnippet @@ -114,7 +125,7 @@ snippet f. "f.hidden_field" endsnippet snippet f. "f.label" -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute', snip)`${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet snippet f. "f.password_field" @@ -140,14 +151,14 @@ endsnippet snippet ffe "form_for with errors" `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` - $0 +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` + $0 `!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` endsnippet snippet ff "form_for" -`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)` - $0 +`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` + $0 `!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)` endsnippet @@ -263,9 +274,9 @@ snippet st "submit_tag" `!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)` endsnippet -snippet el "else (ERB)" +snippet else "else (ERB)" <% else %> - + $0 endsnippet snippet if "if (ERB)" diff --git a/sources_non_forked/vim-snippets/UltiSnips/go.snippets b/sources_non_forked/vim-snippets/UltiSnips/go.snippets index ea46931b..efd15892 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/go.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/go.snippets @@ -1,5 +1,7 @@ # Snippets for Go +priority -50 + # when to abbriviate and when not? # b doesn't work here, because it ignores whitespace # optional local name? @@ -31,37 +33,61 @@ const ( ) endsnippet +snippet struct "Struct declaration" b +type ${1:Struct} struct { + ${0:${VISUAL}} +} +endsnippet + +snippet interface "Interface declaration" b +type ${1:Interface} interface { + ${0:${VISUAL}} +} +endsnippet + # statements -snippet for "For loop" !b +snippet for "For loop" b for ${1:condition}${1/(.+)/ /}{ ${0:${VISUAL}} } endsnippet -snippet forr "For range loop" !b +snippet fori "Integer for loop" b +for ${1:i} := 0; $1 < ${2:N}; $1++ { + ${0:${VISUAL}} +} +endsnippet + +snippet forr "For range loop" b for ${2:name} := range ${1:collection} { ${0:${VISUAL}} } endsnippet -snippet if "If statement" !b +snippet if "If statement" b if ${1:condition}${1/(.+)/ /}{ ${0:${VISUAL}} } endsnippet -snippet switch "Switch statement" !b +snippet switch "Switch statement" b switch ${1:expression}${1/(.+)/ /}{ case${0} } endsnippet -snippet case "Case clause" !b +snippet select "Select statement" b +select { +case${0} +} +endsnippet + +snippet case "Case clause" b case ${1:condition}: ${0:${VISUAL}} endsnippet -snippet default "Default clause" !b +snippet default "Default clause" b default: ${0:${VISUAL}} endsnippet @@ -86,22 +112,26 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { endsnippet # types and variables -snippet map "Map type" !b +snippet map "Map type" b map[${1:keytype}]${2:valtype} endsnippet -snippet : "Variable declaration :=" !b +snippet : "Variable declaration :=" b ${1:name} := ${0:value} endsnippet -snippet var "Variable declaration" !b +snippet var "Variable declaration" b var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} endsnippet -snippet vars "Variables declaration" !b +snippet vars "Variables declaration" b var ( ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } ) endsnippet +snippet json "JSON field" +\`json:"${1:displayName}"\` +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets b/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets index 99f947f8..ad217fd8 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/haskell.snippets @@ -1,13 +1,15 @@ -snippet ife "if ... then ... else ..." +priority -50 + +snippet if "if ... then ... else ..." if ${1:condition} - then ${2:expression} - else ${3:expression} + then ${2:expression} + else ${3:expression} endsnippet snippet case "case ... of ..." -case ${1} of - ${2} -> ${3} - ${4} -> ${5} +case ${1:expression} of + ${2:pattern} -> ${3:expression} + ${4:pattern} -> ${5:expression} endsnippet snippet :: "Type signature" diff --git a/sources_non_forked/vim-snippets/UltiSnips/help.snippets b/sources_non_forked/vim-snippets/UltiSnips/help.snippets index bd0bb12f..61327385 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/help.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/help.snippets @@ -1,10 +1,12 @@ # Snippets for VIM Help Files +priority -50 + global !p def sec_title(snip, t): - file_start = snip.fn.split('.')[0] - sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-') - return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1])) + file_start = snip.fn.split('.')[0] + sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-') + return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1])) endglobal snippet sec "Section marker" b diff --git a/sources_non_forked/vim-snippets/UltiSnips/html.snippets b/sources_non_forked/vim-snippets/UltiSnips/html.snippets index fd11d70b..5746feb6 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/html.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html.snippets @@ -1,13 +1,15 @@ +priority -50 + ########################################################################### # TextMate Snippets # ########################################################################### global !p def x(snip): - if snip.ft.startswith("x"): - snip.rv = '/' - else: - snip.rv = "" + if snip.ft.startswith("x"): + snip.rv = '/' + else: + snip.rv = "" endglobal ############ @@ -123,21 +125,21 @@ endsnippet ############# # HTML TAGS # ############# -snippet input "Input with Label" +snippet input "Input with Label" w endsnippet -snippet input "XHTML " +snippet input "XHTML " w endsnippet -snippet opt "Option" +snippet opt "Option" w ${3:$2} endsnippet -snippet select "Select Box" +snippet select "Select Box" w endsnippet -snippet mailto "XHTML " +snippet mailto "XHTML " w ${3:email me} endsnippet -snippet base "XHTML " +snippet base "XHTML " w endsnippet +snippet img "XHTML " w + +endsnippet + snippet body "XHTML " " - - $0 +snippet div "XHTML
" w + + $0
endsnippet -snippet form "XHTML
" +snippet form "XHTML " w @@ -182,83 +188,82 @@ snip.rv = (snip.basename or 'unnamed') + '_submit' endsnippet -snippet h1 "XHTML

" +snippet h1 "XHTML

" w

${1}

endsnippet snippet head "XHTML " - + ${1:`!p snip.rv = snip.basename or "Page Title"`} $0 endsnippet -snippet link "XHTML " +snippet link "XHTML " w endsnippet -snippet meta "XHTML " +snippet meta "XHTML " w endsnippet -snippet scriptsrc "XHTML endsnippet -snippet script "XHTML endsnippet -snippet style "XHTML endsnippet -snippet table "XHTML
" +snippet table "XHTML
" w
${5:Header}
${0:Data}
endsnippet -snippet a "Link" +snippet a "Link" w ${4:Anchor Text} endsnippet -snippet p "paragraph" +snippet p "paragraph" w

$0

endsnippet -snippet li "list item" -
  • +snippet li "list item" w +
  • $0
  • endsnippet -snippet ul "unordered list" +snippet ul "unordered list" w
      $0
    endsnippet -snippet td "table cell" +snippet td "table cell" w $0 endsnippet -snippet tr "table row" +snippet tr "table row" w $0 endsnippet -snippet title "XHTML " +snippet title "XHTML <title>" w <title>${1:`!p snip.rv = snip.basename or "Page Title"`} endsnippet -snippet fieldset "Fieldset" +snippet fieldset "Fieldset" w
    $1 - $0
    endsnippet @@ -282,7 +287,7 @@ snippet html5 "HTML5 Template" ${1} - +
    diff --git a/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets b/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets index 1f77ad7b..48ff4b72 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/html_minimal.snippets @@ -1,6 +1,8 @@ # more can be found in snippets/html_minimal.snippets # these UltiSnips override snippets because nested placeholders are being used +priority -50 + snippet id id="${1}"${2} endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets b/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets index 9df5f788..5836a2f6 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/htmldjango.snippets @@ -1 +1,3 @@ +priority -50 + extends html, django diff --git a/sources_non_forked/vim-snippets/UltiSnips/htmljinja.snippets b/sources_non_forked/vim-snippets/UltiSnips/htmljinja.snippets new file mode 100644 index 00000000..fa3b3c22 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/htmljinja.snippets @@ -0,0 +1,3 @@ +priority -50 + +extends html, jinja2 diff --git a/sources_non_forked/vim-snippets/UltiSnips/java.snippets b/sources_non_forked/vim-snippets/UltiSnips/java.snippets index 617c1616..54ca6f35 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/java.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/java.snippets @@ -1,25 +1,78 @@ -########################################################################### -# TEXTMATE SNIPPETS # -########################################################################### +priority -50 # Many of the snippets here use a global option called # "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline # before '{' braces. +# Setting "g:ultisnips_java_junit" will change how the test method snippet +# looks, it is defaulted to junit4, setting this option to 3 will remove the +# @Test annotation from the method global !p +def junit(snip): + if snip.opt("g:ultisnips_java_junit", "") == "3": + snip += "" + else: + snip.rv += "@Test\n\t" + def nl(snip): - if snip.opt("g:ultisnips_java_brace_style", "") == "nl": - snip += "" - else: - snip.rv += " " + if snip.opt("g:ultisnips_java_brace_style", "") == "nl": + snip += "" + else: + snip.rv += " " +def getArgs(group): + import re + word = re.compile('[a-zA-Z><.]+ \w+') + return [i.split(" ") for i in word.findall(group) ] + +def camel(word): + if not word: return '' + return word[0].upper() + word[1:] + +def mixedCase(word): + if not word: return '' + return word[0].lower() + word[1:] + endglobal +snippet sleep "try sleep catch" b +try { + Thread.sleep(${1:1000}); +} catch (InterruptedException e){ + e.printStackTrace(); +} +endsnippet + +snippet /i|n/ "new primitive or int" br +${1:int} ${2:i} = ${3:1}; +$0 +endsnippet + +snippet /o|v/ "new Object or variable" br +${1:Object} ${2:var} = new $1(${3}); +endsnippet + +snippet f "field" b +${1:private} ${2:String} ${3:`!p snip.rv = t[2].lower()`}; +endsnippet + snippet ab "abstract" b -abstract +abstract $0 endsnippet snippet as "assert" b -assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};$0 +assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/}; +endsnippet + +snippet at "assert true" b +assertTrue(${1:actual}); +endsnippet + +snippet af "assert false" b +assertFalse(${1:actual}); +endsnippet + +snippet ae "assert equals" b +assertEquals(${1:expected}, ${2:actual}); endsnippet snippet br "break" @@ -39,19 +92,85 @@ catch (${1:Exception} ${2:e})`!p nl(snip)`{ } endsnippet -snippet cl "class" b -class ${1:`!p +snippet cle "class extends" b +public class ${1:`!p snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{ $0 } endsnippet +snippet clc "class with constructor, fields, setter and getters" b +public class `!p +snip.rv = snip.basename or "untitled"` { +`!p +args = getArgs(t[1]) +if len(args) == 0: snip.rv = "" +for i in args: + snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";" +if len(args) > 0: + snip.rv += "\n"` + public `!p snip.rv = snip.basename or "unknown"`($1) { `!p +args = getArgs(t[1]) +for i in args: + snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + ";" +if len(args) == 0: + snip.rv += "\n"` + }$0 +`!p +args = getArgs(t[1]) +if len(args) == 0: snip.rv = "" +for i in args: + snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\ + \tthis." + i[1] + " = " + i[1] + ";\n\t}\n" + + snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\ + \n\t\treturn " + i[1] + ";\n\t}\n" +` +} +endsnippet + +snippet clc "class with constructor, with field names" b +public class `!p +snip.rv = snip.basename or "untitled"` { +`!p +args = getArgs(t[1]) +for i in args: + snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";" +if len(args) > 0: + snip.rv += "\n"` + public `!p snip.rv = snip.basename or "unknown"`($1) { `!p +args = getArgs(t[1]) +for i in args: + snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1]) +if len(args) == 0: + snip.rv += "\n"` + } +} +endsnippet + +snippet clc "class and constructor" b +public class `!p +snip.rv = snip.basename or "untitled"` { + + public `!p snip.rv = snip.basename or "untitled"`($2) { + $0 + } +} +endsnippet + +snippet cl "class" b +public class ${1:`!p +snip.rv = snip.basename or "untitled"`} { + $0 +} +endsnippet + snippet cos "constant string" b -static public final String ${1:var} = "$2";$0 +public static final String ${1:var} = "$2";$0 endsnippet snippet co "constant" b -static public final ${1:String} ${2:var} = $3;$0 +public static final ${1:String} ${2:var} = $3;$0 endsnippet snippet de "default" b @@ -59,20 +178,20 @@ default: $0 endsnippet -snippet eif "else if" b +snippet elif "else if" else if ($1)`!p nl(snip)`{ $0 } endsnippet -snippet /el(se)?/ "else" br +snippet el "else" w else`!p nl(snip)`{ $0 } endsnippet snippet fi "final" b -final +final $0 endsnippet snippet fore "for (each)" b @@ -81,6 +200,12 @@ for ($1 : $2)`!p nl(snip)`{ } endsnippet +snippet fori "for" b +for (int ${1:i} = 0; $1 < ${2:10}; $1++)`!p nl(snip)`{ + $0 +} +endsnippet + snippet for "for" b for ($1; $2; $3)`!p nl(snip)`{ $0 @@ -99,7 +224,7 @@ $0 endsnippet snippet im "import" b -import +import ${1:java}.${2:util}.$0; endsnippet snippet in "interface" b @@ -108,6 +233,48 @@ interface ${1:`!p snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent } endsnippet +snippet cc "constructor call or setter body" +this.${1:var} = $1; +endsnippet + +snippet list "Collections List" b +List<${1:String}> ${2:list} = new ${3:Array}List<$1>(); +endsnippet + +snippet map "Collections Map" b +Map<${1:String}, ${2:String}> ${3:map} = new ${4:Hash}Map<$1, $2>(); +endsnippet + +snippet set "Collections Set" b +Set<${1:String}> ${2:set} = new ${3:Hash}Set<$1>(); +endsnippet + +snippet /Str?|str/ "String" br +String $0 +endsnippet + +snippet cn "Constructor" b +public `!p snip.rv = snip.basename or "untitled"`(${1:}) { + $0 +} +endsnippet + +snippet cn "constructor, \w fields + assigments" b + `!p +args = getArgs(t[1]) +for i in args: + snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";" +if len(args) > 0: + snip.rv += "\n"` +public `!p snip.rv = snip.basename or "unknown"`($1) { `!p +args = getArgs(t[1]) +for i in args: + snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1]) +if len(args) == 0: + snip.rv += "\n"` +} +endsnippet + snippet j.b "java_beans_" i java.beans. endsnippet @@ -134,15 +301,70 @@ public static void main(String[] args)`!p nl(snip)`{ } endsnippet -snippet m "method" b -${1:void} ${2:method}($3) ${4:throws $5 }{ +snippet try "try/catch" b +try { + $1 +} catch(${2:Exception} ${3:e}){ + ${4:e.printStackTrace();} +} +endsnippet + +snippet mt "method throws" b +${1:private} ${2:void} ${3:method}(${4}) ${5:throws $6 }{ $0 } +endsnippet +snippet m "method" b +${1:private} ${2:void} ${3:method}(${4}) { + $0 +} +endsnippet + +snippet md "Method With javadoc" b +/** + * ${7:Short Description}`!p +for i in getArgs(t[4]): + snip.rv += "\n\t * @param " + i[1] + " usage..."` + * `!p +if "throws" in t[5]: + snip.rv = "\n\t * @throws " + t[6] +else: + snip.rv = ""` `!p +if not "void" in t[2]: + snip.rv = "\n\t * @return object" +else: + snip.rv = ""` + **/ +${1:public} ${2:void} ${3:method}($4) ${5:throws $6 }{ + $0 +} +endsnippet + +snippet /get(ter)?/ "getter" br +public ${1:String} get${2:Name}() { + return `!p snip.rv = mixedCase(t[2])`; +} +endsnippet + +snippet /set(ter)?/ "setter" br +public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) { + this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`; +} +endsnippet + +snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br +public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) { + this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`; +} + +public $2 get$1() { + return `!p snip.rv = mixedCase(t[1])`; +} endsnippet snippet pa "package" b -package +package $0 endsnippet snippet p "print" b @@ -154,33 +376,33 @@ System.out.println($1);$0 endsnippet snippet pr "private" b -private +private $0 endsnippet snippet po "protected" b -protected +protected $0 endsnippet snippet pu "public" b -public +public $0 endsnippet snippet re "return" b -return +return $0 endsnippet snippet st "static" -static +static $0 endsnippet snippet sw "switch" b switch ($1)`!p nl(snip)`{ - $0 + case $2: $0 } endsnippet snippet sy "synchronized" -synchronized +synchronized $0 endsnippet snippet tc "test case" @@ -190,17 +412,19 @@ public class ${1:`!p snip.rv = snip.basename or "untitled"`} extends ${2:TestCas endsnippet snippet t "test" b -public void test${1:Name}() throws Exception`!p nl(snip)`{ +`!p junit(snip)`public void test${1:Name}() { + $0 +} +endsnippet + +snippet tt "test throws" b +`!p junit(snip)`public void test${1:Name}() ${2:throws Exception }{ $0 } endsnippet snippet th "throw" b -throw $0 -endsnippet - -snippet v "variable" b -${1:String} ${2:var}${3: = ${0:null}}; +throw new $0 endsnippet snippet wh "while" b diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets index 439ec874..5889e059 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets @@ -1,3 +1,5 @@ +priority -50 + ########################################################################### # TextMate Snippets # ########################################################################### @@ -6,19 +8,19 @@ getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2') endsnippet snippet '':f "object method string" -'${1:${2:#thing}:${3:click}}': function(element){ - $0 +'${1:${2:#thing}:${3:click}}': function(element) { + ${VISUAL}$0 }${10:,} endsnippet snippet :f "Object Method" -${1:method_name}: function(${3:attribute}){ - $0 +${1:method_name}: function(${3:attribute}) { + ${VISUAL}$0 }${10:,} endsnippet snippet :, "Object Value JS" -${1:value_name}:${0:value}, +${1:value_name}: ${0:value}, endsnippet snippet : "Object key key: 'value'" @@ -26,47 +28,147 @@ ${1:key}: ${2:"${3:value}"}${4:, } endsnippet snippet proto "Prototype (proto)" -${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) ,,{ - ${0} -} - +${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) { + ${VISUAL}$0 +}; + endsnippet -snippet for "for (...) {...} (faster)" -for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2--){ - ${3:$1[$2]}$0 +snippet for "for (...) {...} (counting up)" b +for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) { + ${VISUAL}$0 } endsnippet -snippet for "for (...) {...}" -for (var ${2:i}=0; $2 < ${1:Things}.length; $2++) { - ${3:$1[$2]}$0 +snippet ford "for (...) {...} (counting down, faster)" b +for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) { + ${VISUAL}$0 } endsnippet snippet fun "function (fun)" -function ${1:function_name} (${2:argument}) { - ${0} +function ${1:function_name}(${2:argument}) { + ${VISUAL}$0 } endsnippet -# for one line if .. else you usually use a ? b : c +snippet iife "Immediately-Invoked Function Expression (iife)" +(function (${1:argument}) { + ${VISUAL}$0 +}(${2:$1})); +endsnippet + snippet ife "if ___ else" -if (${1}) { - ${2} -} else { - ${3} +if (${1:condition}) { + ${2://code} +} +else { + ${3://code} } endsnippet snippet if "if" -if (${1}) { - ${2} +if (${1:condition}) { + ${VISUAL}$0 } endsnippet snippet timeout "setTimeout function" -setTimeout(function() {$0}${2:}, ${1:10}) +setTimeout(function() { + ${VISUAL}$0 +}${2:.bind(${3:this})}, ${1:10}); +endsnippet + +snippet fi "for prop in obj using hasOwnProperty" b +for (${1:prop} in ${2:obj}){ + if ($2.hasOwnProperty($1)) { + ${VISUAL}$0 + } +} +endsnippet + +# Snippets for Console Debug Output + +snippet ca "console.assert" b +console.assert(${1:assertion}, ${2:"${3:message}"}); +endsnippet + +snippet cclear "console.clear" b +console.clear(); +endsnippet + +snippet cdir "console.dir" b +console.dir(${1:object}); +endsnippet + +snippet cdirx "console.dirxml" b +console.dirxml(${1:object}); +endsnippet + +snippet ce "console.error" b +console.error(${1:"${2:value}"}); +endsnippet + +snippet cgroup "console.group" b +console.group("${1:label}"); +${VISUAL}$0 +console.groupEnd(); +endsnippet + +snippet cgroupc "console.groupCollapsed" b +console.groupCollapsed("${1:label}"); +${VISUAL}$0 +console.groupEnd(); +endsnippet + +snippet ci "console.info" b +console.info(${1:"${2:value}"}); +endsnippet + +snippet cl "console.log" b +console.log(${1:"${2:value}"}); +endsnippet + +snippet cd "console.debug" b +console.debug(${1:"${2:value}"}); +endsnippet + +snippet cprof "console.profile" b +console.profile("${1:label}"); +${VISUAL}$0 +console.profileEnd(); +endsnippet + +snippet ctable "console.table" b +console.table(${1:"${2:value}"}); +endsnippet + +snippet ctime "console.time" b +console.time("${1:label}"); +${VISUAL}$0 +console.timeEnd("$1"); +endsnippet + +snippet ctimestamp "console.timeStamp" b +console.timeStamp("${1:label}"); +endsnippet + +snippet ctrace "console.trace" b +console.trace(); +endsnippet + +snippet cw "console.warn" b +console.warn(${1:"${2:value}"}); +endsnippet + +# AMD (Asynchronous Module Definition) snippets + +snippet def "define an AMD module" +define(${1:optional_name, }[${2:'jquery'}], ${3:callback}); +endsnippet + +snippet req "require an AMD module" +require([${1:'dependencies'}], ${2:callback}); endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_angular.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_angular.snippets new file mode 100644 index 00000000..76e9ca1d --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_angular.snippets @@ -0,0 +1,25 @@ +priority -50 + +snippet iti "it (js, inject)" b +it('${1:description}', inject(function($2) { + $0 +})); +endsnippet + +snippet befi "before each (js, inject)" b +beforeEach(inject(function($1) { + $0 +})); +endsnippet + +snippet aconf "angular config" i +config(function($1) { + $0 +}); +endsnippet + +snippet acont "angular controller" i +controller('${1:name}', function($2) { + $0 +}); +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_ember.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_ember.snippets index 543a26ad..1b7e7b8d 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript_ember.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_ember.snippets @@ -2,6 +2,8 @@ # Ember snippets # ################################################################### +priority -50 + # Application snippet eapp "App.Name = Ember.Application.create({});" ${1:App.Name} = Ember.Application.create({}); @@ -10,48 +12,48 @@ endsnippet # Models snippet emod "App.ModelName = Ember.Model.extend({...});" ${1:model_name} = Ember.Model.extend({ - ${0://Properties here...} + ${0://Properties here...} }); endsnippet # View snippet eview "App.ViewName = Ember.Model.extend({...});" ${1:view_name} = Ember.View.extend({ - ${0://Properties here...} + ${0://Properties here...} }); endsnippet # Controller snippet econtroller "App.ControllerName = Ember.Model.extend({...});" ${1:controller_name} = Ember.ObjectController.extend({ - ${0://Properties here...} + ${0://Properties here...} }); endsnippet # Route snippet eroute "App.RouteName = Ember.Route.extend({...});" ${1:route_name} = Ember.Route.extend({ - ${0://Properties here...} + ${0://Properties here...} }); endsnippet snippet eview "App.ViewName = Ember.Model.create({...});" ${1:view_name} = Ember.View.create({ - ${0://Properties here...} + ${0://Properties here...} }); endsnippet # Object snippet eobj "App.ObjectName = Ember.Object.extend({...});" ${1:object_name} = Ember.Object.create({ - ${0://Properties here...} + ${0://Properties here...} }); endsnippet # Mixin snippet emix "App.MixinName = Ember.Model.extend({...});" ${1:view_name} = Ember.Mixin.create({ - ${0://Properties here...} + ${0://Properties here...} }); endsnippet @@ -67,13 +69,13 @@ endsnippet # Computer properties snippet cpro "property_name: function() {...}.property()," ${1:property_name}: function() { - ${0://body...} + ${0://body...} }.property('${3:argumenet}'), endsnippet snippet cpro ": function() {...}.property('property')," ${1:property_name}: function() { - ${0://body...} + ${0://body...} }.property(), endsnippet @@ -81,7 +83,7 @@ endsnippet # Observes snippet proo "property_name: function() {...}.property()" ${1:property_name}: function() { - ${0://body...} + ${0://body...} }.observes('${3:property}'), endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_jasmine.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_jasmine.snippets index 49e38a35..3a872985 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/javascript_jasmine.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_jasmine.snippets @@ -1,8 +1,8 @@ -# +priority -50 + # JavaScript versions -- from the TextMate bundle + some additions # for jasmine-jquery matchers # -extends javascript snippet des "Describe (js)" b describe('${1:description}', function() { @@ -165,4 +165,3 @@ endsnippet snippet noscw "expect was not called with (js)" b expect(${1:target}).wasNotCalledWith(${2:arguments}); endsnippet - diff --git a/sources_non_forked/vim-snippets/UltiSnips/javascript_jsdoc.snippets b/sources_non_forked/vim-snippets/UltiSnips/javascript_jsdoc.snippets new file mode 100644 index 00000000..ca943fc7 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/javascript_jsdoc.snippets @@ -0,0 +1,51 @@ +priority -50 + +# JSDoc snippets + +snippet /* "A JSDoc comment" b +/** + * ${1:${VISUAL}}$0 + */ +endsnippet + +snippet @au "@author email (First Last)" +@author ${1:`!v g:snips_author_email`} (${2:`!v g:snips_author`}) +endsnippet + +snippet @li "@license Description" +@license ${1:MIT}$0 +endsnippet + +snippet @ver "@version Semantic version" +@version ${1:0.1.0}$0 +endsnippet + +snippet @fileo "@fileoverview Description" b +/** + * @fileoverview ${1:${VISUAL:A description of the file}}$0 + */ +endsnippet + +snippet @constr "@constructor" +@constructor +endsnippet + +snippet @p "@param {Type} varname Description" +@param {${1:Type}} ${2:varname} ${3:Description} +endsnippet + +snippet @ret "@return {Type} Description" +@return {${1:Type}} ${2:Description} +endsnippet + +snippet @pri "@private" +@private +endsnippet + +snippet @over "@override" +@override +endsnippet + +snippet @pro "@protected" +@protected +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/jinja2.snippets b/sources_non_forked/vim-snippets/UltiSnips/jinja2.snippets index 6fef6edf..ded01dcf 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/jinja2.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/jinja2.snippets @@ -1,3 +1,4 @@ +priority -50 # http://jinja.pocoo.org/ @@ -11,7 +12,7 @@ snippet block "block" b {% block ${1:name} %} - $2 + $2 {% endblock $1 %} endsnippet @@ -33,7 +34,7 @@ endsnippet snippet raw "escaped block" b {% raw %} - $1 + $1 {% endraw %} endsnippet @@ -60,7 +61,7 @@ endsnippet snippet filter "filter" b {% filter ${1:filter} %} - $2 + $2 {% endfilter %} endsnippet @@ -78,57 +79,57 @@ endsnippet snippet for "for" b {% for ${1:item} in ${2:sequence} %} - $3 + $3 {% endfor %} endsnippet snippet for "for/else" b {% for ${1:item} in ${2:sequence} %} - $3 + $3 {% else %} - $4 + $4 {% endfor %} endsnippet snippet if "if" b {% if ${1:expr} %} - $2 + $2 {% endif %} endsnippet snippet if "if/else" b {% if ${1:expr} %} - $2 + $2 {% else %} - $3 + $3 {% endif %} endsnippet snippet if "if/elif/else" b {% if ${1:expr} %} - $2 + $2 {% elif %} - $3 + $3 {% else %} - $4 + $4 {% endif %} endsnippet snippet macro "macro" b {% macro ${1:name}(${2:args}) %} - $3 + $3 {% endmacro %} endsnippet snippet call "call" b {% call ${1:name}(${2:args}) %} - $3 + $3 {% endcall %} endsnippet @@ -140,25 +141,24 @@ endsnippet snippet trans "translation" b {% trans %} - $1 + $1 {% endtrans %} endsnippet snippet with "with" b {% with %} - $1 + $1 {% endwith %} endsnippet - snippet autoescape "autoescape" b {% autoescape ${1:true} %} - $2 + $2 {% endautoescape %} endsnippet -# Filters +# Filters # @todo: expand only when snippet is preceeded by a | snippet batch "batch items" w diff --git a/sources_non_forked/vim-snippets/UltiSnips/json.snippets b/sources_non_forked/vim-snippets/UltiSnips/json.snippets index 81e65611..b0cad830 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/json.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/json.snippets @@ -1,3 +1,5 @@ +priority -50 + snippet s "String" b "${1:key}": "${0:value}", endsnippet @@ -8,12 +10,11 @@ endsnippet snippet a "Array" b [ - ${VISUAL}$0 + ${VISUAL}$0 ], endsnippet snippet o "Object" b { - ${VISUAL}$0 + ${VISUAL}$0 }, endsnippet - diff --git a/sources_non_forked/vim-snippets/UltiSnips/julia.snippets b/sources_non_forked/vim-snippets/UltiSnips/julia.snippets new file mode 100644 index 00000000..259c5f4c --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/julia.snippets @@ -0,0 +1,34 @@ +# Documentation +snippet docf "function documentation" b +#' @description +#' +#' ${1:function description} +#' +#' ${2:@param ${3:name}::${4:Type} ${5:Description}} +#' +#' ${6:@returns ${7:name}::${8:Type} ${9:Description}} +#' +#' @examples +#' +#' ${10: function call examples} +endsnippet + +snippet doct "type definition" b +#' @description +#' +#' ${1:type description} +#' +#' ${2:@field ${3:name}::${4:Type} ${5:Description}} +#' +#' @examples +#' +#' ${10: constructor examples} +endsnippet + +snippet par "function parameter documentation" b +#' @param ${1:name}::${2:Type} ${0:Description} +endsnippet + +snippet fld "type field documentation" b +#' @field ${1:name}::${2:Type} ${0:Description} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/ledger.snippets b/sources_non_forked/vim-snippets/UltiSnips/ledger.snippets new file mode 100644 index 00000000..7d7a84da --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/ledger.snippets @@ -0,0 +1,7 @@ +priority -50 + +snippet t "Transaction" b +${1:`!v strftime("%Y")`}-${2:`!v strftime("%m")`}-${3:`!v strftime("%d")`} ${4:*} ${5:Payee} + ${6:Expenses} \$${7:0.00} + ${8:Assets:Checking}$0 +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/lhaskell.snippets b/sources_non_forked/vim-snippets/UltiSnips/lhaskell.snippets new file mode 100644 index 00000000..29169a55 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/lhaskell.snippets @@ -0,0 +1,3 @@ +priority -50 + +extends haskell diff --git a/sources_non_forked/vim-snippets/UltiSnips/lua.snippets b/sources_non_forked/vim-snippets/UltiSnips/lua.snippets index 1b82a245..bc59c60c 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/lua.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/lua.snippets @@ -1,3 +1,5 @@ +priority -50 + ################################# # Snippets for the Lua language # ################################# @@ -8,25 +10,25 @@ endsnippet snippet !fun(ction)?! "New function" br function ${1:new_function}(${2:args}) - $0 + $0 end endsnippet snippet forp "pair for loop" b for ${1:name},${2:val} in pairs(${3:table_name}) do - $0 + $0 end endsnippet snippet fori "ipair for foop" b for ${1:idx},${2:val} in ipairs(${3:table_name}) do - $0 + $0 end endsnippet snippet for "numeric for loop" b for ${1:i}=${2:first},${3:last}${4/^..*/(?0:,:)/}${4:step} do - $0 + $0 end endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/mako.snippets b/sources_non_forked/vim-snippets/UltiSnips/mako.snippets index 92a7be38..fb31ec84 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/mako.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/mako.snippets @@ -1,3 +1,5 @@ +priority -50 + ################# # From snipmate # ################# diff --git a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets index c3189b8a..0720cbfc 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/markdown.snippets @@ -1,6 +1,4 @@ -########################################################################### -# SNIPPETS for MARKDOWN # -########################################################################### +priority -50 ########################### # Sections and Paragraphs # @@ -41,4 +39,15 @@ snippet img "Image" ![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0 endsnippet +snippet ilc "Inline Code" i +\`$1\`$0 +endsnippet + +snippet cbl "Codeblock" b +\`\`\` +$1 +\`\`\` +$0 +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/objc.snippets b/sources_non_forked/vim-snippets/UltiSnips/objc.snippets index 0c676641..45e41fc1 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/objc.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/objc.snippets @@ -1,3 +1,5 @@ +priority -50 + ########################################################################### # TextMate Snippets # ########################################################################### @@ -11,11 +13,11 @@ snippet Imp "#import <> (Imp)" endsnippet snippet cl "020 Class (objc)" -@interface ${1:`!p +@interface ${1:`!p if len(fn): - snip.rv = re.sub(r'\..*$', '', fn) + snip.rv = re.sub(r'\..*$', '', fn) else: - snip.rv = "object" + snip.rv = "object" `} : ${2:NSObject} { } @@ -118,7 +120,7 @@ snippet arracc "LoD array (arracc)" [${3:${1/./\l$0/}} addObject:anObject]; } -- (void)insertObject:($2)anObject in$1AtIndex:(unsigned int)i +- (void)insertObject:($2)anObject in$1AtIndex:(unsigned int)i { [$3 insertObject:anObject atIndex:i]; } @@ -189,7 +191,7 @@ if(choice == NSAlertDefaultReturn) // "$3" } else if(choice == NSAlertAlternateReturn) // "$4" { - + $0 } endsnippet @@ -217,7 +219,7 @@ endsnippet snippet responds "Responds to Selector" if ([${1:self} respondsToSelector:@selector(${2:someSelector:})]) { - [$1 ${3:${2/((:\s*$)|(:\s*))/:<>(?3: )/g}}]; + [$1 ${3:${2/((:\s*$)|(:\s*))/:<>(?3: )/g}}]; } endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets b/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets index 157eb91a..1ebc3477 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/ocaml.snippets @@ -1,20 +1,22 @@ +priority -50 + snippet rs "raise" b raise (${1:Not_found}) endsnippet snippet open "open" let open ${1:module} in -${2} +${2:e} endsnippet snippet try "try" -try ${1} +try ${1:e} with ${2:Not_found} -> ${3:()} endsnippet snippet ref "ref" -let ${1} = ref ${2} in -${3} +let ${1:name} = ref ${2:val} in +${3:e} endsnippet snippet matchl "pattern match on a list" @@ -24,83 +26,88 @@ match ${1:list} with endsnippet snippet matcho "pattern match on an option type" -match ${1} with -| Some(${2}) -> ${3:()} +match ${1:x} with +| Some(${2:y}) -> ${3:()} | None -> ${4:()} endsnippet snippet fun "anonymous function" -(fun ${1} -> ${2}) +(fun ${1:x} -> ${2:x}) endsnippet snippet cc "commment" -(* ${1} *) +(* ${1:comment} *) endsnippet snippet let "let .. in binding" -let ${1} = ${2} in -${3} +let ${1:x} = ${2:v} in +${3:e} endsnippet snippet lr "let rec" -let rec ${1} = - ${2} +let rec ${1:f} = + ${2:expr} endsnippet -snippet ife "if" -if ${1} then - ${2} +snippet if "if" +if ${1:(* condition *)} then + ${2:(* A *)} else - ${3} + ${3:(* B *)} endsnippet -snippet if "If" -if ${1} then - ${2} +snippet If "If" +if ${1:(* condition *)} then + ${2:(* A *)} endsnippet -snippet wh "while" -while ${1} do - ${2} +snippet while "while" +while ${1:(* condition *)} do + ${2:(* A *)} done endsnippet snippet for "for" for ${1:i} = ${2:1} to ${3:10} do - ${4} + ${4:(* BODY *)} done endsnippet snippet match "match" -match ${1} with -| ${2} -> ${3} +match ${1:(* e1 *)} with +| ${2:p} -> ${3:e2} +endsnippet + +snippet Match "match" +match ${1:(* e1 *)} with +| ${2:p} -> ${3:e2} endsnippet snippet class "class" class ${1:name} = object - ${2} + ${2:methods} end endsnippet snippet obj "obj" object - ${2} + ${2:methods} end endsnippet snippet Obj "object" object (self) - ${2} + ${2:methods} end endsnippet snippet {{ "object functional update" -{< ${1} = ${2} >} +{< ${1:x} = ${2:y} >} endsnippet snippet beg "beg" begin - ${1}${VISUAL} + ${1:block} end endsnippet @@ -110,19 +117,19 @@ endsnippet snippet mod "module - no signature" module ${1:(* Name *)} = struct - ${2} + ${2:(* BODY *)} end endsnippet snippet Mod "module with signature" module ${1:(* Name *)} : ${2:(* SIG *)} = struct - ${3} + ${3:(* BODY *)} end endsnippet snippet sig "anonymous signature" sig - ${2} + ${2:(* BODY *)} end endsnippet @@ -132,36 +139,36 @@ endsnippet snippet func "define functor - no signature" module ${1:M} (${2:Arg} : ${3:ARG}) = struct - ${4} + ${4:(* BODY *)} end endsnippet snippet Func "define functor - with signature" module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct - ${5} + ${5:(* BODY *)} end endsnippet snippet mot "Declare module signature" module type ${1:(* Name *)} = sig - ${2} + ${2:(* BODY *)} end endsnippet snippet module "Module with anonymous signature" module ${1:(* Name *)} : sig - ${2} + ${2:(* SIGNATURE *)} end = struct - ${3} + ${3:(* BODY *)} end endsnippet snippet oo "odoc" -(** ${1} *) +(** ${1:odoc} *) endsnippet snippet qt "inline qtest" (*$T ${1:name} - ${2:test} + ${2:test} *) endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/pandoc.snippets b/sources_non_forked/vim-snippets/UltiSnips/pandoc.snippets new file mode 100644 index 00000000..157c9ef0 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/pandoc.snippets @@ -0,0 +1,3 @@ +priority -49 + +extends markdown diff --git a/sources_non_forked/vim-snippets/UltiSnips/perl.snippets b/sources_non_forked/vim-snippets/UltiSnips/perl.snippets index e183b115..abaae3f5 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/perl.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/perl.snippets @@ -1,10 +1,13 @@ +priority -50 + ########################################################################### # TextMate Snippets # ########################################################################### snippet ife "Conditional if..else (ife)" if ($1) { ${2:# body...} -} else { +} +else { ${3:# else...} } @@ -13,9 +16,11 @@ endsnippet snippet ifee "Conditional if..elsif..else (ifee)" if ($1) { ${2:# body...} -} elsif ($3) { +} +elsif ($3) { ${4:# elsif...} -} else { +} +else { ${5:# else...} } @@ -49,7 +54,7 @@ ${1:expression} while ${2:condition}; endsnippet snippet test "Test" -#!/usr/bin/perl -w +#!/usr/bin/env perl -w use strict; use Test::More tests => ${1:1}; @@ -62,7 +67,7 @@ endsnippet snippet class "class" package ${1:ClassName}; -${2:use base qw(${3:ParentClass});}${2/.+/\n\n/}sub new { +${2:use parent qw(${3:ParentClass});}${2/.+/\n\n/}sub new { my $class = shift; $class = ref $class if ref $class; my $self = bless {}, $class; @@ -74,11 +79,12 @@ ${2:use base qw(${3:ParentClass});}${2/.+/\n\n/}sub new { endsnippet snippet eval "eval" +local $@; eval { ${1:# do something risky...} }; -if ($@) { - ${2:# handle failure...} +if (my $${2:exception} = $@) { + ${3:# handle failure...} } endsnippet @@ -105,8 +111,7 @@ if ($1) { endsnippet snippet slurp "slurp" -my $${1:var}; -{ local $/ = undef; local *FILE; open FILE, "<${2:file}"; $$1 = ; close FILE } +my $${1:var} = do { local $/ = undef; open my $fh, '<', ${2:$file}; <$fh> }; endsnippet @@ -117,7 +122,7 @@ unless ($1) { endsnippet -snippet wh "while" +snippet while "while" while ($1) { ${2:# body...} } diff --git a/sources_non_forked/vim-snippets/UltiSnips/php.snippets b/sources_non_forked/vim-snippets/UltiSnips/php.snippets index b7d01670..b7109120 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php.snippets @@ -1,108 +1,264 @@ -snippet ${3});${4} endsnippet -snippet vdd "php var_dump and die" -var_dump(${1}); die(); +snippet def "def" +define('${1}'${2});${3} endsnippet -snippet ns "php namespace" b -namespace ${1:`!p -abspath = os.path.abspath(path) -m = re.search(r'[A-Z].+(?=/)', abspath) -if m: - snip.rv = m.group().replace('/', '\\') -`}; - +snippet do "do" +do { + ${2:// code... } +} while (${1:/* condition */});" endsnippet -snippet nc "php namespace and class or interface" b -namespace ${1:`!p -abspath = os.path.abspath(path) -m = re.search(r'[A-Z].+(?=/)', abspath) -if m: - snip.rv = m.group().replace('/', '\\') -`}; - +snippet doc_f "doc_f" /** - * ${3:@author `whoami`}${4} - */ -`!p -m = re.search(r'Abstract', path) -if m: - snip.rv = 'abstract ' -``!p -if re.search(r'Interface', path): - snip.rv = 'interface' -elif re.search(r'Trait', path): - snip.rv = 'trait' -else: - snip.rv = 'class' -` ${2:`!p -snip.rv = re.match(r'.*(?=\.)', fn).group() -`} -{ + * $2 + * @return ${4:void} + * @author ${5:`!v g:snips_author`} + **/ +${1:public }function ${2:someFunc}(${3}) +{${6} } endsnippet -snippet st "php static function" b -${1:public} static function $2($3) -{ - ${4} -} -endsnippet - -snippet __ "php constructor" b -${1:public} function __construct($2) -{ - ${3} -} -endsnippet - -snippet sg "Setter and Getter" b +snippet doc_i "doc_i" /** - * @var ${3:`!p snip.rv = t[2][0:1].upper() + t[2][1:]`} - * - * ${4} + * $1 + * @package ${2:default} + * @author ${3:`!v g:snips_author`} + **/ +interface ${1:someClass} +{${4} +} // END interface $1" +endsnippet + +snippet else "else" +else { + ${1:// code...} +} +endsnippet + +snippet for "for" +for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { + ${4:// code...} +} +endsnippet + +snippet foreachk "foreachk" +foreach ($${1:variable} as $${2:key} => $${3:value}){ + ${4:// code...} +} +endsnippet + +snippet get "get" +$_GET['${1}']${2} +endsnippet + +snippet if "if" +if (${1:/* condition */}) { + ${2:// code...} +} +endsnippet + +snippet inc "inc" +include '${1:file}';${2} +endsnippet + +snippet log "log" +error_log(var_export(${1}, true));${2} +endsnippet + +snippet post "post" +$_POST['${1}']${2} +endsnippet + +snippet req1 "req1" +require_once '${1:file}';${2} +endsnippet + +snippet session "session" +$_SESSION['${1}']${2} +endsnippet + +snippet t "t" +$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} +endsnippet + +snippet var "var" +var_export(${1});${2} +endsnippet + +snippet getter "PHP Class Getter" b +/* + * Getter for $1 */ -${1:protected} $${2}; - -public function set`!p snip.rv = t[2][0:1].upper() + t[2][1:]`(`!p -if re.match(r'^(\\|[A-Z]).*', t[3]): - snip.rv = t[3] + ' ' -else: - snip.rv = '' -`$$2) +public function get${1/\w+\s*/\u$0/}() { - $this->$2 = $$2; - - return $this; -} - -public function get`!p snip.rv = t[2][0:1].upper() + t[2][1:]`() -{ - return $this->$2; + return $this->$1;$2 } +$4 endsnippet -snippet if "php if" !b -if (${1}) { - ${2} +snippet setter "PHP Class Setter" b +/* + * Setter for $1 + */ +public function set${1/\w+\s*/\u$0/}($$1) +{ + $this->$1 = $$1;$3 + ${4:return $this;} } +$0 endsnippet -snippet ife "php ife" !b -if (${1}) { - ${2} +snippet gs "PHP Class Getter Setter" b +/* + * Getter for $1 + */ +public function get${1/\w+\s*/\u$0/}() +{ + return $this->$1;$2 +} + +/* + * Setter for $1 + */ +public function set${1/\w+\s*/\u$0/}($$1) +{ + $this->$1 = $$1;$3 + ${4:return $this;} +} +$0 +endsnippet + +snippet pub "Public function" b +public function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pro "Protected function" b +protected function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pri "Private function" b +private function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pubs "Public static function" b +public static function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pros "Protected static function" b +protected static function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet pris "Private static function" b +private static function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet fu "Function snip" b +function ${1:name}(${2:$param}) +{ + ${VISUAL}${3:return null;} +} +$0 +endsnippet + +snippet fore "Foreach loop" +foreach ($${1:variable} as $${3:value}){ + ${VISUAL}${4} +} +$0 +endsnippet + +snippet new "New class instance" b +$$1 = new $1($2); +$0 +endsnippet + +snippet ife "if else" +if (${1:/* condition */}) { + ${2:// code...} } else { + ${3:// code...} +} +$0 +endsnippet +snippet class "Class declaration template" b +/** + * Class ${1:`!p snip.rv=snip.fn.split('.')[0]`} + * @author ${2:`!v g:snips_author`} + */ +class $1 +{ + public function ${3:__construct}(${4:$options}) + { + ${5:// code} + } +} +$0 +endsnippet + +snippet construct "__construct()" b +/** + * @param $2mixed ${1/, /\n * \@param mixed /g} + */ +public function __construct(${1:$dependencies}) +{${1/\$(\w+)(, )*/\n $this->$1 = $$1;/g} +} +$0 +endsnippet + +snippet pr "Dumb debug helper in HTML" +echo '
    ' . var_export($1, 1) . '
    ';$0 +endsnippet + +snippet pc "Dumb debug helper in cli" +var_export($1);$0 +endsnippet + +# Symfony 2 based snippets +snippet sfa "Symfony 2 Controller action" +/** +* @Route("/${1:route_name}", name="$1") +* @Template() +*/ +public function $1Action($2) +{ + $3 + return ${4:array();}$0 } endsnippet -snippet /** "php comment block" b -/** - * @${1} - */ -endsnippet +# :vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/php/phpunit.snippets b/sources_non_forked/vim-snippets/UltiSnips/php_phpunit.snippets similarity index 90% rename from sources_non_forked/vim-snippets/UltiSnips/php/phpunit.snippets rename to sources_non_forked/vim-snippets/UltiSnips/php_phpunit.snippets index 6609f3fa..1a310a19 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php/phpunit.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php_phpunit.snippets @@ -1,7 +1,9 @@ -# sugguestion? report bugs? +# suggestion? report bugs? # please go to https://github.com/chrisyue/vim-snippets/issues +priority -50 + snippet test "phpunit test class" b -namespace `!p +namespace `!p abspath = os.path.abspath(path) m = re.search(r'[A-Z].+(?=/)', abspath) if m: diff --git a/sources_non_forked/vim-snippets/UltiSnips/php/symfony2.snippets b/sources_non_forked/vim-snippets/UltiSnips/php_symfony2.snippets similarity index 72% rename from sources_non_forked/vim-snippets/UltiSnips/php/symfony2.snippets rename to sources_non_forked/vim-snippets/UltiSnips/php_symfony2.snippets index b5ff0ee3..55423e71 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/php/symfony2.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/php_symfony2.snippets @@ -1,8 +1,32 @@ -# sugguestion? report bugs? +# sugguestion? report bugs? # go to https://github.com/chrisyue/vim-snippets/issues -snippet contr "symfony2 controller" b -namespace `!p +priority -50 + +snippet classn "Basic class with namespace snippet" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +/** + * ${1:@author `whoami`} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +`$2 +{ + public function __construct(${3:$options}) + { + ${4:// code} + }$0 +} +endsnippet + +snippet contr "Symfony2 controller" b +namespace `!p abspath = os.path.abspath(path) m = re.search(r'[A-Z].+(?=/)', abspath) if m: @@ -25,19 +49,19 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() } endsnippet -snippet act "symfony2 action" b +snippet act "Symfony2 action" b /** * @Route("${3}", name="${4}") * @Method({${5:"POST"}}) + * @Template() */ public function ${1}Action(${2}) { ${6} - return $this->redirect($this->generateUrl('home', [], false)); } endsnippet -snippet actt "symfony2 action and template" b +snippet actt "Symfony2 action and template" b /** * @Route("${3}", name="${4}") * @Method({${5:"GET"}}) @@ -51,8 +75,8 @@ public function ${1}Action(${2}) abspath = os.path.abspath(path)` endsnippet -snippet comm "symfony2 command" b -namespace `!p +snippet comm "Symfony2 command" b +namespace `!p abspath = os.path.abspath(path) m = re.search(r'[A-Z].+(?=/)', abspath) if m: @@ -74,14 +98,12 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() { protected function configure() { - $this - ->setName('${1}') + $this->setName('${1}') ->setDescription('${2}') ->setDefinition([ new InputArgument('', InputArgument::REQUIRED, ''), new InputOption('', null, InputOption::VALUE_NONE, ''), - ]) - ; + ]); } protected function execute(InputInterface $input, OutputInterface $output) @@ -90,8 +112,8 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() } endsnippet -snippet subs "symfony2 subscriber" b -namespace `!p +snippet subs "Symfony2 subscriber" b +namespace `!p abspath = os.path.abspath(path) m = re.search(r'[A-Z].+(?=/)', abspath) if m: @@ -121,8 +143,8 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() } endsnippet -snippet transf "symfony2 form data transformer" b -namespace `!p +snippet transf "Symfony2 form data transformer" b +namespace `!p abspath = os.path.abspath(path) m = re.search(r'[A-Z].+(?=/)', abspath) if m: @@ -155,8 +177,8 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() } endsnippet -snippet ent "symfony2 doctrine entity" b -namespace `!p +snippet ent "Symfony2 doctrine entity" b +namespace `!p abspath = os.path.abspath(path) m = re.search(r'[A-Z].+(?=/)', abspath) if m: @@ -169,7 +191,7 @@ use Doctrine\ORM\Mapping as ORM; * ${3:@author `whoami`} * * @ORM\Entity() - * @ORM\Table(name="`!p + * @ORM\Table(name="`!p tmp = re.match(r'.*(?=\.)', fn).group() tmp = re.sub(r'\B([A-Z])', r'_\1', tmp) snip.rv = tmp.lower() @@ -192,8 +214,8 @@ snip.rv = re.match(r'.*(?=\.)', fn).group() } endsnippet -snippet form "symfony2 form type" b -namespace `!p +snippet form "Symfony2 form type" b +namespace `!p abspath = os.path.abspath(path) m = re.search(r'[A-Z].+(?=/)', abspath) if m: @@ -211,27 +233,51 @@ class `!p snip.rv = re.match(r'.*(?=\.)', fn).group() ` extends AbstractType { - /** - * {@inheritDoc} + /** + * {@inheritDoc} */ public function buildForm(FormBuilderInterface $builder, array $options) - { + { } - /** - * {@inheritDoc} + /** + * {@inheritDoc} */ public function setDefaultOptions(OptionsResolverInterface $resolver) - { - $resolver->setDefaults(); - } + { + $resolver->setDefaults(); + } - /** - * {@inheritDoc} + /** + * {@inheritDoc} */ public function getName() - { + { return '${1}'; } } endsnippet + +snippet ev "Symfony2 event" b +namespace `!p +abspath = os.path.abspath(path) +m = re.search(r'[A-Z].+(?=/)', abspath) +if m: + snip.rv = m.group().replace('/', '\\') +`; + +use Symfony\Component\EventDispatcher\Event; + +/** + * ${2:@author `whoami`} + */ +class `!p +snip.rv = re.match(r'.*(?=\.)', fn).group() +` extends Event +{ +} +endsnippet + +snippet redir "Symfony2 redirect" +$this->redirect($this->generateUrl('${1}', ${2})); +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/proto.snippets b/sources_non_forked/vim-snippets/UltiSnips/proto.snippets new file mode 100644 index 00000000..923be578 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/proto.snippets @@ -0,0 +1,52 @@ +priority -50 + +global !p +from vimsnippets import complete + +FIELD_TYPES = [ + 'double', + 'float', + 'int32', + 'int64', + 'uint32', + 'uint64', + 'sint32', + 'sint64', + 'fixed32', + 'fixed64', + 'sfixed32', + 'sfixed64', + 'bool', + 'string', + 'bytes'] +endglobal + +snippet mess "Proto message" b +// ${2:TODO(`whoami`): Describe this message.} +message ${1:Name} { + $0 + + // Next available id: 1 +} +endsnippet + +snippet reqf "Required field" b +// ${4:TODO(`whoami`): Describe this field.} +optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; // Required +endsnippet + +snippet optf "Optional field" b +// ${4:TODO(`whoami`): Describe this field.} +optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; +endsnippet + +snippet repf "Repeated field" b +// ${4:TODO(`whoami`): Describe this field.} +repeated ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; +endsnippet + +snippet enum "Enumeration" b +// ${2:TODO(`whoami`): Describe this enum.} +enum ${1:Name} { +} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets index 68ae0fe4..1b2cfc57 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/puppet.snippets @@ -1,78 +1,235 @@ -# Snippets for Puppet +priority -50 -snippet /^class/ "Class declaration" r -class ${1:name} { - ${0:# body} +######################################################################### +# Python helper code # +######################################################################### + +global !p +import vim +import os.path +def get_module_namespace_and_basename(): + """This function will try to guess the current class or define name you are + trying to create. Note that for this to work you should be using the module + structure as per the style guide. Examples inputs and it's output + * /home/nikolavp/puppet/modules/collectd/manifests/init.pp -> collectd + * /home/nikolavp/puppet/modules/collectd/manfistes/mysql.pp -> collectd::mysql + """ + first_time = True + current_file_path_without_ext = vim.eval('expand("%:p:r")') or "" + if not current_file_path_without_ext: + return "name" + parts = os.path.split(current_file_path_without_ext) + namespace = '' + while parts[0] and parts[0] != '/': + if parts[1] == 'init' and first_time and not namespace: + first_time = False + parts = os.path.split(parts[0]) + continue + if parts[1] == 'manifests': + return os.path.split(parts[0])[1] + ('::' + namespace).rstrip(':') + else: + namespace = parts[1] + '::' + namespace + parts = os.path.split(parts[0]) + # couldn't guess the namespace. The user is editing a raw file in no module like the site.pp file + return "name" +endglobal + +############################################################################### +# Puppet Language Constructs # +# See http://docs.puppetlabs.com/puppet/latest/reference/lang_summary.html # +############################################################################### + +snippet class "Class declaration" b +class ${1:`!p snip.rv = get_module_namespace_and_basename()`} { + ${0:# body} +} +endsnippet + +snippet define "Definition" b +define ${1:`!p snip.rv = get_module_namespace_and_basename()`} { + ${0:# body} +} +endsnippet + +################################################################# +# Puppet Types # +# See http://docs.puppetlabs.com/references/latest/type.html # +################################################################# + +snippet cron "Cron resource type" b +cron { '${1:name}': + user => ${2:user}, + command => '${3:command}', + minute => ${3:minute}, + hour => ${4:hour}, +} +endsnippet + +snippet exec "Exec resource type" b +exec { '${1:command}': + refreshonly => true, +} +endsnippet + +snippet file "File resource type" b +file { '${1:name}': + source => "puppet://${2:path}", + mode => ${3:mode}, } endsnippet snippet File "Defaults for file" b File { - owner => ${1:username}, - group => ${2:groupname}, + owner => ${1:username}, + group => ${2:groupname}, } endsnippet -# Resource types -snippet package "Package resource type" b -package { "${1:name}": - ensure => ${2:installed}, -} -endsnippet - -snippet file "File resource type" b -file { "${1:name}": - source => "puppet://${2:path}", - mode => ${3:mode}, -endsnippet - snippet group "Group resource type" b -group { "${1:groupname}": - ensure => ${3:present}, - gid => ${2:gid}, -endsnippet - -snippet user "user resource type" b -group { "${1:username}": - ensure => ${2:present}, - uid => ${3:uid}, - gid => ${4:gid}, - comment => ${5:gecos}, - home => ${6:homedirectory}, - managehome => false, - require => Group["${7:group"], -endsnippet - -snippet exec "Exec resource type" b -exec { "${1:command}": - refreshonly => true, -} -endsnippet - -snippet cron "Cron resource type" b -cron { "${1:name}": - user => ${2:user}, - command => "${3:command}", - minute => ${3:minute}, - hour => ${4:hour}, +group { '${1:groupname}': + ensure => ${3:present}, + gid => ${2:gid}, } endsnippet snippet mount "Mount resource type" b -mount { "${1:path}": - device => "${2:/dev}", - fstype => "${3:filesystem}", - ensure => mounted, - options => "rw,errors=remount-ro", +mount { '${1:path}': + device => '${2:/dev}', + fstype => '${3:filesystem}', + ensure => mounted, + options => 'rw,errors=remount-ro', +} +endsnippet + +snippet package "Package resource type" b +package { '${1:name}': + ensure => ${2:installed}, +} +endsnippet + +snippet user "user resource type" b +user { '${1:username}': + ensure => ${2:present}, + uid => ${3:uid}, + gid => ${4:gid}, + comment => ${5:gecos}, + home => ${6:homedirectory}, + managehome => false, + require => Group['${7:group'}], } endsnippet snippet service "Service resource type" b -service { "${1:name}": - hasstatus => true, - enable => true, - ensure => running, +service { '${1:name}': + hasstatus => true, + enable => true, + ensure => running, } endsnippet +######################################################################## +# Puppet Functions # +# See http://docs.puppetlabs.com/references/latest/function.html # +######################################################################## + +snippet alert "Alert Function" b +alert("${1:message}")${0} +endsnippet + +snippet crit "Crit Function" b +crit("${1:message}")${0} +endsnippet + +snippet debug "Debug Function" b +debug("${1:message}")${0} +endsnippet + +snippet defined "Defined Function" b +defined(${1:Resource}["${2:name}"])${0} +endsnippet + +snippet emerg "Emerg Function" b +emerg("${1:message}")${0} +endsnippet + +snippet extlookup "Simple Extlookup" b +$${1:Variable} = extlookup("${2:Lookup}")${0} +endsnippet + +snippet extlookup "Extlookup with defaults" b +$${1:Variable} = extlookup("${2:Lookup}", ${3:Default})${0} +endsnippet + +snippet extlookup "Extlookup with defaults and custom data file" b +$${1:Variable} = extlookup("${2:Lookup}", ${3:Default}, ${4:Data Source})${0} +endsnippet + +snippet fail "Fail Function" b +fail("${1:message}")${0} +endsnippet + +snippet hiera "Hiera Function" b +$${1:Variable} = hiera("${2:Lookup}")${0} +endsnippet + +snippet hiera "Hiera with defaults" b +$${1:Variable} = hiera("${2:Lookup}", ${3:Default})${0} +endsnippet + +snippet hiera "Hiera with defaults and override" b +$${1:Variable} = hiera("${2:Lookup}", ${3:Default}, ${4:Override})${0} +endsnippet + +snippet hiera_hash "Hiera Hash Function" b +$${1:Variable} = hiera_hash("${2:Lookup}")${0} +endsnippet + +snippet hiera_hash "Hiera Hash with defaults" b +$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default})${0} +endsnippet + +snippet hiera_hash "Hiera Hash with defaults and override" b +$${1:Variable} = hiera_hash("${2:Lookup}", ${3:Default}, ${4:Override})${0} +endsnippet + +snippet hiera_include "Hiera Include Function" b +hiera_include("${1:Lookup}")${0} +endsnippet + +snippet include "Include Function" b +include ${1:classname}${0} +endsnippet + +snippet info "Info Function" b +info("${1:message}")${0} +endsnippet + +snippet inline_template "Inline Template Function" b +inline_template("<%= ${1:template} %>")${0} +endsnippet + +snippet notice "Notice Function" b +notice("${1:message}")${0} +endsnippet + +snippet realize "Realize Function" b +realize(${1:Resource}["${2:name}"])${0} +endsnippet + +snippet regsubst "Regsubst Function" b +regsubst($${1:Target}, '${2:regexp}', '${3:replacement}')${0} +endsnippet + +snippet split "Split Function" b +$${1:Variable} = split($${1:Target}, '${2:regexp}')${0} +endsnippet + +snippet versioncmp "Version Compare Function" b +$${1:Variable} = versioncmp('${1:version}', '${2:version}')${0} +endsnippet + +snippet warning "Warning Function" b +warning("${1:message}")${0} +endsnippet + # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/python.snippets b/sources_non_forked/vim-snippets/UltiSnips/python.snippets index a770d2a9..233ad332 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/python.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/python.snippets @@ -1,3 +1,5 @@ +priority -50 + ########################################################################### # TEXTMATE SNIPPETS # ########################################################################### @@ -14,6 +16,10 @@ if __name__ == '__main__': ${1:main()}$0 endsnippet +snippet for "for loop" b +for ${1:item} in ${2:iterable}: + ${3:pass} +endsnippet ########## # COMMON # @@ -28,68 +34,128 @@ global !p NORMAL = 0x1 DOXYGEN = 0x2 SPHINX = 0x3 +GOOGLE = 0x4 + +SINGLE_QUOTES = 0x1 +DOUBLE_QUOTES = 0x2 + + +class Arg(object): + def __init__(self, arg): + self.arg = arg + self.name = arg.split('=')[0].strip() + + def __str__(self): + return self.name + + def __unicode__(self): + return self.name + + def is_kwarg(self): + return '=' in self.arg + def get_args(arglist): - args = [arg.split('=')[0].strip() for arg in arglist.split(',') if arg] - args = [arg for arg in args if arg and arg != "self"] + args = [Arg(arg) for arg in arglist.split(',') if arg] + args = [arg for arg in args if arg.name != 'self'] - return args + return args +def get_quoting_style(snip): + style = snip.opt("g:ultisnips_python_quoting_style", "double") + if style == 'single': + return SINGLE_QUOTES + return DOUBLE_QUOTES + +def triple_quotes(snip): + if get_quoting_style(snip) == SINGLE_QUOTES: + return "'''" + return '"""' + def get_style(snip): - style = snip.opt("g:ultisnips_python_style", "normal") + style = snip.opt("g:ultisnips_python_style", "normal") - if style == "doxygen": return DOXYGEN - elif style == "sphinx": return SPHINX - else: return NORMAL + if style == "doxygen": return DOXYGEN + elif style == "sphinx": return SPHINX + elif style == "google": return GOOGLE + else: return NORMAL def format_arg(arg, style): - if style == DOXYGEN: - return "@param %s @todo" % arg - elif style == SPHINX: - return ":param %s: @todo" % arg - elif style == NORMAL: - return ":%s: @todo" % arg + if style == DOXYGEN: + return "@param %s @todo" % arg + elif style == SPHINX: + return ":param %s: @todo" % arg + elif style == NORMAL: + return ":%s: @todo" % arg + elif style == GOOGLE: + return "%s (@todo): @todo" % arg def format_return(style): - if style == DOXYGEN: - return "@return: @todo" - elif style in (NORMAL, SPHINX): - return ":returns: @todo" + if style == DOXYGEN: + return "@return: @todo" + elif style in (NORMAL, SPHINX): + return ":returns: @todo" + elif style == GOOGLE: + return "Returns: @todo" def write_docstring_args(args, snip): - if not args: - snip.rv += ' """' - return + if not args: + snip.rv += ' {0}'.format(triple_quotes(snip)) + return - snip.rv += '\n' + snip.mkline('', indent='') + snip.rv += '\n' + snip.mkline('', indent='') - style = get_style(snip) + style = get_style(snip) - for arg in args: - snip += format_arg(arg, style) + if style == GOOGLE: + write_google_docstring_args(args, snip) + else: + for arg in args: + snip += format_arg(arg, style) + + +def write_google_docstring_args(args, snip): + kwargs = [arg for arg in args if arg.is_kwarg()] + args = [arg for arg in args if not arg.is_kwarg()] + + if args: + snip += "Args:" + snip.shift() + for arg in args: + snip += format_arg(arg, GOOGLE) + snip.unshift() + snip.rv += '\n' + snip.mkline('', indent='') + + if kwargs: + snip += "Kwargs:" + snip.shift() + for kwarg in kwargs: + snip += format_arg(kwarg, GOOGLE) + snip.unshift() + snip.rv += '\n' + snip.mkline('', indent='') def write_init_body(args, parents, snip): - parents = [p.strip() for p in parents.split(",")] - parents = [p for p in parents if p != 'object'] + parents = [p.strip() for p in parents.split(",")] + parents = [p for p in parents if p != 'object'] - for p in parents: - snip += p + ".__init__(self)" + for p in parents: + snip += p + ".__init__(self)" - if parents: - snip.rv += '\n' + snip.mkline('', indent='') + if parents: + snip.rv += '\n' + snip.mkline('', indent='') - for arg in args: - snip += "self._%s = %s" % (arg, arg) + for arg in args: + snip += "self._%s = %s" % (arg, arg) def write_slots_args(args, snip): - args = ['"%s"' % arg for arg in args] - snip += '__slots__ = (%s,)' % ', '.join(args) + args = ['"_%s"' % arg for arg in args] + snip += '__slots__ = (%s,)' % ', '.join(args) endglobal @@ -99,10 +165,11 @@ endglobal snippet class "class with docstrings" b class ${1:MyClass}(${2:object}): - """${3:Docstring for $1 }""" + + `!p snip.rv = triple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = triple_quotes(snip)` def __init__(self$4): - """${5:@todo: to be defined}`!p + `!p snip.rv = triple_quotes(snip)`${5:@todo: to be defined1.}`!p snip.rv = "" snip >> 2 @@ -110,8 +177,8 @@ args = get_args(t[4]) write_docstring_args(args, snip) if args: - snip.rv += '\n' + snip.mkline('', indent='') - snip += '"""' + snip.rv += '\n' + snip.mkline('', indent='') + snip += '{0}'.format(triple_quotes(snip)) write_init_body(args, t[2], snip) ` @@ -121,7 +188,8 @@ endsnippet snippet slotclass "class with slots and docstrings" b class ${1:MyClass}(${2:object}): - """${3:Docstring for $1 }""" + + `!p snip.rv = triple_quotes(snip)`${3:Docstring for $1. }`!p snip.rv = triple_quotes(snip)` `!p snip >> 1 args = get_args(t[4]) @@ -129,7 +197,7 @@ write_slots_args(args, snip) ` def __init__(self$4): - """${5:@todo: to be defined}`!p + `!p snip.rv = triple_quotes(snip)`${5:@todo: to be defined.}`!p snip.rv = "" snip >> 2 @@ -137,8 +205,8 @@ args = get_args(t[4]) write_docstring_args(args, snip) if args: - snip.rv += '\n' + snip.mkline('', indent='') - snip += '"""' + snip.rv += '\n' + snip.mkline('', indent='') + snip += triple_quotes(snip) write_init_body(args, t[2], snip) ` @@ -330,19 +398,19 @@ endsnippet snippet def "function with docstrings" b def ${1:function}(`!p if snip.indent: - snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}): - """${4:@todo: Docstring for $1}`!p + snip.rv = 'self' + (", " if len(t[2]) else "")`${2:arg1}): + `!p snip.rv = triple_quotes(snip)`${4:@todo: Docstring for $1.}`!p snip.rv = "" snip >> 1 args = get_args(t[2]) if args: - write_docstring_args(args, snip) + write_docstring_args(args, snip) style = get_style(snip) snip += format_return(style) snip.rv += '\n' + snip.mkline('', indent='') -snip += '"""' ` +snip += triple_quotes(snip) ` ${0:pass} endsnippet @@ -362,23 +430,57 @@ endsnippet ############## snippet roprop "Read Only Property" b @property -def ${1:property}(self): +def ${1:name}(self): ${2:return self._$1}$0 endsnippet snippet rwprop "Read write property" b -def ${1:property}(): - ${2/.+/(?0:""")/}${2:The RW property $1}`!p if t[2]: - snip.rv += '"""' - snip >> 1 - snip += "" +def ${1:name}(): + `!p snip.rv = triple_quotes(snip) if t[2] else '' +`${2:@todo: Docstring for $1.}`!p +if t[2]: + snip >> 1 + + style = get_style(snip) + snip.rv += '\n' + snip.mkline('', indent='') + snip += format_return(style) + snip.rv += '\n' + snip.mkline('', indent='') + snip += triple_quotes(snip) else: - snip.rv = ""`def fget(self): + snip.rv = ""` + def fget(self): return self._$1$0 + def fset(self, value): self._$1 = value return locals() -$1 = property(**$1()) + +$1 = property(**$1(), doc=$1.__doc__) +endsnippet + + +#################### +# If / Else / Elif # +#################### +snippet if "If" b +if ${1:condition}: + ${2:pass} +endsnippet + +snippet ife "If / Else" b +if ${1:condition}: + ${2:pass} +else: + ${3:pass} +endsnippet + +snippet ifee "If / Elif / Else" b +if ${1:condition}: + ${2:pass} +elif ${3:condition}: + ${4:pass} +else: + ${5:pass} endsnippet @@ -430,6 +532,14 @@ snippet pdb "Set PDB breakpoint" b import pdb; pdb.set_trace() endsnippet +snippet ipdb "Set IPDB breakpoint" b +import ipdb; ipdb.set_trace() +endsnippet + +snippet pudb "Set PUDB breakpoint" b +import pudb; pudb.set_trace() +endsnippet + snippet ae "Assert equal" b self.assertEqual(${1:first},${2:second}) endsnippet @@ -450,10 +560,18 @@ snippet ar "Assert raises" b self.assertRaises(${1:exception}, ${2:func}${3/.+/, /}${3:arguments}) endsnippet +snippet an "Assert is None" b +self.assertIsNone(${0:expression}) +endsnippet + +snippet ann "Assert is not None" b +self.assertIsNotNone(${0:expression}) +endsnippet snippet testcase "pyunit testcase" b class Test${1:Class}(${2:unittest.TestCase}): - """${3:Test case docstring}""" + + `!p snip.rv = triple_quotes(snip)`${3:Test case docstring.}`!p snip.rv = triple_quotes(snip)` def setUp(self): ${4:pass} diff --git a/sources_non_forked/vim-snippets/UltiSnips/r.snippets b/sources_non_forked/vim-snippets/UltiSnips/r.snippets new file mode 100644 index 00000000..10c818c0 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/r.snippets @@ -0,0 +1,177 @@ +priority -50 + +global !p +import os +from vimsnippets import complete + +FIELD_TYPES = [ +'character', +'data.frame', +'integer', +'list', +'logical', +'matrix', +'numeric', +'vector'] +endglobal + +snippet #! "Hashbang for Rscript (#!)" b +#!/usr/bin/env Rscript +endsnippet + +snippet setwd "Set workingdir" b +setwd("${1:`!p snip.rv = os.getcwd()`}") +endsnippet + +snippet as "Apply type on variable" w +as.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL}) +endsnippet + +snippet is "Test type on variable" w +is.$1`!p snip.rv = complete(t[1], FIELD_TYPES)`(${2}${VISUAL}) +endsnippet + +snippet dl "Download and install a package" b +download.file("${1:${VISUAL:url to package}}", destfile = "${2:${1/.*\/(\S*)$/(?1:$1)/ga}}") +install.packages("$2", type = "source", repos = NULL) +library("${3:${2/^(\w+)_.*$/(?1:$1)/ga}}") +endsnippet + +snippet lib "Import a library" +library(${0:package}) +endsnippet + +snippet req "Require a file" +require(${0:package}) +endsnippet + +snippet source "Source a file" +source('${0:file}') +endsnippet + +snippet if "If statement" +if (${1}) { + ${0} +} +endsnippet + +snippet eif "Else-If statement" +else if (${1}) { + ${0} +} + +snippet el "Else statement" +else { + ${0} +} +endsnippet + +snippet ife "if .. else" +if (${1}) { + ${2} +} else { + ${3} +} +endsnippet + +snippet wh "while loop" +while(${1}) { + ${2} +} +endsnippet + +snippet for "for loop" +for (${1:item} in ${2:list}) { + ${3} +} +endsnippet + +snippet fun "Function definition" +${1:name} <- function (${2}) { + ${0} +} +endsnippet + +snippet ret "Return call" +return(${0}) +endsnippet + +snippet df "Data frame" +${1:name}[${2:rows}, ${0:cols}] +endsnippet + +snippet c "c function" +c(${0:items}) +endsnippet + +snippet li "list function" +list(${0:items}) +endsnippet + +snippet mat "matrix function" +matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols}) +endsnippet + +snippet apply "apply function" +apply(${1:array}, ${2:margin}, ${0:function}) +endsnippet + +snippet lapply "lapply function" +lapply(${1:list}, ${0:function}) +endsnippet + +snippet sapply "sapply function" +sapply(${1:list}, ${0:function}) +endsnippet + +snippet vapply "vapply function" +vapply(${1:list}, ${2:function}, ${0:type}) +endsnippet + +snippet mapply "mapply function" +mapply(${1:function}, ${0:...}) +endsnippet + +snippet tapply "tapply function" +tapply(${1:vector}, ${2:index}, ${0:function}) +endsnippet + +snippet rapply "rapply function" +rapply(${1:list}, ${0:function}) +endsnippet + +snippet pl "Plot function" +plot(${1:x}, ${0:y}) +endsnippet + +snippet ggp "ggplot2 plot" +ggplot(${1:data}, aes(${0:aesthetics})) +endsnippet + +snippet fis "Fisher test" +fisher.test(${1:x}, ${0:y}) +endsnippet + +snippet chi "Chi Squared test" +chisq.test(${1:x}, ${0:y}) +endsnippet + +snippet tt "t-test" +t.test(${1:x}, ${0:y}) +endsnippet + +snippet wil "Wilcox test" +wilcox.test(${1:x}, ${0:y}) +endsnippet + +snippet cor "Correlation test" +cor.test(${1:x}, ${0:y}) +endsnippet + +snippet fte "FTE test" +var.test(${1:x}, ${0:y}) +endsnippet + +snippet kvt "KV test" +kv.test(${1:x}, ${0:y}) +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/rails.snippets b/sources_non_forked/vim-snippets/UltiSnips/rails.snippets index 9e0e29f8..5c521795 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rails.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rails.snippets @@ -1,6 +1,4 @@ -########################################################################### -# GENERATED FROM get_tm_snippets.py # -########################################################################### +priority -50 snippet anaf "accepts_nested_attributes_for" accepts_nested_attributes_for :${1:association_name}${2:${3:, :allow_destroy => true}${4:, :reject_if => proc \{ |obj| ${5:obj.blank?} \}}} @@ -77,90 +75,90 @@ endsnippet snippet resources "Create resources controller class" class ${1:Model}sController < ApplicationController - before_filter :find_${1/./\l$0/}, :only => [:show, :edit, :update, :destroy] + before_filter :find_${1/./\l$0/}, :only => [:show, :edit, :update, :destroy] - # GET /${1/./\l$0/}s - # GET /${1/./\l$0/}s.xml - def index - @${1/./\l$0/}s = ${1:Model}.all + # GET /${1/./\l$0/}s + # GET /${1/./\l$0/}s.xml + def index + @${1/./\l$0/}s = ${1:Model}.all - respond_to do |wants| - wants.html # index.html.erb - wants.xml { render :xml => @${1/./\l$0/}s } - end - end + respond_to do |wants| + wants.html # index.html.erb + wants.xml { render :xml => @${1/./\l$0/}s } + end + end - # GET /${1/./\l$0/}s/1 - # GET /${1/./\l$0/}s/1.xml - def show - respond_to do |wants| - wants.html # show.html.erb - wants.xml { render :xml => @${1/./\l$0/} } - end - end + # GET /${1/./\l$0/}s/1 + # GET /${1/./\l$0/}s/1.xml + def show + respond_to do |wants| + wants.html # show.html.erb + wants.xml { render :xml => @${1/./\l$0/} } + end + end - # GET /${1/./\l$0/}s/new - # GET /${1/./\l$0/}s/new.xml - def new - @${1/./\l$0/} = ${1:Model}.new + # GET /${1/./\l$0/}s/new + # GET /${1/./\l$0/}s/new.xml + def new + @${1/./\l$0/} = ${1:Model}.new - respond_to do |wants| - wants.html # new.html.erb - wants.xml { render :xml => @${1/./\l$0/} } - end - end + respond_to do |wants| + wants.html # new.html.erb + wants.xml { render :xml => @${1/./\l$0/} } + end + end - # GET /${1/./\l$0/}s/1/edit - def edit - end + # GET /${1/./\l$0/}s/1/edit + def edit + end - # POST /${1/./\l$0/}s - # POST /${1/./\l$0/}s.xml - def create - @${1/./\l$0/} = ${1:Model}.new(params[:${1/./\l$0/}]) + # POST /${1/./\l$0/}s + # POST /${1/./\l$0/}s.xml + def create + @${1/./\l$0/} = ${1:Model}.new(params[:${1/./\l$0/}]) - respond_to do |wants| - if @${1/./\l$0/}.save - flash[:notice] = '${1:Model} was successfully created.' - wants.html { redirect_to(@${1/./\l$0/}) } - wants.xml { render :xml => @${1/./\l$0/}, :status => :created, :location => @${1/./\l$0/} } - else - wants.html { render :action => "new" } - wants.xml { render :xml => @${1/./\l$0/}.errors, :status => :unprocessable_entity } - end - end - end + respond_to do |wants| + if @${1/./\l$0/}.save + flash[:notice] = '${1:Model} was successfully created.' + wants.html { redirect_to(@${1/./\l$0/}) } + wants.xml { render :xml => @${1/./\l$0/}, :status => :created, :location => @${1/./\l$0/} } + else + wants.html { render :action => "new" } + wants.xml { render :xml => @${1/./\l$0/}.errors, :status => :unprocessable_entity } + end + end + end - # PUT /${1/./\l$0/}s/1 - # PUT /${1/./\l$0/}s/1.xml - def update - respond_to do |wants| - if @${1/./\l$0/}.update_attributes(params[:${1/./\l$0/}]) - flash[:notice] = '${1:Model} was successfully updated.' - wants.html { redirect_to(@${1/./\l$0/}) } - wants.xml { head :ok } - else - wants.html { render :action => "edit" } - wants.xml { render :xml => @${1/./\l$0/}.errors, :status => :unprocessable_entity } - end - end - end + # PUT /${1/./\l$0/}s/1 + # PUT /${1/./\l$0/}s/1.xml + def update + respond_to do |wants| + if @${1/./\l$0/}.update_attributes(params[:${1/./\l$0/}]) + flash[:notice] = '${1:Model} was successfully updated.' + wants.html { redirect_to(@${1/./\l$0/}) } + wants.xml { head :ok } + else + wants.html { render :action => "edit" } + wants.xml { render :xml => @${1/./\l$0/}.errors, :status => :unprocessable_entity } + end + end + end - # DELETE /${1/./\l$0/}s/1 - # DELETE /${1/./\l$0/}s/1.xml - def destroy - @${1/./\l$0/}.destroy + # DELETE /${1/./\l$0/}s/1 + # DELETE /${1/./\l$0/}s/1.xml + def destroy + @${1/./\l$0/}.destroy - respond_to do |wants| - wants.html { redirect_to(${1/./\l$0/}s_url) } - wants.xml { head :ok } - end - end + respond_to do |wants| + wants.html { redirect_to(${1/./\l$0/}s_url) } + wants.xml { head :ok } + end + end - private - def find_${1/./\l$0/} - @${1/./\l$0/} = ${1:Model}.find(params[:id]) - end + private + def find_${1/./\l$0/} + @${1/./\l$0/} = ${1:Model}.find(params[:id]) + end end @@ -227,31 +225,31 @@ assert_response :${1:success}, @response.body$0 endsnippet snippet aftc "after_create" -after_create +after_create $0 endsnippet snippet aftd "after_destroy" -after_destroy +after_destroy $0 endsnippet snippet afts "after_save" -after_save +after_save $0 endsnippet snippet aftu "after_update" -after_update +after_update $0 endsnippet snippet aftv "after_validation" -after_validation +after_validation $0 endsnippet snippet aftvoc "after_validation_on_create" -after_validation_on_create +after_validation_on_create $0 endsnippet snippet aftvou "after_validation_on_update" -after_validation_on_update +after_validation_on_update $0 endsnippet snippet asg "assert(var = assigns(:var))" @@ -261,13 +259,13 @@ endsnippet snippet asd "assert_difference" assert_difference "${1:Model}.${2:count}", ${3:1} do - $0 + $0 end endsnippet snippet asnd "assert_no_difference" assert_no_difference "${1:Model}.${2:count}" do - $0 + $0 end endsnippet @@ -298,27 +296,27 @@ end} endsnippet snippet befc "before_create" -before_create +before_create $0 endsnippet snippet befd "before_destroy" -before_destroy +before_destroy $0 endsnippet snippet befs "before_save" -before_save +before_save $0 endsnippet snippet befu "before_update" -before_update +before_update $0 endsnippet snippet befv "before_validation" -before_validation +before_validation $0 endsnippet snippet befvoc "before_validation_on_create" -before_validation_on_create +before_validation_on_create $0 endsnippet snippet befvou "before_validation_on_update" @@ -456,13 +454,13 @@ endsnippet snippet mapr "map.resource" ${1:map}.resource :${2:resource}${10: do |${11:$2}| - $0 + $0 end} endsnippet snippet maprs "map.resources" ${1:map}.resources :${2:resource}${10: do |${11:$2}| - $0 + $0 end} endsnippet @@ -605,7 +603,7 @@ endsnippet snippet resw "respond_with" respond_with(${1:@${2:model}})${3: do |format| - format.${4:html} { $0 \} + format.${4:html} { $0 \} end} endsnippet @@ -807,32 +805,32 @@ endsnippet snippet sweeper "Create sweeper class" class ${1:Model}Sweeper < ActionController::Caching::Sweeper - observe ${1:Model} + observe ${1:Model} - def after_save(${1/./\l$0/}) - expire_cache(${1/./\l$0/}) - end + def after_save(${1/./\l$0/}) + expire_cache(${1/./\l$0/}) + end - def after_destroy(${1/./\l$0/}) - expire_cache(${1/./\l$0/}) - end + def after_destroy(${1/./\l$0/}) + expire_cache(${1/./\l$0/}) + end - private + private - def expire_cache(${1/./\l$0/}) - ${0:expire_page ${1/./\l$0/}s_path - expire_page ${1/./\l$0/}_path(${1/./\l$0/})} - end + def expire_cache(${1/./\l$0/}) + ${0:expire_page ${1/./\l$0/}s_path + expire_page ${1/./\l$0/}_path(${1/./\l$0/})} + end end endsnippet snippet col "collection routes" collection do - ${1:get :${2:action}} - ${3:put :${4:action}} - ${5:post :${6:action}} - ${7:delete :${8:action}} + ${1:get :${2:action}} + ${3:put :${4:action}} + ${5:post :${6:action}} + ${7:delete :${8:action}} end endsnippet @@ -854,16 +852,16 @@ endsnippet snippet member "member routes" member do - ${1:get :${2:action}} - ${3:put :${4:action}} - ${5:post :${6:action}} - ${7:delete :${8:action}} + ${1:get :${2:action}} + ${3:put :${4:action}} + ${5:post :${6:action}} + ${7:delete :${8:action}} end endsnippet snippet res "resources" resources :${1:posts}${2: do - $3 + $3 end} endsnippet @@ -877,9 +875,9 @@ endsnippet snippet scopee "scope with extension" scope :${1:name}, ${2:where(${3::${4:field} => ${5:'${6:value}'}})} do - def ${7:method_name} - $0 - end + def ${7:method_name} + $0 + end end endsnippet @@ -893,13 +891,13 @@ setup do end endsnippet -snippet trans "Translation snippet" +snippet trans "Translation snippet" I18n.t('`!v substitute(substitute(substitute(@%, substitute(getcwd() . "/", "\/", "\\\\/", "g"), "", ""), "\\(\\.\\(html\\|js\\)\\.\\(haml\\|erb\\)\\|\\(_controller\\)\\?\\.rb\\)$", "", ""), "/", ".", "g")`.${2:${1/[^\w]/_/g}}${3}', :default => "${1:some_text}"${4})${5:$0} endsnippet snippet route_spec it 'routes to #${1:action}' do - ${2:get}('/${3:url}').should route_to('`!v substitute(expand('%:t:r'), '_routing_spec$', '', '')`#$1'${4:, ${5:params}})${6} + ${2:get}('/${3:url}').should route_to('`!v substitute(expand('%:t:r'), '_routing_spec$', '', '')`#$1'${4:, ${5:params}})${6} end endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/rnoweb.snippets b/sources_non_forked/vim-snippets/UltiSnips/rnoweb.snippets new file mode 100644 index 00000000..773b9aa9 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/rnoweb.snippets @@ -0,0 +1,3 @@ +priority -50 + +extends tex, r diff --git a/sources_non_forked/vim-snippets/UltiSnips/rst.snippets b/sources_non_forked/vim-snippets/UltiSnips/rst.snippets index 88e0caaf..0596eee1 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/rst.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/rst.snippets @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- +priority -50 + ########################################################################### -# General Stuff # +# General Stuff # ########################################################################### global !p import vim @@ -10,27 +12,29 @@ from string import Template import re from collections import Counter +from vimsnippets import complete + #http://docutils.sourceforge.net/docs/ref/rst/roles.html TEXT_ROLES = ['emphasis','literal','code','math', - 'pep-reference','rfc-reference', - 'strong','subscript','superscript', - 'title-reference','raw'] + 'pep-reference','rfc-reference', + 'strong','subscript','superscript', + 'title-reference','raw'] TEXT_ROLES_REGEX = r'\.\.\srole::?\s(w+)' #http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions -SPECIFIC_ADMONITIONS = ["attention", "caution", "danger", - "error", "hint", "important", "note", - "tip", "warning"] +SPECIFIC_ADMONITIONS = ["attention", "caution", "danger", + "error", "hint", "important", "note", + "tip", "warning"] #http://docutils.sourceforge.net/docs/ref/rst/directives.html DIRECTIVES = ['topic','sidebar','math','epigraph', - 'parsed-literal','code','highlights', - 'pull-quote','compound','container', - 'list-table','class','sectnum', - 'role','default-role','unicode', - 'raw'] + 'parsed-literal','code','highlights', + 'pull-quote','compound','container', + 'list-table','class','sectnum', + 'role','default-role','unicode', + 'raw'] NONE_CONTENT_DIRECTIVES = ['rubric', 'contents', 'header', - 'footer', 'date', 'include', 'title'] + 'footer', 'date', 'include', 'title'] INCLUDABLE_DIRECTIVES = ['image', 'figure', 'include'] # CJK chars @@ -38,158 +42,130 @@ INCLUDABLE_DIRECTIVES = ['image', 'figure', 'include'] CJK_RE = re.compile(u'[⺀-⺙⺛-⻳⼀-⿕々〇〡-〩〸-〺〻㐀-䶵一-鿃豈-鶴侮-頻並-龎]', re.UNICODE) -def has_cjk(char): - """ - Detect char contains CJK character - - :param char: characters needs to be detect - """ - try: - CJK_RE.finditer(char).next() - except StopIteration: - return False - else: - return True +def has_cjk(s): + """Detect if s contains CJK characters.""" + return CJK_RE.search(s) is not None def real_filename(filename): - """peal extension name off if possible - # i.e. "foo.bar.png will return "foo.bar" + """pealeextension name off if possible + # i.e. "foo.bar.png will return "foo.bar" """ - return ospath.splitext(filename)[0] + return ospath.splitext(filename)[0] def check_file_exist(rst_path, relative_path): - """ - For RST file, it can just include files as relative path. - - :param rst_path: absolute path to rst file - :param relative_path: path related to rst file - :return: relative file's absolute path if file exist - """ - abs_path = ospath.join(ospath.dirname(rst_path), relative_path) - if ospath.isfile(abs_path): - return abs_path + """ + For RST file, it can just include files as relative path. + + :param rst_path: absolute path to rst file + :param relative_path: path related to rst file + :return: relative file's absolute path if file exist + """ + abs_path = ospath.join(ospath.dirname(rst_path), relative_path) + if ospath.isfile(abs_path): + return abs_path -def rst_char_len(char): - """ - return len of string which fit in rst - For instance:chinese "我" decode as only one character, - However, the rst interpreter needs 2 "=" instead of 1. +try: + rst_char_len = vim.strwidth # Requires Vim 7.3+ +except AttributeError: + from unicodedata import east_asian_width + def rst_char_len(s): + """Return the required over-/underline length for s.""" + result = 0 + for c in s: + result += 2 if east_asian_width(c) in ('W', 'F') else 1 + return result - :param: char needs to be count - """ - return len(re.findall(r'[^\u4e00-\u9fff\s]', char))+len(char) def make_items(times, leading='+'): - """ - make lines with leading char multitimes - - :param: times, how many times you need - :param: leading, leading character - """ - times = int(times) - if leading == 1: - msg = "" - for x in xrange(1, times+1): - msg += "%s. Item\n" % x - return msg - else: - return ("%s Item\n" % leading) * times + """ + make lines with leading char multitimes + + :param: times, how many times you need + :param: leading, leading character + """ + times = int(times) + if leading == 1: + msg = "" + for x in range(1, times+1): + msg += "%s. Item\n" % x + return msg + else: + return ("%s Item\n" % leading) * times def look_up_directives(regex, fpath): - """ - find all directive args in given file - :param: regex, the regex that needs to match - :param: path, to path to rst file + """ + find all directive args in given file + :param: regex, the regex that needs to match + :param: path, to path to rst file - :return: list, empty list if nothing match - """ - try: - with open(fpath) as source: - match = re.findall(regex, source.read()) - except IOError: - match = [] - return match + :return: list, empty list if nothing match + """ + try: + with open(fpath) as source: + match = re.findall(regex, source.read()) + except IOError: + match = [] + return match def get_popular_code_type(): - """ - find most popular code type in the given rst + """ + find most popular code type in the given rst - :param path: file to detect - - :return: string, most popular code type in file - """ - buf = "".join(vim.current.buffer) - types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', buf) - try: - popular_type = Counter(types).most_common()[0][0] - except IndexError: - popular_type = "lua" # Don't break default - return popular_type - - -def complete(t, opts): - """ - get options that start with t - - :param t: query string - :param opts: list that needs to be completed - - :return: a string that start with t - """ - msg = "({0})" - if t: - opts = [ m[len(t):] for m in opts if m.startswith(t) ] - if len(opts) == 1: - return opts[0] - - if not len(opts): - msg = "{0}" - return msg.format("|".join(opts)) + :param path: file to detect + :return: string, most popular code type in file + """ + buf = "".join(vim.current.buffer) + types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', buf) + try: + popular_type = Counter(types).most_common()[0][0] + except IndexError: + popular_type = "lua" # Don't break default + return popular_type endglobal snippet part "Part" b `!p snip.rv = rst_char_len(t[1])*'#'` -${1:Part name} +${1:${VISUAL:Part name}} `!p snip.rv = rst_char_len(t[1])*'#'` $0 endsnippet -snippet sec "Section" b -${1:Section name} -`!p snip.rv = rst_char_len(t[1])*'='` - -$0 -endsnippet - -snippet ssec "Subsection" b -${1:Section name} -`!p snip.rv = rst_char_len(t[1])*'-'` - -$0 -endsnippet - -snippet sssec "Subsubsection" b -${1:Section name} -`!p snip.rv = rst_char_len(t[1])*'^'` - -$0 -endsnippet - snippet chap "Chapter" b `!p snip.rv = rst_char_len(t[1])*'*'` -${1:Chapter name} +${1:${VISUAL:Chapter name}} `!p snip.rv = rst_char_len(t[1])*'*'` $0 endsnippet +snippet sec "Section" b +${1:${VISUAL:Section name}} +`!p snip.rv = rst_char_len(t[1])*'='` + +$0 +endsnippet + +snippet ssec "Subsection" b +${1:${VISUAL:Subsection name}} +`!p snip.rv = rst_char_len(t[1])*'-'` + +$0 +endsnippet + +snippet sssec "Subsubsection" b +${1:${VISUAL:Subsubsection name}} +`!p snip.rv = rst_char_len(t[1])*'^'` + +$0 +endsnippet + snippet para "Paragraph" b -${1:Paragraph name} +${1:${VISUAL:Paragraph name}} `!p snip.rv = rst_char_len(t[1])*'"'` $0 @@ -197,24 +173,24 @@ endsnippet snippet em "Emphasize string" i `!p -# dirty but works with CJK charactor detection +# dirty but works with CJK character detection if has_cjk(vim.current.line): - snip.rv ="\ "`*${1:${VISUAL:Em}}*`!p -if has_cjk(vim.current.line): - snip.rv ="\ " + snip.rv ="\ "`*${1:${VISUAL:Em}}*`!p +if has_cjk(vim.current.line): + snip.rv ="\ " else: - snip.rv = " " + snip.rv = " " `$0 endsnippet snippet st "Strong string" i -`!p +`!p if has_cjk(vim.current.line): - snip.rv ="\ "`**${1:${VISUAL:Strong}}**`!p -if has_cjk(vim.current.line): - snip.rv ="\ " + snip.rv ="\ "`**${1:${VISUAL:Strong}}**`!p +if has_cjk(vim.current.line): + snip.rv ="\ " else: - snip.rv = " " + snip.rv = " " `$0 endsnippet @@ -236,12 +212,12 @@ snip.rv = make_items(match.groupdict()['num'], 1) ` endsnippet ########################################################################### -# More Specialized Stuff. # +# More Specialized Stuff. # ########################################################################### snippet cb "Code Block" b .. code-block:: ${1:`!p snip.rv = get_popular_code_type()`} - ${2:code} + ${2:${VISUAL:code}} $0 endsnippet @@ -249,7 +225,7 @@ endsnippet # match snippets : # img, inc, fig snippet id "Includable Directives" b -`!p +`!p real_name=real_filename(ospath.basename(t[2])) di=t[1][:2] @@ -257,28 +233,31 @@ link="" content="" if di == 'im': - link = "|{0}|".format(real_name) + link = "|{0}|".format(real_name) if di == 'fi': - content=""" - :alt: {0} - {0}""".format(real_name) + content=""" + :alt: {0} + {0}""".format(real_name) ` -..`!p snip.rv = " %s" % link if link else ""` $1`!p snip.rv=complete(t[1], INCLUDABLE_DIRECTIVES)`:: ${2:file}`!p if content: - snip.rv +=" "+content` +..`!p snip.rv = " %s" % link if link else ""` $1`!p +snip.rv=complete(t[1], INCLUDABLE_DIRECTIVES) +`:: ${2:${VISUAL:file}}`!p +if content: + snip.rv +=" "+content` `!p # Tip of whether file is exist in comment type if not check_file_exist(path, t[2]): - snip.rv='.. FILE {0} does not exist'.format(t[2]) + snip.rv='.. FILE {0} does not exist'.format(t[2]) else: - snip.rv="" + snip.rv="" `$0 endsnippet snippet di "Directives" b .. $1`!p snip.rv=complete(t[1], DIRECTIVES)`:: $2 - ${3:Content} + ${3:${VISUAL:Content}} $0 endsnippet @@ -289,8 +268,8 @@ endsnippet snippet sa "Specific Admonitions" b .. $1`!p snip.rv =complete(t[1], SPECIFIC_ADMONITIONS)`:: - - ${2:Content} + + ${2:${VISUAL:Content}} $0 endsnippet @@ -298,8 +277,8 @@ endsnippet #it will be trigger at start of line or after a word snippet ro "Text Roles" w \ :$1`!p snip.rv=complete(t[1], - TEXT_ROLES+look_up_directives(TEXT_ROLES_REGEX, - path))`:\`$2\`\ + TEXT_ROLES+look_up_directives(TEXT_ROLES_REGEX, + path))`:\`$2\`\ endsnippet ############ @@ -309,6 +288,6 @@ endsnippet snippet sid "SideBar" b .. sidebar:: ${1:SideBar Title} - ${2:SideBar Content} + ${2:${VISUAL:SideBar Content}} endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets b/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets index 90001b1a..09a114f6 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/ruby.snippets @@ -1,3 +1,5 @@ +priority -50 + snippet "^#!" "#!/usr/bin/env ruby" r #!/usr/bin/env ruby $0 @@ -25,7 +27,7 @@ endsnippet snippet if "if ... end" if ${1:condition} - ${2} + ${2:# TODO} end endsnippet @@ -33,9 +35,9 @@ endsnippet snippet ife "if ... else ... end" if ${1:condition} - ${2} + ${2:# TODO} else - ${3} + ${3:# TODO} end endsnippet @@ -43,11 +45,11 @@ endsnippet snippet ifee "if ... elseif ... else ... end" if ${1:condition} - ${2} + ${2:# TODO} elsif ${3:condition} - ${4} + ${4:# TODO} else - ${0} + ${0:# TODO} end endsnippet @@ -55,7 +57,7 @@ endsnippet snippet unless "unless ... end" unless ${1:condition} - ${0} + ${0:# TODO} end endsnippet @@ -63,9 +65,9 @@ endsnippet snippet unlesse "unless ... else ... end" unless ${1:condition} - ${2} + ${2:# TODO} else - ${0} + ${0:# TODO} end endsnippet @@ -73,11 +75,11 @@ endsnippet snippet unlesee "unless ... elseif ... else ... end" unless ${1:condition} - ${2} + ${2:# TODO} elsif ${3:condition} - ${4} + ${4:# TODO} else - ${0} + ${0:# TODO} end endsnippet @@ -85,7 +87,7 @@ endsnippet snippet "\b(de)?f" "def ..." r def ${1:function_name}${2: ${3:*args}} - ${0} + ${0:# TODO} end endsnippet @@ -93,7 +95,7 @@ endsnippet snippet defi "def initialize ..." def initialize${1: ${2:*args}} - ${0} + ${0:# TODO} end endsnippet @@ -101,23 +103,23 @@ endsnippet snippet defr "def ... rescue ..." def ${1:function_name}${2: ${3:*args}} - ${4} + ${4:# TODO} rescue - ${0} + ${0:# TODO} end endsnippet snippet For "(..).each { || }" -(${1:from}..${2:to}).each { |${3:i}| ${4} } +(${1:from}..${2:to}).each { |${3:i}| ${4:# TODO} } endsnippet snippet for "(..).each do || end" (${1:from}..${2:to}).each do |${3:i}| - ${0} + ${0:# TODO} end endsnippet @@ -138,42 +140,42 @@ endsnippet snippet "(\S+)\.Del(ete)?_?if" ".delete_if { |,| }" r -`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3} } +`!p snip.rv=match.group(1)`.delete_if { |${1:key},${2:value}| ${3:# TODO} } endsnippet snippet "(\S+)\.del(ete)?_?if" ".delete_if do |,| end" r `!p snip.rv=match.group(1)`.delete_if do |${1:key},${2:value}| - ${0} + ${0:# TODO} end endsnippet snippet "(\S+)\.Keep_?if" ".keep_if { |,| }" r -`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3} } +`!p snip.rv=match.group(1)`.keep_if { |${1:key},${2:value}| ${3:# TODO} } endsnippet snippet "(\S+)\.keep_?if" ".keep_if do ,| end" r `!p snip.rv=match.group(1)`.keep_if do |${1:key},${2:value}| - ${0} + ${0:# TODO} end endsnippet snippet "(\S+)\.Reject" ".reject { |,| }" r -`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3} } +`!p snip.rv=match.group(1)`.reject { |${1:key},${2:value}| ${3:# TODO} } endsnippet snippet "(\S+)\.reject" ".reject do ,| end" r `!p snip.rv=match.group(1)`.reject do |${1:key},${2:value}| - ${0} + ${0:# TODO} end endsnippet @@ -194,71 +196,71 @@ endsnippet snippet "(\S+)\.Sort" ".sort { |,| }" r -`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3} } +`!p snip.rv=match.group(1)`.sort { |${1:a},${2:b}| ${3:# TODO} } endsnippet snippet "(\S+)\.sort" ".sort do |,| end" r `!p snip.rv=match.group(1)`.sort do |${1:a},${2:b}| - ${0} + ${0:# TODO} end endsnippet snippet "(\S+)\.Each_?k(ey)?" ".each_key { || }" r -`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2} } +`!p snip.rv=match.group(1)`.each_key { |${1:key}| ${2:# TODO} } endsnippet snippet "(\S+)\.each_?k(ey)?" ".each_key do |key| end" r `!p snip.rv=match.group(1)`.each_key do |${1:key}| - ${0} + ${0:# TODO} end endsnippet snippet "(\S+)\.Each_?val(ue)?" ".each_value { || }" r -`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2} } +`!p snip.rv=match.group(1)`.each_value { |${1:value}| ${2:# TODO} } endsnippet snippet "(\S+)\.each_?val(ue)?" ".each_value do || end" r `!p snip.rv=match.group(1)`.each_value do |${1:value}| - ${0} + ${0:# TODO} end endsnippet snippet Each ".each { || }" -${1:elements}.each { |${2:${1/s$//}}| ${3} } +${1:elements}.each { |${2:${1/s$//}}| ${3:# TODO} } endsnippet snippet each ".each do || end" ${1:elements}.each do |${2:${1/s$//}}| - ${0} + ${0:# TODO} end endsnippet -snippet each_?s(lice)? ".each_slice(n) do |slice| end" -each_slice(${1:2}) do |${2:slice}| - ${0} +snippet "each_?s(lice)?" ".each_slice(n) do |slice| end" r +${1:elements}.each_slice(${2:2}) do |${3:slice}| + ${0:# TODO} end endsnippet -snippet Each_?s(lice)? ".each_slice(n) { |slice| }" -each_slice(${1:2}) { |${2:slice}| ${3} } +snippet "Each_?s(lice)?" ".each_slice(n) { |slice| }" r +${1:elements}.each_slice(${2:2}) { |${3:slice}| ${0:# TODO} } endsnippet @@ -273,7 +275,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`}| ${2} } +`}| ${2:# TODO} } endsnippet @@ -288,7 +290,7 @@ try: except: snip.rv = 'element' `}| - ${0} + ${0:# TODO} end endsnippet @@ -303,7 +305,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`}| ${2} } +`}| ${2:# TODO} } endsnippet @@ -318,7 +320,7 @@ try: except: snip.rv = 'element' `}| - ${0} + ${0:# TODO} end endsnippet @@ -333,7 +335,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`}| ${2} } +`}| ${2:# TODO} } endsnippet @@ -348,14 +350,14 @@ try: except: snip.rv = 'element' `}| - ${0} + ${0:# TODO} end endsnippet -snippet "(\S+)\.Each_w(ith)?_?i(ndex)?" ".each_with_index { |,| }" r +snippet "(\S+)\.Each_?w(ith)?_?i(ndex)?" ".each_with_index { |,| }" r `!p snip.rv=match.group(1)`.each_with_index { |${1:`!p element_name = match.group(1).lstrip('$@') ematch = re.search("([A-Za-z][A-Za-z0-9_]+?)s?[^A-Za-z0-9_]*?$", element_name) @@ -364,7 +366,7 @@ try: snip.rv = wmatch.group(1).lower() except: snip.rv = 'element' -`},${2:i}| ${3} }$0 +`},${2:i}| ${3:# TODO} }$0 endsnippet @@ -379,7 +381,7 @@ try: except: snip.rv = 'element' `},${2:i}| - ${0} + ${0:# TODO} end endsnippet @@ -387,14 +389,14 @@ endsnippet snippet "(\S+)\.Each_?p(air)?" ".each_pair { |,| }" r -`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3} } +`!p snip.rv=match.group(1)`.each_pair { |${1:key},${2:value}| ${3:# TODO} } endsnippet snippet "(\S+)\.each_?p(air)?" ".each_pair do |,| end" r `!p snip.rv=match.group(1)`.each_pair do |${1:key},${2:value}| - ${0} + ${0:# TODO} end endsnippet @@ -424,24 +426,26 @@ snippet "(\S+)\.Index" ".index do |item| ... end" r end endsnippet -# comments about do and dov see snippets/ruby.snippets -snippet do "do ... end" i + + +snippet do "do || ... end" i +do |${1:args}| + $0 +end +endsnippet + + + +snippet Do "do ... end" i do $0 end endsnippet -snippet dov "do || ... end" i -do |${1:v}| - $2 -end -endsnippet - - snippet until "until ... end" until ${1:expression} - ${0} + ${0:# TODO} end endsnippet @@ -449,15 +453,15 @@ endsnippet snippet Until "begin ... end until " begin - ${0} + ${0:# TODO} end until ${1:expression} endsnippet -snippet wh "while ... end" +snippet while "while ... end" while ${1:expression} - ${0} + ${0:# TODO} end endsnippet @@ -465,7 +469,7 @@ endsnippet snippet While "begin ... end while " begin - ${0} + ${0:# TODO} end while ${1:expression} endsnippet @@ -491,9 +495,9 @@ endsnippet snippet begin "begin ... rescue ... end" begin - ${1} + ${1:# TODO} rescue - ${0} + ${0:# TODO} end endsnippet @@ -559,7 +563,7 @@ endsnippet snippet ### =begin - $0 + $0 =end endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/rust.snippets b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets new file mode 100644 index 00000000..d7f0047c --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/rust.snippets @@ -0,0 +1,252 @@ +####################################################################### +# Rust Snippets # +####################################################################### + +priority -50 + +snippet fn "A function, optionally with arguments and return type." b +fn ${1:function_name}(${2})${3/..*/ -> /}${3} { + ${VISUAL}${0} +} +endsnippet + +snippet test "Test function" b +#[test] +fn ${1:test_function_name}() { + ${VISUAL}${0} +} +endsnippet + + +snippet bench "Bench function" b +#[bench] +fn ${1:bench_function_name}(b: &mut test::Bencher) { + b.iter(|| { + ${VISUAL}${0} + }) +} +endsnippet + +snippet new "A new function" b +pub fn new(${2}) -> ${1:Name} { + ${VISUAL}${0}return $1 { ${3} }; +} +endsnippet + +snippet main "The main function" b +pub fn main() { + ${VISUAL}${0} +} +endsnippet + +snippet let "A let statement" b +let ${1:name}${3} = ${VISUAL}${2}; +endsnippet + +snippet lmut "let mut = .." b +let mut ${1:name}${3} = ${VISUAL}${2}; +endsnippet + +snippet pri "print!(..)" b +print!("${1}"${2/..*/, /}${2}); +endsnippet + +snippet pln "println!(..)" b +println!("${1}"${2/..*/, /}${2}); +endsnippet + +snippet fmt "format!(..)" +format!("${1}"${2/..*/, /}${2}); +endsnippet + +snippet macro "macro_rules!" b +macro_rules! ${1:name} ( + (${2:matcher}) => ( + ${3} + ) +) +endsnippet + +snippet ec "extern crate ..." b +extern crate ${1:sync}; +endsnippet + +snippet ecl "...extern crate log;" b +#![feature(phase)] +#[phase(syntax, link)] extern crate log; +endsnippet + +snippet mod "A module" b +mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} { + ${VISUAL}${0} +} +endsnippet + +snippet crate "Create header information" b +// Crate ID +#![crate_id = "${1:crate_name}#${2:0.0.1}"] + +// Additional metadata attributes +#![desc = "${3:Descrption.}"] +#![license = "${4:BSD}"] +#![comment = "${5:Comment.}"] + +// Specify the output type +#![crate_type = "${6:lib}"] +endsnippet + +snippet allow "#[allow(..)]" b +#[allow(${1:unused_variable})] +endsnippet + +snippet feat "#![feature(..)]" b +#![feature(${1:macro_rules})] +endsnippet + +snippet der "#[deriving(..)]" b +#[deriving(${1:Show})] +endsnippet + +snippet attr "#[..]" b +#[${1:inline}] +endsnippet + +snippet opt "Option<..>" +Option<${1:int}> +endsnippet + +snippet res "Result<.., ..>" +Result<${1:int}, ${2:()}> +endsnippet + +snippet if "if .. (if)" b +if ${1} { + ${VISUAL}${0} +} +endsnippet + +snippet el "else .. (el)" +else { + ${VISUAL}${0} +} +endsnippet + +snippet eli "else if .. (eli)" +else if ${1} { + ${VISUAL}${0} +} +endsnippet + +snippet ife "if .. else (ife)" +if ${1} { + ${2} +} else { + ${3} +} +endsnippet + +snippet mat "match" +match ${1} { + ${2} => ${3}, +} +endsnippet + +snippet loop "loop {}" b +loop { + ${VISUAL}${0} +} +endsnippet + +snippet while "while .. {}" b +while ${1} { + ${VISUAL}${0} +} +endsnippet + +snippet for "for .. in .." b +for ${1:i} in ${2:range(0u, 10)} { + ${VISUAL}${0} +} +endsnippet + +snippet spawn "spawn(proc() { .. });" b +spawn(proc() { + ${VISUAL}${0} +}); +endsnippet + +snippet chan "A channel" b +let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel(); +endsnippet + +snippet duplex "Duplex stream" b +let (${1:from_child}, ${2:to_child}) = sync::duplex(); +endsnippet + +snippet todo "A Todo comment" +// [TODO]: ${1:Description} - `!v strftime("%Y-%m-%d %I:%M%P")` +endsnippet + +snippet fixme "FIXME comment" +// FIXME: ${1} +endsnippet + +snippet st "Struct" b +struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} { + ${VISUAL}${0} +} +endsnippet + +snippet stn "Struct with new constructor." b +pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} { + ${3} +} + +impl $1 { + pub fn new(${2}) -> $1 { + ${4}return $1 { + ${5} + }; + } +} +endsnippet + +snippet enum "An enum" b +enum ${1:Name} { + ${VISUAL}${0}, +} +endsnippet + +snippet type "A type" b +type ${1:NewName} = ${VISUAL}${0}; +endsnippet + +snippet imp "An impl" b +impl ${1:Name} { + ${VISUAL}${0} +} +endsnippet + +snippet drop "Drop implementation" b +impl Drop for ${1:Name} { + fn drop(&mut self) { + ${VISUAL}${0} + } +} +endsnippet + +snippet trait "Trait definition" b +trait ${1:Name} { + ${VISUAL}${0} +} +endsnippet + +snippet ss "A static string." +static ${1}: &'static str = "${VISUAL}${0}"; +endsnippet + +snippet stat "A static variable." +static ${1}: ${2:uint} = ${VISUAL}${0}; +endsnippet + +# vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/scss.snippets b/sources_non_forked/vim-snippets/UltiSnips/scss.snippets new file mode 100644 index 00000000..70a44a07 --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/scss.snippets @@ -0,0 +1,55 @@ +priority -50 + +snippet /@?imp/ "@import '...';" br +@import '${1:file}'; +endsnippet + +snippet /@?inc/ "@include mixin(...);" br +@include ${1:mixin}(${2:arguments}); +endsnippet + +snippet /@?ext?/ "@extend %placeholder;" br +@extend %${1:placeholder}; +endsnippet + +snippet /@?mixin/ "@mixin (...) { ... }" br +@mixin ${1:name}(${2:arguments}) { + ${VISUAL}$0 +} +endsnippet + +snippet /@?fun/ "@function (...) { ... }" br +@function ${1:name}(${2:arguments}) { + ${VISUAL}$0 +} +endsnippet + +snippet /@?if/ "@if (...) { ... }" br +@if ${1:condition} { + ${VISUAL}$0 +} +endsnippet + +snippet /(} )?@?else/ "@else { ... }" br +@else ${1:condition} { + ${VISUAL}$0 +} +endsnippet + +snippet /@?for/ "@for loop" br +@for ${1:$i} from ${2:1} through ${3:3} { + ${VISUAL}$0 +} +endsnippet + +snippet /@?each/ "@each loop" br +@each ${1:$item} in ${2:item, item, item} { + ${VISUAL}$0 +} +endsnippet + +snippet /@?while/ "@while loop" br +@while ${1:$i} ${2:>} ${3:0} { + ${VISUAL}$0 +} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/sh.snippets b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets index cce06ef3..9cc45779 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/sh.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/sh.snippets @@ -1,21 +1,25 @@ +priority -50 + global !p import vim # Tests for the existence of a variable declared by Vim's filetype detection # suggesting the type of shell script of the current file def testShell(scope, shell): - return vim.eval("exists('" + scope + ":is_" + shell + "')") + return vim.eval("exists('" + scope + ":is_" + shell + "')") # Loops over the possible variables, checking for global variables # first since they indicate an override by the user. def getShell(): - for scope in ["g", "b"]: - for shell in ["bash", "sh", "kornshell"]: - if testShell(scope, shell) == "1": - if shell == "kornshell": - return "ksh" - return shell - return "sh" + for scope in ["g", "b"]: + for shell in ["bash", "posix", "sh", "kornshell"]: + if testShell(scope, shell) == "1": + if shell == "kornshell": + return "ksh" + if shell == "posix": + return "sh" + return shell + return "sh" endglobal ########################################################################### @@ -79,7 +83,7 @@ until ${2:[[ ${1:condition} ]]}; do done endsnippet -snippet wh "while ... (done)" +snippet while "while ... (done)" while ${2:[[ ${1:condition} ]]}; do ${0:#statements} done diff --git a/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets b/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets index 414f350e..ee0c8c76 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/snippets.snippets @@ -1,16 +1,14 @@ -######################### -# SNIPPETS for SNIPPETS # -######################### +priority -50 # We use a little hack so that the snippet is expanded # and parsed correctly -snippet snip "Snippet definition" ! -`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:!b} +snippet snip "Snippet definition" b +`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b} $0 `!p snip.rv = "endsnippet"` endsnippet -snippet global "Global snippet" ! +snippet global "Global snippet" b `!p snip.rv = "global"` !p $0 `!p snip.rv = "endglobal"` diff --git a/sources_non_forked/vim-snippets/UltiSnips/soy.snippets b/sources_non_forked/vim-snippets/UltiSnips/soy.snippets new file mode 100644 index 00000000..9a22a57c --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/soy.snippets @@ -0,0 +1,63 @@ +priority -50 + +extends html + +snippet ns "Namespace" b +{namespace ${1:name}} +endsnippet + +snippet tmpl "Template" b +/** + * ${2:TODO(`whoami`): Describe this template.} + */ +{template .${1:name}} + $0 +{/template} +endsnippet + +snippet msg "Message" b +{msg desc="${1:description}"} + $0 +{/msg} +endsnippet + +snippet let "let command" b +{let $${1:identifier}: ${2:expression} /} +endsnippet + +snippet if "if .. (if)" b +{if ${1:expression}} + $0 +{/if} +endsnippet + +snippet ife "if .. else (ife)" b +{if ${1:expression}} + $2 +{else} + $0 +{/if} +endsnippet + +snippet eli "else if .. (eli)" b +{elif ${1:expression}} + $0 +endsnippet + +snippet fore "foreach command" b +{foreach $${1:var} in ${2:ref}} + $0 +{/foreach} +endsnippet + +snippet for "for command" b +{for $${1:var} in range(${2:rangeexpr})} + $0 +{/for} +endsnippet + +snippet call "template call" b +{call ${1:tmpl}} + $0 +{/call} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets b/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets index fd53d265..65849157 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tcl.snippets @@ -1,3 +1,5 @@ +priority -50 + ########################################################################### # TEXTMATE SNIPPETS # ########################################################################### @@ -16,14 +18,14 @@ foreach ${1:var} ${2:\$list} { endsnippet snippet if "if... (if)" b -if {${1}} { +if {${1:condition}} { ${2} } endsnippet snippet proc "proc... (proc)" b -proc ${1} {${2}} \ +proc ${1:name} {${2:args}} \ { ${3} } @@ -40,8 +42,8 @@ switch ${1:-exact} -- ${2:\$var} { endsnippet -snippet wh "while... (while)" b -while {${1}} { +snippet while "while... (while)" b +while {${1:condition}} { ${2} } diff --git a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets index 97ea8a82..ede9090d 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/tex.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/tex.snippets @@ -1,38 +1,28 @@ +priority -50 -########################################################################### -# LATEX SNIPPETS # -########################################################################### +extends texmath -snippet r "\ref{}" w -\ref{$1} -endsnippet - -########################################################################### -# TEXTMATE SNIPPETS # -########################################################################### - -################# -# GENERAL STUFF # -################# snippet "b(egin)?" "begin{} / end{}" br \begin{${1:something}} ${0:${VISUAL}} \end{$1} endsnippet -#################### -# TABULARS, ARRAYS # -#################### - -snippet tab +snippet tab "tabular / array environment" b \begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}} $0${2/((?<=.)c|l|r)|./(?1: & )/g} \end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}} endsnippet -######################## -# ENUM, DESCR, ITEMIZE # -######################## +snippet fig "Figure environment" b +\begin{figure}${2:[htpb]} + \centering + \includegraphics[width=${3:0.8}\linewidth]{${4:name.ext}} + \caption{${4/(\w+)\.\w+/\u$1/}$0} + \label{fig:${4/(\w+)\.\w+/$1/}} +\end{figure} +endsnippet + snippet enum "Enumerate" b \begin{enumerate} \item $0 @@ -51,74 +41,70 @@ snippet desc "Description" b \end{description} endsnippet -##################################### -# SECTIONS, CHAPTERS AND THERE LIKE # -##################################### +snippet it "Individual item" b +\item ${1} +$0 +endsnippet snippet part "Part" b \part{${1:part name}} -\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/g}}} +\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/ga}}} ${0} - -% part $2 (end) endsnippet snippet cha "Chapter" b \chapter{${1:chapter name}} -\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} +\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} ${0} - -% chapter $2 (end) endsnippet snippet sec "Section" b -\section{${1:section name}} -\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} +\section{${1:section name}} +\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} ${0} - -% section $2 (end) endsnippet - snippet sub "Subsection" b \subsection{${1:subsection name}} -\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} +\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} ${0} - -% subsection $2 (end) endsnippet snippet ssub "Subsubsection" b \subsubsection{${1:subsubsection name}} -\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} +\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} ${0} - -% subsubsection $2 (end) - endsnippet snippet par "Paragraph" b \paragraph{${1:paragraph name}} -\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} +\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} ${0} - -% paragraph $2 (end) endsnippet - snippet subp "Subparagraph" b \subparagraph{${1:subparagraph name}} -\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/g}}} +\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}} ${0} - -% subparagraph $2 (end) endsnippet +snippet ni "Non-indented paragraph" b +\noindent +${0} +endsnippet + +snippet pac "Package" b +\usepackage[${1:options}]{${2:package}}$0 +endsnippet + +snippet lp "Long parenthesis" +\left(${1:${VISUAL:contents}}\right)$0 +endsnippet # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/texmath.snippets b/sources_non_forked/vim-snippets/UltiSnips/texmath.snippets index 03589f0f..d0a25e9a 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/texmath.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/texmath.snippets @@ -1,3 +1,5 @@ +priority -50 + ############## # MATH STUFF # ############## diff --git a/sources_non_forked/vim-snippets/UltiSnips/twig.snippets b/sources_non_forked/vim-snippets/UltiSnips/twig.snippets new file mode 100644 index 00000000..156b981b --- /dev/null +++ b/sources_non_forked/vim-snippets/UltiSnips/twig.snippets @@ -0,0 +1,35 @@ +priority -50 + +snippet bl "twig block" b +{% block ${1} %} +${2} +{% endblock $1 %} +endsnippet + +snippet js "twig javascripts" b +{% javascripts '${1}' %} + +{% endjavascripts %} +endsnippet + +snippet css "twig stylesheets" b +{% stylesheets '${1}' %} + +{% endstylesheets %} +endsnippet + +snippet if "twig if" b +{% if ${1} %} +${2} +{% endif %} +endsnippet + +snippet for "twig for" b +{% for ${1} in ${2} %} +${3} +{% endfor %} +endsnippet + +snippet ext "twig extends" b +{% extends ${1} %} +endsnippet diff --git a/sources_non_forked/vim-snippets/UltiSnips/vim.snippets b/sources_non_forked/vim-snippets/UltiSnips/vim.snippets index 5655c4b1..dbb2396d 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/vim.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/vim.snippets @@ -1,58 +1,24 @@ +priority -50 + ########################################################################### # SnipMate Snippets # ########################################################################### -snippet header -" File: ${1:`!v expand('%:t')`} -" Author: ${2:`!v g:snips_author`} -" Description: ${3} -${4:" Last Modified: `!v strftime("%B %d, %Y")`} - -$0 -endsnippet - -snippet gvar "Global / configuration variable" +snippet gvar "Global / configuration variable" b if !exists("g:${1:MyUltraImportantVar}") let g:$1 = ${2:"${3:}"} endif endsnippet -snippet guard +snippet guard "script reload guard" b if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700} finish endif let $1 = 1${3} endsnippet -snippet f +snippet f "function" b fun ${1:function_name}(${2}) - ${3} + ${3:" code} endf endsnippet - -snippet for -for ${1} in ${2} - ${3} -endfor -endsnippet - -snippet wh -while ${1} - ${2} -endw -endsnippet - -snippet if -if ${1} - ${2} -endif -endsnippet - -snippet ife -if ${1} - ${2} -else - ${3} -endif -endsnippet - # vim:ft=snippets: diff --git a/sources_non_forked/vim-snippets/UltiSnips/xhtml.snippets b/sources_non_forked/vim-snippets/UltiSnips/xhtml.snippets index e69de29b..a9c5a29a 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/xhtml.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/xhtml.snippets @@ -0,0 +1,3 @@ +priority -50 + +extends html diff --git a/sources_non_forked/vim-snippets/UltiSnips/xml.snippets b/sources_non_forked/vim-snippets/UltiSnips/xml.snippets index 80b017ce..92dfb6e1 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/xml.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/xml.snippets @@ -1,3 +1,10 @@ +priority -50 + +snippet xml "XML declaration" b + + +endsnippet + snippet t "Simple tag" b <${1:tag}> ${2:content} diff --git a/sources_non_forked/vim-snippets/UltiSnips/zsh.snippets b/sources_non_forked/vim-snippets/UltiSnips/zsh.snippets index 80394597..f7986ea5 100644 --- a/sources_non_forked/vim-snippets/UltiSnips/zsh.snippets +++ b/sources_non_forked/vim-snippets/UltiSnips/zsh.snippets @@ -1,9 +1,15 @@ -snippet #! "shebang" ! +priority -50 + +extends sh + +priority -49 + +snippet #! "shebang" b #!/bin/zsh endsnippet -snippet !env "#!/usr/bin/env (!env)" ! +snippet !env "#!/usr/bin/env (!env)" b #!/usr/bin/env zsh endsnippet diff --git a/sources_non_forked/vim-snippets/plugin/vimsnippets.vim b/sources_non_forked/vim-snippets/plugin/vimsnippets.vim new file mode 100644 index 00000000..3c3ecf92 --- /dev/null +++ b/sources_non_forked/vim-snippets/plugin/vimsnippets.vim @@ -0,0 +1,37 @@ +if exists("b:done_vimsnippets") + finish +endif +let b:done_vimsnippets = 1 + +" Expanding the path is not needed on Vim 7.4 +if &cp || version >= 704 + finish +endif + +" Add pythonx to the python search path if needed (i.e. <= Vim 7.3). +if !has("python") && !has("python3") + finish +end + +" This will fail if UltiSnips is not installed. +try + call UltiSnips#bootstrap#Bootstrap() +catch /E117/ + finish +endtry + + +" This should have been set by UltiSnips, otherwise something is wrong. +if !exists("g:_uspy") + finish +end + + +" Expand our path +let s:SourcedFile=expand("") +exec g:_uspy "import vim, os, sys" +exec g:_uspy "sourced_file = vim.eval('s:SourcedFile')" +exec g:_uspy "while not os.path.exists(os.path.join(sourced_file, 'pythonx')): + \ sourced_file = os.path.dirname(sourced_file)" +exec g:_uspy "module_path = os.path.join(sourced_file, 'pythonx')" +exec g:_uspy "sys.path.append(module_path)" diff --git a/sources_non_forked/vim-snippets/pythonx/vimsnippets.py b/sources_non_forked/vim-snippets/pythonx/vimsnippets.py new file mode 100644 index 00000000..b00edb15 --- /dev/null +++ b/sources_non_forked/vim-snippets/pythonx/vimsnippets.py @@ -0,0 +1,20 @@ +"""Helper methods used in UltiSnips snippets.""" + +def complete(tab, opts): + """ + get options that start with tab + + :param tab: query string + :param opts: list that needs to be completed + + :return: a string that start with tab + """ + msg = "({0})" + if tab: + opts = [m[len(tab):] for m in opts if m.startswith(tab)] + if len(opts) == 1: + return opts[0] + + if not len(opts): + msg = "{0}" + return msg.format("|".join(opts)) diff --git a/sources_non_forked/vim-snippets/snippets/_.snippets b/sources_non_forked/vim-snippets/snippets/_.snippets index 6a3d8b28..85616018 100644 --- a/sources_non_forked/vim-snippets/snippets/_.snippets +++ b/sources_non_forked/vim-snippets/snippets/_.snippets @@ -84,6 +84,24 @@ snippet LGPL3 You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . + ${0} +snippet AGPL3 + ${1:one line to give the program's name and a brief description.} + Copyright (C) `strftime("%Y")` ${2:copyright holder} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + ${0} snippet BSD2 ${1:one line to give the program's name and a brief description} diff --git a/sources_non_forked/vim-snippets/snippets/coffee/angular_coffee.snippets b/sources_non_forked/vim-snippets/snippets/coffee/angular_coffee.snippets new file mode 100644 index 00000000..f98cae35 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/coffee/angular_coffee.snippets @@ -0,0 +1,116 @@ +## Global Snippets +# Define a new Angular Controller; +# You can change the controller name and parameters +snippet ngc + ${1:controllerName} = (${2:scope}, ${3:injectables}) -> + ${4} +# angular.foreach loop +snippet ngfor + angular.forEach ${1:iterateOver}, (value, key) -> + ${2} +## Module Based Snippets +# A new angular module without a config function +snippet ngm + angular.module '${1:moduleName}', [${2:moduleDependencies}] + ${3} +# A new angular module without a config function and a variable assignment +snippet ngma + ${1:moduleName} = angular.module '$1', [${2:moduleDeps}] + ${3} +# A new angular module with a config function +snippet ngmc + ${1:moduleName} = angular.module('$1', [${2:moduleDeps}], (${3:configDeps}) -> + ${4} + ) +# A factory in a module +snippet ngmfa + factory '${1:factoryName}', (${2:dependencies}) -> + ${3} +# Define an Angular Module Service to be attached to a previously defined module +# You can change the service name and service injectables +snippet ngms + service '${1:serviceName}', (${2:injectables}) -> + ${3} +# Define an Angular Module Filter to be attached to a previously defined module +# You can change the filter name +snippet ngmfi + filter '${1:filterName}', (${2:injectables}) -> + (input, ${3:args}) -> + ${4} +## Route Based Snippets +# Defines a when condition of an AngularJS route +snippet ngrw + $routeProvider.when '${1:url}', + templateUrl: '${2:templateUrl}' + controller: '${3:controller}' + ${4} +# Defines a when condition of an AngularJS route with the resolve block +snippet ngrwr + $routeProvider.when '${1:url}', + templateUrl: '${2:templateUrl}' + controller: '${3:controller}' + resolve: + ${4} + ${5} +# Defines an otherwise condition of an AngularJS route +snippet ngro + $routeProvider.otherwise redirectTo: '${1:url}' + ${2} +## Scope Related Snippets +# Define a new $scope'd function (usually inside an AngularJS Controller) +# You can change the function name and arguments +snippet $f + $scope.${1:functionName} = (${2:args}) -> + ${3} +# Defines a new $scope'd variable inside an AngularJS controller +snippet $v + $scope.${1:variable} = ${2:value} + ${3} +# Defines a new $scope'd variable inside an AngularJS controller and assigns a value from a constructor arguments +snippet $va + $scope.${1:variable} = ${2:variable} + ${3} +# Define a $watch for an expression +# You can change the expression to be watched +snippet $w + $scope.$watch '${1:watchExpr}', (newValue, oldValue) -> + ${2} +# Define a $on for a $broadcast/$emit on the $scope inside an Angular Controller +# You can change the event name to listen on +snippet $on + $scope.$on '${1:eventName}', (event, ${2:args}) -> + ${3} +# Define a $broadcast for a $scope inside an Angular Controller / Angular Controller Function +# You can change the event name and optional event arguments +snippet $b + $scope.$broadcast '${1:eventName}', ${2:eventArgs} + ${3} +# Define an $emit for a $scope inside an Angular Controller / Angular Controller Function +# You can change the event name and optional event arguments +snippet $e + $scope.$emit '${1:eventName}', ${2:eventArgs} + ${3} +## Directive related snippets +# A compile function +snippet ngdcf + compile = (tElement, tAttrs, transclude) -> + (scope, element, attrs) -> + ${1} +# A linking function in a directive +snippet ngdlf + (scope, element, attrs${1:ctrl}) -> + ${2} +# A directive with a compile function +snippet ngdc + directive '${1:directiveName}', factory = (${2:injectables}) -> + directiveDefinitionObject = + ${3:directiveAttrs} + compile: compile = (tElement, tAttrs, transclude) -> + (scope, element, attrs) -> + directiveDefinitionObject +# A directive with a linking function only +snippet ngdl + .directive('${1:directiveName}', (${2:directiveDeps}) -> + (scope, element, attrs${3:ctrl}) -> + ${4} + ) \ No newline at end of file diff --git a/sources_non_forked/vim-snippets/snippets/coffee.snippets b/sources_non_forked/vim-snippets/snippets/coffee/coffee.snippets similarity index 95% rename from sources_non_forked/vim-snippets/snippets/coffee.snippets rename to sources_non_forked/vim-snippets/snippets/coffee/coffee.snippets index aca6e81a..bb964346 100644 --- a/sources_non_forked/vim-snippets/snippets/coffee.snippets +++ b/sources_non_forked/vim-snippets/snippets/coffee/coffee.snippets @@ -93,3 +93,9 @@ snippet req # Export snippet exp ${0:root} = exports ? this + +snippet jsonp + JSON.parse ${0:jstr} +# JSON.stringify +snippet jsons + JSON.stringify ${0:object} diff --git a/sources_non_forked/vim-snippets/snippets/coffee/jquery_coffee.snippets b/sources_non_forked/vim-snippets/snippets/coffee/jquery_coffee.snippets new file mode 100644 index 00000000..10bcd775 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/coffee/jquery_coffee.snippets @@ -0,0 +1,524 @@ +snippet add + ${1:obj}.add('${2:selector expression}') +snippet addClass + ${1:obj}.addClass('${2:class name}') +snippet after + ${1:obj}.after('${2:Some text and bold!}') +snippet ajax + $.ajax + url: "${1:mydomain.com/url}" + type: "${2:POST}" + dataType: "${3:xml/html/script/json}" + data: ${4:data} + complete: (jqXHR, textStatus) -> + ${5:// callback} + success: (data, textStatus, jqXHR) -> + ${6:// success callback} + error: (jqXHR, textStatus, errorThrown) -> + ${0:// error callback} +snippet ajaxcomplete + ${1:obj}.ajaxComplete (${1:e}, xhr, settings) -> + ${0:// callback} +snippet ajaxerror + ${1:obj}.ajaxError (${1:e}, xhr, settings, thrownError) -> + ${2:// error callback} + ${0} +snippet ajaxget + $.get '${1:mydomain.com/url}', + ${2:{ param1: value1 },} + (data, textStatus, jqXHR) -> + ${0:// success callback} +snippet ajaxpost + $.post '${1:mydomain.com/url}', + ${2:{ param1: value1 },} + (data, textStatus, jqXHR) -> + ${0:// success callback} +snippet ajaxprefilter + $.ajaxPrefilter (${1:options}, ${2:originalOptions}, jqXHR) -> + ${0: // Modify options, control originalOptions, store jqXHR, etc} +snippet ajaxsend + ${1:obj}.ajaxSend (${1:request, settings}) -> + ${2:// error callback} + ${0} +snippet ajaxsetup + $.ajaxSetup({ + url: "${1:mydomain.com/url}", + type: "${2:POST}", + dataType: "${3:xml/html/script/json}", + data: $.param( $("${4:Element or Expression}") ), + complete: (jqXHR, textStatus) -> + ${5:// callback} + , + success: (data, textStatus, jqXHR) -> + ${6:// success callback} + , + error: (jqXHR, textStatus, errorThrown) -> + ${0:// error callback} + }) +snippet ajaxstart + $.ajaxStart -> + ${1:// handler for when an AJAX call is started and no other AJAX calls are in progress} + ${0} +snippet ajaxstop + $.ajaxStop -> + ${1:// handler for when all AJAX calls have been completed} + ${0} +snippet ajaxsuccess + $.ajaxSuccess (${1:e}, xhr, settings) -> + ${2:// handler for when any AJAX call is successfully completed} + ${0} +snippet andself + ${1:obj}.andSelf() +snippet animate + ${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed}) +snippet append + ${1:obj}.append('${2:Some text and bold!}') +snippet appendTo + ${1:obj}.appendTo('${2:selector expression}') +snippet attr + ${1:obj}.attr('${2:attribute}', '${3:value}') +snippet attrm + ${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'}) +snippet before + ${1:obj}.before('${2:Some text and bold!}') +snippet bind + ${1:obj}.bind('${2:event name}', (${3:e}) -> + ${0:// event handler} +snippet blur + ${1:obj}.blur (${2:e}) -> + ${0:// event handler} +snippet C + $.Callbacks() +snippet Cadd + ${1:callbacks}.add(${2:callbacks}) +snippet Cdis + ${1:callbacks}.disable() +snippet Cempty + ${1:callbacks}.empty() +snippet Cfire + ${1:callbacks}.fire(${2:args}) +snippet Cfired + ${1:callbacks}.fired() +snippet Cfirew + ${1:callbacks}.fireWith(${2:this}, ${3:args}) +snippet Chas + ${1:callbacks}.has(${2:callback}) +snippet Clock + ${1:callbacks}.lock() +snippet Clocked + ${1:callbacks}.locked() +snippet Crem + ${1:callbacks}.remove(${2:callbacks}) +snippet change + ${1:obj}.change (${2:e}) -> + ${0:// event handler} +snippet children + ${1:obj}.children('${2:selector expression}') +snippet clearq + ${1:obj}.clearQueue(${2:'queue name'}) +snippet click + ${1:obj}.click (${2:e}) -> + ${0:// event handler} +snippet clone + ${1:obj}.clone() +snippet contains + $.contains(${1:container}, ${0:contents}) +snippet css + ${1:obj}.css('${2:attribute}', '${3:value}') +snippet csshooks + $.cssHooks['${1:CSS prop}'] = { + get: (elem, computed, extra) -> + ${2: // handle getting the CSS property} + set: (elem, value) -> + ${0: // handle setting the CSS value} + } +snippet cssm + ${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'}) +snippet D + $.Deferred() +snippet Dalways + ${1:deferred}.always(${2:callbacks}) +snippet Ddone + ${1:deferred}.done(${2:callbacks}) +snippet Dfail + ${1:deferred}.fail(${2:callbacks}) +snippet Disrej + ${1:deferred}.isRejected() +snippet Disres + ${1:deferred}.isResolved() +snippet Dnotify + ${1:deferred}.notify(${2:args}) +snippet Dnotifyw + ${1:deferred}.notifyWith(${2:this}, ${3:args}) +snippet Dpipe + ${1:deferred}.then(${2:doneFilter}, ${3:failFilter}, ${4:progressFilter}) +snippet Dprog + ${1:deferred}.progress(${2:callbacks}) +snippet Dprom + ${1:deferred}.promise(${2:target}) +snippet Drej + ${1:deferred}.reject(${2:args}) +snippet Drejw + ${1:deferred}.rejectWith(${2:this}, ${3:args}) +snippet Dres + ${1:deferred}.resolve(${2:args}) +snippet Dresw + ${1:deferred}.resolveWith(${2:this}, ${3:args}) +snippet Dstate + ${1:deferred}.state() +snippet Dthen + ${1:deferred}.then(${2:doneCallbacks}, ${3:failCallbacks}, ${4:progressCallbacks}) +snippet Dwhen + $.when(${1:deferreds}) +snippet data + ${1:obj}.data(${2:obj}) +snippet dataa + $.data('${1:selector expression}', '${2:key}'${3:, 'value'}) +snippet dblclick + ${1:obj}.dblclick (${2:e}) -> + ${0:// event handler} +snippet delay + ${1:obj}.delay('${2:slow/400/fast}'${3:, 'queue name'}) +snippet dele + ${1:obj}.delegate '${2:selector expression}', '${3:event name}', (${4:e}) -> + ${0:// event handler} +snippet deq + ${1:obj}.dequeue(${2:'queue name'}) +snippet deqq + $.dequeue('${1:selector expression}'${2:, 'queue name'}) +snippet detach + ${1:obj}.detach('${2:selector expression}') +snippet die + ${1:obj}.die(${2:event}, ${3:handler}) +snippet each + ${1:obj}.each (index) -> + ${0:this.innerHTML = this + " is the element, " + index + " is the position"} +snippet el + $('<${1}/>'${2:, {}}) +snippet eltrim + $.trim('${1:string}') +snippet empty + ${1:obj}.empty() +snippet end + ${1:obj}.end() +snippet eq + ${1:obj}.eq(${2:element index}) +snippet error + ${1:obj}.error (${2:e}) -> + ${0:// event handler} +snippet eventsmap + { + :f${0} + } +snippet extend + $.extend(${1:true, }${2:target}, ${3:obj}) +snippet fadein + ${1:obj}.fadeIn('${2:slow/400/fast}') +snippet fadeinc + ${1:obj}.fadeIn 'slow/400/fast', -> + ${0:// callback} +snippet fadeout + ${1:obj}.fadeOut('${2:slow/400/fast}') +snippet fadeoutc + ${1:obj}.fadeOut 'slow/400/fast', -> + ${0:// callback} +snippet fadeto + ${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5}) +snippet fadetoc + ${1:obj}.fadeTo 'slow/400/fast', ${2:0.5}, -> + ${0:// callback} +snippet filter + ${1:obj}.filter('${2:selector expression}') +snippet filtert + ${1:obj}.filter (${2:index}) -> + ${3} +snippet find + ${1:obj}.find('${2:selector expression}') +snippet focus + ${1:obj}.focus (${2:e}) -> + ${0:// event handler} +snippet focusin + ${1:obj}.focusIn (${2:e}) -> + ${0:// event handler} +snippet focusout + ${1:obj}.focusOut (${2:e}) -> + ${0:// event handler} +snippet get + ${1:obj}.get(${2:element index}) +snippet getjson + $.getJSON '${1:mydomain.com/url}', + ${2:{ param1: value1 },} + (data, textStatus, jqXHR) -> + ${0:// success callback} +snippet getscript + $.getScript '${1:mydomain.com/url}', (script, textStatus, jqXHR) -> + ${0:// callback} +snippet grep + $.grep(${1:array}, (item, index) > + ${2} + ${0:, true}) +snippet hasc + ${1:obj}.hasClass('${2:className}') +snippet hasd + $.hasData('${0:selector expression}') +snippet height + ${1:obj}.height(${2:integer}) +snippet hide + ${1:obj}.hide('${2:slow/400/fast}') +snippet hidec + ${1:obj}.hide '${2:slow/400/fast}', -> + ${0:// callback} +snippet hover + ${1:obj}.hover (${2:e}) -> + ${3:// event handler} + , ($2) -> + ${4:// event handler} +snippet html + ${1:obj}.html('${2:Some text and bold!}') +snippet inarr + $.inArray(${1:value}, ${0:array}) +snippet insa + ${1:obj}.insertAfter('${2:selector expression}') +snippet insb + ${1:obj}.insertBefore('${2:selector expression}') +snippet is + ${1:obj}.is('${2:selector expression}') +snippet isarr + $.isArray(${1:obj}) +snippet isempty + $.isEmptyObject(${1:obj}) +snippet isfunc + $.isFunction(${1:obj}) +snippet isnum + $.isNumeric(${1:value}) +snippet isobj + $.isPlainObject(${1:obj}) +snippet iswin + $.isWindow(${1:obj}) +snippet isxml + $.isXMLDoc(${1:node}) +snippet jj + $('${1:selector}') +snippet kdown + ${1:obj}.keydown (${2:e}) -> + ${0:// event handler} +snippet kpress + ${1:obj}.keypress (${2:e}) -> + ${0:// event handler} +snippet kup + ${1:obj}.keyup (${2:e}) -> + ${0:// event handler} +snippet last + ${1:obj}.last('${1:selector expression}') +snippet live + ${1:obj}.live '${2:events}', (${3:e}) -> + ${0:// event handler} +snippet load + ${1:obj}.load (${2:e}) -> + ${0:// event handler} +snippet loadf + ${1:obj}.load('${2:mydomain.com/url}', + ${2:{ param1: value1 },} + (responseText, textStatus, xhr) -> + ${0:// success callback} + }) +snippet makearray + $.makeArray(${0:obj}) +snippet map + ${1:obj}.map (${2:index}, ${3:element}) -> + ${0:// callback} +snippet mapp + $.map ${1:arrayOrObject}, (${2:value}, ${3:indexOrKey}) -> + ${0:// callback} +snippet merge + $.merge(${1:target}, ${0:original}) +snippet mdown + ${1:obj}.mousedown (${2:e}) -> + ${0:// event handler} +snippet menter + ${1:obj}.mouseenter (${2:e}) -> + ${0:// event handler} +snippet mleave + ${1:obj}.mouseleave (${2:e}) -> + ${0:// event handler} +snippet mmove + ${1:obj}.mousemove (${2:e}) -> + ${0:// event handler} +snippet mout + ${1:obj}.mouseout (${2:e}) -> + ${0:// event handler} +snippet mover + ${1:obj}.mouseover (${2:e}) -> + ${0:// event handler} +snippet mup + ${1:obj}.mouseup (${2:e}) -> + ${0:// event handler} +snippet next + ${1:obj}.next('${2:selector expression}') +snippet nexta + ${1:obj}.nextAll('${2:selector expression}') +snippet nextu + ${1:obj}.nextUntil('${2:selector expression}'${3:, 'filter expression'}) +snippet not + ${1:obj}.not('${2:selector expression}') +snippet off + ${1:obj}.off('${2:events}', '${3:selector expression}'${4:, handler}) +snippet offset + ${1:obj}.offset() +snippet offsetp + ${1:obj}.offsetParent() +snippet on + ${1:obj}.on '${2:events}', '${3:selector expression}', (${4:e}) -> + ${0:// event handler} +snippet one + ${1:obj}.one '${2:event name}', (${3:e}) -> + ${0:// event handler} +snippet outerh + ${1:obj}.outerHeight() +snippet outerw + ${1:obj}.outerWidth() +snippet param + $.param(${1:obj}) +snippet parent + ${1:obj}.parent('${2:selector expression}') +snippet parents + ${1:obj}.parents('${2:selector expression}') +snippet parentsu + ${1:obj}.parentsUntil('${2:selector expression}'${3:, 'filter expression'}) +snippet parsejson + $.parseJSON(${1:data}) +snippet parsexml + $.parseXML(${1:data}) +snippet pos + ${1:obj}.position() +snippet prepend + ${1:obj}.prepend('${2:Some text and bold!}') +snippet prependto + ${1:obj}.prependTo('${2:selector expression}') +snippet prev + ${1:obj}.prev('${2:selector expression}') +snippet preva + ${1:obj}.prevAll('${2:selector expression}') +snippet prevu + ${1:obj}.prevUntil('${2:selector expression}'${3:, 'filter expression'}) +snippet promise + ${1:obj}.promise(${2:'fx'}, ${3:target}) +snippet prop + ${1:obj}.prop('${2:property name}') +snippet proxy + $.proxy(${1:function}, ${2:this}) +snippet pushstack + ${1:obj}.pushStack(${2:elements}) +snippet queue + ${1:obj}.queue(${2:name}${3:, newQueue}) +snippet queuee + $.queue(${1:element}${2:, name}${3:, newQueue}) +snippet ready + $(() -> + ${0} + ) +snippet rem + ${1:obj}.remove() +snippet rema + ${1:obj}.removeAttr('${2:attribute name}') +snippet remc + ${1:obj}.removeClass('${2:class name}') +snippet remd + ${1:obj}.removeData('${2:key name}') +snippet remdd + $.removeData(${1:element}${2:, 'key name}') +snippet remp + ${1:obj}.removeProp('${2:property name}') +snippet repa + ${1:obj}.replaceAll(${2:target}) +snippet repw + ${1:obj}.replaceWith(${2:content}) +snippet reset + ${1:obj}.reset (${2:e}) -> + ${0:// event handler} +snippet resize + ${1:obj}.resize (${2:e}) -> + ${0:// event handler} +snippet scroll + ${1:obj}.scroll (${2:e}) -> + ${0:// event handler} +snippet scrolll + ${1:obj}.scrollLeft(${2:value}) +snippet scrollt + ${1:obj}.scrollTop(${2:value}) +snippet sdown + ${1:obj}.slideDown('${2:slow/400/fast}') +snippet sdownc + ${1:obj}.slideDown('${2:slow/400/fast}', -> + ${0:// callback} +snippet select + ${1:obj}.select (${2:e}) -> + ${0:// event handler} +snippet serialize + ${1:obj}.serialize() +snippet serializea + ${1:obj}.serializeArray() +snippet show + ${1:obj}.show('${2:slow/400/fast}') +snippet showc + ${1:obj}.show '${2:slow/400/fast}', -> + ${0:// callback} +snippet sib + ${1:obj}.siblings('${2:selector expression}') +snippet size + ${1:obj}.size() +snippet slice + ${1:obj}.slice(${2:start}${3:, end}) +snippet stoggle + ${1:obj}.slideToggle('${2:slow/400/fast}') +snippet stop + ${1:obj}.stop('${2:queue}', ${3:false}, ${4:false}) +snippet submit + ${1:obj}.submit (${2:e}) -> + ${0:// event handler} +snippet sup + ${1:obj}.slideUp('${2:slow/400/fast}') +snippet supc + ${1:obj}.slideUp '${2:slow/400/fast}', -> + ${0:// callback} +snippet text + ${1:obj}.text(${2:'some text'}) +snippet this + $(this) +snippet toarr + ${0:obj}.toArray() +snippet tog + ${1:obj}.toggle (${2:e}) -> + ${3:// event handler} + , ($2) -> + ${4:// event handler} + ${0} +snippet togclass + ${1:obj}.toggleClass('${2:class name}') +snippet togsh + ${1:obj}.toggle('${2:slow/400/fast}') +snippet trig + ${1:obj}.trigger('${2:event name}') +snippet trigh + ${1:obj}.triggerHandler('${2:event name}') +snippet $trim + $.trim(${1:str}) +snippet $type + $.type(${1:obj}) +snippet unbind + ${1:obj}.unbind('${2:event name}') +snippet undele + ${1:obj}.undelegate(${2:selector expression}, ${3:event}, ${4:handler}) +snippet uniq + $.unique(${1:array}) +snippet unload + ${1:obj}.unload (${2:e}) -> + ${0:// event handler} +snippet unwrap + ${1:obj}.unwrap() +snippet val + ${1:obj}.val('${2:text}') +snippet width + ${1:obj}.width(${2:integer}) +snippet wrap + ${1:obj}.wrap('${2:<div class="extra-wrapper"></div>}') diff --git a/sources_non_forked/vim-snippets/snippets/css.snippets b/sources_non_forked/vim-snippets/snippets/css.snippets index 8886643a..c4a74dec 100644 --- a/sources_non_forked/vim-snippets/snippets/css.snippets +++ b/sources_non_forked/vim-snippets/snippets/css.snippets @@ -965,3 +965,23 @@ snippet z:a z-index: auto; snippet zoo zoom: 1; +snippet :h + :hover +snippet :fc + :first-child +snippet :lc + :last-child +snippet :nc + :nth-child(${0}) +snippet :nlc + :nth-last-child(${0}) +snippet :oc + :only-child +snippet :a + :after +snippet :b + :before +snippet ::a + ::after +snippet ::b + ::before diff --git a/sources_non_forked/vim-snippets/snippets/django.snippets b/sources_non_forked/vim-snippets/snippets/django.snippets index cad80eb2..e2a8d6d0 100644 --- a/sources_non_forked/vim-snippets/snippets/django.snippets +++ b/sources_non_forked/vim-snippets/snippets/django.snippets @@ -10,6 +10,10 @@ snippet auto ${1:FIELDNAME} = models.AutoField(${0}) +snippet bigint + ${1:FIELDNAME} = models.BigIntegerField(${0}) +snippet binary + ${1:FIELDNAME} = models.BinaryField(${0}) snippet bool ${1:FIELDNAME} = models.BooleanField(${0:default=True}) snippet char @@ -80,7 +84,7 @@ snippet model def __unicode__(self): ${5} - def save(self, force_insert=False, force_update=False): + def save(self, *args, **kwargs): ${6} @models.permalink diff --git a/sources_non_forked/vim-snippets/snippets/elixir.snippets b/sources_non_forked/vim-snippets/snippets/elixir.snippets index 54aa180b..077cf031 100644 --- a/sources_non_forked/vim-snippets/snippets/elixir.snippets +++ b/sources_non_forked/vim-snippets/snippets/elixir.snippets @@ -6,119 +6,95 @@ snippet if if .. do .. end if ${1} do ${0} end - snippet if if .. do: .. if ${1:condition}, do: ${0} - snippet ife if .. do .. else .. end if ${1:condition} do ${2} else ${0} end - snippet ife if .. do: .. else: if ${1:condition}, do: ${2}, else: ${0} - snippet unless unless .. do .. end unless ${1} do ${0} end - snippet unless unless .. do: .. unless ${1:condition}, do: ${0} - snippet unlesse unless .. do .. else .. end unless ${1:condition} do ${2} else ${0} end - snippet unlesse unless .. do: .. else: unless ${1:condition}, do: ${2}, else: ${0} - snippet cond cond do ${1} -> ${0} end - snippet case case ${1} do ${2} -> ${0} end - +snippet df + def ${1:name}, do: ${2} snippet def def ${1:name} do ${0} end - snippet defim defimpl ${1:protocol_name}, for: ${2:data_type} do ${0} end - snippet defma defmacro ${1:name} do ${0} end - snippet defmo defmodule ${1:module_name} do ${0} end - snippet defp defp ${1:name} do ${0} end - snippet defpr defprotocol ${1:name}, [${0:function}] - snippet defr defrecord ${1:record_name}, ${0:fields} - snippet doc @doc """ ${0} """ - snippet fn fn(${1:args}) -> ${0} end - snippet fun - function do - ${0} - end - + function do + ${0} + end snippet mdoc @moduledoc """ ${0} """ - snippet rec receive do ${1} -> ${0} end - snippet req require ${0:module_name} - snippet imp import ${0:module_name} - snippet ali alias ${0:module_name} - snippet test test "${1:test_name}" do ${0} end - snippet try try .. rescue .. end try do ${1} diff --git a/sources_non_forked/vim-snippets/snippets/erlang.snippets b/sources_non_forked/vim-snippets/snippets/erlang.snippets index 88458703..2a0d1a4c 100644 --- a/sources_non_forked/vim-snippets/snippets/erlang.snippets +++ b/sources_non_forked/vim-snippets/snippets/erlang.snippets @@ -120,8 +120,12 @@ snippet gen_server ]). %% gen_server callbacks - -export([init/1, handle_call/3, handle_cast/2, handle_info/2, - terminate/2, code_change/3]). + -export([init/1, + handle_call/3, + handle_cast/2, + handle_info/2, + terminate/2, + code_change/3]). -define(SERVER, ?MODULE). @@ -157,6 +161,320 @@ snippet gen_server code_change(_OldVsn, State, _Extra) -> {ok, State}. + %%%=================================================================== + %%% Internal functions + %%%=================================================================== +# OTP gen_fsm +snippet gen_fsm + -module(${0:`vim_snippets#Filename('', 'my')`}). + + -behaviour(gen_fsm). + + %% API + -export([start_link/0]). + + %% gen_fsm callbacks + -export([init/1, + state_name/2, + state_name/3, + handle_event/3, + handle_sync_event/4, + handle_info/3, + terminate/3, + code_change/4]). + + -record(state, {}). + + %%%=================================================================== + %%% API + %%%=================================================================== + + %%-------------------------------------------------------------------- + %% @doc + %% Creates a gen_fsm process which calls Module:init/1 to + %% initialize. To ensure a synchronized start-up procedure, this + %% function does not return until Module:init/1 has returned. + %% + %% @spec start_link() -> {ok, Pid} | ignore | {error, Error} + %% @end + %%-------------------------------------------------------------------- + start_link() -> + gen_fsm:start_link({local, ?MODULE}, ?MODULE, [], []). + + %%%=================================================================== + %%% gen_fsm callbacks + %%%=================================================================== + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% Whenever a gen_fsm is started using gen_fsm:start/[3,4] or + %% gen_fsm:start_link/[3,4], this function is called by the new + %% process to initialize. + %% + %% @spec init(Args) -> {ok, StateName, State} | + %% {ok, StateName, State, Timeout} | + %% ignore | + %% {stop, StopReason} + %% @end + %%-------------------------------------------------------------------- + init([]) -> + {ok, state_name, #state{}}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% There should be one instance of this function for each possible + %% state name. Whenever a gen_fsm receives an event sent using + %% gen_fsm:send_event/2, the instance of this function with the same + %% name as the current state name StateName is called to handle + %% the event. It is also called if a timeout occurs. + %% + %% @spec state_name(Event, State) -> + %% {next_state, NextStateName, NextState} | + %% {next_state, NextStateName, NextState, Timeout} | + %% {stop, Reason, NewState} + %% @end + %%-------------------------------------------------------------------- + state_name(_Event, State) -> + {next_state, state_name, State}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% There should be one instance of this function for each possible + %% state name. Whenever a gen_fsm receives an event sent using + %% gen_fsm:sync_send_event/[2,3], the instance of this function with + %% the same name as the current state name StateName is called to + %% handle the event. + %% + %% @spec state_name(Event, From, State) -> + %% {next_state, NextStateName, NextState} | + %% {next_state, NextStateName, NextState, Timeout} | + %% {reply, Reply, NextStateName, NextState} | + %% {reply, Reply, NextStateName, NextState, Timeout} | + %% {stop, Reason, NewState} | + %% {stop, Reason, Reply, NewState} + %% @end + %%-------------------------------------------------------------------- + state_name(_Event, _From, State) -> + Reply = ok, + {reply, Reply, state_name, State}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% Whenever a gen_fsm receives an event sent using + %% gen_fsm:send_all_state_event/2, this function is called to handle + %% the event. + %% + %% @spec handle_event(Event, StateName, State) -> + %% {next_state, NextStateName, NextState} | + %% {next_state, NextStateName, NextState, Timeout} | + %% {stop, Reason, NewState} + %% @end + %%-------------------------------------------------------------------- + handle_event(_Event, StateName, State) -> + {next_state, StateName, State}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% Whenever a gen_fsm receives an event sent using + %% gen_fsm:sync_send_all_state_event/[2,3], this function is called + %% to handle the event. + %% + %% @spec handle_sync_event(Event, From, StateName, State) -> + %% {next_state, NextStateName, NextState} | + %% {next_state, NextStateName, NextState, Timeout} | + %% {reply, Reply, NextStateName, NextState} | + %% {reply, Reply, NextStateName, NextState, Timeout} | + %% {stop, Reason, NewState} | + %% {stop, Reason, Reply, NewState} + %% @end + %%-------------------------------------------------------------------- + handle_sync_event(_Event, _From, StateName, State) -> + Reply = ok, + {reply, Reply, StateName, State}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% This function is called by a gen_fsm when it receives any + %% message other than a synchronous or asynchronous event + %% (or a system message). + %% + %% @spec handle_info(Info,StateName,State)-> + %% {next_state, NextStateName, NextState} | + %% {next_state, NextStateName, NextState, Timeout} | + %% {stop, Reason, NewState} + %% @end + %%-------------------------------------------------------------------- + handle_info(_Info, StateName, State) -> + {next_state, StateName, State}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% This function is called by a gen_fsm when it is about to + %% terminate. It should be the opposite of Module:init/1 and do any + %% necessary cleaning up. When it returns, the gen_fsm terminates with + %% Reason. The return value is ignored. + %% + %% @spec terminate(Reason, StateName, State) -> void() + %% @end + %%-------------------------------------------------------------------- + terminate(_Reason, _StateName, _State) -> + ok. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% Convert process state when code is changed + %% + %% @spec code_change(OldVsn, StateName, State, Extra) -> + %% {ok, StateName, NewState} + %% @end + %%-------------------------------------------------------------------- + code_change(_OldVsn, StateName, State, _Extra) -> + {ok, StateName, State}. + + %%%=================================================================== + %%% Internal functions + %%%=================================================================== +# OTP gen_event +snippet gen_event + -module(${0:`vim_snippets#Filename('', 'my')`}). + + -behaviour(gen_event). + + %% API + -export([start_link/0, + add_handler/2]). + + %% gen_event callbacks + -export([init/1, + handle_event/2, + handle_call/2, + handle_info/2, + terminate/2, + code_change/3]). + + -record(state, {}). + + %%%=================================================================== + %%% gen_event callbacks + %%%=================================================================== + + %%-------------------------------------------------------------------- + %% @doc + %% Creates an event manager + %% + %% @spec start_link() -> {ok, Pid} | {error, Error} + %% @end + %%-------------------------------------------------------------------- + start_link() -> + gen_event:start_link({local, ?MODULE}). + + %%-------------------------------------------------------------------- + %% @doc + %% Adds an event handler + %% + %% @spec add_handler(Handler, Args) -> ok | {'EXIT', Reason} | term() + %% @end + %%-------------------------------------------------------------------- + add_handler(Handler, Args) -> + gen_event:add_handler(?MODULE, Handler, Args). + + %%%=================================================================== + %%% gen_event callbacks + %%%=================================================================== + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% Whenever a new event handler is added to an event manager, + %% this function is called to initialize the event handler. + %% + %% @spec init(Args) -> {ok, State} + %% @end + %%-------------------------------------------------------------------- + init([]) -> + {ok, #state{}}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% Whenever an event manager receives an event sent using + %% gen_event:notify/2 or gen_event:sync_notify/2, this function is + %% called for each installed event handler to handle the event. + %% + %% @spec handle_event(Event, State) -> + %% {ok, State} | + %% {swap_handler, Args1, State1, Mod2, Args2} | + %% remove_handler + %% @end + %%-------------------------------------------------------------------- + handle_event(_Event, State) -> + {ok, State}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% Whenever an event manager receives a request sent using + %% gen_event:call/3,4, this function is called for the specified + %% event handler to handle the request. + %% + %% @spec handle_call(Request, State) -> + %% {ok, Reply, State} | + %% {swap_handler, Reply, Args1, State1, Mod2, Args2} | + %% {remove_handler, Reply} + %% @end + %%-------------------------------------------------------------------- + handle_call(_Request, State) -> + Reply = ok, + {ok, Reply, State}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% This function is called for each installed event handler when + %% an event manager receives any other message than an event or a + %% synchronous request (or a system message). + %% + %% @spec handle_info(Info, State) -> + %% {ok, State} | + %% {swap_handler, Args1, State1, Mod2, Args2} | + %% remove_handler + %% @end + %%-------------------------------------------------------------------- + handle_info(_Info, State) -> + {ok, State}. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% Whenever an event handler is deleted from an event manager, this + %% function is called. It should be the opposite of Module:init/1 and + %% do any necessary cleaning up. + %% + %% @spec terminate(Reason, State) -> void() + %% @end + %%-------------------------------------------------------------------- + terminate(_Reason, _State) -> + ok. + + %%-------------------------------------------------------------------- + %% @private + %% @doc + %% Convert process state when code is changed + %% + %% @spec code_change(OldVsn, State, Extra) -> {ok, NewState} + %% @end + %%-------------------------------------------------------------------- + code_change(_OldVsn, State, _Extra) -> + {ok, State}. + %%%=================================================================== %%% Internal functions %%%=================================================================== diff --git a/sources_non_forked/vim-snippets/snippets/eruby.snippets b/sources_non_forked/vim-snippets/snippets/eruby.snippets index 95418350..bc13fcbb 100644 --- a/sources_non_forked/vim-snippets/snippets/eruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/eruby.snippets @@ -107,6 +107,8 @@ snippet ntc <%= number_to_currency(${1}) %> snippet ofcfs <%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${0:selected_value} %> +snippet ofs + <%= options_for_select ${1:collection}, ${2:value_method} %> snippet rf <%= render :file => "${1:file}"${0} %> snippet rt diff --git a/sources_non_forked/vim-snippets/snippets/go.snippets b/sources_non_forked/vim-snippets/snippets/go.snippets index 0239a3fb..8623eda2 100644 --- a/sources_non_forked/vim-snippets/snippets/go.snippets +++ b/sources_non_forked/vim-snippets/snippets/go.snippets @@ -230,3 +230,15 @@ snippet ga go func(${1} ${2:type}) { ${3:/* code */} }(${0}) +snippet test test function + func Test${1:name}(t *testing.T) { + ${2} + } + ${0} +snippet bench benchmark function + func Benchmark${1:name}(b *testing.B) { + for i := 0; i < b.N; i++ { + ${2} + } + } + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/haskell.snippets b/sources_non_forked/vim-snippets/snippets/haskell.snippets index f5f15984..ddb89d9a 100644 --- a/sources_non_forked/vim-snippets/snippets/haskell.snippets +++ b/sources_non_forked/vim-snippets/snippets/haskell.snippets @@ -1,5 +1,7 @@ snippet lang {-# LANGUAGE ${0:OverloadedStrings} #-} +snippet haddock + {-# OPTIONS_HADDOCK ${0:hide} #-} snippet info -- | -- Module : ${1:Module.Namespace} diff --git a/sources_non_forked/vim-snippets/snippets/html.snippets b/sources_non_forked/vim-snippets/snippets/html.snippets index f25e1bc7..3642bbca 100644 --- a/sources_non_forked/vim-snippets/snippets/html.snippets +++ b/sources_non_forked/vim-snippets/snippets/html.snippets @@ -47,6 +47,9 @@ snippet backspace # ⎋ snippet esc ⎋ +# comment +snippet // + ${0} # Generic Doctype snippet doctype HTML 4.01 Strict ${0:$1} snippet a:mail ${0:email me} +snippet ac + ${0:`@+`} snippet abbr ${0} snippet address @@ -361,15 +366,15 @@ snippet footer# ${0} snippet form -
    + ${0}
    snippet form. -
    + ${0}
    snippet form# -
    + ${0}
    snippet h1 @@ -449,7 +454,8 @@ snippet html5 - + + ${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:meta} @@ -749,15 +755,15 @@ snippet summary snippet sup ${0} snippet table - +
    ${0}
    snippet table. - +
    ${0}
    snippet table# - +
    ${0}
    snippet tbody diff --git a/sources_non_forked/vim-snippets/snippets/html_minimal.snippets b/sources_non_forked/vim-snippets/snippets/html_minimal.snippets deleted file mode 100644 index 43e5d4a4..00000000 --- a/sources_non_forked/vim-snippets/snippets/html_minimal.snippets +++ /dev/null @@ -1,72 +0,0 @@ -# file containing most useful mappings only -# when editing this file please be aware that there is ZenCoding and sparkup - -# html 5 is recommended from now on -snippet html5 - - - - - $2 - $3 - - - $4 - - - -# ==== TAGS -# you always need these: -snippet . - class="${1}" -snippet n - name="${1}" -snippet r - rel="${1}" -snippet t - title="${1}" - -# not using # because id is faster to type -snippet id - id="${1}" -snippet idn - id="${1}" name="${0:$1}" - -snippet label_and_input - - - - -# FORMS -# use idn . or n to add id -snippet input - -snippet submit - -snippet textarea - - -# if you need id or class use snippets above -snippet form -
    - $3 -
    - -# other tags -snippet br -
    -snippet a - $3 -snippet img - $2 -# JS/CSS -snippet css_file - -snippet css_block - -snippet script_block - -snippet script_file - diff --git a/sources_non_forked/vim-snippets/snippets/jade.snippets b/sources_non_forked/vim-snippets/snippets/jade.snippets new file mode 100644 index 00000000..55f0af7b --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/jade.snippets @@ -0,0 +1,18 @@ +# Angular HTML +snippet rep + div(ng-repeat='${1} in ${2}') + +snippet repf + div(ng-repeat='${1} in ${2}' | ${3}) + +snippet repi + div(ng-repeat='${1} in ${2}' track by $index) + +snippet hide + div(ng-hide='${1}') + +snippet show + div(ng-show='${1}') + +snippet if + div(ng-if='${1}') diff --git a/sources_non_forked/vim-snippets/snippets/java.snippets b/sources_non_forked/vim-snippets/snippets/java.snippets index 1595ffc1..ea2ec7aa 100644 --- a/sources_non_forked/vim-snippets/snippets/java.snippets +++ b/sources_non_forked/vim-snippets/snippets/java.snippets @@ -1,10 +1,10 @@ ## Access Modifiers snippet po - protected + protected ${0} snippet pu - public + public ${0} snippet pr - private + private ${0} ## ## Annotations snippet before @@ -25,7 +25,7 @@ snippet oo ## ## Basic Java packages and import snippet im - import + import ${0} snippet j.b java.beans. snippet j.i @@ -39,17 +39,17 @@ snippet j.u ## ## Class snippet cl - class ${1:`vim_snippets#Filename("", "untitled")`} ${0} + class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0} snippet in - interface ${1:`vim_snippets#Filename("", "untitled")`} ${2:extends Parent} + interface ${1:`vim_snippets#Filename("$1", "untitled")`} ${2:extends Parent} snippet tc - public class ${1:`vim_snippets#Filename()`} extends ${0:TestCase} + public class ${1:`vim_snippets#Filename("$1")`} extends ${0:TestCase} ## ## Class Enhancements snippet ext - extends + extends ${0} snippet imp - implements + implements ${0} ## ## Comments snippet /* @@ -89,15 +89,40 @@ snippet m snippet v ${1:String} ${2:var}${3: = null}${4}; ## +## Declaration for ArrayList +snippet d.al + List<${1:Object}> ${2:list} = new ArrayList<$1>();${0} +## Declaration for HashMap +snippet d.hm + Map<${1:Object}, ${2:Object}> ${3:map} = new HashMap<$1, $2>();${0} +## Declaration for HashSet +snippet d.hs + Set<${1:Object}> ${2:set} = new HashSet<$1>();${0} +## Declaration for Stack +snippet d.st + Stack<${1:Object}> ${2:stack} = new Stack<$1>();${0} +## +## Singleton Pattern +snippet singlet + private static class Holder { + private static final ${1:`vim_snippets#Filename("$1")`} INSTANCE = new $1(); + } + + private $1() { } + + public static $1 getInstance() { + return Holder.INSTANCE; + } +## ## Enhancements to Methods, variables, classes, etc. snippet ab - abstract + abstract ${0} snippet fi - final + final ${0} snippet st - static + static ${0} snippet sy - synchronized + synchronized ${0} ## ## Error Methods snippet err @@ -110,12 +135,30 @@ snippet errln ## Exception Handling snippet as assert ${1:test} : "${2:Failure message}"; +snippet ae + assertEquals("${1:Failure message}", ${2:expected}, ${3:actual}); +snippet aae + assertArrayEquals("${1:Failure message}", ${2:expecteds}, ${3:actuals}); +snippet af + assertFalse("${1:Failure message}", ${2:condition}); +snippet at + assertTrue("${1:Failure message}", ${2:condition}); +snippet an + assertNull("${1:Failure message}", ${2:object}); +snippet ann + assertNotNull("${1:Failure message}", ${2:object}); +snippet ass + assertSame("${1:Failure message}", ${2:expected}, ${3:actual}); +snippet asns + assertNotSame("${1:Failure message}", ${2:expected}, ${3:actual}); +snippet fa + fail("${1:Failure message}"); snippet ca catch(${1:Exception} ${2:e}) ${0} snippet thr - throw + throw ${0} snippet ths - throws + throws ${0} snippet try try { ${0} @@ -144,7 +187,7 @@ snippet @au snippet @br @brief ${0:Description} snippet @fi - @file ${0:`vim_snippets#Filename()`}.java + @file ${0:`vim_snippets#Filename("$1")`}.java snippet @pa @param ${0:param} snippet @re @@ -206,7 +249,7 @@ snippet get ## ## Terminate Methods or Loops snippet re - return + return ${0} snippet br break; ## diff --git a/sources_non_forked/vim-snippets/snippets/javascript-jquery.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript-jquery.snippets similarity index 100% rename from sources_non_forked/vim-snippets/snippets/javascript-jquery.snippets rename to sources_non_forked/vim-snippets/snippets/javascript/javascript-jquery.snippets diff --git a/sources_non_forked/vim-snippets/snippets/javascript.d3.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.d3.snippets similarity index 100% rename from sources_non_forked/vim-snippets/snippets/javascript.d3.snippets rename to sources_non_forked/vim-snippets/snippets/javascript/javascript.d3.snippets diff --git a/sources_non_forked/vim-snippets/snippets/javascript.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets similarity index 98% rename from sources_non_forked/vim-snippets/snippets/javascript.snippets rename to sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets index 0a046dbf..d20d7136 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets @@ -13,7 +13,7 @@ snippet fun snippet f function (${1}) { ${0} - }${2:;} + } # Immediate function snippet (f (function (${1}) { @@ -94,6 +94,9 @@ snippet gett # console.log (Firebug) snippet cl console.log(${0}); +# console.debug (Firebug) +snippet cd + console.debug(${0}); # return snippet ret return ${0:result} diff --git a/sources_non_forked/vim-snippets/snippets/javascript_jquery.snippets b/sources_non_forked/vim-snippets/snippets/javascript_jquery.snippets deleted file mode 100644 index 9b4966db..00000000 --- a/sources_non_forked/vim-snippets/snippets/javascript_jquery.snippets +++ /dev/null @@ -1 +0,0 @@ -javascript-jquery.snippets \ No newline at end of file diff --git a/sources_non_forked/vim-snippets/snippets/julia.snippets b/sources_non_forked/vim-snippets/snippets/julia.snippets new file mode 100644 index 00000000..1876ed84 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/julia.snippets @@ -0,0 +1,102 @@ +snippet #! + #!/usr/bin/env julia + +# Functions +snippet fun function definition + function ${1}(${2}) + ${0} + end + +snippet ret return + return(${0}) + +# Printing to console +snippet pr print + print("${1}") + ${0} + +snippet prl print line + println("${1}") + ${0} + +# Includes +snippet use load a package + using ${0} + +snippet incl include source code + include("${1}") + ${0} + +# Loops +snippet forc for loop iterating over iterable container + for ${1} in ${2} + ${0} + end + +snippet for standard for loop + for ${1} = ${2} + ${0} + end + +snippet fornest nested for loop + for ${1} = ${2}, ${3} = ${4} + ${0} + end + +snippet wh while loop + while ${1} ${2:<=} ${3} + ${0} + end + +# Conditionals +snippet if if statement + if ${1} + ${0} + end + +snippet el else part of statement + else + ${0} + +snippet eif else if part of if statement + else if ${1} + ${0} + +snippet ife full if-else statement + if ${1} + ${2} + else + ${0} + end + +snippet tern ternary operator + ${1} ? ${2} : ${3:nothing} + +# Exceptions +snippet try try catch + try + ${1} + catch ${2} + ${0} + end + +snippet fin finally statement + finally + ${0} + +snippet thr throw + throw(${1}) + ${0} + +# Messages +snippet in + info("${1}") + ${0} + +snippet wa + warn("${1}") + ${0} + +snippet err + error("${1}") + ${0} diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index 1793d41c..831d53db 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -40,7 +40,7 @@ snippet i snippet t. $this-> snippet f - function ${1:foo}(${2:array }${3:$bar}) + function ${1}(${3}) { ${0} } @@ -557,3 +557,44 @@ snippet CSVIterator snippet is isset($1{VISUAL}) + +# phpunit +snippet ase + $this->assertEquals(${1:expected}, ${2:actual}); + +snippet asne + $this->assertNotEquals(${1:expected}, ${2:actual}); + +snippet asf + $this->assertFalse(${1:Something}); + +snippet ast + $this->assertTrue(${1:Something}); + +snippet asfex + $this->assertFileExists(${1:path/to/file}); + +snippet asfnex + $this->assertFileNotExists(${1:path/to/file}); + +snippet ascon + $this->assertContains(${1:Search Value}, ${2:Array or Iterator}); + +snippet ashk + $this->assertArrayHasKey(${1:key}, ${2:array}); + +snippet asnhk + this->assertArrayNotHasKey(${1:value}, ${2:array}); + +snippet ascha + $this->assertClassHasAttribute('${1:Attribute Name}', '${2:ClassName}'); + +snippet asi + $this->assertInstanceOf(${1:expected}, ${2:actual}); + +snippet tc + public function test${1:name_of_the_test}() + { + ${0:code} + } + diff --git a/sources_non_forked/vim-snippets/snippets/puppet.snippets b/sources_non_forked/vim-snippets/snippets/puppet.snippets index d35608dd..a4fdf19f 100644 --- a/sources_non_forked/vim-snippets/snippets/puppet.snippets +++ b/sources_non_forked/vim-snippets/snippets/puppet.snippets @@ -90,7 +90,7 @@ snippet class ${0} } snippet node - node "${1:`vim_snippets#Filename('', 'fqdn')`}" { + node '${1:`vim_snippets#Filename('', 'fqdn')`}' { ${0} } snippet case @@ -122,99 +122,99 @@ snippet [ snippet > ${1} => ${0} snippet p: - "puppet://puppet/${1:module name}/${0:file name}" + 'puppet://puppet/${1:module name}/${0:file name}' # # Functions snippet alert - alert("${1:message}") + alert('${1:message}') snippet crit - crit("${1:message}") + crit('${1:message}') snippet debug - debug("${1:message}") + debug('${1:message}') snippet defined - defined(${1:Resource}["${2:name}"]) + defined(${1:Resource}['${2:name}']) snippet emerg - emerg("${1:message}") + emerg('${1:message}') snippet extlookup Simple extlookup - extlookup("${1:variable}") + extlookup('${1:variable}') snippet extlookup Extlookup with defaults - extlookup("${1:variable}", "${2:default}") + extlookup('${1:variable}', '${2:default}') snippet extlookup Extlookup with defaults and custom data file - extlookup("${1:variable}", "${2:default}", "${3:data source}") + extlookup('${1:variable}', '${2:default}', '${3:data source}') snippet fail - fail("${1:message}") + fail('${1:message}') snippet info - info("${1:message}") + info('${1:message}') snippet inline_template - inline_template("<%= ${1} %>") + inline_template('<%= ${1} %>') snippet notice - notice("${1:message}") + notice('${1:message}') snippet realize realize(${1:Resource}[${2:name}]) snippet regsubst - regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}") + regsubst(${1:hay stack}, ${2:needle}, '${3:replacement}') snippet inc include ${1:classname} snippet split - split(${1:hay stack}, "${2:patten}") + split(${1:hay stack}, '${2:patten}') snippet versioncmp - versioncmp("${1:version}", "${2:version}") + versioncmp('${1:version}', '${2:version}') snippet warning - warning("${1:message}") + warning('${1:message}') # # Types snippet cron - cron{ "${1:name}": - command => "${2}", - user => "${3:root}", - ${4} => ${0} + cron { '${1:name}': + command => '${2}', + user => '${3:root}', + ${4} => ${0}, } snippet exec - exec{ "${1:name}": - command => "${2:$1}", - user => "${3:root}", - ${4} => ${0} + exec { '${1:name}': + command => '${2:$1}', + user => '${3:root}', + ${4} => ${0}, } snippet user - user{ "${1:user}": - comment => "${2:$1}", - ensure => present, - managehome => true, - home => "${0:/home/$1}" + user { '${1:user}': + ensure => present, + comment => '${2:$1}', + managehome => true, + home => '${0:/home/$1}', } snippet group - group{ "${1:group}": - ensure => ${0:present} + group { '${1:group}': + ensure => ${0:present}, } snippet host - host{ "${1:hostname}": - ip => ${0:127.0.0.1} + host { '${1:hostname}': + ip => ${0:127.0.0.1}, } snippet mailalias - mailalias{ "${1:localpart}": - recipient => "${0:recipient}" + mailalias { '${1:localpart}': + recipient => '${0:recipient}', } snippet mount - mount{ "${1:destination path}": + mount { '${1:destination path}': ensure => ${2:mounted}, - device => "${0:device name or path}" + device => '${0:device name or path}', } snippet package - package{ "${1:package name}": - ensure => ${0:present} + package { '${1:package name}': + ensure => ${0:present}, } snippet yumrepo - yumrepo{ "${1:repo name}": - descr => "${2:$1}", - enabled => ${0:1} + yumrepo { '${1:repo name}': + Descr => '${2:$1}', + enabled => ${0:1}, } snippet define @@ -223,14 +223,22 @@ snippet define } snippet service - service{ "${1:service}": - enable => ${2:true}, - ensure => ${0:running}, - hasstatus => true, + service { '${1:service}' : + ensure => running, + enable => true, + require => [ Package['${2:package}'], File['${3:file}'], ], + subscribe => [ File['${4:configfile1}'], File['${5:configfile2}'], Package['${6:package}'], ], } snippet file - file{ "${1:path}": - ${2} => ${0} + file { '${1:filename}' : + ensure => ${2:present}, + owner => '${3:root}', + group => '${4:root}', + mode => '${5:0644}', + source => 'puppet:///modules/${6:module}/${7:source}', + content => template('/etc/puppet/templates/${8:template}'), + alias => '${9:alias}', + require => [ Package['${10:package}'], File['${11:file}'], ], } diff --git a/sources_non_forked/vim-snippets/snippets/python.snippets b/sources_non_forked/vim-snippets/snippets/python.snippets index d38df5b1..c221f466 100644 --- a/sources_non_forked/vim-snippets/snippets/python.snippets +++ b/sources_non_forked/vim-snippets/snippets/python.snippets @@ -1,5 +1,6 @@ snippet #! #!/usr/bin/env python + # -*- coding: utf-8 -*- snippet imp import ${0:module} snippet uni @@ -200,3 +201,10 @@ snippet epydoc @raise e: ${0: Description} """ +snippet dol + def ${1:__init__}(self, *args, **kwargs): + super(${0:ClassName}, self).$1(*args, **kwargs) +snippet kwg + self.${1:var_name} = kwargs.get('$1', ${2:None}) +snippet lkwg + ${1:var_name} = kwargs.get('$1', ${2:None}) diff --git a/sources_non_forked/vim-snippets/snippets/r.snippets b/sources_non_forked/vim-snippets/snippets/r.snippets index c7ca5aca..7bdeeec0 100644 --- a/sources_non_forked/vim-snippets/snippets/r.snippets +++ b/sources_non_forked/vim-snippets/snippets/r.snippets @@ -23,9 +23,19 @@ snippet ei ${0} } +# loops +snippet wh + while(${1}) { + ${2} + } +snippet for + for (${1:item} in ${2:list}) { + ${3} + } + # functions snippet fun - ${1:name} = function (${2:variables}) { + ${1:name} <- function (${2:variables}) { ${0} } snippet ret @@ -39,7 +49,7 @@ snippet c snippet li list(${0:items}) snippet mat - matrix(${1:data}, nrow=${2:rows}, ncol=${0:cols}) + matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols}) # apply functions snippet apply @@ -100,7 +110,7 @@ snippet pl snippet ggp ggplot(${1:data}, aes(${0:aesthetics})) snippet img - ${1:(jpeg,bmp,png,tiff)}(filename="${2:filename}", width=${3}, height=${4}, unit="${5}") + ${1:(jpeg,bmp,png,tiff)}(filename = '${2:filename}', width = ${3}, height = ${4}, unit = '${5}') ${0:plot} dev.off() diff --git a/sources_non_forked/vim-snippets/snippets/rails.snippets b/sources_non_forked/vim-snippets/snippets/rails.snippets new file mode 100644 index 00000000..d8fe2be2 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/rails.snippets @@ -0,0 +1,484 @@ +snippet art + assert_redirected_to ${1:action}: '${2:index}' +snippet artnp + assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1}, ${0:@$2}) +snippet artnpp + assert_redirected_to ${1:parent}_${2:child}_path(${0:@$1}) +snippet artp + assert_redirected_to ${1:model}_path(${0:@$1}) +snippet artpp + assert_redirected_to ${0:model}s_path +snippet asd + assert_difference '${1:Model}.${2:count}', ${3:1} do + ${0} + end +snippet asnd + assert_no_difference '${1:Model}.${2:count}' do + ${0} + end +snippet asre + assert_response :${1:success}, @response.body +snippet asrj + assert_rjs :${1:replace}, '${0:dom id}' +snippet ass assert_select(..) + assert_select '${1:path}', ${2:text}: '${3:inner_html}' ${4:do} + ${0} + end +snippet ba + before_action :${0:method} +snippet bf + before_filter :${0:method} +snippet bt + belongs_to :${0:association} +snippet btp + belongs_to :${1:association}, polymorphic: true +snippet crw + cattr_accessor :${0:attr_names} +snippet defcreate + def create + @${1:model_class_name} = ${2:ModelClassName}.new(params[:$1]) + + respond_to do |format| + if @$1.save + flash[:notice] = '$2 was successfully created.' + format.html { redirect_to(@$1) } + format.xml { render xml: @$1, status: :created, location: @$1 } + else + format.html { render action: 'new' } + format.xml { render xml: @$1.errors, status: :unprocessable_entity } + end + end + end +snippet defdestroy + def destroy + @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) + @$1.destroy + + respond_to do |format| + format.html { redirect_to($1s_url) } + format.xml { head :ok } + end + end +snippet defedit + def edit + @${1:model_class_name} = ${0:ModelClassName}.find(params[:id]) + end +snippet defindex + def index + @${1:model_class_name} = ${2:ModelClassName}.all + + respond_to do |format| + format.html # index.html.erb + format.xml { render xml: @$1s } + end + end +snippet defnew + def new + @${1:model_class_name} = ${2:ModelClassName}.new + + respond_to do |format| + format.html # new.html.erb + format.xml { render xml: @$1 } + end + end +snippet defshow + def show + @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.xml { render xml: @$1 } + end + end +snippet defupdate + def update + @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) + + respond_to do |format| + if @$1.update_attributes(params[:$1]) + flash[:notice] = '$2 was successfully updated.' + format.html { redirect_to(@$1) } + format.xml { head :ok } + else + format.html { render action: 'edit' } + format.xml { render xml: @$1.errors, status: :unprocessable_entity } + end + end + end +snippet dele delegate .. to + delegate :${1:methods}, to: :${0:object} +snippet dele delegate .. to .. prefix .. allow_nil + delegate :${1:methods}, to: :${2:object}, prefix: :${3:prefix}, allow_nil: ${0:allow_nil} +snippet flash + flash[:${1:notice}] = '${0}' +snippet habtm + has_and_belongs_to_many :${1:object}, join_table: '${2:table_name}', foreign_key: '${3}_id' +snippet hm + has_many :${0:object} +snippet hmd + has_many :${1:other}s, class_name: '${2:$1}', foreign_key: '${3:$1}_id', dependent: :destroy +snippet hmt + has_many :${1:object}, through: :${0:object} +snippet ho + has_one :${0:object} +snippet hod + has_one :${1:object}, dependent: :${0:destroy} +snippet i18 + I18n.t('${1:type.key}') +snippet ist + <%= image_submit_tag('${1:agree.png}', id: '${2:id}'${0}) %> +snippet log + Rails.logger.${1:debug} ${0} +snippet log2 + RAILS_DEFAULT_LOGGER.${1:debug} ${0} +snippet logd + logger.debug { '${1:message}' } +snippet loge + logger.error { '${1:message}' } +snippet logf + logger.fatal { '${1:message}' } +snippet logi + logger.info { '${1:message}' } +snippet logw + logger.warn { '${1:message}' } +snippet mapc + ${1:map}.${2:connect} '${0:controller/:action/:id}' +snippet mapca + ${1:map}.catch_all '*${2:anything}', controller: '${3:default}', action: '${4:error}' +snippet mapr + ${1:map}.resource :${0:resource} +snippet maprs + ${1:map}.resources :${0:resource} +snippet mapwo + ${1:map}.with_options ${2:controller}: '${3:thing}' do |$3| + ${0} + end + +############################### +# model callback snippets # +############################### + +# before callback +snippet mbv + before_validation :${0:method} +snippet mbc + before_create :${0:method} +snippet mbu + before_update :${0:method} +snippet mbs + before_save :${0:method} +snippet mbd + before_destroy :${0:method} + +# after callback +snippet mav + after_validation :${0:method} +snippet maf + after_find :${0:method} +snippet mat + after_touch :${0:method} +snippet macr + after_create :${0:method} +snippet mau + after_update :${0:method} +snippet mas + after_save :${0:method} +snippet mad + after_destroy :${0:method} + +# around callback +snippet marc + around_create :${0:method} +snippet maru + around_update :${0:method} +snippet mars + around_save :${0:method} +snippet mard + around_destroy :${0:method} + +snippet mcht + change_table :${1:table_name} do |t| + ${0} + end +snippet mp + map(&:${0:id}) +snippet mrw + mattr_accessor :${0:attr_names} +snippet oa + order('${0:field}') +snippet od + order('${0:field} DESC') +snippet pa + params[:${1:id}] +snippet ra + render action: '${0:action}' +snippet ral + render action: '${1:action}', layout: '${0:layoutname}' +snippet rest + respond_to do |format| + format.${1:html} { ${0} } + end +snippet rf + render file: '${0:filepath}' +snippet rfu + render file: '${1:filepath}', use_full_path: ${0:false} +snippet ri + render inline: "${0:<%= 'hello' %>}" +snippet ril + render inline: "${1:<%= 'hello' %>}", locals: { ${2:name}: '${3:value}'${0} } +snippet rit + render inline: "${1:<%= 'hello' %>}", type: ${0::rxml} +snippet rjson + render json: '${0:text to render}' +snippet rl + render layout: '${0:layoutname}' +snippet rn + render nothing: ${0:true} +snippet rns + render nothing: ${1:true}, status: ${0:401} +snippet rp + render partial: '${0:item}' +snippet rpc + render partial: '${1:item}', collection: ${0:@$1s} +snippet rpl + render partial: '${1:item}', locals: { ${2:$1}: ${0:@$1} } +snippet rpo + render partial: '${1:item}', object: ${0:@$1} +snippet rps + render partial: '${1:item}', status: ${0:500} +snippet rt + render text: '${0:text to render}' +snippet rtl + render text: '${1:text to render}', layout: '${0:layoutname}' +snippet rtlt + render text: '${1:text to render}', layout: ${0:true} +snippet rts + render text: '${1:text to render}', status: ${0:401} +snippet ru + render :update do |${1:page}| + $1.${0} + end +snippet rxml + render xml: '${0:text to render}' +snippet sc + scope :${1:name}, -> { where(${2:field}: ${0:value}) } +snippet sl + scope :${1:name}, lambda do |${2:value}| + where('${3:field = ?}', ${0:value}) + end +snippet sha1 + Digest::SHA1.hexdigest(${0:string}) +snippet sweeper + class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper + observe $1 + + def after_save(${0:model_class_name}) + expire_cache($2) + end + + def after_destroy($2) + expire_cache($2) + end + + def expire_cache($2) + expire_page + end + end +snippet va validates_associated + validates_associated :${0:attribute} +snippet va validates .., acceptance: true + validates :${0:terms}, acceptance: true +snippet vc + validates :${0:attribute}, confirmation: true +snippet ve + validates :${1:attribute}, exclusion: { in: ${0:%w( mov avi )} } +snippet vf + validates :${1:attribute}, format: { with: /${0:regex}/ } +snippet vi + validates :${1:attribute}, inclusion: { in: %w(${0: mov avi }) } +snippet vl + validates :${1:attribute}, length: { in: ${2:3}..${0:20} } +snippet vn + validates :${0:attribute}, numericality: true +snippet vp + validates :${0:attribute}, presence: true +snippet vu + validates :${0:attribute}, uniqueness: true +snippet format + format.${1:js|xml|html} { ${0} } +snippet wc + where(${1:'conditions'}${0:, bind_var}) +snippet wf + where(${1:field}: ${0:value}) +snippet xdelete + xhr :delete, :${1:destroy}, id: ${2:1} +snippet xget + xhr :get, :${1:show}, id: ${2:1} +snippet xpost + xhr :post, :${1:create}, ${2:object}: ${3:object} +snippet xput + xhr :put, :${1:update}, id: ${2:1}, ${3:object}: ${4:object} +snippet test + test 'should ${1:do something}' do + ${0} + end +########################### +# migrations snippets # +########################### +snippet mac + add_column :${1:table_name}, :${2:column_name}, :${0:data_type} +snippet mai + add_index :${1:table_name}, :${0:column_name} +snippet mrc + remove_column :${1:table_name}, :${0:column_name} +snippet mrnc + rename_column :${1:table_name}, :${2:old_column_name}, :${0:new_column_name} +snippet mcc + change_column :${1:table}, :${2:column}, :${0:type} +snippet mnc + t.${1:string} :${2:title}${3:, null: false} +snippet mct + create_table :${1:table_name} do |t| + ${0} + end +snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end + class ${1:class_name} < ActiveRecord::Migration + def up + ${0} + end + + def down + end + end +snippet migration class .. < ActiveRecord::Migration .. def change .. end + class ${1:class_name} < ActiveRecord::Migration + def change + ${0} + end + end +snippet trc + t.remove :${0:column} +snippet tre + t.rename :${1:old_column_name}, :${2:new_column_name} + ${0} +snippet tref + t.references :${0:model} +snippet tcb + t.boolean :${1:title} + ${0} +snippet tcbi + t.binary :${1:title}, limit: ${2:2}.megabytes + ${0} +snippet tcd + t.decimal :${1:title}, precision: ${2:10}, scale: ${3:2} + ${0} +snippet tcda + t.date :${1:title} + ${0} +snippet tcdt + t.datetime :${1:title} + ${0} +snippet tcf + t.float :${1:title} + ${0} +snippet tch + t.change :${1:name}, :${2:string}, ${3:limit}: ${4:80} + ${0} +snippet tci + t.integer :${1:title} + ${0} +snippet tcl + t.integer :lock_version, null: false, default: 0 + ${0} +snippet tcr + t.references :${1:taggable}, polymorphic: { default: '${2:Photo}' } + ${0} +snippet tcs + t.string :${1:title} + ${0} +snippet tct + t.text :${1:title} + ${0} +snippet tcti + t.time :${1:title} + ${0} +snippet tcts + t.timestamp :${1:title} + ${0} +snippet tctss + t.timestamps + ${0} +########################## +# Rspec snippets # +########################## +#ShouldaMatchers#ActionController +snippet isfp + it { should filter_param :${0:key} } +snippet isrt + it { should redirect_to ${0:url} } +snippet isrtp + it { should render_template ${0} } +snippet isrwl + it { should render_with_layout ${0} } +snippet isrf + it { should rescue_from ${0:exception} } +snippet isrw + it { should respond_with ${0:status} } +snippet isr + it { should route(:${1:method}, '${0:path}') } +snippet isss + it { should set_session :${0:key} } +snippet issf + it { should set_the_flash('${0}') } +#ShouldaMatchers#ActiveModel +snippet isama + it { should allow_mass_assignment_of :${0} } +snippet isav + it { should allow_value(${1}).for :${0} } +snippet isee + it { should ensure_exclusion_of :${0} } +snippet isei + it { should ensure_inclusion_of :${0} } +snippet isel + it { should ensure_length_of :${0} } +snippet isva + it { should validate_acceptance_of :${0} } +snippet isvc + it { should validate_confirmation_of :${0} } +snippet isvn + it { should validate_numericality_of :${0} } +snippet isvp + it { should validate_presence_of :${0} } +snippet isvu + it { should validate_uniqueness_of :${0} } +#ShouldaMatchers#ActiveRecord +snippet isana + it { should accept_nested_attributes_for :${0} } +snippet isbt + it { should belong_to :${0} } +snippet isbtcc + it { should belong_to(:${1}).counter_cache ${0:true} } +snippet ishbtm + it { should have_and_belong_to_many :${0} } +snippet isbv + it { should be_valid } +snippet ishc + it { should have_db_column :${0} } +snippet ishi + it { should have_db_index :${0} } +snippet ishm + it { should have_many :${0} } +snippet ishmt + it { should have_many(:${1}).through :${0} } +snippet isho + it { should have_one :${0} } +snippet ishro + it { should have_readonly_attribute :${0} } +snippet iss + it { should serialize :${0} } +snippet isres + it { should respond_to :${0} } +snippet isresw + it { should respond_to(:${1}).with(${0}).arguments } +snippet super_call + ${1:super_class}.instance_method(:${0:method}).bind(self).call diff --git a/sources_non_forked/vim-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets index 278c3615..fd4172c1 100644 --- a/sources_non_forked/vim-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -1,7 +1,3 @@ -######################################## -# Ruby snippets - for Rails, see below # -######################################## - # encoding for Ruby 1.9 snippet enc # encoding: utf-8 @@ -35,9 +31,9 @@ snippet beg end snippet req require - require "${1}" + require '${1}' snippet reqr - require_relative "${1}" + require_relative '${1}' snippet # # => snippet end @@ -61,7 +57,7 @@ snippet deft snippet descendants class Class def descendants - ObjectSpace.each_object(::Class).select {|klass| klass < self } + ObjectSpace.each_object(::Class).select { |klass| klass < self } end end snippet if @@ -174,7 +170,7 @@ snippet ana accepts_nested_attributes_for :${0:association} # ivc == instance variable cache snippet ivc - @${1:variable_name} ||= ${0:chached_value} + @${1:variable_name} ||= ${0:cached_value} # include Enumerable snippet Enum include Enumerable @@ -232,13 +228,13 @@ snippet array snippet hash Hash.new { |${1:hash}, ${2:key}| $1[$2] = ${0} } snippet file File.foreach() { |line| .. } - File.foreach(${1:"path/to/file"}) { |${2:line}| ${0} } + File.foreach(${1:'path/to/file'}) { |${2:line}| ${0} } snippet file File.read() - File.read(${1:"path/to/file"}) + File.read(${1:'path/to/file'}) snippet Dir Dir.global() { |file| .. } - Dir.glob(${1:"dir/glob/*"}) { |${2:file}| ${0} } + Dir.glob(${1:'dir/glob/*'}) { |${2:file}| ${0} } snippet Dir Dir[".."] - Dir[${1:"glob/**/*.rb"}] + Dir[${1:'glob/**/*.rb'}] snippet dir Filename.dirname(__FILE__) snippet deli @@ -247,7 +243,7 @@ snippet fil fill(${1:range}) { |${2:i}| ${0} } # flatten_once() snippet flao - inject(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2)} + reduce(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2) } snippet zip zip(${1:enums}) { |${2:row}| ${0} } # downto(0) { |n| .. } @@ -419,6 +415,10 @@ snippet seld end snippet lam lambda { |${1:args}| ${0} } +snippet -> + -> { ${0} } +snippet ->a + ->(${1:args}) { ${0} } # I'm pretty sure that ruby users expect do to expand to do .. end snippet do do @@ -432,12 +432,12 @@ snippet dov ${2} end snippet : - :${1:key} => ${2:"value"} + ${1:key}: ${2:'value'} snippet ope - open(${1:"path/or/url/or/pipe"}, "${2:w}") { |${3:io}| ${0} } + open('${1:path/or/url/or/pipe}', '${2:w}') { |${3:io}| ${0} } # path_from_here() snippet fpath - File.join(File.dirname(__FILE__), *%2[${1:rel path here}]) + File.join(File.dirname(__FILE__), *['${1:rel path here}']) # unix_filter {} snippet unif ARGF.each_line${1} do |${2:line}| @@ -445,21 +445,21 @@ snippet unif end # option_parse {} snippet optp - require "optparse" + require 'optparse' - options = {${0:default => "args"}} + options = { ${0:default: 'args'} } ARGV.options do |opts| - opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} + opts.banner = "Usage: #{File.basename($PROGRAM_NAME)}" + end snippet opt - opts.on( "-${1:o}", "--${2:long-option-name}", ${3:String}, - "${4:Option description.}") do |${5:opt}| + opts.on('-${1:o}', '--${2:long-option-name}', ${3:String}, '${4:Option description.}') do |${5:opt}| ${0} end snippet tc - require "test/unit" + require 'test/unit' - require "${1:library_file_name}" + require '${1:library_file_name}' class Test${2:$1} < Test::Unit::TestCase def test_${3:case_name} @@ -467,18 +467,20 @@ snippet tc end end snippet ts - require "test/unit" + require 'test/unit' - require "tc_${1:test_case_file}" - require "tc_${2:test_case_file}" + require 'tc_${1:test_case_file}' + require 'tc_${2:test_case_file}' snippet as - assert ${1:test}, "${2:Failure message.}" + assert ${1:test}, '${2:Failure message.}' snippet ase assert_equal ${1:expected}, ${2:actual} snippet asne assert_not_equal ${1:unexpected}, ${2:actual} snippet asid - assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:2 ** -20} + assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:2**-20} +snippet asi + assert_includes ${1:collection}, ${2:object} snippet asio assert_instance_of ${1:ExpectedClass}, ${2:actual_instance} snippet asko @@ -488,9 +490,9 @@ snippet asn snippet asnn assert_not_nil ${1:instance} snippet asm - assert_match /${1:expected_pattern}/, ${2:actual_string} + assert_match(/${1:expected_pattern}/, ${2:actual_string}) snippet asnm - assert_no_match /${1:unexpected_pattern}/, ${2:actual_string} + assert_no_match(/${1:unexpected_pattern}/, ${2:actual_string}) snippet aso assert_operator ${1:left}, :${2:operator}, ${3:right} snippet asr @@ -514,7 +516,7 @@ snippet ass assert_send(..) snippet asns assert_not_same ${1:unexpected}, ${2:actual} snippet ast - assert_throws :${1:expected} { ${0} } + assert_throws :${1:expected}, -> { ${0} } snippet astd assert_throws :${1:expected} do ${0} @@ -526,7 +528,7 @@ snippet asntd ${0} end snippet fl - flunk "${1:Failure message.}" + flunk '${1:Failure message.}' # Benchmark.bmbm do .. end snippet bm- TESTS = ${1:10_000} @@ -534,31 +536,31 @@ snippet bm- ${0} end snippet rep - results.report("${1:name}:") { TESTS.times { ${0} }} + results.report('${1:name}:') { TESTS.times { ${0} } } # Marshal.dump(.., file) snippet Md - File.open(${1:"path/to/file.dump"}, "wb") { |${2:file}| Marshal.dump(${3:obj}, $2) } + File.open('${1:path/to/file.dump}', 'wb') { |${2:file}| Marshal.dump(${3:obj}, $2) } # Mashal.load(obj) snippet Ml - File.open(${1:"path/to/file.dump"}, "rb") { |${2:file}| Marshal.load($2) } + File.open('${1:path/to/file.dump}', 'rb') { |${2:file}| Marshal.load($2) } # deep_copy(..) snippet deec Marshal.load(Marshal.dump(${1:obj_to_copy})) snippet Pn- - PStore.new(${1:"file_name.pstore"}) + PStore.new('${1:file_name.pstore}') snippet tra transaction(${1:true}) { ${0} } # xmlread(..) snippet xml- - REXML::Document.new(File.read(${1:"path/to/file"})) + REXML::Document.new(File.read('${1:path/to/file}')) # xpath(..) { .. } snippet xpa - elements.each(${1:"//Xpath"}) do |${2:node}| + elements.each('${1://Xpath}') do |${2:node}| ${0} end # class_from_name() snippet clafn - split("::").inject(Object) { |par, const| par.const_get(const) } + split('::').inject(Object) { |par, const| par.const_get(const) } # singleton_class() snippet sinc class << self; self end @@ -567,8 +569,8 @@ snippet nam ${0} end snippet tas - desc "${1:Task description}" - task :${2:task_name => [:dependent, :tasks]} do + desc '${1:Task description}' + task ${2:task_name: [:dependent, :tasks]} do ${0} end # block @@ -576,7 +578,7 @@ snippet b { |${1:var}| ${0} } snippet begin begin - raise 'A test exception.' + fail 'A test exception.' rescue Exception => e puts e.message puts e.backtrace.inspect @@ -592,375 +594,68 @@ snippet debug snippet pry require 'pry'; binding.pry snippet strf - strftime("${1:%Y-%m-%d %H:%M:%S %z}")${0} -############################################# -# Rails snippets - for pure Ruby, see above # -############################################# -snippet art - assert_redirected_to ${1::action => "${2:index}"} -snippet artnp - assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1}, ${0:@$2}) -snippet artnpp - assert_redirected_to ${1:parent}_${2:child}_path(${0:@$1}) -snippet artp - assert_redirected_to ${1:model}_path(${0:@$1}) -snippet artpp - assert_redirected_to ${0:model}s_path -snippet asd - assert_difference "${1:Model}.${2:count}", ${3:1} do - ${0} - end -snippet asnd - assert_no_difference "${1:Model}.${2:count}" do - ${0} - end -snippet asre - assert_response :${1:success}, @response.body -snippet asrj - assert_rjs :${1:replace}, "${0:dom id}" -snippet ass assert_select(..) - assert_select '${1:path}', :${2:text} => '${3:inner_html' ${4:do} -snippet bf - before_filter :${0:method} -snippet bt - belongs_to :${0:association} -snippet btp - belongs_to :${1:association}, :polymorphic => true -snippet crw - cattr_accessor :${0:attr_names} -snippet defcreate - def create - @${1:model_class_name} = ${2:ModelClassName}.new(params[:$1]) - - respond_to do |format| - if @$1.save - flash[:notice] = '$2 was successfully created.' - format.html { redirect_to(@$1) } - format.xml { render :xml => @$1, :status => :created, :location => @$1 } - else - format.html { render :action => "new" } - format.xml { render :xml => @$1.errors, :status => :unprocessable_entity } - end - end - end -snippet defdestroy - def destroy - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - @$1.destroy - - respond_to do |format| - format.html { redirect_to($1s_url) } - format.xml { head :ok } - end - end -snippet defedit - def edit - @${1:model_class_name} = ${0:ModelClassName}.find(params[:id]) - end -snippet defindex - def index - @${1:model_class_name} = ${2:ModelClassName}.all - - respond_to do |format| - format.html # index.html.erb - format.xml { render :xml => @$1s } - end - end -snippet defnew - def new - @${1:model_class_name} = ${2:ModelClassName}.new - - respond_to do |format| - format.html # new.html.erb - format.xml { render :xml => @$1 } - end - end -snippet defshow - def show - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.xml { render :xml => @$1 } - end - end -snippet defupdate - def update - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - - respond_to do |format| - if @$1.update_attributes(params[:$1]) - flash[:notice] = '$2 was successfully updated.' - format.html { redirect_to(@$1) } - format.xml { head :ok } - else - format.html { render :action => "edit" } - format.xml { render :xml => @$1.errors, :status => :unprocessable_entity } - end - end - end -snippet dele delegate .. to - delegate :${1:methods}, :to => :${0:object} -snippet dele delegate .. to .. prefix .. allow_nil - delegate :${1:methods}, :to => :${2:object}, :prefix => :${3:prefix}, :allow_nil => ${0:allow_nil} -snippet flash - flash[:${1:notice}] = "${0}" -snippet habtm - has_and_belongs_to_many :${1:object}, :join_table => "${2:table_name}", :foreign_key => "${3}_id" -snippet hm - has_many :${0:object} -snippet hmd - has_many :${1:other}s, :class_name => "${2:$1}", :foreign_key => "${3:$1}_id", :dependent => :destroy -snippet hmt - has_many :${1:object}, :through => :${0:object} -snippet ho - has_one :${0:object} -snippet hod - has_one :${1:object}, dependent: :${0:destroy} -snippet i18 - I18n.t('${1:type.key}') -snippet ist - <%= image_submit_tag("${1:agree.png}", :id => "${2:id}"${0} %> -snippet log - Rails.logger.${1:debug} ${0} -snippet log2 - RAILS_DEFAULT_LOGGER.${1:debug} ${0} -snippet logd - logger.debug { "${1:message}" } -snippet loge - logger.error { "${1:message}" } -snippet logf - logger.fatal { "${1:message}" } -snippet logi - logger.info { "${1:message}" } -snippet logw - logger.warn { "${1:message}" } -snippet mapc - ${1:map}.${2:connect} '${0:controller/:action/:id}' -snippet mapca - ${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}" -snippet mapr - ${1:map}.resource :${0:resource} -snippet maprs - ${1:map}.resources :${0:resource} -snippet mapwo - ${1:map}.with_options :${2:controller} => '${3:thing}' do |$3| - ${0} - end -snippet mbs - before_save :${0:method} -snippet mcht - change_table :${1:table_name} do |t| - ${0} - end -snippet mp - map(&:${0:id}) -snippet mrw - mattr_accessor :${0:attr_names} -snippet oa - order("${0:field}") -snippet od - order("${0:field} DESC") -snippet pa - params[:${1:id}] -snippet ra - render :action => "${0:action}" -snippet ral - render :action => "${1:action}", :layout => "${0:layoutname}" -snippet rest - respond_to do |format| - format.${1:html} { ${0} } - end -snippet rf - render :file => "${0:filepath}" -snippet rfu - render :file => "${1:filepath}", :use_full_path => ${0:false} -snippet ri - render :inline => "${0:<%= 'hello' %>}" -snippet ril - render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"${0} } -snippet rit - render :inline => "${1:<%= 'hello' %>}", :type => ${0::rxml} -snippet rjson - render :json => ${0:text to render} -snippet rl - render :layout => "${0:layoutname}" -snippet rn - render :nothing => ${0:true} -snippet rns - render :nothing => ${1:true}, :status => ${0:401} -snippet rp - render :partial => "${0:item}" -snippet rpc - render :partial => "${1:item}", :collection => ${0:@$1s} -snippet rpl - render :partial => "${1:item}", :locals => { :${2:$1} => ${0:@$1} -snippet rpo - render :partial => "${1:item}", :object => ${0:@$1} -snippet rps - render :partial => "${1:item}", :status => ${0:500} -snippet rt - render :text => "${0:text to render}" -snippet rtl - render :text => "${1:text to render}", :layout => "${0:layoutname}" -snippet rtlt - render :text => "${1:text to render}", :layout => ${0:true} -snippet rts - render :text => "${1:text to render}", :status => ${0:401} -snippet ru - render :update do |${1:page}| - $1.${0} - end -snippet rxml - render :xml => ${0:text to render} -snippet sc - scope :${1:name}, -> { where(${2:field}: ${0:value}) } -snippet sl - scope :${1:name}, lambda do |${2:value}| - where("${3:field = ?}", ${0:bind var}) - end -snippet sha1 - Digest::SHA1.hexdigest(${0:string}) -snippet sweeper - class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper - observe $1 - - def after_save(${0:model_class_name}) - expire_cache($2) - end - - def after_destroy($2) - expire_cache($2) - end - - def expire_cache($2) - expire_page - end - end -snippet va validates_associated - validates_associated :${0:attribute} -snippet va validates .., :acceptance => true - validates :${0:terms}, :acceptance => true -snippet vc - validates :${0:attribute}, :confirmation => true -snippet ve - validates :${1:attribute}, :exclusion => { :in => ${0:%w( mov avi )} } -snippet vf - validates :${1:attribute}, :format => { :with => /${0:regex}/ } -snippet vi - validates :${1:attribute}, :inclusion => { :in => %w(${0: mov avi }) } -snippet vl - validates :${1:attribute}, :length => { :in => ${2:3}..${0:20} } -snippet vn - validates :${0:attribute}, :numericality => true -snippet vp - validates :${0:attribute}, :presence => true -snippet vu - validates :${0:attribute}, :uniqueness => true -snippet format - format.${1:js|xml|html} { ${0} } -snippet wc - where(${1:"conditions"}${0:, bind_var}) -snippet wf - where(${1:field} => ${0:value}) -snippet xdelete - xhr :delete, :${1:destroy}, :id => ${2:1} -snippet xget - xhr :get, :${1:show}, :id => ${2:1} -snippet xpost - xhr :post, :${1:create}, :${2:object} => { ${0} } -snippet xput - xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} } -snippet test - test "should ${1:do something}" do - ${0} - end -########################### -# migrations snippets # -########################### -snippet mac - add_column :${1:table_name}, :${2:column_name}, :${0:data_type} -snippet mai - add_index :${1:table_name}, :${0:column_name} -snippet mrc - remove_column :${1:table_name}, :${0:column_name} -snippet mrnc - rename_column :${1:table_name}, :${2:old_column_name}, :${0:new_column_name} -snippet mcc - change_column :${1:table}, :${2:column}, :${0:type} -snippet mnc - t.${1:string} :${2:title}${3:, null: false} -snippet mct - create_table :${1:table_name} do |t| - ${0} - end -snippet migration class .. < ActiveRecord::Migration .. def up .. def down .. end - class ${1:class_name} < ActiveRecord::Migration - def up - ${0} - end - - def down - end - end -snippet migration class .. < ActiveRecord::Migration .. def change .. end - class ${1:class_name} < ActiveRecord::Migration - def change - ${0} - end - end -snippet trc - t.remove :${0:column} -snippet tre - t.rename :${1:old_column_name}, :${2:new_column_name} - ${0} -snippet tref - t.references :${0:model} -snippet tcb - t.boolean :${1:title} - ${0} -snippet tcbi - t.binary :${1:title}, :limit => ${2:2}.megabytes - ${0} -snippet tcd - t.decimal :${1:title}, :precision => ${2:10}, :scale => ${3:2} - ${0} -snippet tcda - t.date :${1:title} - ${0} -snippet tcdt - t.datetime :${1:title} - ${0} -snippet tcf - t.float :${1:title} - ${0} -snippet tch - t.change :${1:name}, :${2:string}, :${3:limit} => ${4:80} - ${0} -snippet tci - t.integer :${1:title} - ${0} -snippet tcl - t.integer :lock_version, :null => false, :default => 0 - ${0} -snippet tcr - t.references :${1:taggable}, :polymorphic => { :default => '${2:Photo}' } - ${0} -snippet tcs - t.string :${1:title} - ${0} -snippet tct - t.text :${1:title} - ${0} -snippet tcti - t.time :${1:title} - ${0} -snippet tcts - t.timestamp :${1:title} - ${0} -snippet tctss - t.timestamps - ${0} + strftime('${1:%Y-%m-%d %H:%M:%S %z}')${0} +# +# Minitest snippets +# +snippet mb + must_be ${0} +snippet wb + wont_be ${0} +snippet mbe + must_be_empty +snippet wbe + wont_be_empty +snippet mbio + must_be_instance_of ${0:Class} +snippet wbio + wont_be_instance_of ${0:Class} +snippet mbko + must_be_kind_of ${0:Class} +snippet wbko + wont_be_kind_of ${0:Class} +snippet mbn + must_be_nil +snippet wbn + wont_be_nil +snippet mbsa + must_be_same_as ${0:other} +snippet wbsa + wont_be_same_as ${0:other} +snippet mbsi + -> { ${0} }.must_be_silent +snippet mbwd + must_be_within_delta ${1:0.1}, ${2:0.1} +snippet wbwd + wont_be_within_delta ${1:0.1}, ${2:0.1} +snippet mbwe + must_be_within_epsilon ${1:0.1}, ${2:0.1} +snippet wbwe + wont_be_within_epsilon ${1:0.1}, ${2:0.1} +snippet me + must_equal ${0:other} +snippet we + wont_equal ${0:other} +snippet mi + must_include ${0:what} +snippet wi + wont_include ${0:what} +snippet mm + must_match /${0:regex}/ +snippet wm + wont_match /${0:regex}/ +snippet mout + -> { ${1} }.must_output '${0}' +snippet mra + -> { ${1} }.must_raise ${0:Exception} +snippet mrt + must_respond_to :${0:method} +snippet wrt + wont_respond_to :${0:method} +snippet msend + must_send [ ${1:what}, :${2:method}, ${3:args} ] +snippet mthrow + -> { throw :${1:error} }.must_throw :${2:error} ########################## # Rspec snippets # ########################## @@ -969,11 +664,11 @@ snippet desc ${0} end snippet descm - describe "${1:#method}" do - ${0:pending "Not implemented"} + describe '${1:#method}' do + ${0:pending 'Not implemented'} end snippet cont - context "${1:message}" do + context '${1:message}' do ${0} end snippet bef @@ -985,9 +680,9 @@ snippet aft ${0} end snippet let - let(:${1:object}) ${0} + let(:${1:object}) { ${0} } snippet let! - let!(:${1:object}) ${0} + let!(:${1:object}) { ${0} } snippet subj subject { ${0} } snippet s. @@ -1001,11 +696,11 @@ snippet expb snippet experr expect { ${1:object} }.to raise_error ${2:StandardError}, /${0:message_regex}/ snippet shared - shared_examples ${0:"shared examples name"} + shared_examples ${0:'shared examples name'} snippet ibl - it_behaves_like ${0:"shared examples name"} + it_behaves_like ${0:'shared examples name'} snippet it - it "${1:spec_name}" do + it '${1:spec_name}' do ${0} end snippet its @@ -1014,74 +709,3 @@ snippet is it { should ${0} } snippet isn it { should_not ${0} } -#ShouldaMatchers#ActionController -snippet isfp - it { should filter_param :${0:key} } -snippet isrt - it { should redirect_to ${0:url} } -snippet isrtp - it { should render_template ${0} } -snippet isrwl - it { should render_with_layout ${0} } -snippet isrf - it { should rescue_from ${0:exception} } -snippet isrw - it { should respond_with ${0:status} } -snippet isr - it { should route(:${1:method}, '${0:path}') } -snippet isss - it { should set_session :${0:key} } -snippet issf - it { should set_the_flash('${0}') } -#ShouldaMatchers#ActiveModel -snippet isama - it { should allow_mass_assignment_of :${0} } -snippet isav - it { should allow_value(${1}).for :${0} } -snippet isee - it { should ensure_exclusion_of :${0} } -snippet isei - it { should ensure_inclusion_of :${0} } -snippet isel - it { should ensure_length_of :${0} } -snippet isva - it { should validate_acceptance_of :${0} } -snippet isvc - it { should validate_confirmation_of :${0} } -snippet isvn - it { should validate_numericality_of :${0} } -snippet isvp - it { should validate_presence_of :${0} } -snippet isvu - it { should validate_uniqueness_of :${0} } -#ShouldaMatchers#ActiveRecord -snippet isana - it { should accept_nested_attributes_for :${0} } -snippet isbt - it { should belong_to :${0} } -snippet isbtcc - it { should belong_to(:${1}).counter_cache ${0:true} } -snippet ishbtm - it { should have_and_belong_to_many :${0} } -snippet isbv - it { should be_valid } -snippet ishc - it { should have_db_column :${0} } -snippet ishi - it { should have_db_index :${0} } -snippet ishm - it { should have_many :${0} } -snippet ishmt - it { should have_many(:${1}).through :${0} } -snippet isho - it { should have_one :${0} } -snippet ishro - it { should have_readonly_attribute :${0} } -snippet iss - it { should serialize :${0} } -snippet isres - it { should respond_to :${0} } -snippet isresw - it { should respond_to(:${1}).with(${0}).arguments } -snippet super_call - ${1:super_class}.instance_method(:${0:method}).bind(self).call diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets new file mode 100644 index 00000000..d4b9264d --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -0,0 +1,125 @@ +################# +# Rust Snippets # +################# + +# Functions +snippet fn + fn ${1:function_name}(${2}) { + ${0} + } +snippet fn- + fn ${1:function_name}(${2}) -> ${3} { + ${0} + } +snippet test + #[test] + fn ${1:test_function_name}() { + ${0} + } +snippet new + pub fn new(${2}) -> ${1:Name} { + ${0}return $1 { ${3} }; + } +snippet main + pub fn main() { + ${0} + } +snippet let + let ${1:name}${3} = ${2}; +snippet pln + println!("${1}"); +snippet pln, + println!("${1}", ${2}); +snippet ec + extern crate ${1:sync}; +snippet ecl + #![feature(phase)] + #[phase(syntax, link)] extern crate log; +snippet mod + mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { + ${0} + } /* $1 */ +snippet crate + // Crate ID + #![crate_id = "${1:crate_name}#${2:0.0.1}"] + // Additional metadata attributes + #![desc = "${3:Descrption.}"] + #![license = "${4:BSD}"] + #![comment = "${5:Comment.}"] + // Specify the output type + #![crate_type = "${6:lib}"] +snippet allow + #[allow(${1:unused_variable})] +snippet feat + #![feature(${1:macro_rules})] +# Common types +snippet opt + Option<${1:int}> +snippet res + Result<${1:~str}, ${2:()}> +snippet if + if ${1:/* condition */} { + ${0} + } +snippet mat + match ${1} { + ${2} => ${3}, + } +snippet while + while ${1:condition} { + ${0} + } +snippet for + for ${1:i} in ${2:range(0u, 10)} { + ${0} + } +snippet spawn + spawn(proc() { + ${0} + }); +snippet chan + let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel(); +snippet duplex + let (${1:from_child}, ${2:to_child}) = sync::duplex(); +# TODO commenting +snippet todo + // [TODO]: ${1:Description} +# Struct +snippet st + struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { + ${0} + } + + impl $1 { + pub fn new(${2}) -> $1 { + ${4}return $1 { + ${5} + }; + } + } +# Enum +snippet enum + enum ${1:enum_name} { + ${0}, + } +# Impl +snippet imp + impl ${1:Name} { + ${0} + } +snippet drop + impl Drop for ${1:Name} { + fn drop(&mut self) { + ${0} + } + } +# Traits +snippet trait + trait ${1:Name} { + ${0} + } +# Statics +snippet ss + static ${1}: &'static str = "${0}"; +snippet stat + static ${1}: ${2:uint} = ${0}; diff --git a/sources_non_forked/vim-snippets/snippets/scala.snippets b/sources_non_forked/vim-snippets/snippets/scala.snippets index 5eddb2c3..09d69ad3 100644 --- a/sources_non_forked/vim-snippets/snippets/scala.snippets +++ b/sources_non_forked/vim-snippets/snippets/scala.snippets @@ -194,8 +194,9 @@ snippet mhmap snippet as ${1:name}.asInstanceOf[${2:T}] #isInstanceOf[] +snippet is ${1:name}.isInstanceOf[${2:T}] -#end + #collections methods #scope() with one arg diff --git a/sources_non_forked/vim-snippets/snippets/scheme.snippets b/sources_non_forked/vim-snippets/snippets/scheme.snippets new file mode 100644 index 00000000..035d5348 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/scheme.snippets @@ -0,0 +1,36 @@ +snippet + + (+ ${1} + ${0}) + +snippet - + (- ${1} + ${0}) + +snippet / + (/ ${1} + ${0}) + +snippet * + (* ${1} + ${0}) + +# Definition +snippet def + (define (${1:name}) + (${0:definition})) + +# Definition with lambda +snippet defl + (define ${1:name} + (lambda (x)(${0:definition}))) + +# Condition +snippet cond + (cond ((${1:predicate}) (${2:action})) + ((${3:predicate}) (${0:action}))) + +# If statement +snippet if + (if (${1:predicate}) + (${2:true-action}) + (${0:false-action})) diff --git a/sources_non_forked/vim-snippets/snippets/sh.snippets b/sources_non_forked/vim-snippets/snippets/sh.snippets index 6bf7089c..c9c6ebc3 100644 --- a/sources_non_forked/vim-snippets/snippets/sh.snippets +++ b/sources_non_forked/vim-snippets/snippets/sh.snippets @@ -81,7 +81,7 @@ snippet getopt done shift $(($OPTIND-1)) snippet root - if [ $(id -u) -ne 0 ]; then exec sudo $0; fi + if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi snippet fun ${1:function_name}() { ${0:#function_body} diff --git a/sources_non_forked/vim-snippets/snippets/slim.snippets b/sources_non_forked/vim-snippets/snippets/slim.snippets new file mode 100644 index 00000000..8eeb4a53 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/slim.snippets @@ -0,0 +1,64 @@ +# Some useful Unicode entities +# ============================ +# Non-Breaking Space +snippet nbs +   +# ← +snippet left + ← +# → +snippet right + → +# ↑ +snippet up + ↑ +# ↓ +snippet down + ↓ +# ↩ +snippet return + ↩ +# ⇤ +snippet backtab + ⇤ +# ⇥ +snippet tab + ⇥ +# ⇧ +snippet shift + ⇧ +# ⌃ +snippet ctrl + ⌃ +# ⌅ +snippet enter + ⌅ +# ⌘ +snippet cmd + ⌘ +# ⌥ +snippet option + ⌥ +# ⌦ +snippet delete + ⌦ +# ⌫ +snippet backspace + ⌫ +# ⎋ +snippet esc + ⎋ + +# Forms +# ===== +snippet fieldset + fieldset + legend ${1} + +# Assets +# ====== +snippet css + link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" + +snippet script + script src="${1:script.js}" type="text/javascript" diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index f3c090e6..87c150ca 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -1,215 +1,224 @@ #PREAMBLE #newcommand -snippet nc - \newcommand{\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0} +snippet nc \newcommand + \newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0} #usepackage -snippet up +snippet up \usepackage \usepackage[${1:options}]{${2:package}} ${0} #newunicodechar -snippet nuc +snippet nuc \newunicodechar \newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}} ${0} #DeclareMathOperator -snippet dmo +snippet dmo \DeclareMathOperator \DeclareMathOperator{${1}}{${2}} ${0} #DOCUMENT # \begin{}...\end{} -snippet begin +snippet begin \begin{} ... \end{} block \begin{${1:env}} ${0} \end{$1} # Tabular -snippet tab +snippet tab tabular (or arbitrary) environment \begin{${1:tabular}}{${2:c}} - ${0} + ${0} \end{$1} -snippet thm +snippet thm thm (or arbitrary) environment with optional argument \begin[${1:author}]{${2:thm}} - ${0} + ${0} \end{$2} -snippet center +snippet center center environment \begin{center} ${0} \end{center} # Align(ed) -snippet ali +snippet ali align(ed) environment \begin{align${1:ed}} + \label{eq:${2}} ${0} \end{align$1} # Gather(ed) -snippet gat +snippet gat gather(ed) environment \begin{gather${1:ed}} ${0} \end{gather$1} # Equation -snippet eq +snippet eq equation environment \begin{equation} + \label{eq:${2}} ${0} \end{equation} # Equation -snippet eq* +snippet eq* unnumbered equation environment \begin{equation*} ${0} \end{equation*} # Unnumbered Equation -snippet \ +snippet \ unnumbered equation: \[ ... \] \[ ${0} \] # Equation array -snippet eqnarray +snippet eqnarray eqnarray environment \begin{eqnarray} ${0} \end{eqnarray} +# Label +snippet lab \label + \label{${1:eq:}${2:fig:}${3:tab:}${0}} # Enumerate -snippet enum +snippet enum enumerate environment \begin{enumerate} \item ${0} \end{enumerate} # Itemize -snippet itemize +snippet itemize itemize environment \begin{itemize} \item ${0} \end{itemize} -snippet item +snippet item \item \item ${1} # Description -snippet desc +snippet desc description environment \begin{description} \item[${1}] ${0} \end{description} # Endless new item -snippet ]i +snippet ]i \item (recursive) \item ${1} - ${0:]i} + ${0:]i} # Matrix -snippet mat +snippet mat smart matrix environment \begin{${1:p/b/v/V/B/small}matrix} ${0} \end{$1matrix} # Cases -snippet cas +snippet cas cases environment \begin{cases} ${1:equation}, &\text{ if }${2:case}\\ ${0} \end{cases} # Split -snippet spl +snippet spl split environment \begin{split} ${0} \end{split} # Part -snippet part +snippet part document \part \part{${1:part name}} % (fold) \label{prt:${2:$1}} ${0} % part $2 (end) # Chapter -snippet cha +snippet cha \chapter \chapter{${1:chapter name}} \label{cha:${2:$1}} ${0} # Section -snippet sec +snippet sec \section \section{${1:section name}} \label{sec:${2:$1}} ${0} # Section without number -snippet sec* +snippet sec* \section* \section*{${1:section name}} \label{sec:${2:$1}} ${0} # Sub Section -snippet sub +snippet sub \subsection \subsection{${1:subsection name}} \label{sub:${2:$1}} ${0} # Sub Section without number -snippet sub* +snippet sub* \subsection* \subsection*{${1:subsection name}} \label{sub:${2:$1}} ${0} # Sub Sub Section -snippet subs +snippet subs \subsubsection \subsubsection{${1:subsubsection name}} \label{ssub:${2:$1}} ${0} # Sub Sub Section without number -snippet subs* +snippet subs* \subsubsection* \subsubsection*{${1:subsubsection name}} \label{ssub:${2:$1}} ${0} # Paragraph -snippet par +snippet par \paragraph \paragraph{${1:paragraph name}} \label{par:${2:$1}} ${0} # Sub Paragraph -snippet subp +snippet subp \subparagraph \subparagraph{${1:subparagraph name}} \label{subp:${2:$1}} ${0} -snippet ni +snippet ni \noindent \noindent ${0} #References -snippet itd +snippet itd description \item \item[${1:description}] ${0:item} -snippet figure +snippet figure reference to a figure ${1:Figure}~\ref{${2:fig:}} -snippet table +snippet table reference to a table ${1:Table}~\ref{${2:tab:}} -snippet listing +snippet listing reference to a listing ${1:Listing}~\ref{${2:list}} -snippet section +snippet section reference to a section ${1:Section}~\ref{sec:${2}} ${0} -snippet page +snippet page reference to a page ${1:page}~\pageref{${2}} ${0} -snippet index +snippet index \index \index{${1:index}} ${0} #Citations -snippet citen - \cite{$1} ${0} -# bibtex commands -snippet citep - \citep{$1} ${0} -snippet citet - \citet{$1} ${0} -snippet cite +snippet citen \citen + \citen{${1}} ${0} +# natbib citations +snippet citep \citep + \citep{${1}} ${0} +snippet citet \citet + \citet{${1}} ${0} +snippet cite \cite[]{} \cite[${1}]{${2}} ${0} -snippet fcite +snippet citea \citeauthor + \citeauthor{${1}} ${0} +snippet citey \citeyear + \citeyear{${1}} ${0} +snippet fcite \footcite[]{} \footcite[${1}]{${2}}${0} #Formating text: italic, bold, underline, small capital, emphase .. -snippet it +snippet it italic text \textit{${0:text}} -snippet bf +snippet bf bold face text \textbf{${0:text}} -snippet under +snippet under underline text \underline{${0:text}} -snippet emp +snippet emp emphasize text \emph{${0:text}} -snippet sc +snippet sc small caps text \textsc{${0:text}} #Choosing font -snippet sf +snippet sf sans serife text \textsf{${0:text}} -snippet rm +snippet rm roman font text \textrm{${0:text}} -snippet tt +snippet tt typewriter (monospace) text \texttt{${0:text}} #misc -snippet ft +snippet ft \footnote \footnote{${0:text}} -snippet fig +snippet fig figure environment (includegraphics) \begin{figure} \begin{center} - \includegraphics[scale=${1}]{Figures/${2}} + \includegraphics[scale=${1}]{Figures/${2}} \end{center} \caption{${3}} \label{fig:${4}} \end{figure} ${0} -snippet tikz +snippet tikz figure environment (tikzpicture) \begin{figure} \begin{center} \begin{tikzpicture}[scale=${1:1}] @@ -221,33 +230,31 @@ snippet tikz \end{figure} ${0} #math -snippet stackrel +snippet stackrel \stackrel{}{} \stackrel{${1:above}}{${2:below}} ${0} -snippet frac +snippet frac \frac{}{} \frac{${1:num}}{${2:denom}} ${0} -snippet sum +snippet sum \sum^{}_{} \sum^{${1:n}}_{${2:i=1}} ${0} -snippet lim +snippet lim \lim_{} \lim_{${1:x \to +\infty}} ${0} -snippet frame - \begin{frame}[<+->] - \frametitle{${1:title}} - +snippet frame frame environment + \begin{frame}[${1:t}]{${2:title}} ${0} \end{frame} -snippet block +snippet block block environment \begin{block}{${1:title}} ${0} \end{block} -snippet alert +snippet alert alertblock environment \begin{alertblock}{${1:title}} ${0} \end{alertblock} -snippet example +snippet example exampleblock environment \begin{exampleblock}{${1:title}} ${0} \end{exampleblock} -snippet col2 +snippet col2 two-column environment \begin{columns} \begin{column}{0.5\textwidth} ${1} diff --git a/sources_non_forked/vim-snippets/snippets/vim.snippets b/sources_non_forked/vim-snippets/snippets/vim.snippets index dd1e65e8..b299f512 100644 --- a/sources_non_forked/vim-snippets/snippets/vim.snippets +++ b/sources_non_forked/vim-snippets/snippets/vim.snippets @@ -1,51 +1,52 @@ -snippet header +snippet header standard Vim script file header " File: ${1:`expand('%:t')`} " Author: ${2:`g:snips_author`} " Description: ${3} ${0:" Last Modified: `strftime("%B %d, %Y")`} -snippet guard +snippet guard script reload guard if exists('${1:did_`vim_snippets#Filename()`}') || &cp${2: || version < 700} finish endif let $1 = 1${0} -snippet f +snippet f function fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3}) ${0} endf -snippet t +snippet t try ... catch statement try ${1} catch ${2} ${0} endtry -snippet for +snippet for for ... in loop for ${1} in ${2} ${0} endfor -snippet forkv +snippet forkv for [key, value] in loop for [${1},${2}] in items(${3}) ${0} - unlet $1 $2 + unlet $1 $2 endfor - -snippet wh +snippet wh while loop while ${1} ${0} endw -snippet if +snippet if if statement if ${1} ${0} endif -snippet ife +snippet ife if ... else statement if ${1} ${2} else ${0} endif -snippet au +snippet au augroup ... autocmd block augroup ${1:AU_NAME} " this one is which you're most likely to use? autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|} ${0} augroup end -snippet bun - Bundle '${0}' +snippet bun Vundle.vim Plugin definition + Plugin '${0}' +snippet plug Vundle.vim Plugin definition + Plugin '${0}' diff --git a/sources_non_forked/vim-surround/plugin/surround.vim b/sources_non_forked/vim-surround/plugin/surround.vim index 05b1c5c3..148a5c9a 100644 --- a/sources_non_forked/vim-surround/plugin/surround.vim +++ b/sources_non_forked/vim-surround/plugin/surround.vim @@ -127,7 +127,7 @@ endfunction function! s:wrap(string,char,type,...) let keeper = a:string let newchar = a:char - let s:tag = "" + let s:input = "" let type = a:type let linemode = type ==# 'V' ? 1 : 0 let special = a:0 ? a:1 : 0 @@ -185,10 +185,10 @@ function! s:wrap(string,char,type,...) if dounmapb silent! cunmap > endif - let s:tag = tag + let s:input = tag if tag != "" let tag = substitute(tag,'>*$','','') - let s:tag = tag . '>' + let s:input = tag . '>' let before = '<'.tag.'>' if tag =~ '/$' let after = '' @@ -217,6 +217,7 @@ function! s:wrap(string,char,type,...) elseif newchar ==# 'f' || newchar ==# 'F' let fnc = input('function: ') if fnc != "" + let s:input = fnc."\" let before = substitute(fnc,'($','','').'(' let after = ')' if newchar ==# 'F' @@ -226,6 +227,7 @@ function! s:wrap(string,char,type,...) endif elseif newchar ==# "\" let fnc = input('function: ') + let s:input = fnc."\" let before = '('.fnc.' ' let after = ')' elseif idx >= 0 @@ -414,7 +416,7 @@ function! s:dosurround(...) " {{{1 exe 'norm! df'.char else " One character backwards - call search('.','bW') + call search('\m.', 'bW') exe "norm! da".char endif let removed = getreg('"') @@ -454,7 +456,7 @@ function! s:dosurround(...) " {{{1 if newchar == "" silent! call repeat#set("\Dsurround".char,scount) else - silent! call repeat#set("\Csurround".char.newchar.s:tag,scount) + silent! call repeat#set("\Csurround".char.newchar.s:input,scount) endif endfunction " }}}1 @@ -527,9 +529,9 @@ function! s:opfunc(type,...) " {{{1 let &selection = sel_save let &clipboard = cb_save if a:type =~ '^\d\+$' - silent! call repeat#set("\Y".(a:0 && a:1 ? "S" : "s")."surround".char.s:tag,a:type) + silent! call repeat#set("\Y".(a:0 && a:1 ? "S" : "s")."surround".char.s:input,a:type) else - silent! call repeat#set("\SurroundRepeat".char.s:tag) + silent! call repeat#set("\SurroundRepeat".char.s:input) endif endfunction diff --git a/sources_non_forked/vim-zenroom2/README.markdown b/sources_non_forked/vim-zenroom2/README.markdown new file mode 100644 index 00000000..e8607d37 --- /dev/null +++ b/sources_non_forked/vim-zenroom2/README.markdown @@ -0,0 +1,30 @@ +This is a Vim extension that emulates iA Writer environment when editing Markdown, reStructuredText or text files. + +It requires [goyo.vim](https://github.com/junegunn/goyo.vim) and it works by setting global Goyo callbacks that triggers special setup for Markdown, reStructuredText and text files. + +This is an improvement of my initial version called [vim-zenroom](https://github.com/amix/vim-zenroom). Please read more here [ +zenroom for Vim: Focusing only on the essential](http://amix.dk/blog/post/19744#zenroom-for-Vim-Focsuing-only-on-the-essential). + +Please note that this might not work perfectly with your colorscheme. Patches are welcome to fix this :-) + +## Installaion and usage + +* Install [goyo.vim](https://github.com/junegunn/goyo.vim) +* In command mode type :Goyo + +Additionally you may want to have a shortcut. Add this to your vimrc: + + nnoremap z :Goyo + +## Inspirations/Similar +* [Writing Markdown With Style in Vim](http://astrails.com/blog/2013/8/12/writing-markdown-with-style-in-vim) +* [lite-dfm](https://github.com/bilalq/lite-dfm) +* [vimroom](https://github.com/mikewest/vimroom) +* [vim-zenroom](https://github.com/amix/vim-zenroom) + + +## How it looks like in action + +![Screenshot 3](http://amix.dk/uploads/zenroom_documentation.jpg) + +![Screenshot 4](http://amix.dk/uploads/zenroom_documentation_1.jpg) diff --git a/sources_non_forked/vim-zenroom2/plugin/zenroom2.vim b/sources_non_forked/vim-zenroom2/plugin/zenroom2.vim new file mode 100644 index 00000000..a9781c74 --- /dev/null +++ b/sources_non_forked/vim-zenroom2/plugin/zenroom2.vim @@ -0,0 +1,90 @@ +"============================================================================== +"File: zenroom2.vim +"Description: Emulates iA Writer environment when editing Markdown, reStructuredText +" or text files. +"Maintainer: Amir Salihefendic +"Version: 0.1 +"Last Change: 2013-12-29 +"License: BSD +"============================================================================== + +if exists( "g:loaded_zenroom2_plugin" ) + finish +endif +let g:loaded_zenroom2_plugin = 1 + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Plugin Configuration +" +" Save the current `background` value for reset later +let s:save_background = "" +if exists( "&background" ) + let s:save_background = &background +endif + +function! s:markdown_room() + set background=light + set linespace=8 + + hi Normal guibg=gray95 + hi NonText guifg=gray95 + hi FoldColumn guibg=gray95 + hi CursorLine guibg=gray90 + hi Title gui=bold guifg=gray25 + hi MarkdownHeadingDelimiter gui=bold guifg=gray25 + hi htmlSpecialChar guifg=black + hi markdownError guifg=black + hi markdownBold gui=bold guifg=gray25 + hi markdownItalic guifg=gray25 gui=underline + hi markdownUrl guifg=#2fb3a6 + hi markdownAutomaticLink guifg=#2fb3a6 + hi markdownLinkText guifg=#317849 + hi markdownUrlTitle guifg=#317849 + hi markdownBlockquote guifg=#317849 gui=bold + hi markdownId guifg=#2fb3a6 + hi markdownIdDeclaration guifg=#317849 gui=bold + hi markdownListMarker guifg=#317849 + hi Cursor guibg=#15abdd + + if has('gui_running') + let l:highlightbgcolor = "guibg=#f2f2f2" + let l:highlightfgbgcolor = "guifg=#f2f2f2" . " " . l:highlightbgcolor + else + let l:highlightbgcolor = "ctermbg=bg" + let l:highlightfgbgcolor = "ctermfg=bg" . " " . l:highlightbgcolor + endif + + exec( "hi Normal " . l:highlightbgcolor ) + exec( "hi VertSplit " . l:highlightfgbgcolor ) + exec( "hi NonText " . l:highlightfgbgcolor ) + exec( "hi StatusLine " . l:highlightfgbgcolor ) + exec( "hi StatusLineNC " . l:highlightfgbgcolor ) +endfunction + +function! g:zenroom_goyo_before() + if !has("gui_running") + return + endif + let is_mark_or_rst = &filetype == "markdown" || &filetype == "rst" || &filetype == "text" + + if is_mark_or_rst + call s:markdown_room() + endif +endfunction + +function! g:zenroom_goyo_after() + if !has("gui_running") + return + endif + let is_mark_or_rst = &filetype == "markdown" || &filetype == "rst" || &filetype == "text" + if is_mark_or_rst + set linespace=0 + + if s:save_background != "" + exec( "set background=" . s:save_background ) + endif + endif +endfunction + +let g:goyo_callbacks = [ function('g:zenroom_goyo_before'), function('g:zenroom_goyo_after') ] diff --git a/update_plugins.py b/update_plugins.py index 9931b378..8c4e4599 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -33,11 +33,17 @@ vim-expand-region https://github.com/terryma/vim-expand-region vim-multiple-cursors https://github.com/terryma/vim-multiple-cursors vim-fugitive https://github.com/tpope/vim-fugitive vim-airline https://github.com/bling/vim-airline +goyo.vim https://github.com/junegunn/goyo.vim +vim-zenroom2 https://github.com/amix/vim-zenroom2 +syntastic https://github.com/scrooloose/syntastic +vim-repeat https://github.com/tpope/vim-repeat +vim-commentary https://github.com/tpope/vim-commentary +vim-golang https://github.com/jnwhiteh/vim-golang """.strip() GITHUB_ZIP = '%s/archive/master.zip' -SOURCE_DIR = path.join( path.dirname(__file__), 'sources_non_forked' ) +SOURCE_DIR = path.join(path.dirname(__file__), 'sources_non_forked') def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): @@ -63,7 +69,7 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): shutil.move(plugin_temp_path, plugin_dest_path) - print 'Updated %s' % plugin_name + print('Updated {0}'.format(plugin_name)) if __name__ == '__main__': diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index c97c082f..65ae82e4 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -293,23 +293,21 @@ autocmd BufWrite *.coffee :call DeleteTrailingWS() """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => vimgrep searching and cope displaying +" => Ack searching and cope displaying +" requires ack.vim - it's much better than vimgrep/grep """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" When you press gv you vimgrep after the selected text +" When you press gv you Ack after the selected text vnoremap gv :call VisualSelection('gv', '') -" Open vimgrep and put the cursor in the right position -map g :vimgrep // **/*. - -" Vimgreps in the current file -map :vimgrep // % +" Open Ack and put the cursor in the right position +map g :Ack " When you press r you can search and replace the selected text vnoremap r :call VisualSelection('replace', '') " Do :help cope if you are unsure what cope is. It's super useful! " -" When you search with vimgrep, display your results in cope by doing: +" When you search with Ack, display your results in cope by doing: " cc " " To go to the next search result do: @@ -343,9 +341,12 @@ map s? z= " Remove the Windows ^M - when the encodings gets messed up noremap m mmHmt:%s///ge'tzt'm -" Quickly open a buffer for scripbble +" Quickly open a buffer for scribble map q :e ~/buffer +" Quickly open a markdown buffer for scribble +map x :e ~/buffer.md + " Toggle paste mode on and off map pp :setlocal paste! @@ -370,7 +371,7 @@ function! VisualSelection(direction, extra_filter) range if a:direction == 'b' execute "normal ?" . l:pattern . "^M" elseif a:direction == 'gv' - call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.' . a:extra_filter) + call CmdLine("Ack \"" . l:pattern . "\" " ) elseif a:direction == 'replace' call CmdLine("%s" . '/'. l:pattern . '/') elseif a:direction == 'f' diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index 77a7c544..a162f000 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -8,15 +8,13 @@ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => GUI related """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -set background=dark - -colorscheme peaksea - " Set font according to system if has("mac") || has("macunix") - set gfn=Menlo:h15 + set gfn=Source\ Code\ Pro:h15,Menlo:h15 elseif has("win16") || has("win32") - set gfn=Bitstream\ Vera\ Sans\ Mono:h11 + set gfn=Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 +elseif has("linux") + set gfn=Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 elseif has("unix") set gfn=Monospace\ 11 endif @@ -33,6 +31,15 @@ set guioptions-=R set guioptions-=l set guioptions-=L +" Colorscheme +if has("gui_running") + set background=dark + colorscheme peaksea +else + colorscheme desert + let g:colors_name="desert" +endif + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Fast editing and reloading of vimrc configs diff --git a/vimrcs/filetypes.vim b/vimrcs/filetypes.vim index 65fa0699..2714239d 100644 --- a/vimrcs/filetypes.vim +++ b/vimrcs/filetypes.vim @@ -26,7 +26,7 @@ au FileType javascript call JavaScriptFold() au FileType javascript setl fen au FileType javascript setl nocindent -au FileType javascript imap AJS.log();hi +au FileType javascript imap $log();hi au FileType javascript imap alert();hi au FileType javascript inoremap $r return diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index b9cd642f..fc0072bd 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -8,8 +8,8 @@ """""""""""""""""""""""""""""" " => Load pathogen paths """""""""""""""""""""""""""""" -call pathogen#infect('~/.vim_runtime/sources_forked') -call pathogen#infect('~/.vim_runtime/sources_non_forked') +call pathogen#infect('~/.vim_runtime/sources_forked/{}') +call pathogen#infect('~/.vim_runtime/sources_non_forked/{}') call pathogen#helptags() """""""""""""""""""""""""""""" @@ -45,19 +45,13 @@ endif let g:ctrlp_working_path_mode = 0 let g:ctrlp_map = '' +map j :CtrlP map :CtrlPBuffer let g:ctrlp_max_height = 20 let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee' -"""""""""""""""""""""""""""""" -" => Peepopen -"""""""""""""""""""""""""""""" -map j :PeepOpen - - - """""""""""""""""""""""""""""" " => ZenCoding """""""""""""""""""""""""""""" @@ -105,3 +99,17 @@ au FileType mako vmap Si S"i${ _(2f"a) } " => vim-airline config (force color) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:airline_theme="luna" + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Vimroom +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:goyo_width=100 +let g:goyo_margin_top = 2 +let g:goyo_margin_bottom = 2 +nnoremap z :Goyo + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Syntastic (syntax checker) +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:syntastic_python_checkers=['pyflakes']