Remove unused vim bundles
parent
8e80e2c113
commit
2957d5bb95
@ -1,6 +1,3 @@
|
|||||||
[submodule "vim/bundle/you-complete-me"]
|
|
||||||
path = vim/bundle/you-complete-me
|
|
||||||
url = https://github.com/Valloric/YouCompleteMe.git
|
|
||||||
[submodule "editorconfig"]
|
[submodule "editorconfig"]
|
||||||
path = vim/bundle/editorconfig
|
path = vim/bundle/editorconfig
|
||||||
url = https://github.com/editorconfig/editorconfig-vim.git
|
url = https://github.com/editorconfig/editorconfig-vim.git
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
This is a mirror of http://www.vim.org/scripts/script.php?script_id=1879
|
|
||||||
|
|
||||||
Repository:
|
|
||||||
https://bitbucket.org/ns9tks/vim-autocomplpop/
|
|
||||||
|
|
||||||
Issues:
|
|
||||||
http://bitbucket.org/ns9tks/vim-autocomplpop/issues/
|
|
||||||
|
|
||||||
Download latest(development) version
|
|
||||||
https://bitbucket.org/ns9tks/vim-autocomplpop/get/tip.zip
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
INTRODUCTION *acp-introduction*
|
|
||||||
|
|
||||||
With this plugin, your vim comes to automatically opens popup menu for
|
|
||||||
completions when you enter characters or move the cursor in Insert mode. It
|
|
||||||
won't prevent you continuing entering characters.
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
INSTALLATION *acp-installation*
|
|
||||||
|
|
||||||
Put all files into your runtime directory. If you have the zip file, extract
|
|
||||||
it to your runtime directory.
|
|
||||||
|
|
||||||
You should place the files as follows:
|
|
||||||
>
|
|
||||||
<your runtime directory>/plugin/acp.vim
|
|
||||||
<your runtime directory>/doc/acp.txt
|
|
||||||
...
|
|
||||||
<
|
|
||||||
If you disgust to jumble up this plugin and other plugins in your runtime
|
|
||||||
directory, put the files into new directory and just add the directory path to
|
|
||||||
'runtimepath'. It's easy to uninstall the plugin.
|
|
||||||
|
|
||||||
And then update your help tags files to enable fuzzyfinder help. See
|
|
||||||
|add-local-help| for details.
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
USAGE *acp-usage*
|
|
||||||
|
|
||||||
Once this plugin is installed, auto-popup is enabled at startup by default.
|
|
||||||
|
|
||||||
Which completion method is used depends on the text before the cursor. The
|
|
||||||
default behavior is as follows:
|
|
||||||
|
|
||||||
kind filetype text before the cursor ~
|
|
||||||
Keyword * two keyword characters
|
|
||||||
Filename * a filename character + a path separator
|
|
||||||
+ 0 or more filename character
|
|
||||||
Omni ruby ".", "::" or non-word character + ":"
|
|
||||||
(|+ruby| required.)
|
|
||||||
Omni python "." (|+python| required.)
|
|
||||||
Omni xml "<", "</" or ("<" + non-">" characters + " ")
|
|
||||||
Omni html/xhtml "<", "</" or ("<" + non-">" characters + " ")
|
|
||||||
Omni css (":", ";", "{", "^", "@", or "!")
|
|
||||||
+ 0 or 1 space
|
|
||||||
|
|
||||||
Also, you can make user-defined completion and snipMate's trigger completion
|
|
||||||
(|acp-snipMate|) auto-popup if the options are set.
|
|
||||||
|
|
||||||
These behavior are customizable.
|
|
||||||
|
|
||||||
*acp-snipMate*
|
|
||||||
snipMate's Trigger Completion ~
|
|
||||||
|
|
||||||
snipMate's trigger completion enables you to complete a snippet trigger
|
|
||||||
provided by snipMate plugin
|
|
||||||
(http://www.vim.org/scripts/script.php?script_id=2540) and expand it.
|
|
||||||
|
|
||||||
|
|
||||||
To enable auto-popup for this completion, add following function to
|
|
||||||
plugin/snipMate.vim:
|
|
||||||
>
|
|
||||||
fun! GetSnipsInCurrentScope()
|
|
||||||
let snips = {}
|
|
||||||
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
|
|
||||||
call extend(snips, get(s:snippets, scope, {}), 'keep')
|
|
||||||
call extend(snips, get(s:multi_snips, scope, {}), 'keep')
|
|
||||||
endfor
|
|
||||||
return snips
|
|
||||||
endf
|
|
||||||
<
|
|
||||||
And set |g:acp_behaviorSnipmateLength| option to 1.
|
|
||||||
|
|
||||||
There is the restriction on this auto-popup, that the word before cursor must
|
|
||||||
consist only of uppercase characters.
|
|
||||||
|
|
||||||
*acp-perl-omni*
|
|
||||||
Perl Omni-Completion ~
|
|
||||||
|
|
||||||
AutoComplPop supports perl-completion.vim
|
|
||||||
(http://www.vim.org/scripts/script.php?script_id=2852).
|
|
||||||
|
|
||||||
To enable auto-popup for this completion, set |g:acp_behaviorPerlOmniLength|
|
|
||||||
option to 0 or more.
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
|
|
@ -1,431 +0,0 @@
|
|||||||
"=============================================================================
|
|
||||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
|
||||||
"
|
|
||||||
"=============================================================================
|
|
||||||
" LOAD GUARD {{{1
|
|
||||||
|
|
||||||
if exists('g:loaded_autoload_acp') || v:version < 702
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:loaded_autoload_acp = 1
|
|
||||||
|
|
||||||
" }}}1
|
|
||||||
"=============================================================================
|
|
||||||
" GLOBAL FUNCTIONS: {{{1
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#enable()
|
|
||||||
call acp#disable()
|
|
||||||
|
|
||||||
augroup AcpGlobalAutoCommand
|
|
||||||
autocmd!
|
|
||||||
autocmd InsertEnter * unlet! s:posLast s:lastUncompletable
|
|
||||||
autocmd InsertLeave * call s:finishPopup(1)
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
if g:acp_mappingDriven
|
|
||||||
call s:mapForMappingDriven()
|
|
||||||
else
|
|
||||||
autocmd AcpGlobalAutoCommand CursorMovedI * call s:feedPopup()
|
|
||||||
endif
|
|
||||||
|
|
||||||
nnoremap <silent> i i<C-r>=<SID>feedPopup()<CR>
|
|
||||||
nnoremap <silent> a a<C-r>=<SID>feedPopup()<CR>
|
|
||||||
nnoremap <silent> R R<C-r>=<SID>feedPopup()<CR>
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#disable()
|
|
||||||
call s:unmapForMappingDriven()
|
|
||||||
augroup AcpGlobalAutoCommand
|
|
||||||
autocmd!
|
|
||||||
augroup END
|
|
||||||
nnoremap i <Nop> | nunmap i
|
|
||||||
nnoremap a <Nop> | nunmap a
|
|
||||||
nnoremap R <Nop> | nunmap R
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#lock()
|
|
||||||
let s:lockCount += 1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#unlock()
|
|
||||||
let s:lockCount -= 1
|
|
||||||
if s:lockCount < 0
|
|
||||||
let s:lockCount = 0
|
|
||||||
throw "AutoComplPop: not locked"
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#meetsForSnipmate(context)
|
|
||||||
if g:acp_behaviorSnipmateLength < 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
let matches = matchlist(a:context, '\(^\|\s\|\<\)\(\u\{' .
|
|
||||||
\ g:acp_behaviorSnipmateLength . ',}\)$')
|
|
||||||
return !empty(matches) && !empty(s:getMatchingSnipItems(matches[2]))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#meetsForKeyword(context)
|
|
||||||
if g:acp_behaviorKeywordLength < 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
let matches = matchlist(a:context, '\(\k\{' . g:acp_behaviorKeywordLength . ',}\)$')
|
|
||||||
if empty(matches)
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
for ignore in g:acp_behaviorKeywordIgnores
|
|
||||||
if stridx(ignore, matches[1]) == 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#meetsForFile(context)
|
|
||||||
if g:acp_behaviorFileLength < 0
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
if has('win32') || has('win64')
|
|
||||||
let separator = '[/\\]'
|
|
||||||
else
|
|
||||||
let separator = '\/'
|
|
||||||
endif
|
|
||||||
if a:context !~ '\f' . separator . '\f\{' . g:acp_behaviorFileLength . ',}$'
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
return a:context !~ '[*/\\][/\\]\f*$\|[^[:print:]]\f*$'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#meetsForRubyOmni(context)
|
|
||||||
if !has('ruby')
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
if g:acp_behaviorRubyOmniMethodLength >= 0 &&
|
|
||||||
\ a:context =~ '[^. \t]\(\.\|::\)\k\{' .
|
|
||||||
\ g:acp_behaviorRubyOmniMethodLength . ',}$'
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
if g:acp_behaviorRubyOmniSymbolLength >= 0 &&
|
|
||||||
\ a:context =~ '\(^\|[^:]\):\k\{' .
|
|
||||||
\ g:acp_behaviorRubyOmniSymbolLength . ',}$'
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#meetsForPythonOmni(context)
|
|
||||||
return has('python') && g:acp_behaviorPythonOmniLength >= 0 &&
|
|
||||||
\ a:context =~ '\k\.\k\{' . g:acp_behaviorPythonOmniLength . ',}$'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#meetsForPerlOmni(context)
|
|
||||||
return g:acp_behaviorPerlOmniLength >= 0 &&
|
|
||||||
\ a:context =~ '\w->\k\{' . g:acp_behaviorPerlOmniLength . ',}$'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#meetsForXmlOmni(context)
|
|
||||||
return g:acp_behaviorXmlOmniLength >= 0 &&
|
|
||||||
\ a:context =~ '\(<\|<\/\|<[^>]\+ \|<[^>]\+=\"\)\k\{' .
|
|
||||||
\ g:acp_behaviorXmlOmniLength . ',}$'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#meetsForHtmlOmni(context)
|
|
||||||
return g:acp_behaviorHtmlOmniLength >= 0 &&
|
|
||||||
\ a:context =~ '\(<\|<\/\|<[^>]\+ \|<[^>]\+=\"\)\k\{' .
|
|
||||||
\ g:acp_behaviorHtmlOmniLength . ',}$'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#meetsForCssOmni(context)
|
|
||||||
if g:acp_behaviorCssOmniPropertyLength >= 0 &&
|
|
||||||
\ a:context =~ '\(^\s\|[;{]\)\s*\k\{' .
|
|
||||||
\ g:acp_behaviorCssOmniPropertyLength . ',}$'
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
if g:acp_behaviorCssOmniValueLength >= 0 &&
|
|
||||||
\ a:context =~ '[:@!]\s*\k\{' .
|
|
||||||
\ g:acp_behaviorCssOmniValueLength . ',}$'
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#completeSnipmate(findstart, base)
|
|
||||||
if a:findstart
|
|
||||||
let s:posSnipmateCompletion = len(matchstr(s:getCurrentText(), '.*\U'))
|
|
||||||
return s:posSnipmateCompletion
|
|
||||||
endif
|
|
||||||
let lenBase = len(a:base)
|
|
||||||
let items = filter(GetSnipsInCurrentScope(),
|
|
||||||
\ 'strpart(v:key, 0, lenBase) ==? a:base')
|
|
||||||
return map(sort(items(items)), 's:makeSnipmateItem(v:val[0], v:val[1])')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#onPopupCloseSnipmate()
|
|
||||||
let word = s:getCurrentText()[s:posSnipmateCompletion :]
|
|
||||||
for trigger in keys(GetSnipsInCurrentScope())
|
|
||||||
if word ==# trigger
|
|
||||||
call feedkeys("\<C-r>=TriggerSnippet()\<CR>", "n")
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#onPopupPost()
|
|
||||||
" to clear <C-r>= expression on command-line
|
|
||||||
echo ''
|
|
||||||
if pumvisible()
|
|
||||||
inoremap <silent> <expr> <C-h> acp#onBs()
|
|
||||||
inoremap <silent> <expr> <BS> acp#onBs()
|
|
||||||
" a command to restore to original text and select the first match
|
|
||||||
return (s:behavsCurrent[s:iBehavs].command =~# "\<C-p>" ? "\<C-n>\<Up>"
|
|
||||||
\ : "\<C-p>\<Down>")
|
|
||||||
endif
|
|
||||||
let s:iBehavs += 1
|
|
||||||
if len(s:behavsCurrent) > s:iBehavs
|
|
||||||
call s:setCompletefunc()
|
|
||||||
return printf("\<C-e>%s\<C-r>=acp#onPopupPost()\<CR>",
|
|
||||||
\ s:behavsCurrent[s:iBehavs].command)
|
|
||||||
else
|
|
||||||
let s:lastUncompletable = {
|
|
||||||
\ 'word': s:getCurrentWord(),
|
|
||||||
\ 'commands': map(copy(s:behavsCurrent), 'v:val.command')[1:],
|
|
||||||
\ }
|
|
||||||
call s:finishPopup(0)
|
|
||||||
return "\<C-e>"
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function acp#onBs()
|
|
||||||
" using "matchstr" and not "strpart" in order to handle multi-byte
|
|
||||||
" characters
|
|
||||||
if call(s:behavsCurrent[s:iBehavs].meets,
|
|
||||||
\ [matchstr(s:getCurrentText(), '.*\ze.')])
|
|
||||||
return "\<BS>"
|
|
||||||
endif
|
|
||||||
return "\<C-e>\<BS>"
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" }}}1
|
|
||||||
"=============================================================================
|
|
||||||
" LOCAL FUNCTIONS: {{{1
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:mapForMappingDriven()
|
|
||||||
call s:unmapForMappingDriven()
|
|
||||||
let s:keysMappingDriven = [
|
|
||||||
\ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
|
|
||||||
\ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
|
||||||
\ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
|
||||||
\ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
|
||||||
\ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
|
||||||
\ '-', '_', '~', '^', '.', ',', ':', '!', '#', '=', '%', '$', '@', '<', '>', '/', '\',
|
|
||||||
\ '<Space>', '<C-h>', '<BS>', ]
|
|
||||||
for key in s:keysMappingDriven
|
|
||||||
execute printf('inoremap <silent> %s %s<C-r>=<SID>feedPopup()<CR>',
|
|
||||||
\ key, key)
|
|
||||||
endfor
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:unmapForMappingDriven()
|
|
||||||
if !exists('s:keysMappingDriven')
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
for key in s:keysMappingDriven
|
|
||||||
execute 'iunmap ' . key
|
|
||||||
endfor
|
|
||||||
let s:keysMappingDriven = []
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:setTempOption(group, name, value)
|
|
||||||
call extend(s:tempOptionSet[a:group], { a:name : eval('&' . a:name) }, 'keep')
|
|
||||||
execute printf('let &%s = a:value', a:name)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:restoreTempOptions(group)
|
|
||||||
for [name, value] in items(s:tempOptionSet[a:group])
|
|
||||||
execute printf('let &%s = value', name)
|
|
||||||
endfor
|
|
||||||
let s:tempOptionSet[a:group] = {}
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:getCurrentWord()
|
|
||||||
return matchstr(s:getCurrentText(), '\k*$')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:getCurrentText()
|
|
||||||
return strpart(getline('.'), 0, col('.') - 1)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:getPostText()
|
|
||||||
return strpart(getline('.'), col('.') - 1)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:isModifiedSinceLastCall()
|
|
||||||
if exists('s:posLast')
|
|
||||||
let posPrev = s:posLast
|
|
||||||
let nLinesPrev = s:nLinesLast
|
|
||||||
let textPrev = s:textLast
|
|
||||||
endif
|
|
||||||
let s:posLast = getpos('.')
|
|
||||||
let s:nLinesLast = line('$')
|
|
||||||
let s:textLast = getline('.')
|
|
||||||
if !exists('posPrev')
|
|
||||||
return 1
|
|
||||||
elseif posPrev[1] != s:posLast[1] || nLinesPrev != s:nLinesLast
|
|
||||||
return (posPrev[1] - s:posLast[1] == nLinesPrev - s:nLinesLast)
|
|
||||||
elseif textPrev ==# s:textLast
|
|
||||||
return 0
|
|
||||||
elseif posPrev[2] > s:posLast[2]
|
|
||||||
return 1
|
|
||||||
elseif has('gui_running') && has('multi_byte')
|
|
||||||
" NOTE: auto-popup causes a strange behavior when IME/XIM is working
|
|
||||||
return posPrev[2] + 1 == s:posLast[2]
|
|
||||||
endif
|
|
||||||
return posPrev[2] != s:posLast[2]
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:makeCurrentBehaviorSet()
|
|
||||||
let modified = s:isModifiedSinceLastCall()
|
|
||||||
if exists('s:behavsCurrent[s:iBehavs].repeat') && s:behavsCurrent[s:iBehavs].repeat
|
|
||||||
let behavs = [ s:behavsCurrent[s:iBehavs] ]
|
|
||||||
elseif exists('s:behavsCurrent[s:iBehavs]')
|
|
||||||
return []
|
|
||||||
elseif modified
|
|
||||||
let behavs = copy(exists('g:acp_behavior[&filetype]')
|
|
||||||
\ ? g:acp_behavior[&filetype]
|
|
||||||
\ : g:acp_behavior['*'])
|
|
||||||
else
|
|
||||||
return []
|
|
||||||
endif
|
|
||||||
let text = s:getCurrentText()
|
|
||||||
call filter(behavs, 'call(v:val.meets, [text])')
|
|
||||||
let s:iBehavs = 0
|
|
||||||
if exists('s:lastUncompletable') &&
|
|
||||||
\ stridx(s:getCurrentWord(), s:lastUncompletable.word) == 0 &&
|
|
||||||
\ map(copy(behavs), 'v:val.command') ==# s:lastUncompletable.commands
|
|
||||||
let behavs = []
|
|
||||||
else
|
|
||||||
unlet! s:lastUncompletable
|
|
||||||
endif
|
|
||||||
return behavs
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:feedPopup()
|
|
||||||
" NOTE: CursorMovedI is not triggered while the popup menu is visible. And
|
|
||||||
" it will be triggered when popup menu is disappeared.
|
|
||||||
if s:lockCount > 0 || pumvisible() || &paste
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
if exists('s:behavsCurrent[s:iBehavs].onPopupClose')
|
|
||||||
if !call(s:behavsCurrent[s:iBehavs].onPopupClose, [])
|
|
||||||
call s:finishPopup(1)
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
let s:behavsCurrent = s:makeCurrentBehaviorSet()
|
|
||||||
if empty(s:behavsCurrent)
|
|
||||||
call s:finishPopup(1)
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
" In case of dividing words by symbols (e.g. "for(int", "ab==cd") while a
|
|
||||||
" popup menu is visible, another popup is not available unless input <C-e>
|
|
||||||
" or try popup once. So first completion is duplicated.
|
|
||||||
call insert(s:behavsCurrent, s:behavsCurrent[s:iBehavs])
|
|
||||||
call s:setTempOption(s:GROUP0, 'spell', 0)
|
|
||||||
call s:setTempOption(s:GROUP0, 'completeopt', 'menuone' . (g:acp_completeoptPreview ? ',preview' : ''))
|
|
||||||
call s:setTempOption(s:GROUP0, 'complete', g:acp_completeOption)
|
|
||||||
call s:setTempOption(s:GROUP0, 'ignorecase', g:acp_ignorecaseOption)
|
|
||||||
" NOTE: With CursorMovedI driven, Set 'lazyredraw' to avoid flickering.
|
|
||||||
" With Mapping driven, set 'nolazyredraw' to make a popup menu visible.
|
|
||||||
call s:setTempOption(s:GROUP0, 'lazyredraw', !g:acp_mappingDriven)
|
|
||||||
" NOTE: 'textwidth' must be restored after <C-e>.
|
|
||||||
call s:setTempOption(s:GROUP1, 'textwidth', 0)
|
|
||||||
call s:setCompletefunc()
|
|
||||||
call feedkeys(s:behavsCurrent[s:iBehavs].command . "\<C-r>=acp#onPopupPost()\<CR>", 'n')
|
|
||||||
return '' " this function is called by <C-r>=
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:finishPopup(fGroup1)
|
|
||||||
inoremap <C-h> <Nop> | iunmap <C-h>
|
|
||||||
inoremap <BS> <Nop> | iunmap <BS>
|
|
||||||
let s:behavsCurrent = []
|
|
||||||
call s:restoreTempOptions(s:GROUP0)
|
|
||||||
if a:fGroup1
|
|
||||||
call s:restoreTempOptions(s:GROUP1)
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:setCompletefunc()
|
|
||||||
if exists('s:behavsCurrent[s:iBehavs].completefunc')
|
|
||||||
call s:setTempOption(0, 'completefunc', s:behavsCurrent[s:iBehavs].completefunc)
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:makeSnipmateItem(key, snip)
|
|
||||||
if type(a:snip) == type([])
|
|
||||||
let descriptions = map(copy(a:snip), 'v:val[0]')
|
|
||||||
let snipFormatted = '[MULTI] ' . join(descriptions, ', ')
|
|
||||||
else
|
|
||||||
let snipFormatted = substitute(a:snip, '\(\n\|\s\)\+', ' ', 'g')
|
|
||||||
endif
|
|
||||||
return {
|
|
||||||
\ 'word': a:key,
|
|
||||||
\ 'menu': strpart(snipFormatted, 0, 80),
|
|
||||||
\ }
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:getMatchingSnipItems(base)
|
|
||||||
let key = a:base . "\n"
|
|
||||||
if !exists('s:snipItems[key]')
|
|
||||||
let s:snipItems[key] = items(GetSnipsInCurrentScope())
|
|
||||||
call filter(s:snipItems[key], 'strpart(v:val[0], 0, len(a:base)) ==? a:base')
|
|
||||||
call map(s:snipItems[key], 's:makeSnipmateItem(v:val[0], v:val[1])')
|
|
||||||
endif
|
|
||||||
return s:snipItems[key]
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" }}}1
|
|
||||||
"=============================================================================
|
|
||||||
" INITIALIZATION {{{1
|
|
||||||
|
|
||||||
let s:GROUP0 = 0
|
|
||||||
let s:GROUP1 = 1
|
|
||||||
let s:lockCount = 0
|
|
||||||
let s:behavsCurrent = []
|
|
||||||
let s:iBehavs = 0
|
|
||||||
let s:tempOptionSet = [{}, {}]
|
|
||||||
let s:snipItems = {}
|
|
||||||
|
|
||||||
" }}}1
|
|
||||||
"=============================================================================
|
|
||||||
" vim: set fdm=marker:
|
|
@ -1,298 +0,0 @@
|
|||||||
*acp.txt* 補完メニューの自動ポップアップ
|
|
||||||
|
|
||||||
Copyright (c) 2007-2009 Takeshi NISHIDA
|
|
||||||
|
|
||||||
AutoComplPop *autocomplpop* *acp*
|
|
||||||
|
|
||||||
概要 |acp-introduction|
|
|
||||||
インストール |acp-installation|
|
|
||||||
使い方 |acp-usage|
|
|
||||||
コマンド |acp-commands|
|
|
||||||
オプション |acp-options|
|
|
||||||
SPECIAL THANKS |acp-thanks|
|
|
||||||
CHANGELOG |acp-changelog|
|
|
||||||
あばうと |acp-about|
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
概要 *acp-introduction*
|
|
||||||
|
|
||||||
このプラグインは、インサートモードで文字を入力したりカーソルを動かしたときに補
|
|
||||||
完メニューを自動的に開くようにします。しかし、続けて文字を入力するのを妨げたり
|
|
||||||
はしません。
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
インストール *acp-installation*
|
|
||||||
|
|
||||||
ZIPファイルをランタイムディレクトリに展開します。
|
|
||||||
|
|
||||||
以下のようにファイルが配置されるはずです。
|
|
||||||
>
|
|
||||||
<your runtime directory>/plugin/acp.vim
|
|
||||||
<your runtime directory>/doc/acp.txt
|
|
||||||
...
|
|
||||||
<
|
|
||||||
もしランタイムディレクトリが他のプラグインとごた混ぜになるのが嫌なら、ファイル
|
|
||||||
を新規ディレクトリに配置し、そのディレクトリのパスを 'runtimepath' に追加して
|
|
||||||
ください。アンインストールも楽になります。
|
|
||||||
|
|
||||||
その後 FuzzyFinder のヘルプを有効にするためにタグファイルを更新してください。
|
|
||||||
詳しくは|add-local-help|を参照してください。
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
使い方 *acp-usage*
|
|
||||||
|
|
||||||
このプラグインがインストールされていれば、自動ポップアップは vim の開始時から
|
|
||||||
有効になります。
|
|
||||||
|
|
||||||
カーソル直前のテキストに応じて、利用する補完の種類を切り替えます。デフォルトの
|
|
||||||
補完動作は次の通りです:
|
|
||||||
|
|
||||||
補完モード filetype カーソル直前のテキスト ~
|
|
||||||
キーワード補完 * 2文字のキーワード文字
|
|
||||||
ファイル名補完 * ファイル名文字 + パスセパレータ
|
|
||||||
+ 0文字以上のファイル名文字
|
|
||||||
オムニ補完 ruby ".", "::" or 単語を構成する文字以外 + ":"
|
|
||||||
オムニ補完 python "."
|
|
||||||
オムニ補完 xml "<", "</" or ("<" + ">"以外の文字列 + " ")
|
|
||||||
オムニ補完 html/xhtml "<", "</" or ("<" + ">"以外の文字列 + " ")
|
|
||||||
オムニ補完 css (":", ";", "{", "^", "@", or "!")
|
|
||||||
+ 0個または1個のスペース
|
|
||||||
|
|
||||||
さらに、設定を行うことで、ユーザー定義補完と snipMate トリガー補完
|
|
||||||
(|acp-snipMate|) を自動ポップアップさせることができます。
|
|
||||||
|
|
||||||
これらの補完動作はカスタマイズ可能です。
|
|
||||||
|
|
||||||
*acp-snipMate*
|
|
||||||
snipMate トリガー補完 ~
|
|
||||||
|
|
||||||
snipMate トリガー補完では、snipMate プラグイン
|
|
||||||
(http://www.vim.org/scripts/script.php?script_id=2540) が提供するスニペットの
|
|
||||||
トリガーを補完してそれを展開することができます。
|
|
||||||
|
|
||||||
この自動ポップアップを有効にするには、次の関数を plugin/snipMate.vim に追加す
|
|
||||||
る必要があります:
|
|
||||||
>
|
|
||||||
fun! GetSnipsInCurrentScope()
|
|
||||||
let snips = {}
|
|
||||||
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
|
|
||||||
call extend(snips, get(s:snippets, scope, {}), 'keep')
|
|
||||||
call extend(snips, get(s:multi_snips, scope, {}), 'keep')
|
|
||||||
endfor
|
|
||||||
return snips
|
|
||||||
endf
|
|
||||||
<
|
|
||||||
そして|g:acp_behaviorSnipmateLength|オプションを 1 にしてください。
|
|
||||||
|
|
||||||
この自動ポップアップには制限があり、カーソル直前の単語は大文字英字だけで構成さ
|
|
||||||
れていなければなりません。
|
|
||||||
|
|
||||||
*acp-perl-omni*
|
|
||||||
Perl オムニ補完 ~
|
|
||||||
|
|
||||||
AutoComplPop は perl-completion.vim
|
|
||||||
(http://www.vim.org/scripts/script.php?script_id=2852) をサポートしています。
|
|
||||||
|
|
||||||
この自動ポップアップを有効にするには、|g:acp_behaviorPerlOmniLength|オプション
|
|
||||||
を 0 以上にしてください。
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
コマンド *acp-commands*
|
|
||||||
|
|
||||||
*:AcpEnable*
|
|
||||||
:AcpEnable
|
|
||||||
自動ポップアップを有効にします。
|
|
||||||
|
|
||||||
*:AcpDisable*
|
|
||||||
:AcpDisable
|
|
||||||
自動ポップアップを無効にします。
|
|
||||||
|
|
||||||
*:AcpLock*
|
|
||||||
:AcpLock
|
|
||||||
自動ポップアップを一時的に停止します。
|
|
||||||
|
|
||||||
別のスクリプトへの干渉を回避する目的なら、このコマンドと|:AcpUnlock|
|
|
||||||
を利用することを、|:AcpDisable|と|:AcpEnable| を利用するよりも推奨しま
|
|
||||||
す。
|
|
||||||
|
|
||||||
*:AcpUnlock*
|
|
||||||
:AcpUnlock
|
|
||||||
|:AcpLock| で停止された自動ポップアップを再開します。
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
オプション *acp-options*
|
|
||||||
|
|
||||||
*g:acp_enableAtStartup* >
|
|
||||||
let g:acp_enableAtStartup = 1
|
|
||||||
<
|
|
||||||
真なら vim 開始時から自動ポップアップが有効になります。
|
|
||||||
|
|
||||||
*g:acp_mappingDriven* >
|
|
||||||
let g:acp_mappingDriven = 0
|
|
||||||
<
|
|
||||||
真なら|CursorMovedI|イベントではなくキーマッピングで自動ポップアップを
|
|
||||||
行うようにします。カーソルを移動するたびに補完が行われることで重いなど
|
|
||||||
の不都合がある場合に利用してください。ただし他のプラグインとの相性問題
|
|
||||||
や日本語入力での不具合が発生する可能性があります。(逆も然り。)
|
|
||||||
|
|
||||||
*g:acp_ignorecaseOption* >
|
|
||||||
let g:acp_ignorecaseOption = 1
|
|
||||||
<
|
|
||||||
自動ポップアップ時に、'ignorecase' に一時的に設定する値
|
|
||||||
|
|
||||||
*g:acp_completeOption* >
|
|
||||||
let g:acp_completeOption = '.,w,b,k'
|
|
||||||
<
|
|
||||||
自動ポップアップ時に、'complete' に一時的に設定する値
|
|
||||||
|
|
||||||
*g:acp_completeoptPreview* >
|
|
||||||
let g:acp_completeoptPreview = 0
|
|
||||||
<
|
|
||||||
真なら自動ポップアップ時に、 'completeopt' へ "preview" を追加します。
|
|
||||||
|
|
||||||
*g:acp_behaviorUserDefinedFunction* >
|
|
||||||
let g:acp_behaviorUserDefinedFunction = ''
|
|
||||||
<
|
|
||||||
ユーザー定義補完の|g:acp_behavior-completefunc|。空ならこの補完は行わ
|
|
||||||
れません。。
|
|
||||||
|
|
||||||
*g:acp_behaviorUserDefinedMeets* >
|
|
||||||
let g:acp_behaviorUserDefinedMeets = ''
|
|
||||||
<
|
|
||||||
ユーザー定義補完の|g:acp_behavior-meets|。空ならこの補完は行われません
|
|
||||||
。
|
|
||||||
|
|
||||||
*g:acp_behaviorSnipmateLength* >
|
|
||||||
let g:acp_behaviorSnipmateLength = -1
|
|
||||||
<
|
|
||||||
snipMate トリガー補完の自動ポップアップを行うのに必要なカーソルの直前
|
|
||||||
のパターン。
|
|
||||||
|
|
||||||
*g:acp_behaviorKeywordCommand* >
|
|
||||||
let g:acp_behaviorKeywordCommand = "\<C-n>"
|
|
||||||
<
|
|
||||||
キーワード補完のコマンド。このオプションには普通 "\<C-n>" か "\<C-p>"
|
|
||||||
を設定します。
|
|
||||||
|
|
||||||
*g:acp_behaviorKeywordLength* >
|
|
||||||
let g:acp_behaviorKeywordLength = 2
|
|
||||||
<
|
|
||||||
キーワード補完の自動ポップアップを行うのに必要なカーソルの直前のキーワ
|
|
||||||
ード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
*g:acp_behaviorKeywordIgnores* >
|
|
||||||
let g:acp_behaviorKeywordIgnores = []
|
|
||||||
<
|
|
||||||
文字列のリスト。カーソル直前の単語がこれらの内いずれかの先頭部分にマッ
|
|
||||||
チする場合、この補完は行われません。
|
|
||||||
|
|
||||||
例えば、 "get" で始まる補完キーワードが多過ぎて、"g", "ge", "get" を入
|
|
||||||
力したときの自動ポップアップがレスポンスの低下を引き起こしている場合、
|
|
||||||
このオプションに ["get"] を設定することでそれを回避することができます。
|
|
||||||
|
|
||||||
*g:acp_behaviorFileLength* >
|
|
||||||
let g:acp_behaviorFileLength = 0
|
|
||||||
<
|
|
||||||
ファイル名補完の自動ポップアップを行うのに必要なカーソルの直前のキーワ
|
|
||||||
ード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
*g:acp_behaviorRubyOmniMethodLength* >
|
|
||||||
let g:acp_behaviorRubyOmniMethodLength = 0
|
|
||||||
<
|
|
||||||
メソッド補完のための、Ruby オムニ補完の自動ポップアップを行うのに必要
|
|
||||||
なカーソルの直前のキーワード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
*g:acp_behaviorRubyOmniSymbolLength* >
|
|
||||||
let g:acp_behaviorRubyOmniSymbolLength = 1
|
|
||||||
<
|
|
||||||
シンボル補完のための、Ruby オムニ補完の自動ポップアップを行うのに必要
|
|
||||||
なカーソルの直前のキーワード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
*g:acp_behaviorPythonOmniLength* >
|
|
||||||
let g:acp_behaviorPythonOmniLength = 0
|
|
||||||
<
|
|
||||||
Python オムニ補完の自動ポップアップを行うのに必要なカーソルの直前のキ
|
|
||||||
ーワード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
*g:acp_behaviorPerlOmniLength* >
|
|
||||||
let g:acp_behaviorPerlOmniLength = -1
|
|
||||||
<
|
|
||||||
Perl オムニ補完の自動ポップアップを行うのに必要なカーソルの直前のキー
|
|
||||||
ワード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
See also: |acp-perl-omni|
|
|
||||||
|
|
||||||
*g:acp_behaviorXmlOmniLength* >
|
|
||||||
let g:acp_behaviorXmlOmniLength = 0
|
|
||||||
<
|
|
||||||
XML オムニ補完の自動ポップアップを行うのに必要なカーソルの直前のキーワ
|
|
||||||
ード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
*g:acp_behaviorHtmlOmniLength* >
|
|
||||||
let g:acp_behaviorHtmlOmniLength = 0
|
|
||||||
<
|
|
||||||
HTML オムニ補完の自動ポップアップを行うのに必要なカーソルの直前のキー
|
|
||||||
ワード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
*g:acp_behaviorCssOmniPropertyLength* >
|
|
||||||
let g:acp_behaviorCssOmniPropertyLength = 1
|
|
||||||
<
|
|
||||||
プロパティ補完のための、CSS オムニ補完の自動ポップアップを行うのに必要
|
|
||||||
なカーソルの直前のキーワード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
*g:acp_behaviorCssOmniValueLength* >
|
|
||||||
let g:acp_behaviorCssOmniValueLength = 0
|
|
||||||
<
|
|
||||||
値補完のための、CSS オムニ補完の自動ポップアップを行うのに必要なカーソ
|
|
||||||
ルの直前のキーワード文字数。負数ならこの補完は行われません。
|
|
||||||
|
|
||||||
*g:acp_behavior* >
|
|
||||||
let g:acp_behavior = {}
|
|
||||||
<
|
|
||||||
|
|
||||||
これは内部仕様がわかっている人向けのオプションで、他のオプションでの設
|
|
||||||
定より優先されます。
|
|
||||||
|
|
||||||
|Dictionary|型で、キーはファイルタイプに対応します。 '*' はデフォルト
|
|
||||||
を表します。値はリスト型です。補完候補が得られるまでリストの先頭アイテ
|
|
||||||
ムから順に評価します。各要素は|Dictionary|で詳細は次の通り:
|
|
||||||
|
|
||||||
"command": *g:acp_behavior-command*
|
|
||||||
補完メニューをポップアップするためのコマンド。
|
|
||||||
|
|
||||||
"completefunc": *g:acp_behavior-completefunc*
|
|
||||||
'completefunc' に設定する関数。 "command" が "<C-x><C-u>" のときだけ
|
|
||||||
意味があります。
|
|
||||||
|
|
||||||
"meets": *g:acp_behavior-meets*
|
|
||||||
この補完を行うかどうかを判断する関数の名前。この関数はカーソル直前の
|
|
||||||
テキストを引数に取り、補完を行うなら非 0 の値を返します。
|
|
||||||
|
|
||||||
"onPopupClose": *g:acp_behavior-onPopupClose*
|
|
||||||
この補完のポップアップメニューが閉じられたときに呼ばれる関数の名前。
|
|
||||||
この関数が 0 を返した場合、続いて行われる予定の補完は抑制されます。
|
|
||||||
|
|
||||||
"repeat": *g:acp_behavior-repeat*
|
|
||||||
真なら最後の補完が自動的に繰り返されます。
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
あばうと *acp-about* *acp-contact* *acp-author*
|
|
||||||
|
|
||||||
作者: Takeshi NISHIDA <ns9tks@DELETE-ME.gmail.com>
|
|
||||||
ライセンス: MIT Licence
|
|
||||||
URL: http://www.vim.org/scripts/script.php?script_id=1879
|
|
||||||
http://bitbucket.org/ns9tks/vim-autocomplpop/
|
|
||||||
|
|
||||||
バグや要望など ~
|
|
||||||
|
|
||||||
こちらへどうぞ: http://bitbucket.org/ns9tks/vim-autocomplpop/issues/
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
|
||||||
|
|
@ -1,512 +0,0 @@
|
|||||||
*acp.txt* Automatically opens popup menu for completions.
|
|
||||||
|
|
||||||
Copyright (c) 2007-2009 Takeshi NISHIDA
|
|
||||||
|
|
||||||
AutoComplPop *autocomplpop* *acp*
|
|
||||||
|
|
||||||
INTRODUCTION |acp-introduction|
|
|
||||||
INSTALLATION |acp-installation|
|
|
||||||
USAGE |acp-usage|
|
|
||||||
COMMANDS |acp-commands|
|
|
||||||
OPTIONS |acp-options|
|
|
||||||
SPECIAL THANKS |acp-thanks|
|
|
||||||
CHANGELOG |acp-changelog|
|
|
||||||
ABOUT |acp-about|
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
INTRODUCTION *acp-introduction*
|
|
||||||
|
|
||||||
With this plugin, your vim comes to automatically opens popup menu for
|
|
||||||
completions when you enter characters or move the cursor in Insert mode. It
|
|
||||||
won't prevent you continuing entering characters.
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
INSTALLATION *acp-installation*
|
|
||||||
|
|
||||||
Put all files into your runtime directory. If you have the zip file, extract
|
|
||||||
it to your runtime directory.
|
|
||||||
|
|
||||||
You should place the files as follows:
|
|
||||||
>
|
|
||||||
<your runtime directory>/plugin/acp.vim
|
|
||||||
<your runtime directory>/doc/acp.txt
|
|
||||||
...
|
|
||||||
<
|
|
||||||
If you disgust to jumble up this plugin and other plugins in your runtime
|
|
||||||
directory, put the files into new directory and just add the directory path to
|
|
||||||
'runtimepath'. It's easy to uninstall the plugin.
|
|
||||||
|
|
||||||
And then update your help tags files to enable fuzzyfinder help. See
|
|
||||||
|add-local-help| for details.
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
USAGE *acp-usage*
|
|
||||||
|
|
||||||
Once this plugin is installed, auto-popup is enabled at startup by default.
|
|
||||||
|
|
||||||
Which completion method is used depends on the text before the cursor. The
|
|
||||||
default behavior is as follows:
|
|
||||||
|
|
||||||
kind filetype text before the cursor ~
|
|
||||||
Keyword * two keyword characters
|
|
||||||
Filename * a filename character + a path separator
|
|
||||||
+ 0 or more filename character
|
|
||||||
Omni ruby ".", "::" or non-word character + ":"
|
|
||||||
(|+ruby| required.)
|
|
||||||
Omni python "." (|+python| required.)
|
|
||||||
Omni xml "<", "</" or ("<" + non-">" characters + " ")
|
|
||||||
Omni html/xhtml "<", "</" or ("<" + non-">" characters + " ")
|
|
||||||
Omni css (":", ";", "{", "^", "@", or "!")
|
|
||||||
+ 0 or 1 space
|
|
||||||
|
|
||||||
Also, you can make user-defined completion and snipMate's trigger completion
|
|
||||||
(|acp-snipMate|) auto-popup if the options are set.
|
|
||||||
|
|
||||||
These behavior are customizable.
|
|
||||||
|
|
||||||
*acp-snipMate*
|
|
||||||
snipMate's Trigger Completion ~
|
|
||||||
|
|
||||||
snipMate's trigger completion enables you to complete a snippet trigger
|
|
||||||
provided by snipMate plugin
|
|
||||||
(http://www.vim.org/scripts/script.php?script_id=2540) and expand it.
|
|
||||||
|
|
||||||
|
|
||||||
To enable auto-popup for this completion, add following function to
|
|
||||||
plugin/snipMate.vim:
|
|
||||||
>
|
|
||||||
fun! GetSnipsInCurrentScope()
|
|
||||||
let snips = {}
|
|
||||||
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
|
|
||||||
call extend(snips, get(s:snippets, scope, {}), 'keep')
|
|
||||||
call extend(snips, get(s:multi_snips, scope, {}), 'keep')
|
|
||||||
endfor
|
|
||||||
return snips
|
|
||||||
endf
|
|
||||||
<
|
|
||||||
And set |g:acp_behaviorSnipmateLength| option to 1.
|
|
||||||
|
|
||||||
There is the restriction on this auto-popup, that the word before cursor must
|
|
||||||
consist only of uppercase characters.
|
|
||||||
|
|
||||||
*acp-perl-omni*
|
|
||||||
Perl Omni-Completion ~
|
|
||||||
|
|
||||||
AutoComplPop supports perl-completion.vim
|
|
||||||
(http://www.vim.org/scripts/script.php?script_id=2852).
|
|
||||||
|
|
||||||
To enable auto-popup for this completion, set |g:acp_behaviorPerlOmniLength|
|
|
||||||
option to 0 or more.
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
COMMANDS *acp-commands*
|
|
||||||
|
|
||||||
*:AcpEnable*
|
|
||||||
:AcpEnable
|
|
||||||
enables auto-popup.
|
|
||||||
|
|
||||||
*:AcpDisable*
|
|
||||||
:AcpDisable
|
|
||||||
disables auto-popup.
|
|
||||||
|
|
||||||
*:AcpLock*
|
|
||||||
:AcpLock
|
|
||||||
suspends auto-popup temporarily.
|
|
||||||
|
|
||||||
For the purpose of avoiding interruption to another script, it is
|
|
||||||
recommended to insert this command and |:AcpUnlock| than |:AcpDisable|
|
|
||||||
and |:AcpEnable| .
|
|
||||||
|
|
||||||
*:AcpUnlock*
|
|
||||||
:AcpUnlock
|
|
||||||
resumes auto-popup suspended by |:AcpLock| .
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
OPTIONS *acp-options*
|
|
||||||
|
|
||||||
*g:acp_enableAtStartup* >
|
|
||||||
let g:acp_enableAtStartup = 1
|
|
||||||
<
|
|
||||||
If non-zero, auto-popup is enabled at startup.
|
|
||||||
|
|
||||||
*g:acp_mappingDriven* >
|
|
||||||
let g:acp_mappingDriven = 0
|
|
||||||
<
|
|
||||||
If non-zero, auto-popup is triggered by key mappings instead of
|
|
||||||
|CursorMovedI| event. This is useful to avoid auto-popup by moving
|
|
||||||
cursor in Insert mode.
|
|
||||||
|
|
||||||
*g:acp_ignorecaseOption* >
|
|
||||||
let g:acp_ignorecaseOption = 1
|
|
||||||
<
|
|
||||||
Value set to 'ignorecase' temporarily when auto-popup.
|
|
||||||
|
|
||||||
*g:acp_completeOption* >
|
|
||||||
let g:acp_completeOption = '.,w,b,k'
|
|
||||||
<
|
|
||||||
Value set to 'complete' temporarily when auto-popup.
|
|
||||||
|
|
||||||
*g:acp_completeoptPreview* >
|
|
||||||
let g:acp_completeoptPreview = 0
|
|
||||||
<
|
|
||||||
If non-zero, "preview" is added to 'completeopt' when auto-popup.
|
|
||||||
|
|
||||||
*g:acp_behaviorUserDefinedFunction* >
|
|
||||||
let g:acp_behaviorUserDefinedFunction = ''
|
|
||||||
<
|
|
||||||
|g:acp_behavior-completefunc| for user-defined completion. If empty,
|
|
||||||
this completion will be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorUserDefinedMeets* >
|
|
||||||
let g:acp_behaviorUserDefinedMeets = ''
|
|
||||||
<
|
|
||||||
|g:acp_behavior-meets| for user-defined completion. If empty, this
|
|
||||||
completion will be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorSnipmateLength* >
|
|
||||||
let g:acp_behaviorSnipmateLength = -1
|
|
||||||
<
|
|
||||||
Pattern before the cursor, which are needed to attempt
|
|
||||||
snipMate-trigger completion.
|
|
||||||
|
|
||||||
*g:acp_behaviorKeywordCommand* >
|
|
||||||
let g:acp_behaviorKeywordCommand = "\<C-n>"
|
|
||||||
<
|
|
||||||
Command for keyword completion. This option is usually set "\<C-n>" or
|
|
||||||
"\<C-p>".
|
|
||||||
|
|
||||||
*g:acp_behaviorKeywordLength* >
|
|
||||||
let g:acp_behaviorKeywordLength = 2
|
|
||||||
<
|
|
||||||
Length of keyword characters before the cursor, which are needed to
|
|
||||||
attempt keyword completion. If negative value, this completion will be
|
|
||||||
never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorKeywordIgnores* >
|
|
||||||
let g:acp_behaviorKeywordIgnores = []
|
|
||||||
<
|
|
||||||
List of string. If a word before the cursor matches to the front part
|
|
||||||
of one of them, keyword completion won't be attempted.
|
|
||||||
|
|
||||||
E.g., when there are too many keywords beginning with "get" for the
|
|
||||||
completion and auto-popup by entering "g", "ge", or "get" causes
|
|
||||||
response degradation, set ["get"] to this option and avoid it.
|
|
||||||
|
|
||||||
*g:acp_behaviorFileLength* >
|
|
||||||
let g:acp_behaviorFileLength = 0
|
|
||||||
<
|
|
||||||
Length of filename characters before the cursor, which are needed to
|
|
||||||
attempt filename completion. If negative value, this completion will
|
|
||||||
be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorRubyOmniMethodLength* >
|
|
||||||
let g:acp_behaviorRubyOmniMethodLength = 0
|
|
||||||
<
|
|
||||||
Length of keyword characters before the cursor, which are needed to
|
|
||||||
attempt ruby omni-completion for methods. If negative value, this
|
|
||||||
completion will be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorRubyOmniSymbolLength* >
|
|
||||||
let g:acp_behaviorRubyOmniSymbolLength = 1
|
|
||||||
<
|
|
||||||
Length of keyword characters before the cursor, which are needed to
|
|
||||||
attempt ruby omni-completion for symbols. If negative value, this
|
|
||||||
completion will be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorPythonOmniLength* >
|
|
||||||
let g:acp_behaviorPythonOmniLength = 0
|
|
||||||
<
|
|
||||||
Length of keyword characters before the cursor, which are needed to
|
|
||||||
attempt python omni-completion. If negative value, this completion
|
|
||||||
will be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorPerlOmniLength* >
|
|
||||||
let g:acp_behaviorPerlOmniLength = -1
|
|
||||||
<
|
|
||||||
Length of keyword characters before the cursor, which are needed to
|
|
||||||
attempt perl omni-completion. If negative value, this completion will
|
|
||||||
be never attempted.
|
|
||||||
|
|
||||||
See also: |acp-perl-omni|
|
|
||||||
|
|
||||||
*g:acp_behaviorXmlOmniLength* >
|
|
||||||
let g:acp_behaviorXmlOmniLength = 0
|
|
||||||
<
|
|
||||||
Length of keyword characters before the cursor, which are needed to
|
|
||||||
attempt XML omni-completion. If negative value, this completion will
|
|
||||||
be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorHtmlOmniLength* >
|
|
||||||
let g:acp_behaviorHtmlOmniLength = 0
|
|
||||||
<
|
|
||||||
Length of keyword characters before the cursor, which are needed to
|
|
||||||
attempt HTML omni-completion. If negative value, this completion will
|
|
||||||
be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorCssOmniPropertyLength* >
|
|
||||||
let g:acp_behaviorCssOmniPropertyLength = 1
|
|
||||||
<
|
|
||||||
Length of keyword characters before the cursor, which are needed to
|
|
||||||
attempt CSS omni-completion for properties. If negative value, this
|
|
||||||
completion will be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behaviorCssOmniValueLength* >
|
|
||||||
let g:acp_behaviorCssOmniValueLength = 0
|
|
||||||
<
|
|
||||||
Length of keyword characters before the cursor, which are needed to
|
|
||||||
attempt CSS omni-completion for values. If negative value, this
|
|
||||||
completion will be never attempted.
|
|
||||||
|
|
||||||
*g:acp_behavior* >
|
|
||||||
let g:acp_behavior = {}
|
|
||||||
<
|
|
||||||
This option is for advanced users. This setting overrides other
|
|
||||||
behavior options. This is a |Dictionary|. Each key corresponds to a
|
|
||||||
filetype. '*' is default. Each value is a list. These are attempted in
|
|
||||||
sequence until completion item is found. Each element is a
|
|
||||||
|Dictionary| which has following items:
|
|
||||||
|
|
||||||
"command": *g:acp_behavior-command*
|
|
||||||
Command to be fed to open popup menu for completions.
|
|
||||||
|
|
||||||
"completefunc": *g:acp_behavior-completefunc*
|
|
||||||
'completefunc' will be set to this user-provided function during the
|
|
||||||
completion. Only makes sense when "command" is "<C-x><C-u>".
|
|
||||||
|
|
||||||
"meets": *g:acp_behavior-meets*
|
|
||||||
Name of the function which dicides whether or not to attempt this
|
|
||||||
completion. It will be attempted if this function returns non-zero.
|
|
||||||
This function takes a text before the cursor.
|
|
||||||
|
|
||||||
"onPopupClose": *g:acp_behavior-onPopupClose*
|
|
||||||
Name of the function which is called when popup menu for this
|
|
||||||
completion is closed. Following completions will be suppressed if
|
|
||||||
this function returns zero.
|
|
||||||
|
|
||||||
"repeat": *g:acp_behavior-repeat*
|
|
||||||
If non-zero, the last completion is automatically repeated.
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
SPECIAL THANKS *acp-thanks*
|
|
||||||
|
|
||||||
- Daniel Schierbeck
|
|
||||||
- Ingo Karkat
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
CHANGELOG *acp-changelog*
|
|
||||||
|
|
||||||
2.14.1
|
|
||||||
- Changed the way of auto-popup for avoiding an issue about filename
|
|
||||||
completion.
|
|
||||||
- Fixed a bug that popup menu was opened twice when auto-popup was done.
|
|
||||||
|
|
||||||
2.14
|
|
||||||
- Added the support for perl-completion.vim.
|
|
||||||
|
|
||||||
2.13
|
|
||||||
- Changed to sort snipMate's triggers.
|
|
||||||
- Fixed a bug that a wasted character was inserted after snipMate's trigger
|
|
||||||
completion.
|
|
||||||
|
|
||||||
2.12.1
|
|
||||||
- Changed to avoid a strange behavior with Microsoft IME.
|
|
||||||
|
|
||||||
2.12
|
|
||||||
- Added g:acp_behaviorKeywordIgnores option.
|
|
||||||
- Added g:acp_behaviorUserDefinedMeets option and removed
|
|
||||||
g:acp_behaviorUserDefinedPattern.
|
|
||||||
- Changed to do auto-popup only when a buffer is modified.
|
|
||||||
- Changed the structure of g:acp_behavior option.
|
|
||||||
- Changed to reflect a change of behavior options (named g:acp_behavior*)
|
|
||||||
any time it is done.
|
|
||||||
- Fixed a bug that completions after omni completions or snipMate's trigger
|
|
||||||
completion were never attempted when no candidate for the former
|
|
||||||
completions was found.
|
|
||||||
|
|
||||||
2.11.1
|
|
||||||
- Fixed a bug that a snipMate's trigger could not be expanded when it was
|
|
||||||
completed.
|
|
||||||
|
|
||||||
2.11
|
|
||||||
- Implemented experimental feature which is snipMate's trigger completion.
|
|
||||||
|
|
||||||
2.10
|
|
||||||
- Improved the response by changing not to attempt any completion when
|
|
||||||
keyword characters are entered after a word which has been found that it
|
|
||||||
has no completion candidate at the last attempt of completions.
|
|
||||||
- Improved the response by changing to close popup menu when <BS> was
|
|
||||||
pressed and the text before the cursor would not match with the pattern of
|
|
||||||
current behavior.
|
|
||||||
|
|
||||||
2.9
|
|
||||||
- Changed default behavior to support XML omni completion.
|
|
||||||
- Changed default value of g:acp_behaviorKeywordCommand option.
|
|
||||||
The option with "\<C-p>" cause a problem which inserts a match without
|
|
||||||
<CR> when 'dictionary' has been set and keyword completion is done.
|
|
||||||
- Changed to show error message when incompatible with a installed vim.
|
|
||||||
|
|
||||||
2.8.1
|
|
||||||
- Fixed a bug which inserted a selected match to the next line when
|
|
||||||
auto-wrapping (enabled with 'formatoptions') was performed.
|
|
||||||
|
|
||||||
2.8
|
|
||||||
- Added g:acp_behaviorUserDefinedFunction option and
|
|
||||||
g:acp_behaviorUserDefinedPattern option for users who want to make custom
|
|
||||||
completion auto-popup.
|
|
||||||
- Fixed a bug that setting 'spell' on a new buffer made typing go crazy.
|
|
||||||
|
|
||||||
2.7
|
|
||||||
- Changed naming conventions for filenames, functions, commands, and options
|
|
||||||
and thus renamed them.
|
|
||||||
- Added g:acp_behaviorKeywordCommand option. If you prefer the previous
|
|
||||||
behavior for keyword completion, set this option "\<C-n>".
|
|
||||||
- Changed default value of g:acp_ignorecaseOption option.
|
|
||||||
|
|
||||||
The following were done by Ingo Karkat:
|
|
||||||
|
|
||||||
- ENH: Added support for setting a user-provided 'completefunc' during the
|
|
||||||
completion, configurable via g:acp_behavior.
|
|
||||||
- BUG: When the configured completion is <C-p> or <C-x><C-p>, the command to
|
|
||||||
restore the original text (in on_popup_post()) must be reverted, too.
|
|
||||||
- BUG: When using a custom completion function (<C-x><C-u>) that also uses
|
|
||||||
an s:...() function name, the s:GetSidPrefix() function dynamically
|
|
||||||
determines the wrong SID. Now calling s:DetermineSidPrefix() once during
|
|
||||||
sourcing and caching the value in s:SID.
|
|
||||||
- BUG: Should not use custom defined <C-X><C-...> completion mappings. Now
|
|
||||||
consistently using unmapped completion commands everywhere. (Beforehand,
|
|
||||||
s:PopupFeeder.feed() used mappings via feedkeys(..., 'm'), but
|
|
||||||
s:PopupFeeder.on_popup_post() did not due to its invocation via
|
|
||||||
:map-expr.)
|
|
||||||
|
|
||||||
2.6:
|
|
||||||
- Improved the behavior of omni completion for HTML/XHTML.
|
|
||||||
|
|
||||||
2.5:
|
|
||||||
- Added some options to customize behavior easily:
|
|
||||||
g:AutoComplPop_BehaviorKeywordLength
|
|
||||||
g:AutoComplPop_BehaviorFileLength
|
|
||||||
g:AutoComplPop_BehaviorRubyOmniMethodLength
|
|
||||||
g:AutoComplPop_BehaviorRubyOmniSymbolLength
|
|
||||||
g:AutoComplPop_BehaviorPythonOmniLength
|
|
||||||
g:AutoComplPop_BehaviorHtmlOmniLength
|
|
||||||
g:AutoComplPop_BehaviorCssOmniPropertyLength
|
|
||||||
g:AutoComplPop_BehaviorCssOmniValueLength
|
|
||||||
|
|
||||||
2.4:
|
|
||||||
- Added g:AutoComplPop_MappingDriven option.
|
|
||||||
|
|
||||||
2.3.1:
|
|
||||||
- Changed to set 'lazyredraw' while a popup menu is visible to avoid
|
|
||||||
flickering.
|
|
||||||
- Changed a behavior for CSS.
|
|
||||||
- Added support for GetLatestVimScripts.
|
|
||||||
|
|
||||||
2.3:
|
|
||||||
- Added a behavior for Python to support omni completion.
|
|
||||||
- Added a behavior for CSS to support omni completion.
|
|
||||||
|
|
||||||
2.2:
|
|
||||||
- Changed not to work when 'paste' option is set.
|
|
||||||
- Fixed AutoComplPopEnable command and AutoComplPopDisable command to
|
|
||||||
map/unmap "i" and "R".
|
|
||||||
|
|
||||||
2.1:
|
|
||||||
- Fixed the problem caused by "." command in Normal mode.
|
|
||||||
- Changed to map "i" and "R" to feed completion command after starting
|
|
||||||
Insert mode.
|
|
||||||
- Avoided the problem caused by Windows IME.
|
|
||||||
|
|
||||||
2.0:
|
|
||||||
- Changed to use CursorMovedI event to feed a completion command instead of
|
|
||||||
key mapping. Now the auto-popup is triggered by moving the cursor.
|
|
||||||
- Changed to feed completion command after starting Insert mode.
|
|
||||||
- Removed g:AutoComplPop_MapList option.
|
|
||||||
|
|
||||||
1.7:
|
|
||||||
- Added behaviors for HTML/XHTML. Now supports the omni completion for
|
|
||||||
HTML/XHTML.
|
|
||||||
- Changed not to show expressions for CTRL-R =.
|
|
||||||
- Changed not to set 'nolazyredraw' while a popup menu is visible.
|
|
||||||
|
|
||||||
1.6.1:
|
|
||||||
- Changed not to trigger the filename completion by a text which has
|
|
||||||
multi-byte characters.
|
|
||||||
|
|
||||||
1.6:
|
|
||||||
- Redesigned g:AutoComplPop_Behavior option.
|
|
||||||
- Changed default value of g:AutoComplPop_CompleteOption option.
|
|
||||||
- Changed default value of g:AutoComplPop_MapList option.
|
|
||||||
|
|
||||||
1.5:
|
|
||||||
- Implemented continuous-completion for the filename completion. And added
|
|
||||||
new option to g:AutoComplPop_Behavior.
|
|
||||||
|
|
||||||
1.4:
|
|
||||||
- Fixed the bug that the auto-popup was not suspended in fuzzyfinder.
|
|
||||||
- Fixed the bug that an error has occurred with Ruby-omni-completion unless
|
|
||||||
Ruby interface.
|
|
||||||
|
|
||||||
1.3:
|
|
||||||
- Supported Ruby-omni-completion by default.
|
|
||||||
- Supported filename completion by default.
|
|
||||||
- Added g:AutoComplPop_Behavior option.
|
|
||||||
- Added g:AutoComplPop_CompleteoptPreview option.
|
|
||||||
- Removed g:AutoComplPop_MinLength option.
|
|
||||||
- Removed g:AutoComplPop_MaxLength option.
|
|
||||||
- Removed g:AutoComplPop_PopupCmd option.
|
|
||||||
|
|
||||||
1.2:
|
|
||||||
- Fixed bugs related to 'completeopt'.
|
|
||||||
|
|
||||||
1.1:
|
|
||||||
- Added g:AutoComplPop_IgnoreCaseOption option.
|
|
||||||
- Added g:AutoComplPop_NotEnableAtStartup option.
|
|
||||||
- Removed g:AutoComplPop_LoadAndEnable option.
|
|
||||||
1.0:
|
|
||||||
- g:AutoComplPop_LoadAndEnable option for a startup activation is added.
|
|
||||||
- AutoComplPopLock command and AutoComplPopUnlock command are added to
|
|
||||||
suspend and resume.
|
|
||||||
- 'completeopt' and 'complete' options are changed temporarily while
|
|
||||||
completing by this script.
|
|
||||||
|
|
||||||
0.4:
|
|
||||||
- The first match are selected when the popup menu is Opened. You can insert
|
|
||||||
the first match with CTRL-Y.
|
|
||||||
|
|
||||||
0.3:
|
|
||||||
- Fixed the problem that the original text is not restored if 'longest' is
|
|
||||||
not set in 'completeopt'. Now the plugin works whether or not 'longest' is
|
|
||||||
set in 'completeopt', and also 'menuone'.
|
|
||||||
|
|
||||||
0.2:
|
|
||||||
- When completion matches are not found, insert CTRL-E to stop completion.
|
|
||||||
- Clear the echo area.
|
|
||||||
- Fixed the problem in case of dividing words by symbols, popup menu is
|
|
||||||
not opened.
|
|
||||||
|
|
||||||
0.1:
|
|
||||||
- First release.
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
ABOUT *acp-about* *acp-contact* *acp-author*
|
|
||||||
|
|
||||||
Author: Takeshi NISHIDA <ns9tks@DELETE-ME.gmail.com>
|
|
||||||
Licence: MIT Licence
|
|
||||||
URL: http://www.vim.org/scripts/script.php?script_id=1879
|
|
||||||
http://bitbucket.org/ns9tks/vim-autocomplpop/
|
|
||||||
|
|
||||||
Bugs/Issues/Suggestions/Improvements ~
|
|
||||||
|
|
||||||
Please submit to http://bitbucket.org/ns9tks/vim-autocomplpop/issues/ .
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
|||||||
"=============================================================================
|
|
||||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
|
||||||
"
|
|
||||||
" GetLatestVimScripts: 1879 1 :AutoInstall: AutoComplPop
|
|
||||||
"=============================================================================
|
|
||||||
" LOAD GUARD {{{1
|
|
||||||
|
|
||||||
if exists('g:loaded_acp')
|
|
||||||
finish
|
|
||||||
elseif v:version < 702
|
|
||||||
echoerr 'AutoComplPop does not support this version of vim (' . v:version . ').'
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:loaded_acp = 1
|
|
||||||
|
|
||||||
" }}}1
|
|
||||||
"=============================================================================
|
|
||||||
" FUNCTION: {{{1
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:defineOption(name, default)
|
|
||||||
if !exists(a:name)
|
|
||||||
let {a:name} = a:default
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"
|
|
||||||
function s:makeDefaultBehavior()
|
|
||||||
let behavs = {
|
|
||||||
\ '*' : [],
|
|
||||||
\ 'ruby' : [],
|
|
||||||
\ 'python' : [],
|
|
||||||
\ 'perl' : [],
|
|
||||||
\ 'xml' : [],
|
|
||||||
\ 'html' : [],
|
|
||||||
\ 'xhtml' : [],
|
|
||||||
\ 'css' : [],
|
|
||||||
\ }
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
if !empty(g:acp_behaviorUserDefinedFunction) &&
|
|
||||||
\ !empty(g:acp_behaviorUserDefinedMeets)
|
|
||||||
for key in keys(behavs)
|
|
||||||
call add(behavs[key], {
|
|
||||||
\ 'command' : "\<C-x>\<C-u>",
|
|
||||||
\ 'completefunc' : g:acp_behaviorUserDefinedFunction,
|
|
||||||
\ 'meets' : g:acp_behaviorUserDefinedMeets,
|
|
||||||
\ 'repeat' : 0,
|
|
||||||
\ })
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
for key in keys(behavs)
|
|
||||||
call add(behavs[key], {
|
|
||||||
\ 'command' : "\<C-x>\<C-u>",
|
|
||||||
\ 'completefunc' : 'acp#completeSnipmate',
|
|
||||||
\ 'meets' : 'acp#meetsForSnipmate',
|
|
||||||
\ 'onPopupClose' : 'acp#onPopupCloseSnipmate',
|
|
||||||
\ 'repeat' : 0,
|
|
||||||
\ })
|
|
||||||
endfor
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
for key in keys(behavs)
|
|
||||||
call add(behavs[key], {
|
|
||||||
\ 'command' : g:acp_behaviorKeywordCommand,
|
|
||||||
\ 'meets' : 'acp#meetsForKeyword',
|
|
||||||
\ 'repeat' : 0,
|
|
||||||
\ })
|
|
||||||
endfor
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
for key in keys(behavs)
|
|
||||||
call add(behavs[key], {
|
|
||||||
\ 'command' : "\<C-x>\<C-f>",
|
|
||||||
\ 'meets' : 'acp#meetsForFile',
|
|
||||||
\ 'repeat' : 1,
|
|
||||||
\ })
|
|
||||||
endfor
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
call add(behavs.ruby, {
|
|
||||||
\ 'command' : "\<C-x>\<C-o>",
|
|
||||||
\ 'meets' : 'acp#meetsForRubyOmni',
|
|
||||||
\ 'repeat' : 0,
|
|
||||||
\ })
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
call add(behavs.python, {
|
|
||||||
\ 'command' : "\<C-x>\<C-o>",
|
|
||||||
\ 'meets' : 'acp#meetsForPythonOmni',
|
|
||||||
\ 'repeat' : 0,
|
|
||||||
\ })
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
call add(behavs.perl, {
|
|
||||||
\ 'command' : "\<C-x>\<C-o>",
|
|
||||||
\ 'meets' : 'acp#meetsForPerlOmni',
|
|
||||||
\ 'repeat' : 0,
|
|
||||||
\ })
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
call add(behavs.xml, {
|
|
||||||
\ 'command' : "\<C-x>\<C-o>",
|
|
||||||
\ 'meets' : 'acp#meetsForXmlOmni',
|
|
||||||
\ 'repeat' : 1,
|
|
||||||
\ })
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
call add(behavs.html, {
|
|
||||||
\ 'command' : "\<C-x>\<C-o>",
|
|
||||||
\ 'meets' : 'acp#meetsForHtmlOmni',
|
|
||||||
\ 'repeat' : 1,
|
|
||||||
\ })
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
call add(behavs.xhtml, {
|
|
||||||
\ 'command' : "\<C-x>\<C-o>",
|
|
||||||
\ 'meets' : 'acp#meetsForHtmlOmni',
|
|
||||||
\ 'repeat' : 1,
|
|
||||||
\ })
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
call add(behavs.css, {
|
|
||||||
\ 'command' : "\<C-x>\<C-o>",
|
|
||||||
\ 'meets' : 'acp#meetsForCssOmni',
|
|
||||||
\ 'repeat' : 0,
|
|
||||||
\ })
|
|
||||||
"---------------------------------------------------------------------------
|
|
||||||
return behavs
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" }}}1
|
|
||||||
"=============================================================================
|
|
||||||
" INITIALIZATION {{{1
|
|
||||||
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
call s:defineOption('g:acp_enableAtStartup', 1)
|
|
||||||
call s:defineOption('g:acp_mappingDriven', 0)
|
|
||||||
call s:defineOption('g:acp_ignorecaseOption', 1)
|
|
||||||
call s:defineOption('g:acp_completeOption', '.,w,b,k')
|
|
||||||
call s:defineOption('g:acp_completeoptPreview', 0)
|
|
||||||
call s:defineOption('g:acp_behaviorUserDefinedFunction', '')
|
|
||||||
call s:defineOption('g:acp_behaviorUserDefinedMeets', '')
|
|
||||||
call s:defineOption('g:acp_behaviorSnipmateLength', -1)
|
|
||||||
call s:defineOption('g:acp_behaviorKeywordCommand', "\<C-n>")
|
|
||||||
call s:defineOption('g:acp_behaviorKeywordLength', 2)
|
|
||||||
call s:defineOption('g:acp_behaviorKeywordIgnores', [])
|
|
||||||
call s:defineOption('g:acp_behaviorFileLength', 0)
|
|
||||||
call s:defineOption('g:acp_behaviorRubyOmniMethodLength', 0)
|
|
||||||
call s:defineOption('g:acp_behaviorRubyOmniSymbolLength', 1)
|
|
||||||
call s:defineOption('g:acp_behaviorPythonOmniLength', 0)
|
|
||||||
call s:defineOption('g:acp_behaviorPerlOmniLength', -1)
|
|
||||||
call s:defineOption('g:acp_behaviorXmlOmniLength', 0)
|
|
||||||
call s:defineOption('g:acp_behaviorHtmlOmniLength', 0)
|
|
||||||
call s:defineOption('g:acp_behaviorCssOmniPropertyLength', 1)
|
|
||||||
call s:defineOption('g:acp_behaviorCssOmniValueLength', 0)
|
|
||||||
call s:defineOption('g:acp_behavior', {})
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
call extend(g:acp_behavior, s:makeDefaultBehavior(), 'keep')
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
command! -bar -narg=0 AcpEnable call acp#enable()
|
|
||||||
command! -bar -narg=0 AcpDisable call acp#disable()
|
|
||||||
command! -bar -narg=0 AcpLock call acp#lock()
|
|
||||||
command! -bar -narg=0 AcpUnlock call acp#unlock()
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
" legacy commands
|
|
||||||
command! -bar -narg=0 AutoComplPopEnable AcpEnable
|
|
||||||
command! -bar -narg=0 AutoComplPopDisable AcpDisable
|
|
||||||
command! -bar -narg=0 AutoComplPopLock AcpLock
|
|
||||||
command! -bar -narg=0 AutoComplPopUnlock AcpUnlock
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
if g:acp_enableAtStartup
|
|
||||||
AcpEnable
|
|
||||||
endif
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
" }}}1
|
|
||||||
"=============================================================================
|
|
||||||
" vim: set fdm=marker:
|
|
@ -1,11 +0,0 @@
|
|||||||
tags
|
|
||||||
archive
|
|
||||||
Makefile
|
|
||||||
TODO.TXT
|
|
||||||
TODO_archived.viki
|
|
||||||
*.vba
|
|
||||||
*.vmb
|
|
||||||
*.zip
|
|
||||||
.last_*
|
|
||||||
test
|
|
||||||
test_*
|
|
@ -1,195 +0,0 @@
|
|||||||
0.2
|
|
||||||
php specific
|
|
||||||
|
|
||||||
0.3
|
|
||||||
generalized plugin; modes; support for ruby, phpp, tex (chktex)
|
|
||||||
|
|
||||||
0.4
|
|
||||||
use vim compilers if available (e.g., tidy, xmllint ...); makeprg was
|
|
||||||
restored in the wrong window
|
|
||||||
|
|
||||||
0.5
|
|
||||||
- Support for jsl (javascript lint).
|
|
||||||
- Support for jlint.
|
|
||||||
- Don't automatically check php files if eclim is installed.
|
|
||||||
- Allow auto_* parameters to be buffer local.
|
|
||||||
- FIX: Unlet current_compiler, use g:current_compiler
|
|
||||||
- FIX: garbled screen: use redraw! (thanks to Vincent de Lau)
|
|
||||||
- Support for lua (thanks to norman)
|
|
||||||
|
|
||||||
0.6
|
|
||||||
- checksyntax_compiler_{&ft} & checksyntax_cmd_{&ft} variables can be
|
|
||||||
buffer local
|
|
||||||
|
|
||||||
1.0
|
|
||||||
- The info maintained as g:checksyntax_* variables is now kept in a
|
|
||||||
dictionary named g:checksyntax
|
|
||||||
- Support for gjslint
|
|
||||||
- Some bug fixes (e.g. tidy)
|
|
||||||
|
|
||||||
version: "1.01"
|
|
||||||
- Experimental support for python: pyflakes, pylint
|
|
||||||
- redraw before calling CheckSyntaxSucceed/CheckSyntaxFail
|
|
||||||
- Make sure we're in the right buffer
|
|
||||||
MD5 checksum: f94781c5748200e809a28562a692ed6b
|
|
||||||
|
|
||||||
version: "1.02"
|
|
||||||
- checksyntax#Check: Check &modified before anything else
|
|
||||||
- .gitignore
|
|
||||||
- Support for "modified" property
|
|
||||||
- Check executable() when setting the *.auto property.
|
|
||||||
- When eclim is installed: Set g:checksyntax.php.auto, not b:checksyntax.php.auto
|
|
||||||
- Do not map `<F5>` if it is used already.
|
|
||||||
- Use either location list (default) or optionally the quickfix list
|
|
||||||
- CheckSyntaxFail(): call .Open(); fixes #6
|
|
||||||
MD5 checksum: 4425f1434baa8795fbccec38721eef67
|
|
||||||
|
|
||||||
version: "1.03"
|
|
||||||
- checksyntax#Check: Check &modified before anything else
|
|
||||||
- .gitignore
|
|
||||||
- Support for "modified" property
|
|
||||||
- Check executable() when setting the *.auto property.
|
|
||||||
- When eclim is installed: Set g:checksyntax.php.auto, not b:checksyntax.php.auto
|
|
||||||
- Do not map `<F5>` if it is used already.
|
|
||||||
- Use either location list (default) or optionally the quickfix list
|
|
||||||
- CheckSyntaxFail(): call .Open(); fixes #6
|
|
||||||
- Tackle issue #7 ... maybe
|
|
||||||
- php is now forced to display parse errors even when in production mode
|
|
||||||
- Rename s:prototypes to g:checksyntax#prototypes
|
|
||||||
MD5 checksum: dfe8b09008f5106fdf7886d4c4cd5fb6
|
|
||||||
|
|
||||||
- Enable syntax checks when loading a file (disabled by default)
|
|
||||||
- g:checksyntax#auto_mode: Default auto mode (fixes #10)
|
|
||||||
- g:checksyntax#debug
|
|
||||||
- s:GetDef(ft): Remove syntax checker definition if the command is not executable
|
|
||||||
- Fix duplicate errors (closes bug #7)
|
|
||||||
- checksyntax#auto_mode: 0 disable, 1 enable, 2 force (fixes #12)
|
|
||||||
- checksyntax: "if" and "alternatives" fields; removed g:checksyntax_javascript
|
|
||||||
- define g:checksyntax in plugin/checksyntax.vim in order to facilitate customisation
|
|
||||||
- s:GetDef(ft): If empty(rv), check if the rest of alternatives is empty
|
|
||||||
- Move syntax checker definitions to autoload/checksyntax/&filetype.vim
|
|
||||||
- php: run with php -l -d error_log= -d error_reporting=E_PARSE
|
|
||||||
- Remove outdated references to failrx and okrx
|
|
||||||
- Move syntax checker definitions to autoload/checksyntax/defs/
|
|
||||||
- Experimental support for syntastic syntax checkers.
|
|
||||||
- debug message
|
|
||||||
- Support for SyntasticLoadChecker()
|
|
||||||
- checksyntax#Require(): Return 0 if filetype is empty
|
|
||||||
- efm for jruby (see https://github.com/tomtom/checksyntax_vim/pull/13)
|
|
||||||
- Run php with "-d display_errors=0" (fixes #7)
|
|
||||||
- php: Use -d display_errors=0
|
|
||||||
- checksyntax#syntastic#Require(): Make sure not to replace existing defintions
|
|
||||||
- Experimental: Prepare for running all valid alternatives
|
|
||||||
- Prepare for run_alternatives == "all"
|
|
||||||
- Javascript: Support for jslint (fixes #14)
|
|
||||||
- Run multiple syntax checkers (fixes #15)
|
|
||||||
- javascript: Remove run_alternatives = all
|
|
||||||
- Improved running all alternatives
|
|
||||||
- Improved support for syntastic syntax checkers (in conjunction with run_alternatives == all)
|
|
||||||
- :CheckSyntax! runs all alternatives (not the alternative syntax checker); use g:checksyntax#preferred for selecting the preferred checker
|
|
||||||
- checksyntax#Name(): Also consider the value of compiler
|
|
||||||
- s:CompleteItem(): Improved display of error message
|
|
||||||
- checksyntax#Alternative(): Define an alternative
|
|
||||||
- Updated syntax checker definitions for java, php, python
|
|
||||||
- checksyntax#syntastic#Require(): Use checksyntax#Alternative()
|
|
||||||
- checksyntax#syntastic#Require(): handle yet undefined filetypes
|
|
||||||
- Syntastic: Improved display of the checker name
|
|
||||||
- Support for bash -n
|
|
||||||
- Call bash -n only if shell =~ bash
|
|
||||||
- Facilitate configuration of g:checksyntax#prototypes.
|
|
||||||
- Map <c-f5> to CheckSyntax!
|
|
||||||
MD5 checksum: dfe8b09008f5106fdf7886d4c4cd5fb6
|
|
||||||
version: "2.00"
|
|
||||||
|
|
||||||
- Enable syntax checks when loading a file (disabled by default)
|
|
||||||
- g:checksyntax#auto_mode: Default auto mode (fixes #10)
|
|
||||||
- g:checksyntax#debug
|
|
||||||
- s:GetDef(ft): Remove syntax checker definition if the command is not executable
|
|
||||||
- Fix duplicate errors (closes bug #7)
|
|
||||||
- checksyntax#auto_mode: 0 disable, 1 enable, 2 force (fixes #12)
|
|
||||||
- checksyntax: "if" and "alternatives" fields; removed g:checksyntax_javascript
|
|
||||||
- define g:checksyntax in plugin/checksyntax.vim in order to facilitate customisation
|
|
||||||
- s:GetDef(ft): If empty(rv), check if the rest of alternatives is empty
|
|
||||||
- Move syntax checker definitions to autoload/checksyntax/&filetype.vim
|
|
||||||
- php: run with php -l -d error_log= -d error_reporting=E_PARSE
|
|
||||||
- Remove outdated references to failrx and okrx
|
|
||||||
- Move syntax checker definitions to autoload/checksyntax/defs/
|
|
||||||
- Experimental support for syntastic syntax checkers.
|
|
||||||
- debug message
|
|
||||||
- Support for SyntasticLoadChecker()
|
|
||||||
- checksyntax#Require(): Return 0 if filetype is empty
|
|
||||||
- efm for jruby (see https://github.com/tomtom/checksyntax_vim/pull/13)
|
|
||||||
- Run php with "-d display_errors=0" (fixes #7)
|
|
||||||
- php: Use -d display_errors=0
|
|
||||||
- checksyntax#syntastic#Require(): Make sure not to replace existing defintions
|
|
||||||
- Experimental: Prepare for running all valid alternatives
|
|
||||||
- Prepare for run_alternatives == "all"
|
|
||||||
- Javascript: Support for jslint (fixes #14)
|
|
||||||
- Run multiple syntax checkers (fixes #15)
|
|
||||||
- javascript: Remove run_alternatives = all
|
|
||||||
- Improved running all alternatives
|
|
||||||
- Improved support for syntastic syntax checkers (in conjunction with run_alternatives == all)
|
|
||||||
- :CheckSyntax! runs all alternatives (not the alternative syntax checker); use g:checksyntax#preferred for selecting the preferred checker
|
|
||||||
- checksyntax#Name(): Also consider the value of compiler
|
|
||||||
- s:CompleteItem(): Improved display of error message
|
|
||||||
- checksyntax#Alternative(): Define an alternative
|
|
||||||
- Updated syntax checker definitions for java, php, python
|
|
||||||
- checksyntax#syntastic#Require(): Use checksyntax#Alternative()
|
|
||||||
- checksyntax#syntastic#Require(): handle yet undefined filetypes
|
|
||||||
- Syntastic: Improved display of the checker name
|
|
||||||
- Support for bash -n
|
|
||||||
- Call bash -n only if shell =~ bash
|
|
||||||
- Facilitate configuration of g:checksyntax#prototypes.
|
|
||||||
- Map <c-f5> to CheckSyntax!
|
|
||||||
MD5 checksum: dfe8b09008f5106fdf7886d4c4cd5fb6
|
|
||||||
version: "2.00"
|
|
||||||
|
|
||||||
version: "2.01"
|
|
||||||
- Extra syntax checker definitions was prematurely removed after running a single syntax checker
|
|
||||||
- Facilitate customization of maps (g:checksyntax_key_single, g:checksyntax_key_all)
|
|
||||||
- process_list attribute for syntax checker definitions
|
|
||||||
- Support for R (lint::lint, svTools::lint)
|
|
||||||
- s:Executable(): Run executable() only once
|
|
||||||
- SyntasticLoadChecker(): Accept filetype as optional argument
|
|
||||||
- Support for jshint
|
|
||||||
MD5 checksum: 617a9cc8fd1fac7533e75b721106f2ad
|
|
||||||
|
|
||||||
- Support for perl (by TheAthlete)
|
|
||||||
- s:Make(): Echo v:exception & v:throwpoint
|
|
||||||
- checksyntax#Alternative(): Copy top-level properties
|
|
||||||
- Don't change the checker definition when dealing with alternatives (reported by techlivezheng)
|
|
||||||
MD5 checksum: d2d95bcff1d039497bc9c95cdb7a0ea1
|
|
||||||
version: "2.02"
|
|
||||||
|
|
||||||
version: "2.03"
|
|
||||||
- Included missing files in vba (fixes #16)
|
|
||||||
MD5 checksum: 40c9ea31d916db1ff5f22ec1c4af14c3
|
|
||||||
|
|
||||||
version: "3.00"
|
|
||||||
- addon-info
|
|
||||||
- Help template
|
|
||||||
- g:checksyntax#preferred defaults to {'xml': '.'}
|
|
||||||
- g:checksyntax['xml'] use auto: 0 for xmllint
|
|
||||||
- javascript: Support for esvalidate (esprima)
|
|
||||||
- javascript: default to jshint
|
|
||||||
- Support for running checkers asynchronously (requires the AsyncCommand vim plugin)
|
|
||||||
- Updated errorformat for jslint 0.2.7
|
|
||||||
- Support for typescript compiler (requires https://github.com/leafgarland/typescript-vim)
|
|
||||||
- Experimental: Enable async processing when performing a full check (:CheckSyntax!) if AsyncCommand is installed
|
|
||||||
- checksyntax#Check(): When mixing async & sync processing, don't show issue list if a check is still pending
|
|
||||||
- When mixing sync & async & no pending checks: Include async results in sync results
|
|
||||||
- Removed support for syntastic
|
|
||||||
- async_handler.get(): Properly handle issues list when the last check yielded no new issues
|
|
||||||
- Use job_ids to check for pending tasks
|
|
||||||
- g:checksyntax#async_runner and related vars is set based on exists(':AsyncMake')
|
|
||||||
- Show info about pending jobs (also support toptions_vim)
|
|
||||||
- Correctly handle makeprgs with full filename
|
|
||||||
- GetList(): Correctly handle "process_list" property
|
|
||||||
- r options: Add --ess
|
|
||||||
- Reset pending tasks, when calling CheckSyntax before all async tasks were completed
|
|
||||||
- Improved integration with toptions_vim
|
|
||||||
- R checker defaults to codetools::checkUsage
|
|
||||||
- Tentative integration with airline
|
|
||||||
- Support for tstatus (replaces toptions)
|
|
||||||
MD5 checksum: c9a7ae5304038568ea2309ed13c8ed96
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
The checksyntax plugin runs an external syntax checker for the current buffer
|
|
||||||
whenever the buffer is saved (by calling the |:CheckSyntax| command). Syntax
|
|
||||||
errors are managed as location or quickfix lists. If any syntax error occurs,
|
|
||||||
the |location-list| is opened (users can redefine |CheckSyntaxFail()| to change
|
|
||||||
this behaviour). You can use any |location-list| related command to navigate
|
|
||||||
the list of syntax errors.
|
|
||||||
|
|
||||||
If vimscript #2584 is installed, lines containing syntax errors will be marked
|
|
||||||
with signs.
|
|
||||||
|
|
||||||
By default, |:CheckSyntax| is mapped to <F5> (if not mapped already),
|
|
||||||
and automatically executed when saving the buffer. The |:CheckSyntax|
|
|
||||||
command takes one optional argument: the mode (default: &filetype).
|
|
||||||
<C-F5> will run all syntax checkers for a given filetype if multiple
|
|
||||||
alternatives are defined and installed on your computer.
|
|
||||||
|
|
||||||
As the plugin doesn't provide syntax checks by its own. This is done by
|
|
||||||
an external syntax checker that has to be installed on your computer.
|
|
||||||
|
|
||||||
For the following filetypes, syntax checkers are pre-defined:
|
|
||||||
|
|
||||||
c, cpp :: Check syntax via splint
|
|
||||||
html :: Check syntax via tidy
|
|
||||||
javascript :: Check syntax via jslint, jshint, jsl, or gjslint
|
|
||||||
java :: Check syntax via jlint or javaCheckstyle
|
|
||||||
lua :: Parse file (luac -p)
|
|
||||||
php :: Check syntax (php -l)
|
|
||||||
python :: Check file with pyflakes or pylint
|
|
||||||
r :: Check syntax & style with lint::lint or svTools::lint
|
|
||||||
ruby :: Check syntax (ruby -c)
|
|
||||||
tex, latex :: Parse file (chktex -q -v0)
|
|
||||||
xml, docbk :: Check syntax via xmllint
|
|
||||||
|
|
||||||
See the autoload/checksyntax/defs/ directory for a complete list of
|
|
||||||
supported syntax checkers. See |g:checksyntax| also for how to define
|
|
||||||
your own syntax checkers.
|
|
||||||
|
|
||||||
This plugin was originally based on Klaus Horsten's php_console
|
|
||||||
(vimscript #779) and it is the successor of php_check_syntax.vim
|
|
||||||
(vimscript #1272).
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Status: Works for me (there may be some minor quirks)
|
|
||||||
Install: See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
|
|
||||||
See http://github.com/tomtom for related plugins.
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"name" : "checksyntax",
|
|
||||||
"version" : "dev",
|
|
||||||
"author" : "Tom Link <micathom at gmail com>",
|
|
||||||
"maintainer" : "Tom Link <micathom at gmail com>",
|
|
||||||
"repository" : {"type": "git", "url": "git://github.com/tomtom/checksyntax_vim.git"},
|
|
||||||
"dependencies" : {},
|
|
||||||
"description" : "Check syntax when saving a file (php etc.)"
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
if !exists(':CheckSyntax')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
function! airline#extensions#checksyntax#get_msg()
|
|
||||||
let errors = checksyntax#Status()
|
|
||||||
if !empty(errors)
|
|
||||||
return errors.(g:airline_symbols.space)
|
|
||||||
endif
|
|
||||||
return ''
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
let s:spc = g:airline_symbols.space
|
|
||||||
|
|
||||||
|
|
||||||
function! airline#extensions#checksyntax#apply(...)
|
|
||||||
let w:airline_section_c = get(w:, 'airline_section_c', g:airline_section_c)
|
|
||||||
let w:airline_section_c .= s:spc . g:airline_left_alt_sep . s:spc . '%{airline#extensions#checksyntax#get_msg()}'
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
function! airline#extensions#checksyntax#init(ext)
|
|
||||||
call airline#parts#define_function('checksyntax', 'airline#extensions#checksyntax#get_msg')
|
|
||||||
" call airline#parts#define_raw('checksyntax', '%{airline#extensions#checksyntax#get_msg()}')
|
|
||||||
call a:ext.add_statusline_func('airline#extensions#checksyntax#apply')
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
" vi: ft=vim:tw=72:ts=4
|
|
File diff suppressed because it is too large
Load Diff
@ -1,68 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 37
|
|
||||||
|
|
||||||
|
|
||||||
let s:async_handler = {}
|
|
||||||
|
|
||||||
|
|
||||||
function s:async_handler.get(temp_file_name) dict
|
|
||||||
" echom "DBG async_handler.get" self.name self.job_id
|
|
||||||
let jobs = checksyntax#RemoveJob(self.job_id)
|
|
||||||
if jobs != -1
|
|
||||||
let errorformat = &errorformat
|
|
||||||
try
|
|
||||||
" TLogVAR self.async_type, self.bufnr, bufnr('%')
|
|
||||||
if self.async_type != 'loc' || self.bufnr == bufnr('%')
|
|
||||||
let &errorformat = self.async_efm
|
|
||||||
" TLogVAR self.async_efm
|
|
||||||
" TLogVAR self.async_cmd, a:temp_file_name
|
|
||||||
" let lines = readfile(a:temp_file_name) " DBG
|
|
||||||
" TLogVAR lines
|
|
||||||
exec self.async_cmd a:temp_file_name
|
|
||||||
let list = g:checksyntax#issues.AddList(self.name, self, self.async_type)
|
|
||||||
" TLogVAR list
|
|
||||||
" TLogVAR self.name, len(list)
|
|
||||||
if g:checksyntax#debug
|
|
||||||
echo
|
|
||||||
echom printf('CheckSyntax: Processing %s (%s items)', self.name, len(list))
|
|
||||||
endif
|
|
||||||
if jobs == 0
|
|
||||||
" let bg = self.bg
|
|
||||||
let bg = 1
|
|
||||||
" let manually = self.manually
|
|
||||||
let manually = g:checksyntax#debug
|
|
||||||
call g:checksyntax#issues.Display(manually, bg)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
finally
|
|
||||||
let &errorformat = errorformat
|
|
||||||
endtry
|
|
||||||
endif
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
function! s:AsyncCommandHandler(make_def)
|
|
||||||
" TLogVAR a:make_def
|
|
||||||
let type = get(a:make_def, 'listtype', 'loc')
|
|
||||||
let async_handler = {
|
|
||||||
\ 'async_cmd': type == 'loc' ? 'lgetfile' : 'cgetfile',
|
|
||||||
\ 'async_type': type,
|
|
||||||
\ 'async_efm': get(a:make_def, 'efm', &errorformat),
|
|
||||||
\ }
|
|
||||||
call extend(async_handler, a:make_def)
|
|
||||||
call extend(async_handler, s:async_handler, 'keep')
|
|
||||||
" TLogVAR async_handler
|
|
||||||
return asynccommand#tab_restore(async_handler)
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
function! checksyntax#async#asynccommand#Run(cmd, make_def) "{{{3
|
|
||||||
" TLogVAR a:cmd, a:make_def
|
|
||||||
let @+ = a:cmd
|
|
||||||
let async_handler = s:AsyncCommandHandler(a:make_def)
|
|
||||||
" TLogVAR async_handler
|
|
||||||
call asynccommand#run(a:cmd, async_handler)
|
|
||||||
return 1
|
|
||||||
endf
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 5
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('c?',
|
|
||||||
\ {
|
|
||||||
\ 'compiler': 'splint',
|
|
||||||
\ 'if_executable': 'splint',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('splint'),
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 4
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#Require('c')
|
|
||||||
call checksyntax#AddChecker('cpp?', checksyntax#GetChecker('c'))
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 3
|
|
||||||
|
|
||||||
call checksyntax#Require('xml')
|
|
||||||
call checksyntax#AddChecker('docbk?', checksyntax#GetChecker('xml'))
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 4
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('html?',
|
|
||||||
\ {
|
|
||||||
\ 'cmd': 'tidy -eq',
|
|
||||||
\ 'efm': 'line %l column %c - %m',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('tidy'),
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 46
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('checksyntax#defs#java#pmd_rulesets')
|
|
||||||
" :read: let checksyntax#defs#java#pmd_rulesets = [...] "{{{2
|
|
||||||
let checksyntax#defs#java#pmd_rulesets = [
|
|
||||||
\ "basic", "braces", "clone", "codesize", "comments",
|
|
||||||
\ "design", "empty", "finalizers", "imports", "javabeans",
|
|
||||||
\ "logging-jakarta-commons", "logging-java", "migrating",
|
|
||||||
\ "optimizations", "strictexception", "strings",
|
|
||||||
\ "sunsecure", "typeresolution", "unnecessary",
|
|
||||||
\ "unusedcode"]
|
|
||||||
"android", "controversial", "coupling", "j2ee", "junit", "naming",
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('checksyntax#defs#java#pmd_args')
|
|
||||||
let checksyntax#defs#java#pmd_args = '' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
function! checksyntax#defs#java#Jlint() "{{{3
|
|
||||||
let filename = expand('%:r') .'.class'
|
|
||||||
let dirname = expand('%:h')
|
|
||||||
return 'jlint +all -done -source '. shellescape(dirname) .' '. shellescape(filename)
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('java?',
|
|
||||||
\ {
|
|
||||||
\ 'if_executable': 'checkstyle',
|
|
||||||
\ 'compiler': 'checkstyle',
|
|
||||||
\ 'compiler_args': '%'
|
|
||||||
\ })
|
|
||||||
" \ {
|
|
||||||
" \ 'name': 'jlint',
|
|
||||||
" \ 'if_executable': 'jlint',
|
|
||||||
" \ 'efm': '%m',
|
|
||||||
" \ 'cmdexpr': 'checksyntax#defs#java#Jlint()'
|
|
||||||
" \ },
|
|
||||||
|
|
||||||
if !empty(g:checksyntax#pmd#cmd)
|
|
||||||
call checksyntax#AddChecker('java?',
|
|
||||||
\ {
|
|
||||||
\ 'name': 'pmd',
|
|
||||||
\ 'type': 'qfl',
|
|
||||||
\ 'cmdexpr': 'checksyntax#pmd#Cmd("java", g:checksyntax#defs#java#pmd_args, g:checksyntax#defs#java#pmd_rulesets)',
|
|
||||||
\ 'cmd_args': '',
|
|
||||||
\ 'buffers': 'listed',
|
|
||||||
\ 'efm': '%f:%l:%m',
|
|
||||||
\ })
|
|
||||||
endif
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 66
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#javascript#closure')
|
|
||||||
" If non-empty, enable some checks via closure compiler.
|
|
||||||
let g:checksyntax#defs#javascript#closure = '' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#javascript#closure_warnings')
|
|
||||||
let g:checksyntax#defs#javascript#closure_warnings = ['const', 'constantProperty', 'checkRegExp', 'strictModuleDepCheck', 'visibility'] "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('checksyntax#defs#javascript#pmd_rulesets')
|
|
||||||
let checksyntax#defs#javascript#pmd_rulesets = ["basic", "braces", "unnecessary"]
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('checksyntax#defs#javascript#pmd_args')
|
|
||||||
let checksyntax#defs#javascript#pmd_args = '' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('javascript?',
|
|
||||||
\ {
|
|
||||||
\ 'name': 'jshint',
|
|
||||||
\ 'cmd': 'jshint --verbose',
|
|
||||||
\ 'efm': '%f: line %l\, col %c\, %m (%t%n)',
|
|
||||||
\ },
|
|
||||||
\ {
|
|
||||||
\ 'name': 'esprima',
|
|
||||||
\ 'cmd': 'esvalidate',
|
|
||||||
\ 'efm': '%f:%l: %m',
|
|
||||||
\ },
|
|
||||||
\ {
|
|
||||||
\ 'name': 'gjslint',
|
|
||||||
\ 'cmd': 'gjslint',
|
|
||||||
\ 'ignore_nr': [1, 110],
|
|
||||||
\ 'efm': '%P%*[^F]FILE%*[^:]: %f %*[-],Line %l%\, %t:%n: %m,%Q',
|
|
||||||
\ },
|
|
||||||
\ {
|
|
||||||
\ 'name': 'jslint',
|
|
||||||
\ 'cmd': 'jslint --terse',
|
|
||||||
\ 'efm': '%f:%l:%c: %m',
|
|
||||||
\ },
|
|
||||||
\ {
|
|
||||||
\ 'name': 'jsl',
|
|
||||||
\ 'cmd': 'jsl -nofilelisting -nocontext -nosummary -nologo -process',
|
|
||||||
\ },
|
|
||||||
\ )
|
|
||||||
|
|
||||||
if !empty(g:checksyntax#defs#javascript#closure)
|
|
||||||
if !empty(g:checksyntax#defs#javascript#closure_warnings)
|
|
||||||
let s:closure_warnings = ' --jscomp_warning '. join(g:checksyntax#defs#javascript#closure_warnings, ' --jscomp_warning ')
|
|
||||||
else
|
|
||||||
let s:closure_warnings = ''
|
|
||||||
endif
|
|
||||||
call checksyntax#AddChecker('javascript?',
|
|
||||||
\ {
|
|
||||||
\ 'name': 'closure',
|
|
||||||
\ 'cmd': g:checksyntax#defs#javascript#closure .' --warning_level VERBOSE '. checksyntax#NullOutput('--js_output_file') . s:closure_warnings,
|
|
||||||
\ 'efm': '%A%f:%l: %m,%-Cfound %#: %.%#,%+Crequired %#: %.%#,%-C%.%#,%-Z%p^',
|
|
||||||
\ },
|
|
||||||
\ )
|
|
||||||
unlet s:closure_warnings
|
|
||||||
" ,%-C%.%#,%+Z%p^
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !empty(g:checksyntax#pmd#cmd)
|
|
||||||
call checksyntax#AddChecker('javascript?',
|
|
||||||
\ {
|
|
||||||
\ 'name': 'pmd',
|
|
||||||
\ 'type': 'qfl',
|
|
||||||
\ 'cmdexpr': "checksyntax#pmd#Cmd('ecmascript', g:checksyntax#defs#javascript#pmd_args, g:checksyntax#defs#javascript#pmd_rulesets)",
|
|
||||||
\ 'cmd_args': '',
|
|
||||||
\ 'buffers': 'listed',
|
|
||||||
\ 'efm': '%f:%l:%m',
|
|
||||||
\ })
|
|
||||||
endif
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 5
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('lua?',
|
|
||||||
\ {
|
|
||||||
\ 'if_executable': 'luac',
|
|
||||||
\ 'cmd': 'luac -p',
|
|
||||||
\ 'efm': 'luac\:\ %f:%l:\ %m'
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('luac'),
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 14
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('perl?',
|
|
||||||
\ {
|
|
||||||
\ 'cmd': 'perl -Wc %',
|
|
||||||
\ 'efm': '%-G%.%#had compilation errors.,%-G%.%#syntax OK,%m at %f line %l.,%+A%.%# at %f line %l\,%.%#,%+C%.%#',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('perl'),
|
|
||||||
\ },
|
|
||||||
\ )
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 13
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('php?',
|
|
||||||
\ {
|
|
||||||
\ 'name': 'php',
|
|
||||||
\ 'cmd': 'php -l -d display_errors=0 -d error_log= -d error_reporting=E_PARSE',
|
|
||||||
\ 'if_executable': 'php',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('php'),
|
|
||||||
\ 'efm': '%*[^:]: %m in %f on line %l',
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 16
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('python?',
|
|
||||||
\ {
|
|
||||||
\ 'cmd': 'pyflakes',
|
|
||||||
\ 'if_executable': 'pyflakes',
|
|
||||||
\ 'efm': '%f:%l: %m',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('pyflakes'),
|
|
||||||
\ },
|
|
||||||
\ {
|
|
||||||
\ 'cmd': 'pylint -r n -f parseable',
|
|
||||||
\ 'if_executable': 'pylint',
|
|
||||||
\ 'efm': '%f:%l: [%t] %m',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('pylint'),
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
@ -1,176 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 145
|
|
||||||
|
|
||||||
" :doc:
|
|
||||||
" Syntax checkers for R:
|
|
||||||
"
|
|
||||||
" codetools::checkUsageEnv ... Requires http://cran.r-project.org/web/packages/codetools/
|
|
||||||
" lint::lint ... Requires http://cran.r-project.org/web/packages/lint/
|
|
||||||
" svTools::lint ... Requires http://cran.r-project.org/web/packages/svTools/
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#r#progname')
|
|
||||||
let g:checksyntax#defs#r#progname = executable('Rterm') ? 'Rterm' : 'R' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !executable(g:checksyntax#defs#r#progname)
|
|
||||||
throw "Please set g:checksyntax#defs#r#progname to the full filename of Rterm/R first!"
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#r#options')
|
|
||||||
let g:checksyntax#defs#r#options = '--slave --ess --restore --no-save -e "%s" --args' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#r#checkUsage_options')
|
|
||||||
" Optons passed to codetools::checkUsageEnv.
|
|
||||||
" Must not be empty.
|
|
||||||
let g:checksyntax#defs#r#checkUsage_options = 'all = TRUE' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#r#checkUsage_ignore_undefined_rx')
|
|
||||||
" A |/\V| regexp pattern of names that should be ignored, when
|
|
||||||
" codetools::checkUsageEnv reports "no visible global function
|
|
||||||
" definition".
|
|
||||||
let g:checksyntax#defs#r#checkUsage_ignore_undefined_rx = '' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#r#checkUsage_ignore_functions')
|
|
||||||
" A list of function names that will be ignored when parsing the
|
|
||||||
" result list from codetools::checkUsageEnv.
|
|
||||||
let g:checksyntax#defs#r#checkUsage_ignore_functions = [] "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#r#checkUsage_search_other_buffers')
|
|
||||||
" If 2, also search other buffers for patterns returned by
|
|
||||||
" codetools::checkUsageEnv. This may cause unreponsive behaviour.
|
|
||||||
"
|
|
||||||
" If 1, show unidentifiable patterns as is.
|
|
||||||
"
|
|
||||||
" If 0, remove unidentifiable patterns.
|
|
||||||
let g:checksyntax#defs#r#checkUsage_search_other_buffers = 0 "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('r?',
|
|
||||||
\ {
|
|
||||||
\ 'listtype': 'qfl',
|
|
||||||
\ 'name': 'codetools',
|
|
||||||
\ 'cmd': g:checksyntax#defs#r#progname .' '.
|
|
||||||
\ printf(g:checksyntax#defs#r#options, 'try({library(codetools); source(commandArgs(TRUE)); checkUsageEnv(globalenv(),'. g:checksyntax#defs#r#checkUsage_options .')})'),
|
|
||||||
\ 'efm': '%m (%f:%l), %s : <anonymous>: %m, %s : %m, %s: %m',
|
|
||||||
\ 'process_list': 'checksyntax#defs#r#CheckUsageEnv'
|
|
||||||
\ },
|
|
||||||
\ {
|
|
||||||
\ 'name': 'lint',
|
|
||||||
\ 'cmd': g:checksyntax#defs#r#progname .' '.
|
|
||||||
\ printf(g:checksyntax#defs#r#options, 'try(lint::lint(commandArgs(TRUE)))'),
|
|
||||||
\ 'efm': 'Lint: %m,%E%f:%l:%c,%Z%\\s\\+%m',
|
|
||||||
\ 'process_list': 'checksyntax#defs#r#LintLint'
|
|
||||||
\ },
|
|
||||||
\ {
|
|
||||||
\ 'name': 'svTools::lint',
|
|
||||||
\ 'cmd': g:checksyntax#defs#r#progname .' '.
|
|
||||||
\ printf(g:checksyntax#defs#r#options, 'try(svTools::lint(commandArgs(TRUE),type=''flat''))'),
|
|
||||||
\ 'efm': '%t%\\w%\\++++%l+++%c+++%m',
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
||||||
|
|
||||||
" :nodoc:
|
|
||||||
function! checksyntax#defs#r#LintLint(list) "{{{3
|
|
||||||
" TLogVAR a:list
|
|
||||||
let list = []
|
|
||||||
for issue in a:list
|
|
||||||
let text = get(issue, 'text', '')
|
|
||||||
if text =~ ': found on lines \d\+'
|
|
||||||
let message = matchstr(text, '^.\{-}\ze: found on lines \d\+')
|
|
||||||
let lines = split(matchstr(text, 'found on lines \zs\d\+.*$'), ', ')
|
|
||||||
" TLogVAR message, lines
|
|
||||||
for line in lines
|
|
||||||
if line[0] =~ '^\d\+'
|
|
||||||
let issue1 = copy(issue)
|
|
||||||
let issue1.text = message
|
|
||||||
let issue1.lnum = str2nr(line)
|
|
||||||
call add(list, issue1)
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
else
|
|
||||||
call add(list, issue)
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
" TLogVAR list
|
|
||||||
return list
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
" :nodoc:
|
|
||||||
function! checksyntax#defs#r#CheckUsageEnv(list) "{{{3
|
|
||||||
" TLogVAR a:list
|
|
||||||
let view = winsaveview()
|
|
||||||
try
|
|
||||||
let list = map(a:list, 's:CompleteCheckUsageEnvItem(v:val)')
|
|
||||||
unlet! s:lnum s:bufnr
|
|
||||||
let list = filter(list, '!empty(v:val)')
|
|
||||||
finally
|
|
||||||
call winrestview(view)
|
|
||||||
endtry
|
|
||||||
return list
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
function! s:CompleteCheckUsageEnvItem(item) "{{{3
|
|
||||||
" TLogVAR a:item
|
|
||||||
let item = a:item
|
|
||||||
let pattern = get(item, 'pattern', '')
|
|
||||||
if !empty(g:checksyntax#defs#r#checkUsage_ignore_functions) && !empty(pattern)
|
|
||||||
let ignored = filter(copy(g:checksyntax#defs#r#checkUsage_ignore_functions),
|
|
||||||
\ 'v:val =~ pattern')
|
|
||||||
if len(ignored) > 0
|
|
||||||
return {}
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
if !empty(g:checksyntax#defs#r#checkUsage_ignore_undefined_rx) &&
|
|
||||||
\ item.text =~ '\C\V\<no visible global function definition for '''. g:checksyntax#defs#r#checkUsage_ignore_undefined_rx .''''
|
|
||||||
return {}
|
|
||||||
endif
|
|
||||||
" TLogVAR bufname(item.bufnr)
|
|
||||||
if get(item, 'bufnr', 0) == 0 && !empty(pattern)
|
|
||||||
let pattern = substitute(pattern, '\\\$', '\\>', '')
|
|
||||||
let s:bufnr = bufnr('%')
|
|
||||||
" let fn_rx = pattern .'\_s\*<-\_s\*function\_s\*('
|
|
||||||
let fn_rx = pattern .'\_s\*<-\_s\*'
|
|
||||||
let s:lnum = search(fn_rx, 'cwn')
|
|
||||||
if s:lnum == 0 && g:checksyntax#defs#r#checkUsage_search_other_buffers == 2
|
|
||||||
let bufnr0 = s:bufnr
|
|
||||||
let view = winsaveview()
|
|
||||||
try
|
|
||||||
bufdo! if &ft == 'r' | let s:lnum = search(fn_rx, 'cwn') | if s:lnum > 0 | let s:bufnr = bufnr('%') | throw "ok" | endif | endif
|
|
||||||
catch /ok/
|
|
||||||
finally
|
|
||||||
exec 'buffer' bufnr0
|
|
||||||
call winrestview(view)
|
|
||||||
endtry
|
|
||||||
endif
|
|
||||||
" TLogVAR pattern, s:lnum
|
|
||||||
if s:lnum > 0
|
|
||||||
let item.bufnr = s:bufnr
|
|
||||||
let item.lnum = s:lnum
|
|
||||||
let item.pattern = ''
|
|
||||||
" TLogVAR item
|
|
||||||
elseif g:checksyntax#defs#r#checkUsage_search_other_buffers == 1
|
|
||||||
let item.pattern = pattern
|
|
||||||
else
|
|
||||||
return {}
|
|
||||||
endif
|
|
||||||
elseif bufname(item.bufnr) == '<Text>'
|
|
||||||
return {}
|
|
||||||
endif
|
|
||||||
return item
|
|
||||||
endf
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 10
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#ruby#interpreter')
|
|
||||||
let g:checksyntax#defs#ruby#interpreter = system('ruby --version') "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
let s:def = {
|
|
||||||
\ 'prepare': 'compiler ruby',
|
|
||||||
\ 'cmd': 'ruby -c',
|
|
||||||
\ }
|
|
||||||
|
|
||||||
if g:checksyntax#defs#ruby#interpreter =~ '\<jruby'
|
|
||||||
let s:def.efm = 'SyntaxError in %f:%l:%m'
|
|
||||||
else
|
|
||||||
let s:def.convert_filename = checksyntax#MaybeUseCygpath('xmllint')
|
|
||||||
endif
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('ruby?', s:def)
|
|
||||||
|
|
||||||
unlet s:def
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 17
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#defs#scala#scalastyle')
|
|
||||||
" The command to invoke scalastyle -- see http://www.scalastyle.org
|
|
||||||
" and especially http://www.scalastyle.org/command-line.html
|
|
||||||
let g:checksyntax#defs#scala#scalastyle = '' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
function! checksyntax#defs#scala#Cmd() "{{{3
|
|
||||||
let build = findfile('build.sbt', '.;')
|
|
||||||
if !empty(build)
|
|
||||||
let config = fnamemodify(build, ':h') .'/scalastyle-config.xml'
|
|
||||||
if filereadable(config)
|
|
||||||
return 'sbt scalastyle'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
if !empty(g:checksyntax#defs#scala#scalastyle)
|
|
||||||
return g:checksyntax#defs#scala#scalastyle .' %'
|
|
||||||
endif
|
|
||||||
return ''
|
|
||||||
endf
|
|
||||||
|
|
||||||
|
|
||||||
" if !empty(g:checksyntax#defs#scala#scalastyle)
|
|
||||||
call checksyntax#AddChecker('scala?',
|
|
||||||
\ {
|
|
||||||
\ 'name': 'scalastyle',
|
|
||||||
\ 'cmdexpr': 'checksyntax#defs#scala#Cmd()',
|
|
||||||
\ 'cmd_args': '',
|
|
||||||
\ 'efm': '%t%\\S%\\+ file=%f message=%m line=%l column=%c',
|
|
||||||
\ },
|
|
||||||
\ )
|
|
||||||
" endif
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 7
|
|
||||||
|
|
||||||
if &shell =~ '\<bash\>'
|
|
||||||
call checksyntax#AddChecker('sh?',
|
|
||||||
\ {
|
|
||||||
\ 'cmd': 'bash -n',
|
|
||||||
\ 'efm': '%f: %\\w%\\+ %l: %m',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('bash'),
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
endif
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 3
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('tex?',
|
|
||||||
\ {
|
|
||||||
\ 'cmd': 'chktex -q -v0',
|
|
||||||
\ 'if_executable': 'chktex',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('chktex'),
|
|
||||||
\ 'efm': '%f:%l:%m',
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 4
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('typescript?',
|
|
||||||
\ {
|
|
||||||
\ 'name': 'tsc',
|
|
||||||
\ 'args': checksyntax#NullOutput('--out'),
|
|
||||||
\ 'if_executable': 'tsc',
|
|
||||||
\ 'compiler': 'typescript',
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 4
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('viki?',
|
|
||||||
\ {
|
|
||||||
\ 'cmd': 'deplate -f null',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('deplate'),
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 2
|
|
||||||
|
|
||||||
call checksyntax#Require('html')
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('xhtml?',
|
|
||||||
\ checksyntax#GetChecker('html'))
|
|
||||||
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 27
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('checksyntax#defs#xml#pmd_rulesets')
|
|
||||||
let checksyntax#defs#xml#pmd_rulesets = ["basic"]
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('checksyntax#defs#xml#pmd_args')
|
|
||||||
let checksyntax#defs#xml#pmd_args = '' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
call checksyntax#AddChecker('xml?',
|
|
||||||
\ {
|
|
||||||
\ 'compiler': 'xmllint',
|
|
||||||
\ 'compiler_args': '%',
|
|
||||||
\ 'convert_filename': checksyntax#MaybeUseCygpath('xmllint'),
|
|
||||||
\ }
|
|
||||||
\ )
|
|
||||||
|
|
||||||
|
|
||||||
if !empty(g:checksyntax#pmd#cmd)
|
|
||||||
call checksyntax#AddChecker('xml?',
|
|
||||||
\ {
|
|
||||||
\ 'name': 'pmd',
|
|
||||||
\ 'type': 'qfl',
|
|
||||||
\ 'cmdexpr': "checksyntax#pmd#Cmd('xml', g:checksyntax#defs#xml#pmd_args, g:checksyntax#defs#xml#pmd_rulesets)",
|
|
||||||
\ 'cmd_args': '',
|
|
||||||
\ 'buffers': 'listed',
|
|
||||||
\ 'efm': '%f:%l:%m',
|
|
||||||
\ })
|
|
||||||
endif
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Revision: 13
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#pmd#cmd')
|
|
||||||
" The command to run pmd.
|
|
||||||
let g:checksyntax#pmd#cmd = '' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax#pmd#args')
|
|
||||||
let g:checksyntax#pmd#args = '-f text' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
function! checksyntax#pmd#Cmd(language, args, rulesets) "{{{3
|
|
||||||
if empty(g:checksyntax#pmd#cmd)
|
|
||||||
return ''
|
|
||||||
else
|
|
||||||
let args = [g:checksyntax#pmd#args, a:args, '-l', a:language]
|
|
||||||
if !exists('b:checksyntax_project_dir')
|
|
||||||
if exists('b:project_dir')
|
|
||||||
let b:checksyntax_project_dir = b:project_dir
|
|
||||||
else
|
|
||||||
let b:checksyntax_project_dir = expand('%:h')
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
call add(args, '-d '. shellescape(b:checksyntax_project_dir))
|
|
||||||
let rulesets = join(map(copy(a:rulesets), 'a:language ."-". v:val'), ',')
|
|
||||||
let args += ['-R', rulesets]
|
|
||||||
return printf("%s %s",
|
|
||||||
\ g:checksyntax#pmd#cmd,
|
|
||||||
\ join(args))
|
|
||||||
endif
|
|
||||||
endf
|
|
||||||
|
|
@ -1,328 +0,0 @@
|
|||||||
*checksyntax.txt* checksyntax -- Check syntax when saving a file (php, ruby, tex ...)
|
|
||||||
Author: Tom Link, micathom at gmail com
|
|
||||||
|
|
||||||
The checksyntax plugin runs an external syntax checker for the current buffer
|
|
||||||
whenever the buffer is saved (by calling the |:CheckSyntax| command). Syntax
|
|
||||||
errors are managed as location or quickfix lists. If any syntax error occurs,
|
|
||||||
the |location-list| is opened (users can redefine |CheckSyntaxFail()| to change
|
|
||||||
this behaviour). You can use any |location-list| related command to navigate
|
|
||||||
the list of syntax errors.
|
|
||||||
|
|
||||||
If quickfixsigns (vimscript #2584) is installed, lines containing syntax errors
|
|
||||||
will be marked with signs.
|
|
||||||
|
|
||||||
Experimental: If AsyncCommand (vimscript #3431) is installed, syntax checks can
|
|
||||||
be peformed asynchronously -- see also |g:checksyntax#run_alternatives|,
|
|
||||||
|g:checksyntax#run_all_alternatives| and |g:checksyntax#async_runner|.
|
|
||||||
|
|
||||||
By default, |:CheckSyntax| is mapped to <F5> (if not mapped already),
|
|
||||||
and automatically executed when saving the buffer. :CheckSyntax! or <C-F5> will
|
|
||||||
run all syntax checkers for a given filetype if multiple alternatives are
|
|
||||||
defined and installed on your computer.
|
|
||||||
|
|
||||||
The |:CheckSyntax| command takes one optional argument: the mode (default:
|
|
||||||
&filetype).
|
|
||||||
|
|
||||||
As the plugin doesn't provide syntax checks by its own. This is done by
|
|
||||||
an external syntax checker that has to be installed on your computer.
|
|
||||||
|
|
||||||
Pre-defined syntax checkers (the respective syntax checker has to
|
|
||||||
be installed):
|
|
||||||
|
|
||||||
c, cpp ... Requires splint
|
|
||||||
html ... Requires tidy
|
|
||||||
java ... Requires
|
|
||||||
jlint (http://jlint.sourceforge.net),
|
|
||||||
checkstyle (http://checkstyle.sourceforge.net),
|
|
||||||
pmd (http://pmd.sourceforge.net)
|
|
||||||
javascript ... Syntax check; requires jshint, esprima,
|
|
||||||
gjslint, jslint, jsl, pmd
|
|
||||||
lua ... Requires luac (run luac -p)
|
|
||||||
php ... Syntax check; requires php (run php -l)
|
|
||||||
python ... Requires pyflakes or pylint
|
|
||||||
r ... Requires codetools::checkUsage, lint::lint, or
|
|
||||||
svTools::lint
|
|
||||||
ruby ... Requires ruby (run ruby -c)
|
|
||||||
tex, latex ... Requires chktex (run chktex -q -v0)
|
|
||||||
viki ... Requires deplate
|
|
||||||
xhtml ... Requires tidy
|
|
||||||
xml, docbk ... Requires xmllint, pmd
|
|
||||||
|
|
||||||
Syntax checker definitions are kept in:
|
|
||||||
autoload/checksyntax/defs/{&filetype}.vim
|
|
||||||
|
|
||||||
Run this command to find out, which filetypes are supported: >
|
|
||||||
:echo globpath(&rtp, 'autoload/checksyntax/defs/*.vim')
|
|
||||||
|
|
||||||
This plugin was originally based on Klaus Horsten's php_console
|
|
||||||
(vimscript #779) and it is the successor of php_check_syntax.vim
|
|
||||||
(vimscript #1272).
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
Install~
|
|
||||||
|
|
||||||
Edit the vba file and type: >
|
|
||||||
|
|
||||||
:so %
|
|
||||||
|
|
||||||
See :help vimball for details. If you have difficulties or use vim 7.0,
|
|
||||||
please make sure, you have the current version of vimball (vimscript
|
|
||||||
#1502) installed or update your runtime.
|
|
||||||
|
|
||||||
Optional enhancements:
|
|
||||||
quickfixsigns (vimscript #2584) ... Use signs
|
|
||||||
AsyncCommand (vimscript #3431) ... Run commands asynchronously
|
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
Contents~
|
|
||||||
|
|
||||||
:CheckSyntax ......................... |:CheckSyntax|
|
|
||||||
g:checksyntax_key_single ............. |g:checksyntax_key_single|
|
|
||||||
g:checksyntax_key_all ................ |g:checksyntax_key_all|
|
|
||||||
g:checksyntax_auto ................... |g:checksyntax_auto|
|
|
||||||
g:checksyntax#auto_enable_rx ......... |g:checksyntax#auto_enable_rx|
|
|
||||||
g:checksyntax#auto_disable_rx ........ |g:checksyntax#auto_disable_rx|
|
|
||||||
g:checksyntax#preferred .............. |g:checksyntax#preferred|
|
|
||||||
g:checksyntax#async_runner ........... |g:checksyntax#async_runner|
|
|
||||||
:CheckSyntaxStatus ................... |:CheckSyntaxStatus|
|
|
||||||
g:checksyntax#run_alternatives ....... |g:checksyntax#run_alternatives|
|
|
||||||
g:checksyntax#run_all_alternatives ... |g:checksyntax#run_all_alternatives|
|
|
||||||
g:checksyntax#windows ................ |g:checksyntax#windows|
|
|
||||||
g:checksyntax#null ................... |g:checksyntax#null|
|
|
||||||
g:checksyntax#cygwin_path_rx ......... |g:checksyntax#cygwin_path_rx|
|
|
||||||
g:checksyntax#cygwin_expr ............ |g:checksyntax#cygwin_expr|
|
|
||||||
g:checksyntax#check_cygpath .......... |g:checksyntax#check_cygpath|
|
|
||||||
CheckSyntaxSucceed ................... |CheckSyntaxSucceed()|
|
|
||||||
CheckSyntaxFail ...................... |CheckSyntaxFail()|
|
|
||||||
g:checksyntax#prototypes ............. |g:checksyntax#prototypes|
|
|
||||||
checksyntax#AddChecker ............... |checksyntax#AddChecker()|
|
|
||||||
checksyntax#GetChecker ............... |checksyntax#GetChecker()|
|
|
||||||
checksyntax#Check .................... |checksyntax#Check()|
|
|
||||||
checksyntax#AddJob ................... |checksyntax#AddJob()|
|
|
||||||
checksyntax#RemoveJob ................ |checksyntax#RemoveJob()|
|
|
||||||
checksyntax#Status ................... |checksyntax#Status()|
|
|
||||||
checksyntax#GetList .................. |checksyntax#GetList()|
|
|
||||||
checksyntax#NullOutput ............... |checksyntax#NullOutput()|
|
|
||||||
checksyntax#MaybeUseCygpath .......... |checksyntax#MaybeUseCygpath()|
|
|
||||||
g:checksyntax#pmd#cmd ................ |g:checksyntax#pmd#cmd|
|
|
||||||
g:checksyntax#pmd#args ............... |g:checksyntax#pmd#args|
|
|
||||||
checksyntax#pmd#Cmd .................. |checksyntax#pmd#Cmd()|
|
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
plugin/checksyntax.vim~
|
|
||||||
|
|
||||||
*:CheckSyntax*
|
|
||||||
CheckSyntax[!] [NAME]
|
|
||||||
Check the current buffer's syntax (type defaults to &filetype).
|
|
||||||
Or use NAME instead of &filetype.
|
|
||||||
|
|
||||||
With the bang !, run all alternatives (see
|
|
||||||
|g:checksyntax#run_alternatives|).
|
|
||||||
|
|
||||||
*g:checksyntax_key_single*
|
|
||||||
g:checksyntax_key_single (default: '<F5>')
|
|
||||||
Map for running the preferred syntax checkers on the current
|
|
||||||
buffer.
|
|
||||||
|
|
||||||
*g:checksyntax_key_all*
|
|
||||||
g:checksyntax_key_all (default: '<C-F5>')
|
|
||||||
Map for running all suitable syntax checkers on the current
|
|
||||||
buffer.
|
|
||||||
|
|
||||||
*g:checksyntax_auto*
|
|
||||||
g:checksyntax_auto (default: 1)
|
|
||||||
If 1, enable automatic syntax checks after saving a file.
|
|
||||||
If 2, enable automatic syntax checks when saving and loading a
|
|
||||||
file.
|
|
||||||
NOTE: This variable must be customized in vimrc before loading
|
|
||||||
this plugin.
|
|
||||||
|
|
||||||
See also |g:checksyntax|, |g:checksyntax#auto_enable_rx| and
|
|
||||||
|g:checksyntax#auto_disable_rx|.
|
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
autoload/checksyntax.vim~
|
|
||||||
|
|
||||||
*g:checksyntax#auto_enable_rx*
|
|
||||||
g:checksyntax#auto_enable_rx (default: '')
|
|
||||||
Enable automatic checking for filetypes matching this rx.
|
|
||||||
Set to "." to enable for all filetypes.
|
|
||||||
This requires |g:checksyntax_auto| to be > 0.
|
|
||||||
This variable overrules any filetype-specific settings in
|
|
||||||
|g:checksyntax|.
|
|
||||||
|
|
||||||
*g:checksyntax#auto_disable_rx*
|
|
||||||
g:checksyntax#auto_disable_rx (default: '')
|
|
||||||
Disable automatic checking for filetypes matching this rx.
|
|
||||||
Set to "." to disable for all filetypes.
|
|
||||||
This requires |g:checksyntax_auto| to be > 0.
|
|
||||||
This variable overrules any filetype-specific settings in
|
|
||||||
|g:checksyntax|.
|
|
||||||
|
|
||||||
*g:checksyntax#preferred*
|
|
||||||
g:checksyntax#preferred (default: {'xml': '.'})
|
|
||||||
A dictionary of 'filetype' => |regexp|.
|
|
||||||
If only one alternative should be run (see
|
|
||||||
|g:checksyntax#run_alternatives|), check only those syntax
|
|
||||||
checkers whose names matches |regexp|.
|
|
||||||
|
|
||||||
*g:checksyntax#async_runner*
|
|
||||||
g:checksyntax#async_runner (default: has('clientserver') && !empty(v:servername) && exists(':AsyncMake') ? 'asynccommand' : '')
|
|
||||||
Supported values:
|
|
||||||
asynccommand ... Use the AsyncCommand plugin
|
|
||||||
|
|
||||||
*:CheckSyntaxStatus*
|
|
||||||
:CheckSyntaxStatus
|
|
||||||
Show status information (pending async tasks).
|
|
||||||
|
|
||||||
*g:checksyntax#run_alternatives*
|
|
||||||
g:checksyntax#run_alternatives (default: 'first' . (!empty(g:checksyntax#async_runner) ? ' async' : ''))
|
|
||||||
How to handle alternatives. Possible values:
|
|
||||||
|
|
||||||
first ... Use the first valid entry
|
|
||||||
all ... Run all valid alternatives one after another
|
|
||||||
|
|
||||||
Alternatively, the following flag can be added in order to change
|
|
||||||
how the alternatives are run:
|
|
||||||
|
|
||||||
async ... Run alternatives asynchronously (see also
|
|
||||||
|g:checksyntax#async_runner|)
|
|
||||||
|
|
||||||
*g:checksyntax#run_all_alternatives*
|
|
||||||
g:checksyntax#run_all_alternatives (default: 'all' . (!empty(g:checksyntax#async_runner) ? ' async' : ''))
|
|
||||||
How to run "all" alternatives -- e.g., when calling the
|
|
||||||
|:CheckSyntax| command with a bang.
|
|
||||||
|
|
||||||
*g:checksyntax#windows*
|
|
||||||
g:checksyntax#windows (default: &shell !~ 'sh' && (has('win16') || has('win32') || has('win64')))
|
|
||||||
|
|
||||||
*g:checksyntax#null*
|
|
||||||
g:checksyntax#null (default: g:checksyntax#windows ? 'nul' : (filereadable('/dev/null') ? '/dev/null' : ''))
|
|
||||||
|
|
||||||
*g:checksyntax#cygwin_path_rx*
|
|
||||||
g:checksyntax#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:checksyntax#cygwin_expr*
|
|
||||||
g:checksyntax#cygwin_expr (default: '"bash -c ''". escape(%s, "''\\") ."''"')
|
|
||||||
For cygwin binaries, convert command calls using this vim
|
|
||||||
expression.
|
|
||||||
|
|
||||||
*g:checksyntax#check_cygpath*
|
|
||||||
g:checksyntax#check_cygpath (default: g:checksyntax#windows && s:Executable('cygpath'))
|
|
||||||
If true, check whether we have to convert a path via cyppath --
|
|
||||||
see |checksyntax#MaybeUseCygpath|
|
|
||||||
|
|
||||||
*CheckSyntaxSucceed()*
|
|
||||||
CheckSyntaxSucceed(type, manually)
|
|
||||||
This function is called when no syntax errors were found.
|
|
||||||
|
|
||||||
*CheckSyntaxFail()*
|
|
||||||
CheckSyntaxFail(type, manually, bg)
|
|
||||||
This function is called when a syntax error was found.
|
|
||||||
|
|
||||||
*g:checksyntax#prototypes*
|
|
||||||
g:checksyntax#prototypes (default: {'loc': {}, 'qfl': {}})
|
|
||||||
Contains prototype definitions for syntax checkers that use the
|
|
||||||
|location-list| ("loc") or the |quixfix|-list.
|
|
||||||
|
|
||||||
*checksyntax#AddChecker()*
|
|
||||||
checksyntax#AddChecker(filetype, ...)
|
|
||||||
Define a syntax checker definition for a given filetype.
|
|
||||||
If filetype ends with "?", add only if no checker with the given name
|
|
||||||
is defined.
|
|
||||||
|
|
||||||
A checker definition is a dictionary with the following fields:
|
|
||||||
|
|
||||||
Mandatory (either one of the following):
|
|
||||||
|
|
||||||
cmd ........ A shell command used as 'makeprg' to check the file.
|
|
||||||
cmdexpr .... A vim expression that returns the cmd
|
|
||||||
compiler ... A vim compiler that is used to check the file.
|
|
||||||
exec ....... A vim command used to check the file (deprecated; use
|
|
||||||
cmdexpr & process_list instead)
|
|
||||||
|
|
||||||
Optional:
|
|
||||||
|
|
||||||
efm ....... An 'errorformat' string.
|
|
||||||
prepare .... An ex command that is run before doing anything.
|
|
||||||
ignore_nr .. A list of error numbers that should be ignored.
|
|
||||||
listtype ... Either loc (default) or qfl
|
|
||||||
include .... Include another definition
|
|
||||||
process_list .. Process a list of issues
|
|
||||||
if ......... An expression to test *once* whether a syntax checker
|
|
||||||
should be used.
|
|
||||||
if_executable .. Test whether an application is executable.
|
|
||||||
buffers .... Keep results only for either "current", "listed", or
|
|
||||||
"all" buffers
|
|
||||||
compiler_args .. Internal use
|
|
||||||
cmd_args ... Internal use
|
|
||||||
|
|
||||||
Optional top-level fields:
|
|
||||||
|
|
||||||
auto ....... Run automatically when saving a file (see also
|
|
||||||
|g:checksyntax#auto_enable_rx| and
|
|
||||||
|g:checksyntax#auto_disable_rx|)
|
|
||||||
modified ... The name of a pseudo-filetype that should be used if
|
|
||||||
the buffer was modified
|
|
||||||
run_alternatives ... A string that defines how to run
|
|
||||||
alternatives (overrides
|
|
||||||
|g:checksyntax#run_alternatives|).
|
|
||||||
|
|
||||||
Top-level fields affect how syntax checkers for a filetype are run.
|
|
||||||
|
|
||||||
*checksyntax#GetChecker()*
|
|
||||||
checksyntax#GetChecker(filetype, ...)
|
|
||||||
|
|
||||||
*checksyntax#Check()*
|
|
||||||
checksyntax#Check(manually, ?bang='', ?filetype=&ft, ?background=1)
|
|
||||||
Perform a syntax check.
|
|
||||||
If bang is not empty, run all alternatives (see
|
|
||||||
|g:checksyntax#run_alternatives|).
|
|
||||||
If filetype is empty, the current buffer's 'filetype' will be used.
|
|
||||||
If background is true, display the list of issues in the background,
|
|
||||||
i.e. the active window will keep the focus.
|
|
||||||
|
|
||||||
*checksyntax#AddJob()*
|
|
||||||
checksyntax#AddJob(make_def)
|
|
||||||
|
|
||||||
*checksyntax#RemoveJob()*
|
|
||||||
checksyntax#RemoveJob(job_id)
|
|
||||||
|
|
||||||
*checksyntax#Status()*
|
|
||||||
checksyntax#Status()
|
|
||||||
|
|
||||||
*checksyntax#GetList()*
|
|
||||||
checksyntax#GetList(name, make_def, type)
|
|
||||||
|
|
||||||
*checksyntax#NullOutput()*
|
|
||||||
checksyntax#NullOutput(flag)
|
|
||||||
|
|
||||||
*checksyntax#MaybeUseCygpath()*
|
|
||||||
checksyntax#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.
|
|
||||||
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
autoload/checksyntax/pmd.vim~
|
|
||||||
|
|
||||||
*g:checksyntax#pmd#cmd*
|
|
||||||
g:checksyntax#pmd#cmd (default: '')
|
|
||||||
The command to run pmd.
|
|
||||||
|
|
||||||
*g:checksyntax#pmd#args*
|
|
||||||
g:checksyntax#pmd#args (default: '-f text')
|
|
||||||
|
|
||||||
*checksyntax#pmd#Cmd()*
|
|
||||||
checksyntax#pmd#Cmd(language, args, rulesets)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl:
|
|
@ -1,78 +0,0 @@
|
|||||||
*checksyntax.txt* checksyntax -- Check syntax when saving a file (php, ruby, tex ...)
|
|
||||||
Author: Tom Link, micathom at gmail com
|
|
||||||
|
|
||||||
The checksyntax plugin runs an external syntax checker for the current buffer
|
|
||||||
whenever the buffer is saved (by calling the |:CheckSyntax| command). Syntax
|
|
||||||
errors are managed as location or quickfix lists. If any syntax error occurs,
|
|
||||||
the |location-list| is opened (users can redefine |CheckSyntaxFail()| to change
|
|
||||||
this behaviour). You can use any |location-list| related command to navigate
|
|
||||||
the list of syntax errors.
|
|
||||||
|
|
||||||
If quickfixsigns (vimscript #2584) is installed, lines containing syntax errors
|
|
||||||
will be marked with signs.
|
|
||||||
|
|
||||||
Experimental: If AsyncCommand (vimscript #3431) is installed, syntax checks can
|
|
||||||
be peformed asynchronously -- see also |g:checksyntax#run_alternatives|,
|
|
||||||
|g:checksyntax#run_all_alternatives| and |g:checksyntax#async_runner|.
|
|
||||||
|
|
||||||
By default, |:CheckSyntax| is mapped to <F5> (if not mapped already),
|
|
||||||
and automatically executed when saving the buffer. :CheckSyntax! or <C-F5> will
|
|
||||||
run all syntax checkers for a given filetype if multiple alternatives are
|
|
||||||
defined and installed on your computer.
|
|
||||||
|
|
||||||
The |:CheckSyntax| command takes one optional argument: the mode (default:
|
|
||||||
&filetype).
|
|
||||||
|
|
||||||
As the plugin doesn't provide syntax checks by its own. This is done by
|
|
||||||
an external syntax checker that has to be installed on your computer.
|
|
||||||
|
|
||||||
Pre-defined syntax checkers (the respective syntax checker has to
|
|
||||||
be installed):
|
|
||||||
|
|
||||||
c, cpp ... Requires splint
|
|
||||||
html ... Requires tidy
|
|
||||||
java ... Requires
|
|
||||||
jlint (http://jlint.sourceforge.net),
|
|
||||||
checkstyle (http://checkstyle.sourceforge.net),
|
|
||||||
pmd (http://pmd.sourceforge.net)
|
|
||||||
javascript ... Syntax check; requires jshint, esprima,
|
|
||||||
gjslint, jslint, jsl, pmd
|
|
||||||
lua ... Requires luac (run luac -p)
|
|
||||||
php ... Syntax check; requires php (run php -l)
|
|
||||||
python ... Requires pyflakes or pylint
|
|
||||||
r ... Requires codetools::checkUsage, lint::lint, or
|
|
||||||
svTools::lint
|
|
||||||
ruby ... Requires ruby (run ruby -c)
|
|
||||||
tex, latex ... Requires chktex (run chktex -q -v0)
|
|
||||||
viki ... Requires deplate
|
|
||||||
xhtml ... Requires tidy
|
|
||||||
xml, docbk ... Requires xmllint, pmd
|
|
||||||
|
|
||||||
Syntax checker definitions are kept in:
|
|
||||||
autoload/checksyntax/defs/{&filetype}.vim
|
|
||||||
|
|
||||||
Run this command to find out, which filetypes are supported: >
|
|
||||||
:echo globpath(&rtp, 'autoload/checksyntax/defs/*.vim')
|
|
||||||
|
|
||||||
This plugin was originally based on Klaus Horsten's php_console
|
|
||||||
(vimscript #779) and it is the successor of php_check_syntax.vim
|
|
||||||
(vimscript #1272).
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
Install~
|
|
||||||
|
|
||||||
Edit the vba file and type: >
|
|
||||||
|
|
||||||
:so %%
|
|
||||||
|
|
||||||
See :help vimball for details. If you have difficulties or use vim 7.0,
|
|
||||||
please make sure, you have the current version of vimball (vimscript
|
|
||||||
#1502) installed or update your runtime.
|
|
||||||
|
|
||||||
Optional enhancements:
|
|
||||||
quickfixsigns (vimscript #2584) ... Use signs
|
|
||||||
AsyncCommand (vimscript #3431) ... Run commands asynchronously
|
|
||||||
|
|
||||||
|
|
||||||
%s
|
|
@ -1,87 +0,0 @@
|
|||||||
" checksyntax.vim -- Check syntax when saving a file (php, ruby, tex ...)
|
|
||||||
" @Author: Tom Link (micathom AT gmail com)
|
|
||||||
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
" @Created: 04-Mai-2005.
|
|
||||||
" @Last Change: 2012-08-28.
|
|
||||||
" GetLatestVimScripts: 1431 0 :AutoInstall: checksyntax.vim
|
|
||||||
" @Revision: 429
|
|
||||||
|
|
||||||
if exists('g:loaded_checksyntax')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:loaded_checksyntax = 300
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax')
|
|
||||||
let g:checksyntax = {}
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" :display: CheckSyntax[!] [NAME]
|
|
||||||
" Check the current buffer's syntax (type defaults to &filetype).
|
|
||||||
" Or use NAME instead of &filetype.
|
|
||||||
"
|
|
||||||
" With the bang !, run all alternatives (see
|
|
||||||
" |g:checksyntax#run_alternatives|).
|
|
||||||
command! -bang -nargs=? CheckSyntax call checksyntax#Check(1, "<bang>", <f-args>)
|
|
||||||
|
|
||||||
|
|
||||||
" @TPluginInclude
|
|
||||||
if !exists('g:checksyntax_key_single')
|
|
||||||
" Map for running the preferred syntax checkers on the current
|
|
||||||
" buffer.
|
|
||||||
let g:checksyntax_key_single = '<F5>' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" @TPluginInclude
|
|
||||||
if !exists('g:checksyntax_key_all')
|
|
||||||
" Map for running all suitable syntax checkers on the current
|
|
||||||
" buffer.
|
|
||||||
let g:checksyntax_key_all = '<C-F5>' "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:checksyntax_auto')
|
|
||||||
" If 1, enable automatic syntax checks after saving a file.
|
|
||||||
" If 2, enable automatic syntax checks when saving and loading a
|
|
||||||
" file.
|
|
||||||
" NOTE: This variable must be customized in vimrc before loading
|
|
||||||
" this plugin.
|
|
||||||
"
|
|
||||||
" See also |g:checksyntax|, |g:checksyntax#auto_enable_rx| and
|
|
||||||
" |g:checksyntax#auto_disable_rx|.
|
|
||||||
let g:checksyntax_auto = 1 "{{{2
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" @TPluginInclude
|
|
||||||
augroup CheckSyntax
|
|
||||||
autocmd!
|
|
||||||
if !exists('g:checksyntax_auto') || g:checksyntax_auto >= 1
|
|
||||||
autocmd BufWritePost * call checksyntax#Check(0)
|
|
||||||
endif
|
|
||||||
if exists('g:checksyntax_auto') && g:checksyntax_auto >= 2
|
|
||||||
autocmd BufEnter * if !exists('b:checksyntax_runs')
|
|
||||||
\ | call checksyntax#Check(0, 0, &ft, 1)
|
|
||||||
\ | endif
|
|
||||||
endif
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
|
|
||||||
" @TPluginInclude
|
|
||||||
if !hasmapto(':CheckSyntax')
|
|
||||||
if empty(maparg(g:checksyntax_key_single, 'n'))
|
|
||||||
exec 'noremap' g:checksyntax_key_single ':CheckSyntax<cr>'
|
|
||||||
endif
|
|
||||||
if empty(maparg(g:checksyntax_key_single, 'i'))
|
|
||||||
exec 'inoremap' g:checksyntax_key_single '<c-o>:CheckSyntax<cr>'
|
|
||||||
endif
|
|
||||||
if empty(maparg(g:checksyntax_key_all, 'n'))
|
|
||||||
exec 'noremap' g:checksyntax_key_all ':CheckSyntax!<cr>'
|
|
||||||
endif
|
|
||||||
if empty(maparg(g:checksyntax_key_all, 'i'))
|
|
||||||
exec 'inoremap' g:checksyntax_key_all '<c-o>:CheckSyntax!<cr>'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
.*.sw[a-z]
|
|
||||||
.*.un~
|
|
||||||
doc/tags
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
||||||
Version 2, December 2004
|
|
||||||
|
|
||||||
Copyright (C) 2010 to 2012 Mick Koch <kchmck@gmail.com>
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
REF = HEAD
|
|
||||||
VERSION = $(shell git describe --always $(REF))
|
|
||||||
|
|
||||||
ARCHIVE = vim-coffee-script-$(VERSION).zip
|
|
||||||
ARCHIVE_DIRS = after autoload compiler doc ftdetect ftplugin indent syntax
|
|
||||||
|
|
||||||
# Don't do anything by default.
|
|
||||||
all:
|
|
||||||
|
|
||||||
# Make vim.org zipball.
|
|
||||||
archive:
|
|
||||||
git archive $(REF) -o $(ARCHIVE) -- $(ARCHIVE_DIRS)
|
|
||||||
|
|
||||||
# Remove zipball.
|
|
||||||
clean:
|
|
||||||
-rm -f $(ARCHIVE)
|
|
||||||
|
|
||||||
# Build the list of syntaxes for @coffeeAll.
|
|
||||||
coffeeAll:
|
|
||||||
@grep -E 'syn (match|region)' syntax/coffee.vim |\
|
|
||||||
grep -v 'contained' |\
|
|
||||||
awk '{print $$3}' |\
|
|
||||||
uniq
|
|
||||||
|
|
||||||
.PHONY: all archive clean hash coffeeAll
|
|
@ -1,18 +0,0 @@
|
|||||||
### Version 002 (December 5, 2011)
|
|
||||||
|
|
||||||
Added binary numbers (0b0101) and fixed some bugs (#9, #62, #63, #65).
|
|
||||||
|
|
||||||
### Version 001 (October 18, 2011)
|
|
||||||
|
|
||||||
Removed deprecated `coffee_folding` option, added `coffee_compile_vert` option,
|
|
||||||
split out compiler, fixed indentation and syntax bugs, and added Haml support
|
|
||||||
and omnicompletion.
|
|
||||||
|
|
||||||
- The coffee compiler is now a proper vim compiler that can be loaded with
|
|
||||||
`:compiler coffee`.
|
|
||||||
- The `coffee_compile_vert` option can now be set to split the CoffeeCompile
|
|
||||||
buffer vertically by default.
|
|
||||||
- CoffeeScript is now highlighted inside the `:coffeescript` filter in Haml.
|
|
||||||
- Omnicompletion (`:help compl-omni`) now uses JavaScript's dictionary to
|
|
||||||
complete words.
|
|
||||||
- We now have a fancy version number.
|
|
@ -1,599 +0,0 @@
|
|||||||
This project adds [CoffeeScript] support to vim. It covers syntax, indenting,
|
|
||||||
compiling, and more.
|
|
||||||
|
|
||||||
![Screenshot](http://i.imgur.com/j1BhpZQ.png)
|
|
||||||
|
|
||||||
[CoffeeScript]: http://coffeescript.org/
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- Installation
|
|
||||||
- [Requirements](#requirements)
|
|
||||||
- [Install using Pathogen](#install-using-pathogen)
|
|
||||||
- [Install using Vundle](#install-using-vundle)
|
|
||||||
- [Install from a Zip File](#install-from-a-zip-file)
|
|
||||||
- Coffee Commands
|
|
||||||
- [Compile to JavaScript](#compile-to-javascript)
|
|
||||||
- [Compile CoffeeScript Snippets](#coffeecompile-compile-coffeescript-snippets)
|
|
||||||
- [Live Preview Compiling](#coffeewatch-live-preview-compiling)
|
|
||||||
- [Run CoffeeScript Snippets](#coffeerun-run-coffeescript-snippets)
|
|
||||||
- [Lint your CoffeeScript](#coffeelint-lint-your-coffeescript)
|
|
||||||
- Extras
|
|
||||||
- [Literate CoffeeScript](#literate-coffeescript)
|
|
||||||
- [CoffeeScript in HTML](#coffeescript-in-html)
|
|
||||||
- [CoffeeScript in Haml](#coffeescript-in-haml)
|
|
||||||
- Configuration
|
|
||||||
- [Custom Autocmds](#custom-autocmds)
|
|
||||||
- [Configuration Variables](#configuration-variables)
|
|
||||||
- [Configure Syntax Highlighting](#configure-syntax-highlighting)
|
|
||||||
- [Tune Vim for CoffeeScript](#tune-vim-for-coffeescript)
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
- vim 7.4 or later
|
|
||||||
- coffee 1.2.0 or later
|
|
||||||
|
|
||||||
## Install using Pathogen
|
|
||||||
|
|
||||||
This project uses rolling releases based on git commits, so pathogen is a
|
|
||||||
natural fit for it. If you're already using pathogen, you can skip to step 4.
|
|
||||||
|
|
||||||
1. Install [pathogen.vim] into `~/.vim/autoload/` (see [pathogen's
|
|
||||||
readme][install-pathogen] for more information.)
|
|
||||||
|
|
||||||
[pathogen.vim]: http://www.vim.org/scripts/script.php?script_id=2332
|
|
||||||
[install-pathogen]: https://github.com/tpope/vim-pathogen#installation
|
|
||||||
|
|
||||||
2. Enable pathogen in your vimrc. Here's a bare-minimum vimrc that enables
|
|
||||||
all the features of `vim-coffee-script`:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
call pathogen#infect()
|
|
||||||
syntax enable
|
|
||||||
filetype plugin indent on
|
|
||||||
```
|
|
||||||
|
|
||||||
If you already have a vimrc built up, just make sure it contains these calls,
|
|
||||||
in this order.
|
|
||||||
|
|
||||||
3. Create the directory `~/.vim/bundle/`:
|
|
||||||
|
|
||||||
mkdir ~/.vim/bundle
|
|
||||||
|
|
||||||
4. Clone the `vim-coffee-script` repo into `~/.vim/bundle/`:
|
|
||||||
|
|
||||||
git clone https://github.com/kchmck/vim-coffee-script.git ~/.vim/bundle/vim-coffee-script/
|
|
||||||
|
|
||||||
Updating takes two steps:
|
|
||||||
|
|
||||||
1. Change into `~/.vim/bundle/vim-coffee-script/`:
|
|
||||||
|
|
||||||
cd ~/.vim/bundle/vim-coffee-script
|
|
||||||
|
|
||||||
2. Pull in the latest changes:
|
|
||||||
|
|
||||||
git pull
|
|
||||||
|
|
||||||
## Install using Vundle
|
|
||||||
|
|
||||||
1. [Install Vundle] into `~/.vim/bundle/`.
|
|
||||||
|
|
||||||
[Install Vundle]: https://github.com/gmarik/vundle#quick-start
|
|
||||||
|
|
||||||
2. Configure your vimrc for Vundle. Here's a bare-minimum vimrc that enables all
|
|
||||||
the features of `vim-coffee-script`:
|
|
||||||
|
|
||||||
|
|
||||||
```vim
|
|
||||||
set nocompatible
|
|
||||||
filetype off
|
|
||||||
|
|
||||||
set rtp+=~/.vim/bundle/vundle/
|
|
||||||
call vundle#rc()
|
|
||||||
|
|
||||||
Bundle 'kchmck/vim-coffee-script'
|
|
||||||
|
|
||||||
syntax enable
|
|
||||||
filetype plugin indent on
|
|
||||||
```
|
|
||||||
|
|
||||||
If you're adding Vundle to a built-up vimrc, just make sure all these calls
|
|
||||||
are in there and that they occur in this order.
|
|
||||||
|
|
||||||
3. Open vim and run `:BundleInstall`.
|
|
||||||
|
|
||||||
To update, open vim and run `:BundleInstall!` (notice the bang!)
|
|
||||||
|
|
||||||
## Install from a Zip File
|
|
||||||
|
|
||||||
1. Download the latest zip file from [vim.org][zip].
|
|
||||||
|
|
||||||
2. Extract the archive into `~/.vim/`:
|
|
||||||
|
|
||||||
unzip -od ~/.vim/ ARCHIVE.zip
|
|
||||||
|
|
||||||
This should create the files `~/.vim/autoload/coffee.vim`,
|
|
||||||
`~/.vim/compiler/coffee.vim`, etc.
|
|
||||||
|
|
||||||
You can update the plugin using the same steps.
|
|
||||||
|
|
||||||
[zip]: http://www.vim.org/scripts/script.php?script_id=3590
|
|
||||||
|
|
||||||
## Compile to JavaScript
|
|
||||||
|
|
||||||
A `coffee` wrapper for use with `:make` is enabled automatically for coffee
|
|
||||||
files if no other compiler is loaded. To enable it manually, run
|
|
||||||
|
|
||||||
:compiler coffee
|
|
||||||
|
|
||||||
The `:make` command is then configured to use the `coffee` compiler and
|
|
||||||
recognize its errors. I've included a quick reference here but be sure to check
|
|
||||||
out [`:help :make`][make] for a full reference of the command.
|
|
||||||
|
|
||||||
![make](http://i.imgur.com/scUXmxR.png)
|
|
||||||
|
|
||||||
![make Result](http://i.imgur.com/eGIjEdn.png)
|
|
||||||
|
|
||||||
[make]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:make_makeprg
|
|
||||||
|
|
||||||
Consider the full signature of a `:make` call as
|
|
||||||
|
|
||||||
:[silent] make[!] [COFFEE-OPTIONS]...
|
|
||||||
|
|
||||||
By default `:make` shows all compiler output and jumps to the first line
|
|
||||||
reported as an error. Compiler output can be hidden with a leading `:silent`:
|
|
||||||
|
|
||||||
:silent make
|
|
||||||
|
|
||||||
Line-jumping can be turned off by adding a bang:
|
|
||||||
|
|
||||||
:make!
|
|
||||||
|
|
||||||
`COFFEE-OPTIONS` given to `:make` are passed along to `coffee` (see also
|
|
||||||
[`coffee_make_options`](#coffee_make_options)):
|
|
||||||
|
|
||||||
:make --bare --output /some/dir
|
|
||||||
|
|
||||||
See the [full table of options](http://coffeescript.org/#usage) for a
|
|
||||||
list of all the options that `coffee` recognizes.
|
|
||||||
|
|
||||||
*Configuration*: [`coffee_compiler`](#coffee_compiler),
|
|
||||||
[`coffee_make_options`](#coffee_make_options)
|
|
||||||
|
|
||||||
#### The quickfix window
|
|
||||||
|
|
||||||
Compiler errors are added to the [quickfix] list by `:make`, but the quickfix
|
|
||||||
window isn't automatically shown. The [`:cwindow`][cwindow] command will pop up
|
|
||||||
the quickfix window if there are any errors:
|
|
||||||
|
|
||||||
:make
|
|
||||||
:cwindow
|
|
||||||
|
|
||||||
This is usually the desired behavior, so you may want to add an autocmd to your
|
|
||||||
vimrc to do this automatically:
|
|
||||||
|
|
||||||
autocmd QuickFixCmdPost * nested cwindow | redraw!
|
|
||||||
|
|
||||||
The `redraw!` command is needed to fix a redrawing quirk in terminal vim, but
|
|
||||||
can removed for gVim.
|
|
||||||
|
|
||||||
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
|
|
||||||
[cwindow]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:cwindow
|
|
||||||
|
|
||||||
#### Recompile on write
|
|
||||||
|
|
||||||
To recompile a file when it's written, add a `BufWritePost` autocmd to your
|
|
||||||
vimrc:
|
|
||||||
|
|
||||||
autocmd BufWritePost *.coffee silent make!
|
|
||||||
|
|
||||||
#### Cake and Cakefiles
|
|
||||||
|
|
||||||
A `cake` compiler is also available with the call
|
|
||||||
|
|
||||||
:compiler cake
|
|
||||||
|
|
||||||
You can then use `:make` as above to run your Cakefile and capture any `coffee`
|
|
||||||
errors:
|
|
||||||
|
|
||||||
:silent make build
|
|
||||||
|
|
||||||
It runs within the current directory, so make sure you're in the directory of
|
|
||||||
your Cakefile before calling it.
|
|
||||||
|
|
||||||
*Configuration*: [`coffee_cake`](#coffee_cake),
|
|
||||||
[`coffee_cake_options`](#coffee_cake_options)
|
|
||||||
|
|
||||||
## CoffeeCompile: Compile CoffeeScript Snippets
|
|
||||||
|
|
||||||
CoffeeCompile shows how the current file or a snippet of CoffeeScript is
|
|
||||||
compiled to JavaScript.
|
|
||||||
|
|
||||||
:[RANGE] CoffeeCompile [vert[ical]] [WINDOW-SIZE]
|
|
||||||
|
|
||||||
Calling `:CoffeeCompile` without a range compiles the whole file:
|
|
||||||
|
|
||||||
![CoffeeCompile](http://i.imgur.com/0zFG0l0.png)
|
|
||||||
|
|
||||||
![CoffeeCompile Result](http://i.imgur.com/bpiAxaa.png)
|
|
||||||
|
|
||||||
Calling it with a range, like in visual mode, compiles only the selected snippet
|
|
||||||
of CoffeeScript:
|
|
||||||
|
|
||||||
![CoffeeCompile Snippet](http://i.imgur.com/x3OT3Ay.png)
|
|
||||||
|
|
||||||
![Compiled Snippet](http://i.imgur.com/J02j4T8.png)
|
|
||||||
|
|
||||||
Each file gets its own CoffeeCompile buffer, and the same buffer is used for all
|
|
||||||
future calls of `:CoffeeCompile` on that file. It can be quickly closed by
|
|
||||||
hitting `q` in normal mode.
|
|
||||||
|
|
||||||
Using `vert` opens the CoffeeCompile buffer vertically instead of horizontally
|
|
||||||
(see also [`coffee_compile_vert`](#coffee_compile_vert)):
|
|
||||||
|
|
||||||
:CoffeeCompile vert
|
|
||||||
|
|
||||||
By default the CoffeeCompile buffer splits the source buffer in half, but this
|
|
||||||
can be overridden by passing in a `WINDOW-SIZE`:
|
|
||||||
|
|
||||||
:CoffeeCompile 4
|
|
||||||
|
|
||||||
*Configuration*: [`coffee_compiler`](#coffee_compiler`),
|
|
||||||
[`coffee_compile_vert`](#coffee_compile_vert)
|
|
||||||
|
|
||||||
#### Quick syntax checking
|
|
||||||
|
|
||||||
If compiling a snippet results in a compiler error, CoffeeCompile adds that
|
|
||||||
error to the [quickfix] list.
|
|
||||||
|
|
||||||
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
|
|
||||||
|
|
||||||
![Syntax Checking](http://i.imgur.com/RC8accF.png)
|
|
||||||
|
|
||||||
![Syntax Checking Result](http://i.imgur.com/gi1ON75.png)
|
|
||||||
|
|
||||||
You can use this to quickly check the syntax of a snippet.
|
|
||||||
|
|
||||||
## CoffeeWatch: Live Preview Compiling
|
|
||||||
|
|
||||||
CoffeeWatch emulates using the Try CoffeeScript preview box on the [CoffeeScript
|
|
||||||
homepage][CoffeeScript].
|
|
||||||
|
|
||||||
![CoffeeWatch](http://i.imgur.com/TRHdIMG.png)
|
|
||||||
|
|
||||||
![CoffeeWatch Result](http://i.imgur.com/rJbOeeS.png)
|
|
||||||
|
|
||||||
CoffeeWatch takes the same options as CoffeeCompile:
|
|
||||||
|
|
||||||
:CoffeeWatch [vert[ical]] [WINDOW-SIZE]
|
|
||||||
|
|
||||||
After a source buffer is watched, leaving insert mode or saving the file fires
|
|
||||||
off a recompile of the CoffeeScript:
|
|
||||||
|
|
||||||
![Insert Mode](http://i.imgur.com/SBVcf4k.png)
|
|
||||||
|
|
||||||
![Recompile](http://i.imgur.com/pbPMog7.png)
|
|
||||||
|
|
||||||
You can force recompilation by calling `:CoffeeWatch`.
|
|
||||||
|
|
||||||
To get synchronized scrolling of the source buffer and CoffeeWatch buffer, set
|
|
||||||
[`'scrollbind'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'scrollbind')
|
|
||||||
on each:
|
|
||||||
|
|
||||||
:setl scrollbind
|
|
||||||
|
|
||||||
*Configuration*: [`coffee_compiler`](#coffee_compiler),
|
|
||||||
[`coffee_watch_vert`](#coffee_watch_vert)
|
|
||||||
|
|
||||||
## CoffeeRun: Run CoffeeScript Snippets
|
|
||||||
|
|
||||||
CoffeeRun compiles the current file or selected snippet and runs the resulting
|
|
||||||
JavaScript.
|
|
||||||
|
|
||||||
![CoffeeRun](http://i.imgur.com/YSkHUuQ.png)
|
|
||||||
|
|
||||||
![CoffeeRun Output](http://i.imgur.com/wZQbggN.png)
|
|
||||||
|
|
||||||
The command has two forms:
|
|
||||||
|
|
||||||
:CoffeeRun [PROGRAM-OPTIONS]...
|
|
||||||
|
|
||||||
This form applies when no `RANGE` is given or when the given range is `1,$`
|
|
||||||
(first line to last line). It allows passing `PROGRAM-OPTIONS` to your compiled
|
|
||||||
program. The filename is passed directly to `coffee` so you must save the file
|
|
||||||
for your changes to take effect.
|
|
||||||
|
|
||||||
:RANGE CoffeeRun [COFFEE-OPTIONS]...
|
|
||||||
|
|
||||||
This form applies with all other ranges. It compiles and runs the lines within
|
|
||||||
the given `RANGE` and any extra `COFFEE-OPTIONS` are passed to `coffee`.
|
|
||||||
|
|
||||||
*Configuration*: [`coffee_compiler`](#coffee_compiler),
|
|
||||||
[`coffee_run_vert`](#coffee_run_vert)
|
|
||||||
|
|
||||||
## CoffeeLint: Lint your CoffeeScript
|
|
||||||
|
|
||||||
CoffeeLint runs [coffeelint](http://www.coffeelint.org/) (version 0.5.7 or later
|
|
||||||
required) on the current file and adds any issues to the [quickfix] list.
|
|
||||||
|
|
||||||
![CoffeeLint](http://i.imgur.com/UN8Nr5N.png)
|
|
||||||
|
|
||||||
![CoffeeLint Result](http://i.imgur.com/9hSIj3W.png)
|
|
||||||
|
|
||||||
:[RANGE] CoffeeLint[!] [COFFEELINT-OPTIONS]... [ | cwindow]
|
|
||||||
|
|
||||||
If a `RANGE` is given, only those lines are piped to `coffeelint`. Options given
|
|
||||||
in `COFFEELINT-OPTIONS` are passed to `coffeelint` (see also
|
|
||||||
[`coffee_lint_options`](#coffee_lint_options)):
|
|
||||||
|
|
||||||
:CoffeeLint -f lint.json
|
|
||||||
|
|
||||||
It behaves very similar to `:make`, described [above](#compile-to-javascript).
|
|
||||||
|
|
||||||
:CoffeeLint! | cwindow
|
|
||||||
|
|
||||||
*Configuration*: [`coffee_linter`](#coffee_linter),
|
|
||||||
[`coffee_lint_options`](#coffee_lint_options)
|
|
||||||
|
|
||||||
## Literate CoffeeScript
|
|
||||||
|
|
||||||
Literate CoffeeScript syntax and indent support is provided by
|
|
||||||
[vim-literate-coffeescript]. The `Coffee` commands detect when they're running
|
|
||||||
on a litcoffee file and pass the `--literate` flag to their respective tools,
|
|
||||||
but at this time the commands are not automatically loaded when a litcoffee file
|
|
||||||
is opened.
|
|
||||||
|
|
||||||
[vim-literate-coffeescript]: https://github.com/mintplant/vim-literate-coffeescript
|
|
||||||
|
|
||||||
To load them, run
|
|
||||||
|
|
||||||
runtime ftplugin/coffee.vim
|
|
||||||
|
|
||||||
while inside a litcoffee buffer. To do this automatically, add
|
|
||||||
|
|
||||||
autocmd FileType litcoffee runtime ftplugin/coffee.vim
|
|
||||||
|
|
||||||
to your vimrc.
|
|
||||||
|
|
||||||
## CoffeeScript in HTML
|
|
||||||
|
|
||||||
CoffeeScript is highlighted and indented within
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script type="text/coffeescript">
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
blocks in html files.
|
|
||||||
|
|
||||||
## CoffeeScript in Haml
|
|
||||||
|
|
||||||
CoffeeScript is highlighted within the `:coffeescript` filter in haml files:
|
|
||||||
|
|
||||||
```haml
|
|
||||||
:coffeescript
|
|
||||||
console.log "hullo"
|
|
||||||
```
|
|
||||||
|
|
||||||
At this time, coffee indenting doesn't work in these blocks.
|
|
||||||
|
|
||||||
## Custom Autocmds
|
|
||||||
|
|
||||||
You can [define commands][autocmd-explain] to be ran automatically on these
|
|
||||||
custom events.
|
|
||||||
|
|
||||||
In all cases, the name of the command running the event (`CoffeeCompile`,
|
|
||||||
`CoffeeWatch`, or `CoffeeRun`) is matched by the [`{pat}`][autocmd] argument.
|
|
||||||
You can match all commands with a `*` or only specific commands by separating
|
|
||||||
them with a comma: `CoffeeCompile,CoffeeWatch`.
|
|
||||||
|
|
||||||
[autocmd-explain]: http://vimdoc.sourceforge.net/htmldoc/usr_40.html#40.3
|
|
||||||
[autocmd]: http://vimdoc.sourceforge.net/htmldoc/autocmd.html#:autocmd
|
|
||||||
|
|
||||||
#### CoffeeBufNew
|
|
||||||
|
|
||||||
CoffeeBufNew is ran when a new scratch buffer is created. It's called from the
|
|
||||||
new buffer, so it can be used to do additional set up.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
augroup CoffeeBufNew
|
|
||||||
autocmd User * set wrap
|
|
||||||
augroup END
|
|
||||||
```
|
|
||||||
|
|
||||||
*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun
|
|
||||||
|
|
||||||
#### CoffeeBufUpdate
|
|
||||||
|
|
||||||
CoffeeBufUpdate is ran when a scratch buffer is updated with output from
|
|
||||||
`coffee`. It's called from the scratch buffer, so it can be used to alter the
|
|
||||||
compiled output.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" Switch back to the source buffer after updating.
|
|
||||||
augroup CoffeeBufUpdate
|
|
||||||
autocmd User CoffeeCompile,CoffeeRun exec bufwinnr(b:coffee_src_buf) 'wincmd w'
|
|
||||||
augroup END
|
|
||||||
```
|
|
||||||
|
|
||||||
For example, to strip off the "Generated by" comment on the first line, put this
|
|
||||||
in your vimrc:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
function! s:RemoveGeneratedBy()
|
|
||||||
" If there was an error compiling, there's no comment to remove.
|
|
||||||
if v:shell_error
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Save cursor position.
|
|
||||||
let pos = getpos('.')
|
|
||||||
|
|
||||||
" Remove first line.
|
|
||||||
set modifiable
|
|
||||||
1 delete _
|
|
||||||
set nomodifiable
|
|
||||||
|
|
||||||
" Restore cursor position.
|
|
||||||
call setpos('.', pos)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
augroup CoffeeBufUpdate
|
|
||||||
autocmd User CoffeeCompile,CoffeeWatch call s:RemoveGeneratedBy()
|
|
||||||
augroup END
|
|
||||||
```
|
|
||||||
|
|
||||||
*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun
|
|
||||||
|
|
||||||
## Configuration Variables
|
|
||||||
|
|
||||||
This is the full list of configuration variables available, with example
|
|
||||||
settings and default values. Use these in your vimrc to control the default
|
|
||||||
behavior.
|
|
||||||
|
|
||||||
#### coffee\_indent\_keep\_current
|
|
||||||
|
|
||||||
By default, the indent function matches the indent of the previous line if it
|
|
||||||
doesn't find a reason to indent or outdent. To change this behavior so it
|
|
||||||
instead keeps the [current indent of the cursor][98], use
|
|
||||||
|
|
||||||
let coffee_indent_keep_current = 1
|
|
||||||
|
|
||||||
[98]: https://github.com/kchmck/vim-coffee-script/pull/98
|
|
||||||
|
|
||||||
*Default*: `unlet coffee_indent_keep_current`
|
|
||||||
|
|
||||||
Note that if you change this after a coffee file has been loaded, you'll have to
|
|
||||||
reload the indent script for the change to take effect:
|
|
||||||
|
|
||||||
unlet b:did_indent | runtime indent/coffee.vim
|
|
||||||
|
|
||||||
#### coffee\_compiler
|
|
||||||
|
|
||||||
Path to the `coffee` executable used by the `Coffee` commands:
|
|
||||||
|
|
||||||
let coffee_compiler = '/usr/bin/coffee'
|
|
||||||
|
|
||||||
*Default*: `'coffee'` (search `$PATH` for executable)
|
|
||||||
|
|
||||||
#### coffee\_make\_options
|
|
||||||
|
|
||||||
Options to pass to `coffee` with `:make`:
|
|
||||||
|
|
||||||
let coffee_make_options = '--bare'
|
|
||||||
|
|
||||||
*Default*: `''` (nothing)
|
|
||||||
|
|
||||||
Note that `coffee_make_options` is embedded into `'makeprg'`, so `:compiler
|
|
||||||
coffee` must be ran after changing `coffee_make_options` for the changes to take
|
|
||||||
effect.
|
|
||||||
|
|
||||||
#### coffee\_cake
|
|
||||||
|
|
||||||
Path to the `cake` executable:
|
|
||||||
|
|
||||||
let coffee_cake = '/opt/bin/cake'
|
|
||||||
|
|
||||||
*Default*: `'cake'` (search `$PATH` for executable)
|
|
||||||
|
|
||||||
#### coffee\_cake\_options
|
|
||||||
|
|
||||||
Options to pass to `cake` with `:make`:
|
|
||||||
|
|
||||||
let coffee_cake_options = 'build'
|
|
||||||
|
|
||||||
*Default*: `''` (nothing)
|
|
||||||
|
|
||||||
#### coffee\_linter
|
|
||||||
|
|
||||||
Path to the `coffeelint` executable:
|
|
||||||
|
|
||||||
let coffee_linter = '/opt/bin/coffeelint'
|
|
||||||
|
|
||||||
*Default*: `'coffeelint'` (search `$PATH` for executable)
|
|
||||||
|
|
||||||
#### coffee\_lint\_options
|
|
||||||
|
|
||||||
Options to pass to `coffeelint`:
|
|
||||||
|
|
||||||
let coffee_lint_options = '-f lint.json'
|
|
||||||
|
|
||||||
*Default*: `''` (nothing)
|
|
||||||
|
|
||||||
#### coffee\_compile\_vert
|
|
||||||
|
|
||||||
Open the CoffeeCompile buffer with a vertical split instead of a horizontal
|
|
||||||
one:
|
|
||||||
|
|
||||||
let coffee_compile_vert = 1
|
|
||||||
|
|
||||||
*Default*: `unlet coffee_compile_vert`
|
|
||||||
|
|
||||||
#### coffee\_watch\_vert
|
|
||||||
|
|
||||||
Open the CoffeeWatch buffer with a vertical split instead of a horizontal
|
|
||||||
one:
|
|
||||||
|
|
||||||
let coffee_watch_vert = 1
|
|
||||||
|
|
||||||
*Default*: `unlet coffee_watch_vert`
|
|
||||||
|
|
||||||
#### coffee\_run\_vert
|
|
||||||
|
|
||||||
Open the CoffeeRun buffer with a vertical split instead of a horizontal
|
|
||||||
one:
|
|
||||||
|
|
||||||
let coffee_run_vert = 1
|
|
||||||
|
|
||||||
*Default*: `unlet coffee_run_vert`
|
|
||||||
|
|
||||||
## Configure Syntax Highlighting
|
|
||||||
|
|
||||||
Add these lines to your vimrc to disable the relevant syntax group.
|
|
||||||
|
|
||||||
#### Disable trailing whitespace error
|
|
||||||
|
|
||||||
Trailing whitespace is highlighted as an error by default. This can be disabled
|
|
||||||
with:
|
|
||||||
|
|
||||||
hi link coffeeSpaceError NONE
|
|
||||||
|
|
||||||
#### Disable trailing semicolon error
|
|
||||||
|
|
||||||
Trailing semicolons are considered an error (for help transitioning from
|
|
||||||
JavaScript.) This can be disabled with:
|
|
||||||
|
|
||||||
hi link coffeeSemicolonError NONE
|
|
||||||
|
|
||||||
#### Disable reserved words error
|
|
||||||
|
|
||||||
Reserved words like `function` and `var` are highlighted as an error where
|
|
||||||
they're not allowed in CoffeeScript. This can be disabled with:
|
|
||||||
|
|
||||||
hi link coffeeReservedError NONE
|
|
||||||
|
|
||||||
## Tune Vim for CoffeeScript
|
|
||||||
|
|
||||||
Changing these core settings can make vim more CoffeeScript friendly.
|
|
||||||
|
|
||||||
#### Fold by indentation
|
|
||||||
|
|
||||||
Folding by indentation works well for CoffeeScript functions and classes:
|
|
||||||
|
|
||||||
![Folding](http://i.imgur.com/gDgUBdO.png)
|
|
||||||
|
|
||||||
To fold by indentation in CoffeeScript files, add this line to your vimrc:
|
|
||||||
|
|
||||||
autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
|
|
||||||
|
|
||||||
With this, folding is disabled by default but can be quickly toggled per-file
|
|
||||||
by hitting `zi`. To enable folding by default, remove `nofoldenable`:
|
|
||||||
|
|
||||||
autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent
|
|
||||||
|
|
||||||
#### Two-space indentation
|
|
||||||
|
|
||||||
To get standard two-space indentation in CoffeeScript files, add this line to
|
|
||||||
your vimrc:
|
|
||||||
|
|
||||||
autocmd BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab
|
|
@ -1,44 +0,0 @@
|
|||||||
Thanks to all bug reporters, and special thanks to those who have contributed
|
|
||||||
code:
|
|
||||||
|
|
||||||
Brian Egan (brianegan):
|
|
||||||
Initial compiling support
|
|
||||||
|
|
||||||
Ches Martin (ches):
|
|
||||||
Initial vim docs
|
|
||||||
|
|
||||||
Chris Hoffman (cehoffman):
|
|
||||||
Add new keywoards from, to, and do
|
|
||||||
Highlight the - in negative integers
|
|
||||||
Add here regex highlighting, increase fold level for here docs
|
|
||||||
|
|
||||||
David Wilhelm (bigfish):
|
|
||||||
CoffeeRun command
|
|
||||||
|
|
||||||
Jay Adkisson (jayferd):
|
|
||||||
Support for eco templates
|
|
||||||
|
|
||||||
Karl Guertin (grayrest)
|
|
||||||
Cakefiles are coffeescript
|
|
||||||
|
|
||||||
Maciej Konieczny (narfdotpl):
|
|
||||||
Fix funny typo
|
|
||||||
|
|
||||||
Matt Sacks (mattsa):
|
|
||||||
Javascript omni-completion
|
|
||||||
coffee_compile_vert option
|
|
||||||
|
|
||||||
Nick Stenning (nickstenning):
|
|
||||||
Fold by indentation for coffeescript
|
|
||||||
|
|
||||||
Simon Lipp (sloonz):
|
|
||||||
Trailing spaces are not error on lines containing only spaces
|
|
||||||
|
|
||||||
Stéphan Kochen (stephank):
|
|
||||||
Initial HTML CoffeeScript highlighting
|
|
||||||
|
|
||||||
Sven Felix Oberquelle (Svelix):
|
|
||||||
Haml CoffeeScript highlighting
|
|
||||||
|
|
||||||
Wei Dai (clvv):
|
|
||||||
Fix the use of Vim built-in make command.
|
|
@ -1 +0,0 @@
|
|||||||
- Don't highlight bad operator combinations
|
|
@ -1,33 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
" Load the coffee and html indent functions.
|
|
||||||
silent! unlet b:did_indent
|
|
||||||
runtime indent/coffee.vim
|
|
||||||
let s:coffeeIndentExpr = &l:indentexpr
|
|
||||||
|
|
||||||
" Load html last so it can overwrite coffee settings.
|
|
||||||
silent! unlet b:did_indent
|
|
||||||
runtime indent/html.vim
|
|
||||||
let s:htmlIndentExpr = &l:indentexpr
|
|
||||||
|
|
||||||
" Inject our wrapper indent function.
|
|
||||||
setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum)
|
|
||||||
|
|
||||||
function! GetCoffeeHtmlIndent(curlinenum)
|
|
||||||
" See if we're inside a coffeescript block.
|
|
||||||
let scriptlnum = searchpair('<script [^>]*type="text/coffeescript"[^>]*>', '',
|
|
||||||
\ '</script>', 'bWn')
|
|
||||||
let prevlnum = prevnonblank(a:curlinenum)
|
|
||||||
|
|
||||||
" If we're in the script block and the previous line isn't the script tag
|
|
||||||
" itself, use coffee indenting.
|
|
||||||
if scriptlnum && scriptlnum != prevlnum
|
|
||||||
exec 'return ' s:coffeeIndentExpr
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Otherwise use html indenting.
|
|
||||||
exec 'return ' s:htmlIndentExpr
|
|
||||||
endfunction
|
|
@ -1,13 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Sven Felix Oberquelle <Svelix.Github@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
" Inherit coffee from html so coffeeComment isn't redefined and given higher
|
|
||||||
" priority than hamlInterpolation.
|
|
||||||
syn cluster hamlCoffeescript contains=@htmlCoffeeScript
|
|
||||||
syn region hamlCoffeescriptFilter matchgroup=hamlFilter
|
|
||||||
\ start="^\z(\s*\):coffee\z(script\)\?\s*$"
|
|
||||||
\ end="^\%(\z1 \| *$\)\@!"
|
|
||||||
\ contains=@hamlCoffeeScript,hamlInterpolation
|
|
||||||
\ keepend
|
|
@ -1,11 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
" Syntax highlighting for text/coffeescript script tags
|
|
||||||
syn include @htmlCoffeeScript syntax/coffee.vim
|
|
||||||
syn region coffeeScript start=#<script [^>]*type="text/coffeescript"[^>]*>#
|
|
||||||
\ end=#</script>#me=s-1 keepend
|
|
||||||
\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc
|
|
||||||
\ containedin=htmlHead
|
|
@ -1,54 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
" Set up some common global/buffer variables.
|
|
||||||
function! coffee#CoffeeSetUpVariables()
|
|
||||||
" Path to coffee executable
|
|
||||||
if !exists('g:coffee_compiler')
|
|
||||||
let g:coffee_compiler = 'coffee'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Options passed to coffee with make
|
|
||||||
if !exists('g:coffee_make_options')
|
|
||||||
let g:coffee_make_options = ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Path to cake executable
|
|
||||||
if !exists('g:coffee_cake')
|
|
||||||
let g:coffee_cake = 'cake'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Extra options passed to cake
|
|
||||||
if !exists('g:coffee_cake_options')
|
|
||||||
let g:coffee_cake_options = ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Path to coffeelint executable
|
|
||||||
if !exists('g:coffee_linter')
|
|
||||||
let g:coffee_linter = 'coffeelint'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Options passed to CoffeeLint
|
|
||||||
if !exists('g:coffee_lint_options')
|
|
||||||
let g:coffee_lint_options = ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Pass the litcoffee flag to tools in this buffer if a litcoffee file is open.
|
|
||||||
" Let the variable be overwritten so it can be updated if a different filetype
|
|
||||||
" is set.
|
|
||||||
if &filetype == 'litcoffee'
|
|
||||||
let b:coffee_litcoffee = '--literate'
|
|
||||||
else
|
|
||||||
let b:coffee_litcoffee = ''
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! coffee#CoffeeSetUpErrorFormat()
|
|
||||||
CompilerSet errorformat=Error:\ In\ %f\\,\ %m\ on\ line\ %l,
|
|
||||||
\Error:\ In\ %f\\,\ Parse\ error\ on\ line\ %l:\ %m,
|
|
||||||
\SyntaxError:\ In\ %f\\,\ %m,
|
|
||||||
\%f:%l:%c:\ error:\ %m,
|
|
||||||
\%-G%.%#
|
|
||||||
endfunction
|
|
@ -1,15 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
if exists('current_compiler')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
let current_compiler = 'cake'
|
|
||||||
call coffee#CoffeeSetUpVariables()
|
|
||||||
|
|
||||||
exec 'CompilerSet makeprg=' . escape(g:coffee_cake . ' ' .
|
|
||||||
\ g:coffee_cake_options . ' $*', ' ')
|
|
||||||
call coffee#CoffeeSetUpErrorFormat()
|
|
@ -1,82 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
" All this is needed to support compiling filenames with spaces, quotes, and
|
|
||||||
" such. The filename is escaped and embedded into the `makeprg` setting.
|
|
||||||
"
|
|
||||||
" Because of this, `makeprg` must be updated on every file rename. And because
|
|
||||||
" of that, `CompilerSet` can't be used because it doesn't exist when the
|
|
||||||
" rename autocmd is ran. So, we have to do some checks to see whether `compiler`
|
|
||||||
" was called locally or globally, and respect that in the rest of the script.
|
|
||||||
|
|
||||||
if exists('current_compiler')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
let current_compiler = 'coffee'
|
|
||||||
call coffee#CoffeeSetUpVariables()
|
|
||||||
|
|
||||||
" Pattern to check if coffee is the compiler
|
|
||||||
let s:pat = '^' . current_compiler
|
|
||||||
|
|
||||||
" Get a `makeprg` for the current filename.
|
|
||||||
function! s:GetMakePrg()
|
|
||||||
return g:coffee_compiler .
|
|
||||||
\ ' -c' .
|
|
||||||
\ ' ' . b:coffee_litcoffee .
|
|
||||||
\ ' ' . g:coffee_make_options .
|
|
||||||
\ ' $*' .
|
|
||||||
\ ' ' . fnameescape(expand('%'))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Set `makeprg` and return 1 if coffee is still the compiler, else return 0.
|
|
||||||
function! s:SetMakePrg()
|
|
||||||
if &l:makeprg =~ s:pat
|
|
||||||
let &l:makeprg = s:GetMakePrg()
|
|
||||||
elseif &g:makeprg =~ s:pat
|
|
||||||
let &g:makeprg = s:GetMakePrg()
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Set a dummy compiler so we can check whether to set locally or globally.
|
|
||||||
exec 'CompilerSet makeprg=' . current_compiler
|
|
||||||
" Then actually set the compiler.
|
|
||||||
call s:SetMakePrg()
|
|
||||||
call coffee#CoffeeSetUpErrorFormat()
|
|
||||||
|
|
||||||
function! s:CoffeeMakeDeprecated(bang, args)
|
|
||||||
echoerr 'CoffeeMake is deprecated! Please use :make instead, its behavior ' .
|
|
||||||
\ 'is identical.'
|
|
||||||
sleep 5
|
|
||||||
exec 'make' . a:bang a:args
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Compile the current file.
|
|
||||||
command! -bang -bar -nargs=* CoffeeMake
|
|
||||||
\ call s:CoffeeMakeDeprecated(<q-bang>, <q-args>)
|
|
||||||
|
|
||||||
" Set `makeprg` on rename since we embed the filename in the setting.
|
|
||||||
augroup CoffeeUpdateMakePrg
|
|
||||||
autocmd!
|
|
||||||
|
|
||||||
" Update `makeprg` if coffee is still the compiler, else stop running this
|
|
||||||
" function.
|
|
||||||
function! s:UpdateMakePrg()
|
|
||||||
if !s:SetMakePrg()
|
|
||||||
autocmd! CoffeeUpdateMakePrg
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Set autocmd locally if compiler was set locally.
|
|
||||||
if &l:makeprg =~ s:pat
|
|
||||||
autocmd BufWritePre,BufFilePost <buffer> call s:UpdateMakePrg()
|
|
||||||
else
|
|
||||||
autocmd BufWritePre,BufFilePost call s:UpdateMakePrg()
|
|
||||||
endif
|
|
||||||
augroup END
|
|
@ -1,4 +0,0 @@
|
|||||||
Please see the project readme for up-to-date docs:
|
|
||||||
https://github.com/kchmck/vim-coffee-script
|
|
||||||
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
|
@ -1,17 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
|
|
||||||
autocmd BufNewFile,BufRead *Cakefile set filetype=coffee
|
|
||||||
autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee
|
|
||||||
autocmd BufNewFile,BufRead *._coffee set filetype=coffee
|
|
||||||
|
|
||||||
function! s:DetectCoffee()
|
|
||||||
if getline(1) =~ '^#!.*\<coffee\>'
|
|
||||||
set filetype=coffee
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
autocmd BufNewFile,BufRead * call s:DetectCoffee()
|
|
@ -1,404 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
if exists('b:did_ftplugin')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:did_ftplugin = 1
|
|
||||||
call coffee#CoffeeSetUpVariables()
|
|
||||||
|
|
||||||
setlocal formatoptions-=t formatoptions+=croql
|
|
||||||
setlocal comments=:# commentstring=#\ %s
|
|
||||||
setlocal omnifunc=javascriptcomplete#CompleteJS
|
|
||||||
|
|
||||||
" Create custom augroups.
|
|
||||||
augroup CoffeeBufUpdate | augroup END
|
|
||||||
augroup CoffeeBufNew | augroup END
|
|
||||||
|
|
||||||
" Enable coffee compiler if a compiler isn't set already.
|
|
||||||
if !len(&l:makeprg)
|
|
||||||
compiler coffee
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Switch to the window for buf.
|
|
||||||
function! s:SwitchWindow(buf)
|
|
||||||
exec bufwinnr(a:buf) 'wincmd w'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Create a new scratch buffer and return the bufnr of it. After the function
|
|
||||||
" returns, vim remains in the scratch buffer so more set up can be done.
|
|
||||||
function! s:ScratchBufBuild(src, vert, size)
|
|
||||||
if a:size <= 0
|
|
||||||
if a:vert
|
|
||||||
let size = winwidth(bufwinnr(a:src)) / 2
|
|
||||||
else
|
|
||||||
let size = winheight(bufwinnr(a:src)) / 2
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if a:vert
|
|
||||||
vertical belowright new
|
|
||||||
exec 'vertical resize' size
|
|
||||||
else
|
|
||||||
belowright new
|
|
||||||
exec 'resize' size
|
|
||||||
endif
|
|
||||||
|
|
||||||
setlocal bufhidden=wipe buftype=nofile nobuflisted noswapfile nomodifiable
|
|
||||||
nnoremap <buffer> <silent> q :hide<CR>
|
|
||||||
|
|
||||||
return bufnr('%')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Replace buffer contents with text and delete the last empty line.
|
|
||||||
function! s:ScratchBufUpdate(buf, text)
|
|
||||||
" Move to the scratch buffer.
|
|
||||||
call s:SwitchWindow(a:buf)
|
|
||||||
|
|
||||||
" Double check we're in the scratch buffer before overwriting.
|
|
||||||
if bufnr('%') != a:buf
|
|
||||||
throw 'unable to change to scratch buffer'
|
|
||||||
endif
|
|
||||||
|
|
||||||
setlocal modifiable
|
|
||||||
silent exec '% delete _'
|
|
||||||
silent put! =a:text
|
|
||||||
silent exec '$ delete _'
|
|
||||||
setlocal nomodifiable
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Parse the output of coffee into a qflist entry for src buffer.
|
|
||||||
function! s:ParseCoffeeError(output, src, startline)
|
|
||||||
" Coffee error is always on first line?
|
|
||||||
let match = matchlist(a:output,
|
|
||||||
\ '^\(\f\+\|\[stdin\]\):\(\d\):\(\d\): error: \(.\{-}\)' . "\n")
|
|
||||||
|
|
||||||
if !len(match)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Consider the line number from coffee as relative and add it to the beginning
|
|
||||||
" line number of the range the command was called on, then subtract one for
|
|
||||||
" zero-based relativity.
|
|
||||||
call setqflist([{'bufnr': a:src, 'lnum': a:startline + str2nr(match[2]) - 1,
|
|
||||||
\ 'type': 'E', 'col': str2nr(match[3]), 'text': match[4]}], 'r')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Reset source buffer variables.
|
|
||||||
function! s:CoffeeCompileResetVars()
|
|
||||||
" Variables defined in source buffer:
|
|
||||||
" b:coffee_compile_buf: bufnr of output buffer
|
|
||||||
" Variables defined in output buffer:
|
|
||||||
" b:coffee_src_buf: bufnr of source buffer
|
|
||||||
" b:coffee_compile_pos: previous cursor position in output buffer
|
|
||||||
|
|
||||||
let b:coffee_compile_buf = -1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:CoffeeWatchResetVars()
|
|
||||||
" Variables defined in source buffer:
|
|
||||||
" b:coffee_watch_buf: bufnr of output buffer
|
|
||||||
" Variables defined in output buffer:
|
|
||||||
" b:coffee_src_buf: bufnr of source buffer
|
|
||||||
" b:coffee_watch_pos: previous cursor position in output buffer
|
|
||||||
|
|
||||||
let b:coffee_watch_buf = -1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:CoffeeRunResetVars()
|
|
||||||
" Variables defined in CoffeeRun source buffer:
|
|
||||||
" b:coffee_run_buf: bufnr of output buffer
|
|
||||||
" Variables defined in CoffeeRun output buffer:
|
|
||||||
" b:coffee_src_buf: bufnr of source buffer
|
|
||||||
" b:coffee_run_pos: previous cursor position in output buffer
|
|
||||||
|
|
||||||
let b:coffee_run_buf = -1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Clean things up in the source buffers.
|
|
||||||
function! s:CoffeeCompileClose()
|
|
||||||
" Switch to the source buffer if not already in it.
|
|
||||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
|
||||||
call s:CoffeeCompileResetVars()
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:CoffeeWatchClose()
|
|
||||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
|
||||||
silent! autocmd! CoffeeAuWatch * <buffer>
|
|
||||||
call s:CoffeeWatchResetVars()
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:CoffeeRunClose()
|
|
||||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
|
||||||
call s:CoffeeRunResetVars()
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Compile the lines between startline and endline and put the result into buf.
|
|
||||||
function! s:CoffeeCompileToBuf(buf, startline, endline)
|
|
||||||
let src = bufnr('%')
|
|
||||||
let input = join(getline(a:startline, a:endline), "\n")
|
|
||||||
|
|
||||||
" Coffee doesn't like empty input.
|
|
||||||
if !len(input)
|
|
||||||
" Function should still return within output buffer.
|
|
||||||
call s:SwitchWindow(a:buf)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Pipe lines into coffee.
|
|
||||||
let output = system(g:coffee_compiler .
|
|
||||||
\ ' -scb' .
|
|
||||||
\ ' ' . b:coffee_litcoffee .
|
|
||||||
\ ' 2>&1', input)
|
|
||||||
|
|
||||||
" Paste output into output buffer.
|
|
||||||
call s:ScratchBufUpdate(a:buf, output)
|
|
||||||
|
|
||||||
" Highlight as JavaScript if there were no compile errors.
|
|
||||||
if v:shell_error
|
|
||||||
call s:ParseCoffeeError(output, src, a:startline)
|
|
||||||
setlocal filetype=
|
|
||||||
else
|
|
||||||
" Clear the quickfix list.
|
|
||||||
call setqflist([], 'r')
|
|
||||||
setlocal filetype=javascript
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Peek at compiled CoffeeScript in a scratch buffer. We handle ranges like this
|
|
||||||
" to prevent the cursor from being moved (and its position saved) before the
|
|
||||||
" function is called.
|
|
||||||
function! s:CoffeeCompile(startline, endline, args)
|
|
||||||
if a:args =~ '\<watch\>'
|
|
||||||
echoerr 'CoffeeCompile watch is deprecated! Please use CoffeeWatch instead'
|
|
||||||
sleep 5
|
|
||||||
call s:CoffeeWatch(a:args)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Switch to the source buffer if not already in it.
|
|
||||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
|
||||||
|
|
||||||
" Bail if not in source buffer.
|
|
||||||
if !exists('b:coffee_compile_buf')
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Build the output buffer if it doesn't exist.
|
|
||||||
if bufwinnr(b:coffee_compile_buf) == -1
|
|
||||||
let src = bufnr('%')
|
|
||||||
|
|
||||||
let vert = exists('g:coffee_compile_vert') || a:args =~ '\<vert\%[ical]\>'
|
|
||||||
let size = str2nr(matchstr(a:args, '\<\d\+\>'))
|
|
||||||
|
|
||||||
" Build the output buffer and save the source bufnr.
|
|
||||||
let buf = s:ScratchBufBuild(src, vert, size)
|
|
||||||
let b:coffee_src_buf = src
|
|
||||||
|
|
||||||
" Set the buffer name.
|
|
||||||
exec 'silent! file [CoffeeCompile ' . src . ']'
|
|
||||||
|
|
||||||
" Clean up the source buffer when the output buffer is closed.
|
|
||||||
autocmd BufWipeout <buffer> call s:CoffeeCompileClose()
|
|
||||||
" Save the cursor when leaving the output buffer.
|
|
||||||
autocmd BufLeave <buffer> let b:coffee_compile_pos = getpos('.')
|
|
||||||
|
|
||||||
" Run user-defined commands on new buffer.
|
|
||||||
silent doautocmd CoffeeBufNew User CoffeeCompile
|
|
||||||
|
|
||||||
" Switch back to the source buffer and save the output bufnr. This also
|
|
||||||
" triggers BufLeave above.
|
|
||||||
call s:SwitchWindow(src)
|
|
||||||
let b:coffee_compile_buf = buf
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Fill the scratch buffer.
|
|
||||||
call s:CoffeeCompileToBuf(b:coffee_compile_buf, a:startline, a:endline)
|
|
||||||
" Reset cursor to previous position.
|
|
||||||
call setpos('.', b:coffee_compile_pos)
|
|
||||||
|
|
||||||
" Run any user-defined commands on the scratch buffer.
|
|
||||||
silent doautocmd CoffeeBufUpdate User CoffeeCompile
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Update the scratch buffer and switch back to the source buffer.
|
|
||||||
function! s:CoffeeWatchUpdate()
|
|
||||||
call s:CoffeeCompileToBuf(b:coffee_watch_buf, 1, '$')
|
|
||||||
call setpos('.', b:coffee_watch_pos)
|
|
||||||
silent doautocmd CoffeeBufUpdate User CoffeeWatch
|
|
||||||
call s:SwitchWindow(b:coffee_src_buf)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Continually compile a source buffer.
|
|
||||||
function! s:CoffeeWatch(args)
|
|
||||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
|
||||||
|
|
||||||
if !exists('b:coffee_watch_buf')
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
if bufwinnr(b:coffee_watch_buf) == -1
|
|
||||||
let src = bufnr('%')
|
|
||||||
|
|
||||||
let vert = exists('g:coffee_watch_vert') || a:args =~ '\<vert\%[ical]\>'
|
|
||||||
let size = str2nr(matchstr(a:args, '\<\d\+\>'))
|
|
||||||
|
|
||||||
let buf = s:ScratchBufBuild(src, vert, size)
|
|
||||||
let b:coffee_src_buf = src
|
|
||||||
|
|
||||||
exec 'silent! file [CoffeeWatch ' . src . ']'
|
|
||||||
|
|
||||||
autocmd BufWipeout <buffer> call s:CoffeeWatchClose()
|
|
||||||
autocmd BufLeave <buffer> let b:coffee_watch_pos = getpos('.')
|
|
||||||
|
|
||||||
silent doautocmd CoffeeBufNew User CoffeeWatch
|
|
||||||
|
|
||||||
call s:SwitchWindow(src)
|
|
||||||
let b:coffee_watch_buf = buf
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Make sure only one watch autocmd is defined on this buffer.
|
|
||||||
silent! autocmd! CoffeeAuWatch * <buffer>
|
|
||||||
|
|
||||||
augroup CoffeeAuWatch
|
|
||||||
autocmd InsertLeave <buffer> call s:CoffeeWatchUpdate()
|
|
||||||
autocmd BufWritePost <buffer> call s:CoffeeWatchUpdate()
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
call s:CoffeeWatchUpdate()
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Run a snippet of CoffeeScript between startline and endline.
|
|
||||||
function! s:CoffeeRun(startline, endline, args)
|
|
||||||
silent! call s:SwitchWindow(b:coffee_src_buf)
|
|
||||||
|
|
||||||
if !exists('b:coffee_run_buf')
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
if bufwinnr(b:coffee_run_buf) == -1
|
|
||||||
let src = bufnr('%')
|
|
||||||
|
|
||||||
let buf = s:ScratchBufBuild(src, exists('g:coffee_run_vert'), 0)
|
|
||||||
let b:coffee_src_buf = src
|
|
||||||
|
|
||||||
exec 'silent! file [CoffeeRun ' . src . ']'
|
|
||||||
|
|
||||||
autocmd BufWipeout <buffer> call s:CoffeeRunClose()
|
|
||||||
autocmd BufLeave <buffer> let b:coffee_run_pos = getpos('.')
|
|
||||||
|
|
||||||
silent doautocmd CoffeeBufNew User CoffeeRun
|
|
||||||
|
|
||||||
call s:SwitchWindow(src)
|
|
||||||
let b:coffee_run_buf = buf
|
|
||||||
endif
|
|
||||||
|
|
||||||
if a:startline == 1 && a:endline == line('$')
|
|
||||||
let output = system(g:coffee_compiler .
|
|
||||||
\ ' ' . b:coffee_litcoffee .
|
|
||||||
\ ' ' . fnameescape(expand('%')) .
|
|
||||||
\ ' ' . a:args)
|
|
||||||
else
|
|
||||||
let input = join(getline(a:startline, a:endline), "\n")
|
|
||||||
|
|
||||||
if !len(input)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let output = system(g:coffee_compiler .
|
|
||||||
\ ' -s' .
|
|
||||||
\ ' ' . b:coffee_litcoffee .
|
|
||||||
\ ' ' . a:args, input)
|
|
||||||
endif
|
|
||||||
|
|
||||||
call s:ScratchBufUpdate(b:coffee_run_buf, output)
|
|
||||||
call setpos('.', b:coffee_run_pos)
|
|
||||||
|
|
||||||
silent doautocmd CoffeeBufUpdate User CoffeeRun
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Run coffeelint on a file, and add any errors between startline and endline
|
|
||||||
" to the quickfix list.
|
|
||||||
function! s:CoffeeLint(startline, endline, bang, args)
|
|
||||||
let input = join(getline(a:startline, a:endline), "\n")
|
|
||||||
|
|
||||||
if !len(input)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let output = system(g:coffee_linter .
|
|
||||||
\ ' -s --csv' .
|
|
||||||
\ ' ' . b:coffee_litcoffee .
|
|
||||||
\ ' ' . g:coffee_lint_options .
|
|
||||||
\ ' ' . a:args .
|
|
||||||
\ ' 2>&1', input)
|
|
||||||
|
|
||||||
" Convert output into an array and strip off the csv header.
|
|
||||||
let lines = split(output, "\n")[1:]
|
|
||||||
let buf = bufnr('%')
|
|
||||||
let qflist = []
|
|
||||||
|
|
||||||
for line in lines
|
|
||||||
let match = matchlist(line, '^stdin,\(\d\+\),\d*,\(error\|warn\),\(.\+\)$')
|
|
||||||
|
|
||||||
" Ignore unmatched lines.
|
|
||||||
if !len(match)
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
" The 'type' will result in either 'E' or 'W'.
|
|
||||||
call add(qflist, {'bufnr': buf, 'lnum': a:startline + str2nr(match[1]) - 1,
|
|
||||||
\ 'type': toupper(match[2][0]), 'text': match[3]})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
" Replace the quicklist with our items.
|
|
||||||
call setqflist(qflist, 'r')
|
|
||||||
|
|
||||||
" If not given a bang, jump to first error.
|
|
||||||
if !len(a:bang)
|
|
||||||
silent! cc 1
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Complete arguments for Coffee* commands.
|
|
||||||
function! s:CoffeeComplete(cmd, cmdline, cursor)
|
|
||||||
let args = ['vertical']
|
|
||||||
|
|
||||||
" If no partial command, return all possibilities.
|
|
||||||
if !len(a:cmd)
|
|
||||||
return args
|
|
||||||
endif
|
|
||||||
|
|
||||||
let pat = '^' . a:cmd
|
|
||||||
|
|
||||||
for arg in args
|
|
||||||
if arg =~ pat
|
|
||||||
return [arg]
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Set initial state variables if they don't exist
|
|
||||||
if !exists('b:coffee_compile_buf')
|
|
||||||
call s:CoffeeCompileResetVars()
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists('b:coffee_watch_buf')
|
|
||||||
call s:CoffeeWatchResetVars()
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists('b:coffee_run_buf')
|
|
||||||
call s:CoffeeRunResetVars()
|
|
||||||
endif
|
|
||||||
|
|
||||||
command! -range=% -bar -nargs=* -complete=customlist,s:CoffeeComplete
|
|
||||||
\ CoffeeCompile call s:CoffeeCompile(<line1>, <line2>, <q-args>)
|
|
||||||
command! -bar -nargs=* -complete=customlist,s:CoffeeComplete
|
|
||||||
\ CoffeeWatch call s:CoffeeWatch(<q-args>)
|
|
||||||
command! -range=% -bar -nargs=* CoffeeRun
|
|
||||||
\ call s:CoffeeRun(<line1>, <line2>, <q-args>)
|
|
||||||
command! -range=% -bang -bar -nargs=* CoffeeLint
|
|
||||||
\ call s:CoffeeLint(<line1>, <line2>, <q-bang>, <q-args>)
|
|
@ -1,428 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
if exists('b:did_indent')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:did_indent = 1
|
|
||||||
|
|
||||||
setlocal autoindent
|
|
||||||
setlocal indentexpr=GetCoffeeIndent(v:lnum)
|
|
||||||
" Make sure GetCoffeeIndent is run when these are typed so they can be
|
|
||||||
" indented or outdented.
|
|
||||||
setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally
|
|
||||||
|
|
||||||
" If no indenting or outdenting is needed, either keep the indent of the cursor
|
|
||||||
" (use autoindent) or match the indent of the previous line.
|
|
||||||
if exists('g:coffee_indent_keep_current')
|
|
||||||
let s:DEFAULT_LEVEL = '-1'
|
|
||||||
else
|
|
||||||
let s:DEFAULT_LEVEL = 'indent(prevnlnum)'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Only define the function once.
|
|
||||||
if exists('*GetCoffeeIndent')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Keywords that begin a block
|
|
||||||
let s:BEGIN_BLOCK_KEYWORD = '\C^\%(if\|unless\|else\|for\|while\|until\|'
|
|
||||||
\ . 'loop\|switch\|when\|try\|catch\|finally\|'
|
|
||||||
\ . 'class\)\>\%(\s*:\)\@!'
|
|
||||||
|
|
||||||
" An expression that uses the result of a statement
|
|
||||||
let s:COMPOUND_EXPRESSION = '\C\%([^-]-\|[^+]+\|[^/]/\|[:=*%&|^<>]\)\s*'
|
|
||||||
\ . '\%(if\|unless\|for\|while\|until\|loop\|switch\|'
|
|
||||||
\ . 'try\|class\)\>'
|
|
||||||
|
|
||||||
" Combine the two above
|
|
||||||
let s:BEGIN_BLOCK = s:BEGIN_BLOCK_KEYWORD . '\|' . s:COMPOUND_EXPRESSION
|
|
||||||
|
|
||||||
" Operators that begin a block but also count as a continuation
|
|
||||||
let s:BEGIN_BLOCK_OP = '[([{:=]$'
|
|
||||||
|
|
||||||
" Begins a function block
|
|
||||||
let s:FUNCTION = '[-=]>$'
|
|
||||||
|
|
||||||
" Operators that continue a line onto the next line
|
|
||||||
let s:CONTINUATION_OP = '\C\%(\<\%(is\|isnt\|and\|or\)\>\|'
|
|
||||||
\ . '[^-]-\|[^+]+\|[^-=]>\|[^.]\.\|[<*/%&|^,]\)$'
|
|
||||||
|
|
||||||
" Ancestor operators that prevent continuation indenting
|
|
||||||
let s:CONTINUATION = s:CONTINUATION_OP . '\|' . s:BEGIN_BLOCK_OP
|
|
||||||
|
|
||||||
" A closing bracket by itself on a line followed by a continuation
|
|
||||||
let s:BRACKET_CONTINUATION = '^\s*[}\])]\s*' . s:CONTINUATION_OP
|
|
||||||
|
|
||||||
" A continuation dot access
|
|
||||||
let s:DOT_ACCESS = '^\.'
|
|
||||||
|
|
||||||
" Keywords that break out of a block
|
|
||||||
let s:BREAK_BLOCK_OP = '\C^\%(return\|break\|continue\|throw\)\>'
|
|
||||||
|
|
||||||
" A condition attached to the end of a statement
|
|
||||||
let s:POSTFIX_CONDITION = '\C\S\s\+\zs\<\%(if\|unless\|when\|while\|until\)\>'
|
|
||||||
|
|
||||||
" A then contained in brackets
|
|
||||||
let s:CONTAINED_THEN = '\C[(\[].\{-}\<then\>.\{-\}[)\]]'
|
|
||||||
|
|
||||||
" An else with a condition attached
|
|
||||||
let s:ELSE_COND = '\C^\s*else\s\+\<\%(if\|unless\)\>'
|
|
||||||
|
|
||||||
" A single-line else statement (without a condition attached)
|
|
||||||
let s:SINGLE_LINE_ELSE = '\C^else\s\+\%(\<\%(if\|unless\)\>\)\@!'
|
|
||||||
|
|
||||||
" Pairs of starting and ending keywords, with an initial pattern to match
|
|
||||||
let s:KEYWORD_PAIRS = [
|
|
||||||
\ ['\C^else\>', '\C\<\%(if\|unless\|when\|else\s\+\%(if\|unless\)\)\>',
|
|
||||||
\ '\C\<else\>'],
|
|
||||||
\ ['\C^catch\>', '\C\<try\>', '\C\<catch\>'],
|
|
||||||
\ ['\C^finally\>', '\C\<try\>', '\C\<finally\>']
|
|
||||||
\]
|
|
||||||
|
|
||||||
" Pairs of starting and ending brackets
|
|
||||||
let s:BRACKET_PAIRS = {']': '\[', '}': '{', ')': '('}
|
|
||||||
|
|
||||||
" Max lines to look back for a match
|
|
||||||
let s:MAX_LOOKBACK = 50
|
|
||||||
|
|
||||||
" Syntax names for strings
|
|
||||||
let s:SYNTAX_STRING = 'coffee\%(String\|AssignString\|Embed\|Regex\|Heregex\|'
|
|
||||||
\ . 'Heredoc\)'
|
|
||||||
|
|
||||||
" Syntax names for comments
|
|
||||||
let s:SYNTAX_COMMENT = 'coffee\%(Comment\|BlockComment\|HeregexComment\)'
|
|
||||||
|
|
||||||
" Syntax names for strings and comments
|
|
||||||
let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT
|
|
||||||
|
|
||||||
" Compatibility code for shiftwidth() as recommended by the docs, but modified
|
|
||||||
" so there isn't as much of a penalty if shiftwidth() exists.
|
|
||||||
if exists('*shiftwidth')
|
|
||||||
let s:ShiftWidth = function('shiftwidth')
|
|
||||||
else
|
|
||||||
function! s:ShiftWidth()
|
|
||||||
return &shiftwidth
|
|
||||||
endfunction
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Get the linked syntax name of a character.
|
|
||||||
function! s:SyntaxName(lnum, col)
|
|
||||||
return synIDattr(synID(a:lnum, a:col, 1), 'name')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Check if a character is in a comment.
|
|
||||||
function! s:IsComment(lnum, col)
|
|
||||||
return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_COMMENT
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Check if a character is in a string.
|
|
||||||
function! s:IsString(lnum, col)
|
|
||||||
return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Check if a character is in a comment or string.
|
|
||||||
function! s:IsCommentOrString(lnum, col)
|
|
||||||
return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING_COMMENT
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Search a line for a regex until one is found outside a string or comment.
|
|
||||||
function! s:SearchCode(lnum, regex)
|
|
||||||
" Start at the first column and look for an initial match (including at the
|
|
||||||
" cursor.)
|
|
||||||
call cursor(a:lnum, 1)
|
|
||||||
let pos = search(a:regex, 'c', a:lnum)
|
|
||||||
|
|
||||||
while pos
|
|
||||||
if !s:IsCommentOrString(a:lnum, col('.'))
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Move to the match and continue searching (don't accept matches at the
|
|
||||||
" cursor.)
|
|
||||||
let pos = search(a:regex, '', a:lnum)
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Search for the nearest previous line that isn't a comment.
|
|
||||||
function! s:GetPrevNormalLine(startlnum)
|
|
||||||
let curlnum = a:startlnum
|
|
||||||
|
|
||||||
while curlnum
|
|
||||||
let curlnum = prevnonblank(curlnum - 1)
|
|
||||||
|
|
||||||
" Return the line if the first non-whitespace character isn't a comment.
|
|
||||||
if !s:IsComment(curlnum, indent(curlnum) + 1)
|
|
||||||
return curlnum
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:SearchPair(startlnum, lookback, skip, open, close)
|
|
||||||
" Go to the first column so a:close will be matched even if it's at the
|
|
||||||
" beginning of the line.
|
|
||||||
call cursor(a:startlnum, 1)
|
|
||||||
return searchpair(a:open, '', a:close, 'bnW', a:skip, max([1, a:lookback]))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Skip if a match
|
|
||||||
" - is in a string or comment
|
|
||||||
" - is a single-line statement that isn't immediately
|
|
||||||
" adjacent
|
|
||||||
" - has a postfix condition and isn't an else statement or compound
|
|
||||||
" expression
|
|
||||||
function! s:ShouldSkip(startlnum, lnum, col)
|
|
||||||
return s:IsCommentOrString(a:lnum, a:col) ||
|
|
||||||
\ s:SearchCode(a:lnum, '\C\<then\>') && a:startlnum - a:lnum > 1 ||
|
|
||||||
\ s:SearchCode(a:lnum, s:POSTFIX_CONDITION) &&
|
|
||||||
\ getline(a:lnum) !~ s:ELSE_COND &&
|
|
||||||
\ !s:SearchCode(a:lnum, s:COMPOUND_EXPRESSION)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Search for the nearest and farthest match for a keyword pair.
|
|
||||||
function! s:SearchMatchingKeyword(startlnum, open, close)
|
|
||||||
let skip = 's:ShouldSkip(' . a:startlnum . ", line('.'), line('.'))"
|
|
||||||
|
|
||||||
" Search for the nearest match.
|
|
||||||
let nearestlnum = s:SearchPair(a:startlnum, a:startlnum - s:MAX_LOOKBACK,
|
|
||||||
\ skip, a:open, a:close)
|
|
||||||
|
|
||||||
if !nearestlnum
|
|
||||||
return []
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Find the nearest previous line with indent less than or equal to startlnum.
|
|
||||||
let ind = indent(a:startlnum)
|
|
||||||
let lookback = s:GetPrevNormalLine(a:startlnum)
|
|
||||||
|
|
||||||
while lookback && indent(lookback) > ind
|
|
||||||
let lookback = s:GetPrevNormalLine(lookback)
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
" Search for the farthest match. If there are no other matches, then the
|
|
||||||
" nearest match is also the farthest one.
|
|
||||||
let matchlnum = nearestlnum
|
|
||||||
|
|
||||||
while matchlnum
|
|
||||||
let lnum = matchlnum
|
|
||||||
let matchlnum = s:SearchPair(matchlnum, lookback, skip, a:open, a:close)
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
return [nearestlnum, lnum]
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Strip a line of a trailing comment and surrounding whitespace.
|
|
||||||
function! s:GetTrimmedLine(lnum)
|
|
||||||
" Try to find a comment starting at the first column.
|
|
||||||
call cursor(a:lnum, 1)
|
|
||||||
let pos = search('#', 'c', a:lnum)
|
|
||||||
|
|
||||||
" Keep searching until a comment is found or search returns 0.
|
|
||||||
while pos
|
|
||||||
if s:IsComment(a:lnum, col('.'))
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
|
|
||||||
let pos = search('#', '', a:lnum)
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
if !pos
|
|
||||||
" No comment was found so use the whole line.
|
|
||||||
let line = getline(a:lnum)
|
|
||||||
else
|
|
||||||
" Subtract 1 to get to the column before the comment and another 1 for
|
|
||||||
" column indexing -> zero-based indexing.
|
|
||||||
let line = getline(a:lnum)[:col('.') - 2]
|
|
||||||
endif
|
|
||||||
|
|
||||||
return substitute(substitute(line, '^\s\+', '', ''),
|
|
||||||
\ '\s\+$', '', '')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Get the indent policy when no special rules are used.
|
|
||||||
function! s:GetDefaultPolicy(curlnum)
|
|
||||||
" Check whether equalprg is being ran on existing lines.
|
|
||||||
if strlen(getline(a:curlnum)) == indent(a:curlnum)
|
|
||||||
" If not indenting an existing line, use the default policy.
|
|
||||||
return s:DEFAULT_LEVEL
|
|
||||||
else
|
|
||||||
" Otherwise let autoindent determine what to do with an existing line.
|
|
||||||
return '-1'
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! GetCoffeeIndent(curlnum)
|
|
||||||
" Get the previous non-blank line (may be a comment.)
|
|
||||||
let prevlnum = prevnonblank(a:curlnum - 1)
|
|
||||||
|
|
||||||
" Bail if there's no code before.
|
|
||||||
if !prevlnum
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Bail if inside a multiline string.
|
|
||||||
if s:IsString(a:curlnum, 1)
|
|
||||||
let prevnlnum = prevlnum
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Get the code part of the current line.
|
|
||||||
let curline = s:GetTrimmedLine(a:curlnum)
|
|
||||||
" Get the previous non-comment line.
|
|
||||||
let prevnlnum = s:GetPrevNormalLine(a:curlnum)
|
|
||||||
|
|
||||||
" Check if the current line is the closing bracket in a bracket pair.
|
|
||||||
if has_key(s:BRACKET_PAIRS, curline[0])
|
|
||||||
" Search for a matching opening bracket.
|
|
||||||
let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK,
|
|
||||||
\ "s:IsCommentOrString(line('.'), col('.'))",
|
|
||||||
\ s:BRACKET_PAIRS[curline[0]], curline[0])
|
|
||||||
|
|
||||||
if matchlnum
|
|
||||||
" Match the indent of the opening bracket.
|
|
||||||
return indent(matchlnum)
|
|
||||||
else
|
|
||||||
" No opening bracket found (bad syntax), so bail.
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Check if the current line is the closing keyword in a keyword pair.
|
|
||||||
for pair in s:KEYWORD_PAIRS
|
|
||||||
if curline =~ pair[0]
|
|
||||||
" Find the nearest and farthest matches within the same indent level.
|
|
||||||
let matches = s:SearchMatchingKeyword(a:curlnum, pair[1], pair[2])
|
|
||||||
|
|
||||||
if len(matches)
|
|
||||||
" Don't force indenting/outdenting as long as line is already lined up
|
|
||||||
" with a valid match
|
|
||||||
return max([min([indent(a:curlnum), indent(matches[0])]),
|
|
||||||
\ indent(matches[1])])
|
|
||||||
else
|
|
||||||
" No starting keyword found (bad syntax), so bail.
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
" Check if the current line is a `when` and not the first in a switch block.
|
|
||||||
if curline =~ '\C^when\>' && !s:SearchCode(prevnlnum, '\C\<switch\>')
|
|
||||||
" Look back for a `when`.
|
|
||||||
while prevnlnum
|
|
||||||
if getline(prevnlnum) =~ '\C^\s*when\>'
|
|
||||||
" Indent to match the found `when`, but don't force indenting (for when
|
|
||||||
" indenting nested switch blocks.)
|
|
||||||
return min([indent(a:curlnum), indent(prevnlnum)])
|
|
||||||
endif
|
|
||||||
|
|
||||||
let prevnlnum = s:GetPrevNormalLine(prevnlnum)
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
" No matching `when` found (bad syntax), so bail.
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the previous line is a comment, use its indentation, but don't force
|
|
||||||
" indenting.
|
|
||||||
if prevlnum != prevnlnum
|
|
||||||
return min([indent(a:curlnum), indent(prevlnum)])
|
|
||||||
endif
|
|
||||||
|
|
||||||
let prevline = s:GetTrimmedLine(prevnlnum)
|
|
||||||
|
|
||||||
" Always indent after these operators.
|
|
||||||
if prevline =~ s:BEGIN_BLOCK_OP
|
|
||||||
return indent(prevnlnum) + s:ShiftWidth()
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Indent if the previous line starts a function block, but don't force
|
|
||||||
" indenting if the line is non-blank (for empty function bodies.)
|
|
||||||
if prevline =~ s:FUNCTION
|
|
||||||
if strlen(getline(a:curlnum)) > indent(a:curlnum)
|
|
||||||
return min([indent(prevnlnum) + s:ShiftWidth(), indent(a:curlnum)])
|
|
||||||
else
|
|
||||||
return indent(prevnlnum) + s:ShiftWidth()
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Check if continuation indenting is needed. If the line ends in a slash, make
|
|
||||||
" sure it isn't a regex.
|
|
||||||
if prevline =~ s:CONTINUATION_OP &&
|
|
||||||
\ !(prevline =~ '/$' && s:IsString(prevnlnum, col([prevnlnum, '$']) - 1))
|
|
||||||
" Don't indent if the continuation follows a closing bracket.
|
|
||||||
if prevline =~ s:BRACKET_CONTINUATION
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
let prevprevnlnum = s:GetPrevNormalLine(prevnlnum)
|
|
||||||
|
|
||||||
" Don't indent if not the first continuation.
|
|
||||||
if prevprevnlnum && s:GetTrimmedLine(prevprevnlnum) =~ s:CONTINUATION
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Continuation indenting seems to vary between programmers, so if the line
|
|
||||||
" is non-blank, don't override the indentation
|
|
||||||
if strlen(getline(a:curlnum)) > indent(a:curlnum)
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Otherwise indent a level.
|
|
||||||
return indent(prevnlnum) + s:ShiftWidth()
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Check if the previous line starts with a keyword that begins a block.
|
|
||||||
if prevline =~ s:BEGIN_BLOCK
|
|
||||||
" Indent if the current line doesn't start with `then` and the previous line
|
|
||||||
" isn't a single-line statement.
|
|
||||||
if curline !~ '\C^\<then\>' && !s:SearchCode(prevnlnum, '\C\<then\>') &&
|
|
||||||
\ prevline !~ s:SINGLE_LINE_ELSE
|
|
||||||
return indent(prevnlnum) + s:ShiftWidth()
|
|
||||||
else
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Indent a dot access if it's the first.
|
|
||||||
if curline =~ s:DOT_ACCESS
|
|
||||||
if prevline !~ s:DOT_ACCESS
|
|
||||||
return indent(prevnlnum) + s:ShiftWidth()
|
|
||||||
else
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Outdent if a keyword breaks out of a block as long as it doesn't have a
|
|
||||||
" postfix condition (and the postfix condition isn't a single-line statement.)
|
|
||||||
if prevline =~ s:BREAK_BLOCK_OP
|
|
||||||
if !s:SearchCode(prevnlnum, s:POSTFIX_CONDITION) ||
|
|
||||||
\ s:SearchCode(prevnlnum, '\C\<then\>') &&
|
|
||||||
\ !s:SearchCode(prevnlnum, s:CONTAINED_THEN)
|
|
||||||
" Don't force indenting.
|
|
||||||
return min([indent(a:curlnum), indent(prevnlnum) - s:ShiftWidth()])
|
|
||||||
else
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Check if inside brackets.
|
|
||||||
let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK,
|
|
||||||
\ "s:IsCommentOrString(line('.'), col('.'))",
|
|
||||||
\ '\[\|(\|{', '\]\|)\|}')
|
|
||||||
|
|
||||||
" If inside brackets, indent relative to the brackets, but don't outdent an
|
|
||||||
" already indented line.
|
|
||||||
if matchlnum
|
|
||||||
return max([indent(a:curlnum), indent(matchlnum) + s:ShiftWidth()])
|
|
||||||
endif
|
|
||||||
|
|
||||||
" No special rules applied, so use the default policy.
|
|
||||||
exec 'return' s:GetDefaultPolicy(a:curlnum)
|
|
||||||
endfunction
|
|
@ -1,221 +0,0 @@
|
|||||||
" Language: CoffeeScript
|
|
||||||
" Maintainer: Mick Koch <kchmck@gmail.com>
|
|
||||||
" URL: http://github.com/kchmck/vim-coffee-script
|
|
||||||
" License: WTFPL
|
|
||||||
|
|
||||||
" Bail if our syntax is already loaded.
|
|
||||||
if exists('b:current_syntax') && b:current_syntax == 'coffee'
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Include JavaScript for coffeeEmbed.
|
|
||||||
syn include @coffeeJS syntax/javascript.vim
|
|
||||||
silent! unlet b:current_syntax
|
|
||||||
|
|
||||||
" Highlight long strings.
|
|
||||||
syntax sync fromstart
|
|
||||||
|
|
||||||
" These are `matches` instead of `keywords` because vim's highlighting
|
|
||||||
" priority for keywords is higher than matches. This causes keywords to be
|
|
||||||
" highlighted inside matches, even if a match says it shouldn't contain them --
|
|
||||||
" like with coffeeAssign and coffeeDot.
|
|
||||||
syn match coffeeStatement /\<\%(return\|break\|continue\|throw\)\>/ display
|
|
||||||
hi def link coffeeStatement Statement
|
|
||||||
|
|
||||||
syn match coffeeRepeat /\<\%(for\|while\|until\|loop\)\>/ display
|
|
||||||
hi def link coffeeRepeat Repeat
|
|
||||||
|
|
||||||
syn match coffeeConditional /\<\%(if\|else\|unless\|switch\|when\|then\)\>/
|
|
||||||
\ display
|
|
||||||
hi def link coffeeConditional Conditional
|
|
||||||
|
|
||||||
syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display
|
|
||||||
hi def link coffeeException Exception
|
|
||||||
|
|
||||||
syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\)\>/
|
|
||||||
\ display
|
|
||||||
" The `own` keyword is only a keyword after `for`.
|
|
||||||
syn match coffeeKeyword /\<for\s\+own\>/ contained containedin=coffeeRepeat
|
|
||||||
\ display
|
|
||||||
hi def link coffeeKeyword Keyword
|
|
||||||
|
|
||||||
syn match coffeeOperator /\<\%(instanceof\|typeof\|delete\)\>/ display
|
|
||||||
hi def link coffeeOperator Operator
|
|
||||||
|
|
||||||
" The first case matches symbol operators only if they have an operand before.
|
|
||||||
syn match coffeeExtendedOp /\%(\S\s*\)\@<=[+\-*/%&|\^=!<>?.]\{-1,}\|[-=]>\|--\|++\|:/
|
|
||||||
\ display
|
|
||||||
syn match coffeeExtendedOp /\<\%(and\|or\)=/ display
|
|
||||||
hi def link coffeeExtendedOp coffeeOperator
|
|
||||||
|
|
||||||
" This is separate from `coffeeExtendedOp` to help differentiate commas from
|
|
||||||
" dots.
|
|
||||||
syn match coffeeSpecialOp /[,;]/ display
|
|
||||||
hi def link coffeeSpecialOp SpecialChar
|
|
||||||
|
|
||||||
syn match coffeeBoolean /\<\%(true\|on\|yes\|false\|off\|no\)\>/ display
|
|
||||||
hi def link coffeeBoolean Boolean
|
|
||||||
|
|
||||||
syn match coffeeGlobal /\<\%(null\|undefined\)\>/ display
|
|
||||||
hi def link coffeeGlobal Type
|
|
||||||
|
|
||||||
" A special variable
|
|
||||||
syn match coffeeSpecialVar /\<\%(this\|prototype\|arguments\)\>/ display
|
|
||||||
hi def link coffeeSpecialVar Special
|
|
||||||
|
|
||||||
" An @-variable
|
|
||||||
syn match coffeeSpecialIdent /@\%(\%(\I\|\$\)\%(\i\|\$\)*\)\?/ display
|
|
||||||
hi def link coffeeSpecialIdent Identifier
|
|
||||||
|
|
||||||
" A class-like name that starts with a capital letter
|
|
||||||
syn match coffeeObject /\<\u\w*\>/ display
|
|
||||||
hi def link coffeeObject Structure
|
|
||||||
|
|
||||||
" A constant-like name in SCREAMING_CAPS
|
|
||||||
syn match coffeeConstant /\<\u[A-Z0-9_]\+\>/ display
|
|
||||||
hi def link coffeeConstant Constant
|
|
||||||
|
|
||||||
" A variable name
|
|
||||||
syn cluster coffeeIdentifier contains=coffeeSpecialVar,coffeeSpecialIdent,
|
|
||||||
\ coffeeObject,coffeeConstant
|
|
||||||
|
|
||||||
" A non-interpolated string
|
|
||||||
syn cluster coffeeBasicString contains=@Spell,coffeeEscape
|
|
||||||
" An interpolated string
|
|
||||||
syn cluster coffeeInterpString contains=@coffeeBasicString,coffeeInterp
|
|
||||||
|
|
||||||
" Regular strings
|
|
||||||
syn region coffeeString start=/"/ skip=/\\\\\|\\"/ end=/"/
|
|
||||||
\ contains=@coffeeInterpString
|
|
||||||
syn region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/
|
|
||||||
\ contains=@coffeeBasicString
|
|
||||||
hi def link coffeeString String
|
|
||||||
|
|
||||||
" A integer, including a leading plus or minus
|
|
||||||
syn match coffeeNumber /\%(\i\|\$\)\@<![-+]\?\d\+\%([eE][+-]\?\d\+\)\?/ display
|
|
||||||
" A hex, binary, or octal number
|
|
||||||
syn match coffeeNumber /\<0[xX]\x\+\>/ display
|
|
||||||
syn match coffeeNumber /\<0[bB][01]\+\>/ display
|
|
||||||
syn match coffeeNumber /\<0[oO][0-7]\+\>/ display
|
|
||||||
syn match coffeeNumber /\<\%(Infinity\|NaN\)\>/ display
|
|
||||||
hi def link coffeeNumber Number
|
|
||||||
|
|
||||||
" A floating-point number, including a leading plus or minus
|
|
||||||
syn match coffeeFloat /\%(\i\|\$\)\@<![-+]\?\d*\.\@<!\.\d\+\%([eE][+-]\?\d\+\)\?/
|
|
||||||
\ display
|
|
||||||
hi def link coffeeFloat Float
|
|
||||||
|
|
||||||
" An error for reserved keywords, taken from the RESERVED array:
|
|
||||||
" http://coffeescript.org/documentation/docs/lexer.html#section-67
|
|
||||||
syn match coffeeReservedError /\<\%(case\|default\|function\|var\|void\|with\|const\|let\|enum\|export\|import\|native\|__hasProp\|__extends\|__slice\|__bind\|__indexOf\|implements\|interface\|package\|private\|protected\|public\|static\|yield\)\>/
|
|
||||||
\ display
|
|
||||||
hi def link coffeeReservedError Error
|
|
||||||
|
|
||||||
" A normal object assignment
|
|
||||||
syn match coffeeObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@coffeeIdentifier display
|
|
||||||
hi def link coffeeObjAssign Identifier
|
|
||||||
|
|
||||||
syn keyword coffeeTodo TODO FIXME XXX contained
|
|
||||||
hi def link coffeeTodo Todo
|
|
||||||
|
|
||||||
syn match coffeeComment /#.*/ contains=@Spell,coffeeTodo
|
|
||||||
hi def link coffeeComment Comment
|
|
||||||
|
|
||||||
syn region coffeeBlockComment start=/####\@!/ end=/###/
|
|
||||||
\ contains=@Spell,coffeeTodo
|
|
||||||
hi def link coffeeBlockComment coffeeComment
|
|
||||||
|
|
||||||
" A comment in a heregex
|
|
||||||
syn region coffeeHeregexComment start=/#/ end=/\ze\/\/\/\|$/ contained
|
|
||||||
\ contains=@Spell,coffeeTodo
|
|
||||||
hi def link coffeeHeregexComment coffeeComment
|
|
||||||
|
|
||||||
" Embedded JavaScript
|
|
||||||
syn region coffeeEmbed matchgroup=coffeeEmbedDelim
|
|
||||||
\ start=/`/ skip=/\\\\\|\\`/ end=/`/ keepend
|
|
||||||
\ contains=@coffeeJS
|
|
||||||
hi def link coffeeEmbedDelim Delimiter
|
|
||||||
|
|
||||||
syn region coffeeInterp matchgroup=coffeeInterpDelim start=/#{/ end=/}/ contained
|
|
||||||
\ contains=@coffeeAll
|
|
||||||
hi def link coffeeInterpDelim PreProc
|
|
||||||
|
|
||||||
" A string escape sequence
|
|
||||||
syn match coffeeEscape /\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\./ contained display
|
|
||||||
hi def link coffeeEscape SpecialChar
|
|
||||||
|
|
||||||
" A regex -- must not follow a parenthesis, number, or identifier, and must not
|
|
||||||
" be followed by a number
|
|
||||||
syn region coffeeRegex start=#\%(\%()\|\%(\i\|\$\)\@<!\d\)\s*\|\i\)\@<!/=\@!\s\@!#
|
|
||||||
\ end=#/[gimy]\{,4}\d\@!#
|
|
||||||
\ oneline contains=@coffeeBasicString,coffeeRegexCharSet
|
|
||||||
syn region coffeeRegexCharSet start=/\[/ end=/]/ contained
|
|
||||||
\ contains=@coffeeBasicString
|
|
||||||
hi def link coffeeRegex String
|
|
||||||
hi def link coffeeRegexCharSet coffeeRegex
|
|
||||||
|
|
||||||
" A heregex
|
|
||||||
syn region coffeeHeregex start=#///# end=#///[gimy]\{,4}#
|
|
||||||
\ contains=@coffeeInterpString,coffeeHeregexComment,
|
|
||||||
\ coffeeHeregexCharSet
|
|
||||||
\ fold
|
|
||||||
syn region coffeeHeregexCharSet start=/\[/ end=/]/ contained
|
|
||||||
\ contains=@coffeeInterpString
|
|
||||||
hi def link coffeeHeregex coffeeRegex
|
|
||||||
hi def link coffeeHeregexCharSet coffeeHeregex
|
|
||||||
|
|
||||||
" Heredoc strings
|
|
||||||
syn region coffeeHeredoc start=/"""/ end=/"""/ contains=@coffeeInterpString
|
|
||||||
\ fold
|
|
||||||
syn region coffeeHeredoc start=/'''/ end=/'''/ contains=@coffeeBasicString
|
|
||||||
\ fold
|
|
||||||
hi def link coffeeHeredoc String
|
|
||||||
|
|
||||||
" An error for trailing whitespace, as long as the line isn't just whitespace
|
|
||||||
syn match coffeeSpaceError /\S\@<=\s\+$/ display
|
|
||||||
hi def link coffeeSpaceError Error
|
|
||||||
|
|
||||||
" An error for trailing semicolons, for help transitioning from JavaScript
|
|
||||||
syn match coffeeSemicolonError /;$/ display
|
|
||||||
hi def link coffeeSemicolonError Error
|
|
||||||
|
|
||||||
" Ignore reserved words in dot accesses.
|
|
||||||
syn match coffeeDotAccess /\.\@<!\.\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+1 contains=@coffeeIdentifier
|
|
||||||
hi def link coffeeDotAccess coffeeExtendedOp
|
|
||||||
|
|
||||||
" Ignore reserved words in prototype accesses.
|
|
||||||
syn match coffeeProtoAccess /::\s*\%(\I\|\$\)\%(\i\|\$\)*/he=s+2 contains=@coffeeIdentifier
|
|
||||||
hi def link coffeeProtoAccess coffeeExtendedOp
|
|
||||||
|
|
||||||
" This is required for interpolations to work.
|
|
||||||
syn region coffeeCurlies matchgroup=coffeeCurly start=/{/ end=/}/
|
|
||||||
\ contains=@coffeeAll
|
|
||||||
syn region coffeeBrackets matchgroup=coffeeBracket start=/\[/ end=/\]/
|
|
||||||
\ contains=@coffeeAll
|
|
||||||
syn region coffeeParens matchgroup=coffeeParen start=/(/ end=/)/
|
|
||||||
\ contains=@coffeeAll
|
|
||||||
|
|
||||||
" These are highlighted the same as commas since they tend to go together.
|
|
||||||
hi def link coffeeBlock coffeeSpecialOp
|
|
||||||
hi def link coffeeBracket coffeeBlock
|
|
||||||
hi def link coffeeCurly coffeeBlock
|
|
||||||
hi def link coffeeParen coffeeBlock
|
|
||||||
|
|
||||||
" This is used instead of TOP to keep things coffee-specific for good
|
|
||||||
" embedding. `contained` groups aren't included.
|
|
||||||
syn cluster coffeeAll contains=coffeeStatement,coffeeRepeat,coffeeConditional,
|
|
||||||
\ coffeeException,coffeeKeyword,coffeeOperator,
|
|
||||||
\ coffeeExtendedOp,coffeeSpecialOp,coffeeBoolean,
|
|
||||||
\ coffeeGlobal,coffeeSpecialVar,coffeeSpecialIdent,
|
|
||||||
\ coffeeObject,coffeeConstant,coffeeString,
|
|
||||||
\ coffeeNumber,coffeeFloat,coffeeReservedError,
|
|
||||||
\ coffeeObjAssign,coffeeComment,coffeeBlockComment,
|
|
||||||
\ coffeeEmbed,coffeeRegex,coffeeHeregex,
|
|
||||||
\ coffeeHeredoc,coffeeSpaceError,
|
|
||||||
\ coffeeSemicolonError,coffeeDotAccess,
|
|
||||||
\ coffeeProtoAccess,coffeeCurlies,coffeeBrackets,
|
|
||||||
\ coffeeParens
|
|
||||||
|
|
||||||
if !exists('b:current_syntax')
|
|
||||||
let b:current_syntax = 'coffee'
|
|
||||||
endif
|
|
@ -1,3 +0,0 @@
|
|||||||
# Nested curlies
|
|
||||||
" >> #{ == { { { } } } == } << "
|
|
||||||
" >> #{ == { abc: { def: 42 } } == } << "
|
|
@ -1,90 +0,0 @@
|
|||||||
# Various operators
|
|
||||||
abc instanceof def
|
|
||||||
typeof abc
|
|
||||||
delete abc
|
|
||||||
abc::def
|
|
||||||
|
|
||||||
abc + def
|
|
||||||
abc - def
|
|
||||||
abc * def
|
|
||||||
abc / def
|
|
||||||
abc % def
|
|
||||||
abc & def
|
|
||||||
abc | def
|
|
||||||
abc ^ def
|
|
||||||
abc >> def
|
|
||||||
abc << def
|
|
||||||
abc >>> def
|
|
||||||
abc ? def
|
|
||||||
abc && def
|
|
||||||
abc and def
|
|
||||||
abc || def
|
|
||||||
abc or def
|
|
||||||
|
|
||||||
abc += def
|
|
||||||
abc -= def
|
|
||||||
abc *= def
|
|
||||||
abc /= def
|
|
||||||
abc %= def
|
|
||||||
abc &= def
|
|
||||||
abc |= def
|
|
||||||
abc ^= def
|
|
||||||
abc >>= def
|
|
||||||
abc <<= def
|
|
||||||
abc >>>= def
|
|
||||||
abc ?= def
|
|
||||||
abc &&= def
|
|
||||||
abc ||= def
|
|
||||||
|
|
||||||
abc and= def
|
|
||||||
abc or= def
|
|
||||||
|
|
||||||
abc.def.ghi
|
|
||||||
abc?.def?.ghi
|
|
||||||
|
|
||||||
abc < def
|
|
||||||
abc > def
|
|
||||||
abc = def
|
|
||||||
abc == def
|
|
||||||
abc != def
|
|
||||||
abc <= def
|
|
||||||
abc >= def
|
|
||||||
|
|
||||||
abc++
|
|
||||||
abc--
|
|
||||||
++abc
|
|
||||||
--abc
|
|
||||||
|
|
||||||
# Nested operators
|
|
||||||
abc[def] = ghi
|
|
||||||
abc[def[ghi: jkl]] = 42
|
|
||||||
@abc[def] = ghi
|
|
||||||
|
|
||||||
abc["#{def = 42}"] = 42
|
|
||||||
abc["#{def.ghi = 42}"] = 42
|
|
||||||
abc["#{def[ghi] = 42}"] = 42
|
|
||||||
abc["#{def['ghi']}"] = 42
|
|
||||||
|
|
||||||
# Object assignments
|
|
||||||
abc =
|
|
||||||
def: 123
|
|
||||||
DEF: 123
|
|
||||||
@def: 123
|
|
||||||
Def: 123
|
|
||||||
'def': 123
|
|
||||||
42: 123
|
|
||||||
|
|
||||||
# Operators shouldn't be highlighted
|
|
||||||
vector=
|
|
||||||
wand=
|
|
||||||
|
|
||||||
abc+++
|
|
||||||
abc---
|
|
||||||
abc ** def
|
|
||||||
abc &&& def
|
|
||||||
abc ^^ def
|
|
||||||
abc ===== def
|
|
||||||
abc <==== def
|
|
||||||
abc >==== def
|
|
||||||
abc +== def
|
|
||||||
abc =^= def
|
|
@ -1,27 +0,0 @@
|
|||||||
# Should be an error
|
|
||||||
function = 42
|
|
||||||
var = 42
|
|
||||||
|
|
||||||
# Shouldn't be an error
|
|
||||||
abc.with = 42
|
|
||||||
function: 42
|
|
||||||
var: 42
|
|
||||||
|
|
||||||
# Keywords shouldn't be highlighted
|
|
||||||
abc.function
|
|
||||||
abc.do
|
|
||||||
abc.break
|
|
||||||
abc.true
|
|
||||||
|
|
||||||
abc::function
|
|
||||||
abc::do
|
|
||||||
abc::break
|
|
||||||
abc::true
|
|
||||||
|
|
||||||
abc:: function
|
|
||||||
abc. function
|
|
||||||
|
|
||||||
# Numbers should be highlighted
|
|
||||||
def.42
|
|
||||||
def .42
|
|
||||||
def::42
|
|
@ -1,3 +0,0 @@
|
|||||||
:coffeescript
|
|
||||||
class Hello
|
|
||||||
# test
|
|
@ -1,7 +0,0 @@
|
|||||||
<head>
|
|
||||||
<script type="text/coffeescript">
|
|
||||||
abc = {
|
|
||||||
def: 42
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
@ -1,6 +0,0 @@
|
|||||||
*.markdown
|
|
||||||
*.zip
|
|
||||||
note.txt
|
|
||||||
tags
|
|
||||||
.hg*
|
|
||||||
tmp/*
|
|
File diff suppressed because it is too large
Load Diff
@ -1,140 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/bookmarkdir.vim
|
|
||||||
" Description: Bookmarked directories extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_bookmarkdir = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#bookmarkdir#init()',
|
|
||||||
\ 'accept': 'ctrlp#bookmarkdir#accept',
|
|
||||||
\ 'lname': 'bookmarked dirs',
|
|
||||||
\ 'sname': 'bkd',
|
|
||||||
\ 'type': 'tabs',
|
|
||||||
\ 'opmul': 1,
|
|
||||||
\ 'nolim': 1,
|
|
||||||
\ 'wipe': 'ctrlp#bookmarkdir#remove',
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:getinput(str, ...)
|
|
||||||
echoh Identifier
|
|
||||||
cal inputsave()
|
|
||||||
let input = call('input', a:0 ? [a:str] + a:000 : [a:str])
|
|
||||||
cal inputrestore()
|
|
||||||
echoh None
|
|
||||||
retu input
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:cachefile()
|
|
||||||
if !exists('s:cadir') || !exists('s:cafile')
|
|
||||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd'
|
|
||||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
|
||||||
en
|
|
||||||
retu s:cafile
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:writecache(lines)
|
|
||||||
cal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:getbookmarks()
|
|
||||||
retu ctrlp#utils#readfile(s:cachefile())
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:savebookmark(name, cwd)
|
|
||||||
let cwds = exists('+ssl') ? [tr(a:cwd, '\', '/'), tr(a:cwd, '/', '\')] : [a:cwd]
|
|
||||||
let entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0')
|
|
||||||
cal s:writecache(insert(entries, a:name.' '.a:cwd))
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:setentries()
|
|
||||||
let time = getftime(s:cachefile())
|
|
||||||
if !( exists('s:bookmarks') && time == s:bookmarks[0] )
|
|
||||||
let s:bookmarks = [time, s:getbookmarks()]
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:parts(str)
|
|
||||||
let mlist = matchlist(a:str, '\v([^\t]+)\t(.*)$')
|
|
||||||
retu mlist != [] ? mlist[1:2] : ['', '']
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:process(entries, type)
|
|
||||||
retu map(a:entries, 's:modify(v:val, a:type)')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:modify(entry, type)
|
|
||||||
let [name, dir] = s:parts(a:entry)
|
|
||||||
let dir = fnamemodify(dir, a:type)
|
|
||||||
retu name.' '.( dir == '' ? '.' : dir )
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:msg(name, cwd)
|
|
||||||
redr
|
|
||||||
echoh Identifier | echon 'Bookmarked ' | echoh Constant
|
|
||||||
echon a:name.' ' | echoh Directory | echon a:cwd
|
|
||||||
echoh None
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPBookmark', 'Identifier')
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPBookmark '^> [^\t]\+' contains=CtrlPLinePre
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#bookmarkdir#init()
|
|
||||||
cal s:setentries()
|
|
||||||
cal s:syntax()
|
|
||||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#bookmarkdir#accept(mode, str)
|
|
||||||
let parts = s:parts(s:modify(a:str, ':p'))
|
|
||||||
cal call('s:savebookmark', parts)
|
|
||||||
if a:mode =~ 't\|v\|h'
|
|
||||||
cal ctrlp#exit()
|
|
||||||
en
|
|
||||||
cal ctrlp#setdir(parts[1], a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
|
||||||
if a:mode == 'e'
|
|
||||||
cal ctrlp#switchtype(0)
|
|
||||||
cal ctrlp#recordhist()
|
|
||||||
cal ctrlp#prtclear()
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#bookmarkdir#add(dir)
|
|
||||||
let str = 'Directory to bookmark: '
|
|
||||||
let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir')
|
|
||||||
if cwd == '' | retu | en
|
|
||||||
let cwd = fnamemodify(cwd, ':p')
|
|
||||||
let name = s:getinput('Bookmark as: ', cwd)
|
|
||||||
if name == '' | retu | en
|
|
||||||
let name = tr(name, ' ', ' ')
|
|
||||||
cal s:savebookmark(name, cwd)
|
|
||||||
cal s:msg(name, cwd)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#bookmarkdir#remove(entries)
|
|
||||||
cal s:process(a:entries, ':p')
|
|
||||||
cal s:writecache(a:entries == [] ? [] :
|
|
||||||
\ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0'))
|
|
||||||
cal s:setentries()
|
|
||||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#bookmarkdir#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,261 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/buffertag.vim
|
|
||||||
" Description: Buffer Tag extension
|
|
||||||
" Maintainer: Kien Nguyen <github.com/kien>
|
|
||||||
" Credits: Much of the code was taken from tagbar.vim by Jan Larres, plus
|
|
||||||
" a few lines from taglist.vim by Yegappan Lakshmanan and from
|
|
||||||
" buffertag.vim by Takeshi Nishida.
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_buftag = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
|
|
||||||
\ 'accept': 'ctrlp#buffertag#accept',
|
|
||||||
\ 'lname': 'buffer tags',
|
|
||||||
\ 'sname': 'bft',
|
|
||||||
\ 'exit': 'ctrlp#buffertag#exit()',
|
|
||||||
\ 'type': 'tabs',
|
|
||||||
\ 'opts': 'ctrlp#buffertag#opts()',
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
let [s:pref, s:opts] = ['g:ctrlp_buftag_', {
|
|
||||||
\ 'systemenc': ['s:enc', &enc],
|
|
||||||
\ 'ctags_bin': ['s:bin', ''],
|
|
||||||
\ 'types': ['s:usr_types', {}],
|
|
||||||
\ }]
|
|
||||||
|
|
||||||
let s:bins = [
|
|
||||||
\ 'ctags-exuberant',
|
|
||||||
\ 'exuberant-ctags',
|
|
||||||
\ 'exctags',
|
|
||||||
\ '/usr/local/bin/ctags',
|
|
||||||
\ '/opt/local/bin/ctags',
|
|
||||||
\ 'ctags',
|
|
||||||
\ 'ctags.exe',
|
|
||||||
\ 'tags',
|
|
||||||
\ ]
|
|
||||||
|
|
||||||
let s:types = {
|
|
||||||
\ 'asm' : '%sasm%sasm%sdlmt',
|
|
||||||
\ 'aspperl': '%sasp%sasp%sfsv',
|
|
||||||
\ 'aspvbs' : '%sasp%sasp%sfsv',
|
|
||||||
\ 'awk' : '%sawk%sawk%sf',
|
|
||||||
\ 'beta' : '%sbeta%sbeta%sfsv',
|
|
||||||
\ 'c' : '%sc%sc%sdgsutvf',
|
|
||||||
\ 'cpp' : '%sc++%sc++%snvdtcgsuf',
|
|
||||||
\ 'cs' : '%sc#%sc#%sdtncEgsipm',
|
|
||||||
\ 'cobol' : '%scobol%scobol%sdfgpPs',
|
|
||||||
\ 'eiffel' : '%seiffel%seiffel%scf',
|
|
||||||
\ 'erlang' : '%serlang%serlang%sdrmf',
|
|
||||||
\ 'expect' : '%stcl%stcl%scfp',
|
|
||||||
\ 'fortran': '%sfortran%sfortran%spbceiklmntvfs',
|
|
||||||
\ 'html' : '%shtml%shtml%saf',
|
|
||||||
\ 'java' : '%sjava%sjava%spcifm',
|
|
||||||
\ 'javascript': '%sjavascript%sjavascript%sf',
|
|
||||||
\ 'lisp' : '%slisp%slisp%sf',
|
|
||||||
\ 'lua' : '%slua%slua%sf',
|
|
||||||
\ 'make' : '%smake%smake%sm',
|
|
||||||
\ 'pascal' : '%spascal%spascal%sfp',
|
|
||||||
\ 'perl' : '%sperl%sperl%sclps',
|
|
||||||
\ 'php' : '%sphp%sphp%scdvf',
|
|
||||||
\ 'python' : '%spython%spython%scmf',
|
|
||||||
\ 'rexx' : '%srexx%srexx%ss',
|
|
||||||
\ 'ruby' : '%sruby%sruby%scfFm',
|
|
||||||
\ 'scheme' : '%sscheme%sscheme%ssf',
|
|
||||||
\ 'sh' : '%ssh%ssh%sf',
|
|
||||||
\ 'csh' : '%ssh%ssh%sf',
|
|
||||||
\ 'zsh' : '%ssh%ssh%sf',
|
|
||||||
\ 'slang' : '%sslang%sslang%snf',
|
|
||||||
\ 'sml' : '%ssml%ssml%secsrtvf',
|
|
||||||
\ 'sql' : '%ssql%ssql%scFPrstTvfp',
|
|
||||||
\ 'tcl' : '%stcl%stcl%scfmp',
|
|
||||||
\ 'vera' : '%svera%svera%scdefgmpPtTvx',
|
|
||||||
\ 'verilog': '%sverilog%sverilog%smcPertwpvf',
|
|
||||||
\ 'vim' : '%svim%svim%savf',
|
|
||||||
\ 'yacc' : '%syacc%syacc%sl',
|
|
||||||
\ }
|
|
||||||
|
|
||||||
cal map(s:types, 'printf(v:val, "--language-force=", " --", "-types=")')
|
|
||||||
|
|
||||||
if executable('jsctags')
|
|
||||||
cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } })
|
|
||||||
en
|
|
||||||
|
|
||||||
fu! ctrlp#buffertag#opts()
|
|
||||||
for [ke, va] in items(s:opts)
|
|
||||||
let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
|
|
||||||
endfo
|
|
||||||
" Ctags bin
|
|
||||||
if empty(s:bin)
|
|
||||||
for bin in s:bins | if executable(bin)
|
|
||||||
let s:bin = bin
|
|
||||||
brea
|
|
||||||
en | endfo
|
|
||||||
el
|
|
||||||
let s:bin = expand(s:bin, 1)
|
|
||||||
en
|
|
||||||
" Types
|
|
||||||
cal extend(s:types, s:usr_types)
|
|
||||||
endf
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:validfile(fname, ftype)
|
|
||||||
if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname)
|
|
||||||
\ && index(keys(s:types), a:ftype) >= 0 | retu 1 | en
|
|
||||||
retu 0
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:exectags(cmd)
|
|
||||||
if exists('+ssl')
|
|
||||||
let [ssl, &ssl] = [&ssl, 0]
|
|
||||||
en
|
|
||||||
if &sh =~ 'cmd\.exe'
|
|
||||||
let [sxq, &sxq, shcf, &shcf] = [&sxq, '"', &shcf, '/s /c']
|
|
||||||
en
|
|
||||||
let output = system(a:cmd)
|
|
||||||
if &sh =~ 'cmd\.exe'
|
|
||||||
let [&sxq, &shcf] = [sxq, shcf]
|
|
||||||
en
|
|
||||||
if exists('+ssl')
|
|
||||||
let &ssl = ssl
|
|
||||||
en
|
|
||||||
retu output
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:exectagsonfile(fname, ftype)
|
|
||||||
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs ', a:ftype]
|
|
||||||
if type(s:types[ft]) == 1
|
|
||||||
let ags .= s:types[ft]
|
|
||||||
let bin = s:bin
|
|
||||||
elsei type(s:types[ft]) == 4
|
|
||||||
let ags = s:types[ft]['args']
|
|
||||||
let bin = expand(s:types[ft]['bin'], 1)
|
|
||||||
en
|
|
||||||
if empty(bin) | retu '' | en
|
|
||||||
let cmd = s:esctagscmd(bin, ags, a:fname)
|
|
||||||
if empty(cmd) | retu '' | en
|
|
||||||
let output = s:exectags(cmd)
|
|
||||||
if v:shell_error || output =~ 'Warning: cannot open' | retu '' | en
|
|
||||||
retu output
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:esctagscmd(bin, args, ...)
|
|
||||||
if exists('+ssl')
|
|
||||||
let [ssl, &ssl] = [&ssl, 0]
|
|
||||||
en
|
|
||||||
let fname = a:0 ? shellescape(a:1) : ''
|
|
||||||
let cmd = shellescape(a:bin).' '.a:args.' '.fname
|
|
||||||
if &sh =~ 'cmd\.exe'
|
|
||||||
let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g')
|
|
||||||
en
|
|
||||||
if exists('+ssl')
|
|
||||||
let &ssl = ssl
|
|
||||||
en
|
|
||||||
if has('iconv')
|
|
||||||
let last = s:enc != &enc ? s:enc : !empty( $LANG ) ? $LANG : &enc
|
|
||||||
let cmd = iconv(cmd, &enc, last)
|
|
||||||
en
|
|
||||||
retu cmd
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:process(fname, ftype)
|
|
||||||
if !s:validfile(a:fname, a:ftype) | retu [] | endif
|
|
||||||
let ftime = getftime(a:fname)
|
|
||||||
if has_key(g:ctrlp_buftags, a:fname)
|
|
||||||
\ && g:ctrlp_buftags[a:fname]['time'] >= ftime
|
|
||||||
let lines = g:ctrlp_buftags[a:fname]['lines']
|
|
||||||
el
|
|
||||||
let data = s:exectagsonfile(a:fname, a:ftype)
|
|
||||||
let [raw, lines] = [split(data, '\n\+'), []]
|
|
||||||
for line in raw
|
|
||||||
if line !~# '^!_TAG_' && len(split(line, ';"')) == 2
|
|
||||||
let parsed_line = s:parseline(line)
|
|
||||||
if parsed_line != ''
|
|
||||||
cal add(lines, parsed_line)
|
|
||||||
en
|
|
||||||
en
|
|
||||||
endfo
|
|
||||||
let cache = { a:fname : { 'time': ftime, 'lines': lines } }
|
|
||||||
cal extend(g:ctrlp_buftags, cache)
|
|
||||||
en
|
|
||||||
retu lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:parseline(line)
|
|
||||||
let vals = matchlist(a:line,
|
|
||||||
\ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)')
|
|
||||||
if vals == [] | retu '' | en
|
|
||||||
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
|
|
||||||
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPTagKind', 'Title')
|
|
||||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
|
||||||
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:chknearby(pat)
|
|
||||||
if match(getline('.'), a:pat) < 0
|
|
||||||
let [int, forw, maxl] = [1, 1, line('$')]
|
|
||||||
wh !search(a:pat, 'W'.( forw ? '' : 'b' ))
|
|
||||||
if !forw
|
|
||||||
if int > maxl | brea | en
|
|
||||||
let int += int
|
|
||||||
en
|
|
||||||
let forw = !forw
|
|
||||||
endw
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#buffertag#init(fname)
|
|
||||||
let bufs = exists('s:btmode') && s:btmode
|
|
||||||
\ ? filter(ctrlp#buffers(), 'filereadable(v:val)')
|
|
||||||
\ : [exists('s:bufname') ? s:bufname : a:fname]
|
|
||||||
let lines = []
|
|
||||||
for each in bufs
|
|
||||||
let bname = fnamemodify(each, ':p')
|
|
||||||
let tftype = get(split(getbufvar('^'.bname.'$', '&ft'), '\.'), 0, '')
|
|
||||||
cal extend(lines, s:process(bname, tftype))
|
|
||||||
endfo
|
|
||||||
cal s:syntax()
|
|
||||||
retu lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#buffertag#accept(mode, str)
|
|
||||||
let vals = matchlist(a:str,
|
|
||||||
\ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$')
|
|
||||||
let bufnr = str2nr(get(vals, 1))
|
|
||||||
if bufnr
|
|
||||||
cal ctrlp#acceptfile(a:mode, bufname(bufnr))
|
|
||||||
exe 'norm!' str2nr(get(vals, 2, line('.'))).'G'
|
|
||||||
cal s:chknearby('\V\C'.get(vals, 3, ''))
|
|
||||||
sil! norm! zvzz
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#buffertag#cmd(mode, ...)
|
|
||||||
let s:btmode = a:mode
|
|
||||||
if a:0 && !empty(a:1)
|
|
||||||
let s:bufname = fnamemodify(a:1, ':p')
|
|
||||||
en
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#buffertag#exit()
|
|
||||||
unl! s:btmode s:bufname
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,95 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/changes.vim
|
|
||||||
" Description: Change list extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_changes = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#changes#init(s:bufnr, s:crbufnr)',
|
|
||||||
\ 'accept': 'ctrlp#changes#accept',
|
|
||||||
\ 'lname': 'changes',
|
|
||||||
\ 'sname': 'chs',
|
|
||||||
\ 'exit': 'ctrlp#changes#exit()',
|
|
||||||
\ 'type': 'tabe',
|
|
||||||
\ 'sort': 0,
|
|
||||||
\ 'nolim': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:changelist(bufnr)
|
|
||||||
sil! exe 'noa hid b' a:bufnr
|
|
||||||
redi => result
|
|
||||||
sil! changes
|
|
||||||
redi END
|
|
||||||
retu map(split(result, "\n")[1:], 'tr(v:val, " ", " ")')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:process(clines, ...)
|
|
||||||
let [clines, evas] = [[], []]
|
|
||||||
for each in a:clines
|
|
||||||
let parts = matchlist(each, '\v^.\s*\d+\s+(\d+)\s+(\d+)\s(.*)$')
|
|
||||||
if !empty(parts)
|
|
||||||
if parts[3] == '' | let parts[3] = ' ' | en
|
|
||||||
cal add(clines, parts[3].' |'.a:1.':'.a:2.'|'.parts[1].':'.parts[2].'|')
|
|
||||||
en
|
|
||||||
endfo
|
|
||||||
retu reverse(filter(clines, 'count(clines, v:val) == 1'))
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#changes#init(original_bufnr, bufnr)
|
|
||||||
let bufnr = exists('s:bufnr') ? s:bufnr : a:bufnr
|
|
||||||
let bufs = exists('s:clmode') && s:clmode ? ctrlp#buffers('id') : [bufnr]
|
|
||||||
cal filter(bufs, 'v:val > 0')
|
|
||||||
let [swb, &swb] = [&swb, '']
|
|
||||||
let lines = []
|
|
||||||
for each in bufs
|
|
||||||
let fnamet = fnamemodify(bufname(each), ':t')
|
|
||||||
cal extend(lines, s:process(s:changelist(each), each, fnamet))
|
|
||||||
endfo
|
|
||||||
sil! exe 'noa hid b' a:original_bufnr
|
|
||||||
let &swb = swb
|
|
||||||
cal ctrlp#syntax()
|
|
||||||
cal s:syntax()
|
|
||||||
retu lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#changes#accept(mode, str)
|
|
||||||
let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$')
|
|
||||||
let bufnr = str2nr(get(info, 1))
|
|
||||||
if bufnr
|
|
||||||
cal ctrlp#acceptfile(a:mode, bufname(bufnr))
|
|
||||||
cal cursor(get(info, 2), get(info, 3))
|
|
||||||
sil! norm! zvzz
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#changes#cmd(mode, ...)
|
|
||||||
let s:clmode = a:mode
|
|
||||||
if a:0 && !empty(a:1)
|
|
||||||
let s:bufnr = bufnr('^'.fnamemodify(a:1, ':p').'$')
|
|
||||||
en
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#changes#exit()
|
|
||||||
unl! s:clmode s:bufnr
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,93 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/dir.vim
|
|
||||||
" Description: Directory extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_dir') && g:loaded_ctrlp_dir
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0]
|
|
||||||
|
|
||||||
let s:ars = ['s:maxdepth', 's:maxfiles', 's:compare_lim', 's:glob', 's:caching']
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
|
|
||||||
\ 'accept': 'ctrlp#dir#accept',
|
|
||||||
\ 'lname': 'dirs',
|
|
||||||
\ 'sname': 'dir',
|
|
||||||
\ 'type': 'path',
|
|
||||||
\ 'specinput': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
let s:dircounts = {}
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:globdirs(dirs, depth)
|
|
||||||
let entries = split(globpath(a:dirs, s:glob), "\n")
|
|
||||||
let [dirs, depth] = [ctrlp#dirnfile(entries)[0], a:depth + 1]
|
|
||||||
cal extend(g:ctrlp_alldirs, dirs)
|
|
||||||
let nr = len(g:ctrlp_alldirs)
|
|
||||||
if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
|
|
||||||
sil! cal ctrlp#progress(nr)
|
|
||||||
cal map(dirs, 'ctrlp#utils#fnesc(v:val, "g", ",")')
|
|
||||||
cal s:globdirs(join(dirs, ','), depth)
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:max(len, max)
|
|
||||||
retu a:max && a:len > a:max
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:nocache()
|
|
||||||
retu !s:caching || ( s:caching > 1 && get(s:dircounts, s:cwd) < s:caching )
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#dir#init(...)
|
|
||||||
let s:cwd = getcwd()
|
|
||||||
for each in range(len(s:ars))
|
|
||||||
let {s:ars[each]} = a:{each + 1}
|
|
||||||
endfo
|
|
||||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'
|
|
||||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
|
|
||||||
if g:ctrlp_newdir || s:nocache() || !filereadable(cafile)
|
|
||||||
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
|
|
||||||
cal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0)
|
|
||||||
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
|
|
||||||
if len(g:ctrlp_alldirs) <= s:compare_lim
|
|
||||||
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
|
|
||||||
en
|
|
||||||
cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile)
|
|
||||||
let g:ctrlp_newdir = 0
|
|
||||||
el
|
|
||||||
if !( exists('s:initcwd') && s:initcwd == s:cwd )
|
|
||||||
let s:initcwd = s:cwd
|
|
||||||
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
|
|
||||||
en
|
|
||||||
en
|
|
||||||
cal extend(s:dircounts, { s:cwd : len(g:ctrlp_alldirs) })
|
|
||||||
retu g:ctrlp_alldirs
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#dir#accept(mode, str)
|
|
||||||
let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#utils#lash().a:str
|
|
||||||
if a:mode =~ 't\|v\|h'
|
|
||||||
cal ctrlp#exit()
|
|
||||||
en
|
|
||||||
cal ctrlp#setdir(path, a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
|
||||||
if a:mode == 'e'
|
|
||||||
sil! cal ctrlp#statusline()
|
|
||||||
cal ctrlp#setlines(s:id)
|
|
||||||
cal ctrlp#recordhist()
|
|
||||||
cal ctrlp#prtclear()
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#dir#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,62 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/line.vim
|
|
||||||
" Description: Line extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_line = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#line#init()',
|
|
||||||
\ 'accept': 'ctrlp#line#accept',
|
|
||||||
\ 'lname': 'lines',
|
|
||||||
\ 'sname': 'lns',
|
|
||||||
\ 'type': 'tabe',
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#line#init()
|
|
||||||
let [bufs, lines] = [ctrlp#buffers('id'), []]
|
|
||||||
for bufnr in bufs
|
|
||||||
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
|
|
||||||
let lfb = lfb == [] ? ctrlp#utils#readfile(fnamemodify(bufn, ':p')) : lfb
|
|
||||||
cal map(lfb, 'tr(v:val, '' '', '' '')')
|
|
||||||
let [linenr, len_lfb, buft] = [1, len(lfb), fnamemodify(bufn, ':t')]
|
|
||||||
wh linenr <= len_lfb
|
|
||||||
let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|'
|
|
||||||
let linenr += 1
|
|
||||||
endw
|
|
||||||
cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
|
|
||||||
endfo
|
|
||||||
cal s:syntax()
|
|
||||||
retu lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#line#accept(mode, str)
|
|
||||||
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
|
|
||||||
let bufnr = str2nr(get(info, 1))
|
|
||||||
if bufnr
|
|
||||||
cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(info, 2))
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#line#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,83 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/mixed.vim
|
|
||||||
" Description: Mixing Files + MRU + Buffers
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0]
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#mixed#init(s:compare_lim)',
|
|
||||||
\ 'accept': 'ctrlp#acceptfile',
|
|
||||||
\ 'lname': 'fil + mru + buf',
|
|
||||||
\ 'sname': 'mix',
|
|
||||||
\ 'type': 'path',
|
|
||||||
\ 'opmul': 1,
|
|
||||||
\ 'specinput': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:newcache(cwd)
|
|
||||||
if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en
|
|
||||||
retu g:ctrlp_allmixes['cwd'] != a:cwd
|
|
||||||
\ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile())
|
|
||||||
\ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile())
|
|
||||||
\ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#bufs())
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:getnewmix(cwd, clim)
|
|
||||||
if g:ctrlp_newmix
|
|
||||||
cal ctrlp#mrufiles#refresh('raw')
|
|
||||||
let g:ctrlp_newcache = 1
|
|
||||||
en
|
|
||||||
let g:ctrlp_lines = copy(ctrlp#files())
|
|
||||||
cal ctrlp#progress('Mixing...')
|
|
||||||
let mrufs = copy(ctrlp#mrufiles#list('raw'))
|
|
||||||
if exists('+ssl') && &ssl
|
|
||||||
cal map(mrufs, 'tr(v:val, "\\", "/")')
|
|
||||||
en
|
|
||||||
let bufs = map(ctrlp#buffers('id'), 'fnamemodify(bufname(v:val), ":p")')
|
|
||||||
let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0')
|
|
||||||
if len(mrufs) > len(g:ctrlp_lines)
|
|
||||||
cal filter(mrufs, 'stridx(v:val, a:cwd)')
|
|
||||||
el
|
|
||||||
let cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)')
|
|
||||||
let cwd_mrufs = ctrlp#rmbasedir(cwd_mrufs)
|
|
||||||
for each in cwd_mrufs
|
|
||||||
let id = index(g:ctrlp_lines, each)
|
|
||||||
if id >= 0 | cal remove(g:ctrlp_lines, id) | en
|
|
||||||
endfo
|
|
||||||
en
|
|
||||||
cal map(mrufs, 'fnamemodify(v:val, ":.")')
|
|
||||||
let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines)
|
|
||||||
\ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines
|
|
||||||
if len(g:ctrlp_lines) <= a:clim
|
|
||||||
cal sort(g:ctrlp_lines, 'ctrlp#complen')
|
|
||||||
en
|
|
||||||
let g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()),
|
|
||||||
\ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd,
|
|
||||||
\ 'bufs': len(ctrlp#mrufiles#bufs()), 'data': g:ctrlp_lines }
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#mixed#init(clim)
|
|
||||||
let cwd = getcwd()
|
|
||||||
if s:newcache(cwd)
|
|
||||||
cal s:getnewmix(cwd, a:clim)
|
|
||||||
el
|
|
||||||
let g:ctrlp_lines = g:ctrlp_allmixes['data']
|
|
||||||
en
|
|
||||||
let g:ctrlp_newmix = 0
|
|
||||||
retu g:ctrlp_lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mixed#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,148 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/mrufiles.vim
|
|
||||||
" Description: Most Recently Used Files extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Static variables {{{1
|
|
||||||
let [s:mrbs, s:mrufs] = [[], []]
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#opts()
|
|
||||||
let [pref, opts] = ['g:ctrlp_mruf_', {
|
|
||||||
\ 'max': ['s:max', 250],
|
|
||||||
\ 'include': ['s:in', ''],
|
|
||||||
\ 'exclude': ['s:ex', ''],
|
|
||||||
\ 'case_sensitive': ['s:cseno', 1],
|
|
||||||
\ 'relative': ['s:re', 0],
|
|
||||||
\ 'save_on_update': ['s:soup', 1],
|
|
||||||
\ }]
|
|
||||||
for [ke, va] in items(opts)
|
|
||||||
let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]
|
|
||||||
endfo
|
|
||||||
endf
|
|
||||||
cal ctrlp#mrufiles#opts()
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:excl(fn)
|
|
||||||
retu !empty({s:ex}) && a:fn =~# {s:ex}
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:mergelists()
|
|
||||||
let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile())
|
|
||||||
cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0')
|
|
||||||
let mrufs = s:mrufs + diskmrufs
|
|
||||||
retu s:chop(mrufs)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:chop(mrufs)
|
|
||||||
if len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en
|
|
||||||
retu a:mrufs
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:reformat(mrufs)
|
|
||||||
let cwd = getcwd()
|
|
||||||
let cwd .= cwd !~ '[\/]$' ? ctrlp#utils#lash() : ''
|
|
||||||
if {s:re}
|
|
||||||
let cwd = exists('+ssl') ? tr(cwd, '/', '\') : cwd
|
|
||||||
cal filter(a:mrufs, '!stridx(v:val, cwd)')
|
|
||||||
en
|
|
||||||
let idx = strlen(cwd)
|
|
||||||
if exists('+ssl') && &ssl
|
|
||||||
let cwd = tr(cwd, '\', '/')
|
|
||||||
cal map(a:mrufs, 'tr(v:val, "\\", "/")')
|
|
||||||
en
|
|
||||||
retu map(a:mrufs, '!stridx(v:val, cwd) ? strpart(v:val, idx) : v:val')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:record(bufnr)
|
|
||||||
if s:locked | retu | en
|
|
||||||
let bufnr = a:bufnr + 0
|
|
||||||
let bufname = bufname(bufnr)
|
|
||||||
if bufnr > 0 && !empty(bufname)
|
|
||||||
cal filter(s:mrbs, 'v:val != bufnr')
|
|
||||||
cal insert(s:mrbs, bufnr)
|
|
||||||
cal s:addtomrufs(bufname)
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:addtomrufs(fname)
|
|
||||||
let fn = fnamemodify(a:fname, ':p')
|
|
||||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
|
||||||
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
|
|
||||||
\ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu
|
|
||||||
en
|
|
||||||
let idx = index(s:mrufs, fn, 0, !{s:cseno})
|
|
||||||
if idx
|
|
||||||
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
|
|
||||||
cal insert(s:mrufs, fn)
|
|
||||||
if {s:soup} && idx < 0
|
|
||||||
cal s:savetofile(s:mergelists())
|
|
||||||
en
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:savetofile(mrufs)
|
|
||||||
cal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile)
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#mrufiles#refresh(...)
|
|
||||||
let mrufs = s:mergelists()
|
|
||||||
cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
|
|
||||||
if exists('+ssl')
|
|
||||||
cal map(mrufs, 'tr(v:val, "/", "\\")')
|
|
||||||
cal map(s:mrufs, 'tr(v:val, "/", "\\")')
|
|
||||||
let cond = 'count(mrufs, v:val, !{s:cseno}) == 1'
|
|
||||||
cal filter(mrufs, cond)
|
|
||||||
cal filter(s:mrufs, cond)
|
|
||||||
en
|
|
||||||
cal s:savetofile(mrufs)
|
|
||||||
retu a:0 && a:1 == 'raw' ? [] : s:reformat(mrufs)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#remove(files)
|
|
||||||
let mrufs = []
|
|
||||||
if a:files != []
|
|
||||||
let mrufs = s:mergelists()
|
|
||||||
let cond = 'index(a:files, v:val, 0, !{s:cseno}) < 0'
|
|
||||||
cal filter(mrufs, cond)
|
|
||||||
cal filter(s:mrufs, cond)
|
|
||||||
en
|
|
||||||
cal s:savetofile(mrufs)
|
|
||||||
retu s:reformat(mrufs)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#add(fn)
|
|
||||||
if !empty(a:fn)
|
|
||||||
cal s:addtomrufs(a:fn)
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#list(...)
|
|
||||||
retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists())
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#bufs()
|
|
||||||
retu s:mrbs
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#cachefile()
|
|
||||||
if !exists('s:cadir') || !exists('s:cafile')
|
|
||||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
|
||||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
|
||||||
en
|
|
||||||
retu s:cafile
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#init()
|
|
||||||
if !has('autocmd') | retu | en
|
|
||||||
let s:locked = 0
|
|
||||||
aug CtrlPMRUF
|
|
||||||
au!
|
|
||||||
au BufAdd,BufEnter,BufLeave,BufWritePost * cal s:record(expand('<abuf>', 1))
|
|
||||||
au QuickFixCmdPre *vimgrep* let s:locked = 1
|
|
||||||
au QuickFixCmdPost *vimgrep* let s:locked = 0
|
|
||||||
au VimLeavePre * cal s:savetofile(s:mergelists())
|
|
||||||
aug END
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,59 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/quickfix.vim
|
|
||||||
" Description: Quickfix extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_quickfix = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#quickfix#init()',
|
|
||||||
\ 'accept': 'ctrlp#quickfix#accept',
|
|
||||||
\ 'lname': 'quickfix',
|
|
||||||
\ 'sname': 'qfx',
|
|
||||||
\ 'type': 'line',
|
|
||||||
\ 'sort': 0,
|
|
||||||
\ 'nolim': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
fu! s:lineout(dict)
|
|
||||||
retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'],
|
|
||||||
\ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S'))
|
|
||||||
endf
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPqfLineCol', 'Search')
|
|
||||||
sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|'
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#quickfix#init()
|
|
||||||
cal s:syntax()
|
|
||||||
retu map(getqflist(), 's:lineout(v:val)')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#quickfix#accept(mode, str)
|
|
||||||
let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
|
|
||||||
if vals == [] || vals[1] == '' | retu | en
|
|
||||||
cal ctrlp#acceptfile(a:mode, vals[1])
|
|
||||||
let cur_pos = getpos('.')[1:2]
|
|
||||||
if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)')
|
|
||||||
mark '
|
|
||||||
en
|
|
||||||
cal cursor(vals[2], vals[3])
|
|
||||||
sil! norm! zvzz
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#quickfix#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,59 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/rtscript.vim
|
|
||||||
" Description: Runtime scripts extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#rtscript#init(s:caching)',
|
|
||||||
\ 'accept': 'ctrlp#acceptfile',
|
|
||||||
\ 'lname': 'runtime scripts',
|
|
||||||
\ 'sname': 'rts',
|
|
||||||
\ 'type': 'path',
|
|
||||||
\ 'opmul': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
let s:filecounts = {}
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:nocache()
|
|
||||||
retu g:ctrlp_newrts ||
|
|
||||||
\ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#rtscript#init(caching)
|
|
||||||
let [s:caching, s:cwd] = [a:caching, getcwd()]
|
|
||||||
if s:nocache() ||
|
|
||||||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
|
|
||||||
sil! cal ctrlp#progress('Indexing...')
|
|
||||||
let entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), "\n")
|
|
||||||
cal filter(entries, 'count(entries, v:val) == 1')
|
|
||||||
let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
|
|
||||||
el
|
|
||||||
let [entries, results] = g:ctrlp_rtscache[2:3]
|
|
||||||
en
|
|
||||||
if s:nocache() ||
|
|
||||||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
|
|
||||||
if !exists('echoed')
|
|
||||||
sil! cal ctrlp#progress('Processing...')
|
|
||||||
en
|
|
||||||
let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
|
|
||||||
en
|
|
||||||
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]
|
|
||||||
cal extend(s:filecounts, { s:cwd : len(results) })
|
|
||||||
retu results
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#rtscript#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,128 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/tag.vim
|
|
||||||
" Description: Tag file extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_tag = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#tag#init()',
|
|
||||||
\ 'accept': 'ctrlp#tag#accept',
|
|
||||||
\ 'lname': 'tags',
|
|
||||||
\ 'sname': 'tag',
|
|
||||||
\ 'enter': 'ctrlp#tag#enter()',
|
|
||||||
\ 'type': 'tabs',
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:findcount(str)
|
|
||||||
let [tg, fname] = split(a:str, '\t\+\ze[^\t]\+$')
|
|
||||||
let tgs = taglist('^'.tg.'$')
|
|
||||||
if len(tgs) < 2
|
|
||||||
retu [1, 1]
|
|
||||||
en
|
|
||||||
let bname = fnamemodify(bufname('%'), ':p')
|
|
||||||
let fname = expand(fnamemodify(simplify(fname), ':s?^[.\/]\+??:p:.'), 1)
|
|
||||||
let [fnd, ct, pos, idx] = [0, 0, 0, 0]
|
|
||||||
wh idx < len(tgs)
|
|
||||||
if bname == fnamemodify(tgs[idx]["filename"], ':p')
|
|
||||||
cal insert(tgs, remove(tgs, idx))
|
|
||||||
brea
|
|
||||||
en
|
|
||||||
let idx += 1
|
|
||||||
endw
|
|
||||||
for each in tgs
|
|
||||||
let ct += 1
|
|
||||||
let fulname = fnamemodify(each["filename"], ':p')
|
|
||||||
if stridx(fulname, fname) >= 0
|
|
||||||
\ && strlen(fname) + stridx(fulname, fname) == strlen(fulname)
|
|
||||||
let fnd += 1
|
|
||||||
let pos = ct
|
|
||||||
en
|
|
||||||
if fnd > 1 | brea | en
|
|
||||||
endfo
|
|
||||||
retu [fnd, pos]
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:filter(tags)
|
|
||||||
let nr = 0
|
|
||||||
wh 0 < 1
|
|
||||||
if a:tags == [] | brea | en
|
|
||||||
if a:tags[nr] =~ '^!' && a:tags[nr] !~# '^!_TAG_'
|
|
||||||
let nr += 1
|
|
||||||
con
|
|
||||||
en
|
|
||||||
if a:tags[nr] =~# '^!_TAG_' && len(a:tags) > nr
|
|
||||||
cal remove(a:tags, nr)
|
|
||||||
el
|
|
||||||
brea
|
|
||||||
en
|
|
||||||
endw
|
|
||||||
retu a:tags
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#tag#init()
|
|
||||||
if empty(s:tagfiles) | retu [] | en
|
|
||||||
let g:ctrlp_alltags = []
|
|
||||||
let tagfiles = sort(filter(s:tagfiles, 'count(s:tagfiles, v:val) == 1'))
|
|
||||||
for each in tagfiles
|
|
||||||
let alltags = s:filter(ctrlp#utils#readfile(each))
|
|
||||||
cal extend(g:ctrlp_alltags, alltags)
|
|
||||||
endfo
|
|
||||||
cal s:syntax()
|
|
||||||
retu g:ctrlp_alltags
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#tag#accept(mode, str)
|
|
||||||
cal ctrlp#exit()
|
|
||||||
let str = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\ze\t')
|
|
||||||
let [tg, fnd] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str)]
|
|
||||||
let cmds = {
|
|
||||||
\ 't': ['tab sp', 'tab stj'],
|
|
||||||
\ 'h': ['sp', 'stj'],
|
|
||||||
\ 'v': ['vs', 'vert stj'],
|
|
||||||
\ 'e': ['', 'tj'],
|
|
||||||
\ }
|
|
||||||
let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1]
|
|
||||||
let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw)
|
|
||||||
\ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd
|
|
||||||
let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd
|
|
||||||
if fnd[0] == 1
|
|
||||||
if cmd != ''
|
|
||||||
exe cmd
|
|
||||||
en
|
|
||||||
let save_cst = &cst
|
|
||||||
set cst&
|
|
||||||
cal feedkeys(":".fnd[1]."ta ".tg."\r", 'nt')
|
|
||||||
let &cst = save_cst
|
|
||||||
el
|
|
||||||
cal feedkeys(":".cmd." ".tg."\r", 'nt')
|
|
||||||
en
|
|
||||||
cal ctrlp#setlcdir()
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#tag#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#tag#enter()
|
|
||||||
let tfs = tagfiles()
|
|
||||||
let s:tagfiles = tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'),
|
|
||||||
\ 'filereadable(v:val)') : []
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,154 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/undo.vim
|
|
||||||
" Description: Undo extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_undo = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#undo#init()',
|
|
||||||
\ 'accept': 'ctrlp#undo#accept',
|
|
||||||
\ 'lname': 'undo',
|
|
||||||
\ 'sname': 'udo',
|
|
||||||
\ 'enter': 'ctrlp#undo#enter()',
|
|
||||||
\ 'exit': 'ctrlp#undo#exit()',
|
|
||||||
\ 'type': 'line',
|
|
||||||
\ 'sort': 0,
|
|
||||||
\ 'nolim': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
let s:text = map(['second', 'seconds', 'minutes', 'hours', 'days', 'weeks',
|
|
||||||
\ 'months', 'years'], '" ".v:val." ago"')
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:getundo()
|
|
||||||
if exists('*undotree')
|
|
||||||
\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )
|
|
||||||
retu [1, undotree()]
|
|
||||||
el
|
|
||||||
redi => result
|
|
||||||
sil! undol
|
|
||||||
redi END
|
|
||||||
retu [0, split(result, "\n")[1:]]
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:flatten(tree, cur)
|
|
||||||
let flatdict = {}
|
|
||||||
for each in a:tree
|
|
||||||
let saved = has_key(each, 'save') ? 'saved' : ''
|
|
||||||
let current = each['seq'] == a:cur ? 'current' : ''
|
|
||||||
cal extend(flatdict, { each['seq'] : [each['time'], saved, current] })
|
|
||||||
if has_key(each, 'alt')
|
|
||||||
cal extend(flatdict, s:flatten(each['alt'], a:cur))
|
|
||||||
en
|
|
||||||
endfo
|
|
||||||
retu flatdict
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:elapsed(nr)
|
|
||||||
let [text, time] = [s:text, localtime() - a:nr]
|
|
||||||
let mins = time / 60
|
|
||||||
let hrs = time / 3600
|
|
||||||
let days = time / 86400
|
|
||||||
let wks = time / 604800
|
|
||||||
let mons = time / 2592000
|
|
||||||
let yrs = time / 31536000
|
|
||||||
if yrs > 1
|
|
||||||
retu yrs.text[7]
|
|
||||||
elsei mons > 1
|
|
||||||
retu mons.text[6]
|
|
||||||
elsei wks > 1
|
|
||||||
retu wks.text[5]
|
|
||||||
elsei days > 1
|
|
||||||
retu days.text[4]
|
|
||||||
elsei hrs > 1
|
|
||||||
retu hrs.text[3]
|
|
||||||
elsei mins > 1
|
|
||||||
retu mins.text[2]
|
|
||||||
elsei time == 1
|
|
||||||
retu time.text[0]
|
|
||||||
elsei time < 120
|
|
||||||
retu time.text[1]
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if ctrlp#nosy() | retu | en
|
|
||||||
for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String',
|
|
||||||
\ 'Sv': 'Comment', 'Po': 'Title'})
|
|
||||||
cal ctrlp#hicheck('CtrlPUndo'.ke, va)
|
|
||||||
endfo
|
|
||||||
sy match CtrlPUndoT '\v\d+ \zs[^ ]+\ze|\d+:\d+:\d+'
|
|
||||||
sy match CtrlPUndoBr '\[\|\]'
|
|
||||||
sy match CtrlPUndoNr '\[\d\+\]' contains=CtrlPUndoBr
|
|
||||||
sy match CtrlPUndoSv 'saved'
|
|
||||||
sy match CtrlPUndoPo 'current'
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:dict2list(dict)
|
|
||||||
for ke in keys(a:dict)
|
|
||||||
let a:dict[ke][0] = s:elapsed(a:dict[ke][0])
|
|
||||||
endfo
|
|
||||||
retu map(keys(a:dict), 'eval(''[v:val, a:dict[v:val]]'')')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:compval(...)
|
|
||||||
retu a:2[0] - a:1[0]
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:format(...)
|
|
||||||
let saved = !empty(a:1[1][1]) ? ' '.a:1[1][1] : ''
|
|
||||||
let current = !empty(a:1[1][2]) ? ' '.a:1[1][2] : ''
|
|
||||||
retu a:1[1][0].' ['.a:1[0].']'.saved.current
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:formatul(...)
|
|
||||||
let parts = matchlist(a:1,
|
|
||||||
\ '\v^\s+(\d+)\s+\d+\s+([^ ]+\s?[^ ]+|\d+\s\w+\s\w+)(\s*\d*)$')
|
|
||||||
retu parts == [] ? '----'
|
|
||||||
\ : parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#undo#init()
|
|
||||||
let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]
|
|
||||||
if empty(entries) | retu [] | en
|
|
||||||
if !exists('s:lines')
|
|
||||||
if s:undos[0]
|
|
||||||
let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))
|
|
||||||
let s:lines = map(sort(entries, 's:compval'), 's:format(v:val)')
|
|
||||||
el
|
|
||||||
let s:lines = map(reverse(entries), 's:formatul(v:val)')
|
|
||||||
en
|
|
||||||
en
|
|
||||||
cal s:syntax()
|
|
||||||
retu s:lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#undo#accept(mode, str)
|
|
||||||
let undon = matchstr(a:str, '\[\zs\d\+\ze\]')
|
|
||||||
if empty(undon) | retu | en
|
|
||||||
cal ctrlp#exit()
|
|
||||||
exe 'u' undon
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#undo#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#undo#enter()
|
|
||||||
let s:undos = s:getundo()
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#undo#exit()
|
|
||||||
unl! s:lines
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,120 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/utils.vim
|
|
||||||
" Description: Utilities
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Static variables {{{1
|
|
||||||
fu! ctrlp#utils#lash()
|
|
||||||
retu &ssl || !exists('+ssl') ? '/' : '\'
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:lash(...)
|
|
||||||
retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#opts()
|
|
||||||
let s:lash = ctrlp#utils#lash()
|
|
||||||
let usrhome = $HOME . s:lash( $HOME )
|
|
||||||
let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
|
|
||||||
let cadir = isdirectory(usrhome.'.ctrlp_cache')
|
|
||||||
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
|
|
||||||
if exists('g:ctrlp_cache_dir')
|
|
||||||
let cadir = expand(g:ctrlp_cache_dir, 1)
|
|
||||||
if isdirectory(cadir.s:lash(cadir).'.ctrlp_cache')
|
|
||||||
let cadir = cadir.s:lash(cadir).'.ctrlp_cache'
|
|
||||||
en
|
|
||||||
en
|
|
||||||
let s:cache_dir = cadir
|
|
||||||
endf
|
|
||||||
cal ctrlp#utils#opts()
|
|
||||||
|
|
||||||
let s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') )
|
|
||||||
" Files and Directories {{{1
|
|
||||||
fu! ctrlp#utils#cachedir()
|
|
||||||
retu s:cache_dir
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#cachefile(...)
|
|
||||||
let [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()]
|
|
||||||
let cache_file = substitute(dir, '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt'
|
|
||||||
retu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#readfile(file)
|
|
||||||
if filereadable(a:file)
|
|
||||||
let data = readfile(a:file)
|
|
||||||
if empty(data) || type(data) != 3
|
|
||||||
unl data
|
|
||||||
let data = []
|
|
||||||
en
|
|
||||||
retu data
|
|
||||||
en
|
|
||||||
retu []
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#mkdir(dir)
|
|
||||||
if exists('*mkdir') && !isdirectory(a:dir)
|
|
||||||
sil! cal mkdir(a:dir, 'p')
|
|
||||||
en
|
|
||||||
retu a:dir
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#writecache(lines, ...)
|
|
||||||
if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir))
|
|
||||||
sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile())
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#glob(...)
|
|
||||||
let path = ctrlp#utils#fnesc(a:1, 'g')
|
|
||||||
retu s:wig_cond ? glob(path, a:2) : glob(path)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#globpath(...)
|
|
||||||
retu call('globpath', s:wig_cond ? a:000 : a:000[:1])
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#fnesc(path, type, ...)
|
|
||||||
if exists('*fnameescape')
|
|
||||||
if exists('+ssl')
|
|
||||||
if a:type == 'c'
|
|
||||||
let path = escape(a:path, '%#')
|
|
||||||
elsei a:type == 'f'
|
|
||||||
let path = fnameescape(a:path)
|
|
||||||
elsei a:type == 'g'
|
|
||||||
let path = escape(a:path, '?*')
|
|
||||||
en
|
|
||||||
let path = substitute(path, '[', '[[]', 'g')
|
|
||||||
el
|
|
||||||
let path = fnameescape(a:path)
|
|
||||||
en
|
|
||||||
el
|
|
||||||
if exists('+ssl')
|
|
||||||
if a:type == 'c'
|
|
||||||
let path = escape(a:path, '%#')
|
|
||||||
elsei a:type == 'f'
|
|
||||||
let path = escape(a:path, " \t\n%#*?|<\"")
|
|
||||||
elsei a:type == 'g'
|
|
||||||
let path = escape(a:path, '?*')
|
|
||||||
en
|
|
||||||
let path = substitute(path, '[', '[[]', 'g')
|
|
||||||
el
|
|
||||||
let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<")
|
|
||||||
en
|
|
||||||
en
|
|
||||||
retu a:0 ? escape(path, a:1) : path
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#dircompl(...)
|
|
||||||
let [hsl, str] = [match(a:1, '[\/]'), '']
|
|
||||||
let par = substitute(a:1, '[^\/]*$', '', '')
|
|
||||||
let path = !hsl ? par : hsl > 0 ? getcwd().s:lash().par : getcwd()
|
|
||||||
for dir in split(globpath(ctrlp#utils#fnesc(path, 'g', ','), '*/'), '\n')
|
|
||||||
let str .= par.split(dir, '[\/]')[-1]."\n"
|
|
||||||
endfo
|
|
||||||
retu str
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
File diff suppressed because it is too large
Load Diff
@ -1,69 +0,0 @@
|
|||||||
" =============================================================================
|
|
||||||
" File: plugin/ctrlp.vim
|
|
||||||
" Description: Fuzzy file, buffer, mru, tag, etc finder.
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
" GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip
|
|
||||||
|
|
||||||
if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp = 1
|
|
||||||
|
|
||||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
|
||||||
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
|
|
||||||
\ = [[], [], [], [], {}, {}, [], 2]
|
|
||||||
|
|
||||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
|
||||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
|
||||||
|
|
||||||
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlP
|
|
||||||
\ cal ctrlp#init(0, { 'dir': <q-args> })
|
|
||||||
|
|
||||||
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPMRUFiles
|
|
||||||
\ cal ctrlp#init(2, { 'dir': <q-args> })
|
|
||||||
|
|
||||||
com! -bar CtrlPBuffer cal ctrlp#init(1)
|
|
||||||
com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
|
|
||||||
|
|
||||||
com! -bar CtrlPClearCache cal ctrlp#clr()
|
|
||||||
com! -bar CtrlPClearAllCaches cal ctrlp#clra()
|
|
||||||
|
|
||||||
com! -bar ClearCtrlPCache cal ctrlp#clr()
|
|
||||||
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
|
|
||||||
|
|
||||||
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
|
|
||||||
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
|
|
||||||
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' })
|
|
||||||
|
|
||||||
if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
|
|
||||||
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
|
|
||||||
en
|
|
||||||
|
|
||||||
cal ctrlp#mrufiles#init()
|
|
||||||
|
|
||||||
com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
|
||||||
com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
|
||||||
|
|
||||||
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPDir
|
|
||||||
\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })
|
|
||||||
|
|
||||||
com! -n=? -com=buffer CtrlPBufTag
|
|
||||||
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
|
|
||||||
|
|
||||||
com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
|
||||||
com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
|
||||||
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
|
||||||
com! -bar CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
|
||||||
|
|
||||||
com! -n=? -com=buffer CtrlPChange
|
|
||||||
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
|
||||||
|
|
||||||
com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
|
||||||
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
|
|
||||||
com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
|
|
||||||
|
|
||||||
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPBookmarkDirAdd
|
|
||||||
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
|
|
||||||
|
|
||||||
" vim:ts=2:sw=2:sts=2
|
|
@ -1,86 +0,0 @@
|
|||||||
# ctrlp.vim
|
|
||||||
Full path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim.
|
|
||||||
|
|
||||||
* Written in pure Vimscript for MacVim, gVim and Vim 7.0+.
|
|
||||||
* Full support for Vim's regexp as search patterns.
|
|
||||||
* Built-in Most Recently Used (MRU) files monitoring.
|
|
||||||
* Built-in project's root finder.
|
|
||||||
* Open multiple files at once.
|
|
||||||
* Create new files and directories.
|
|
||||||
* [Extensible][2].
|
|
||||||
|
|
||||||
![ctrlp][1]
|
|
||||||
|
|
||||||
## Basic Usage
|
|
||||||
* Run `:CtrlP` or `:CtrlP [starting-directory]` to invoke CtrlP in find file mode.
|
|
||||||
* Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in find buffer or find MRU file mode.
|
|
||||||
* Run `:CtrlPMixed` to search in Files, Buffers and MRU files at the same time.
|
|
||||||
|
|
||||||
Check `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands.
|
|
||||||
|
|
||||||
##### Once CtrlP is open:
|
|
||||||
* Press `<F5>` to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options.
|
|
||||||
* Press `<c-f>` and `<c-b>` to cycle between modes.
|
|
||||||
* Press `<c-d>` to switch to filename only search instead of full path.
|
|
||||||
* Press `<c-r>` to switch to regexp mode.
|
|
||||||
* Use `<c-n>`, `<c-p>` to select the next/previous string in the prompt's history.
|
|
||||||
* Use `<c-y>` to create a new file and its parent directories.
|
|
||||||
* Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.
|
|
||||||
|
|
||||||
Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help.
|
|
||||||
|
|
||||||
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
|
|
||||||
* End the input string with a colon `:` followed by a command to execute it on the opening file(s):
|
|
||||||
Use `:25` to jump to line 25.
|
|
||||||
Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files.
|
|
||||||
|
|
||||||
## Basic Options
|
|
||||||
* Change the default mapping and the default command to invoke CtrlP:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:ctrlp_map = '<c-p>'
|
|
||||||
let g:ctrlp_cmd = 'CtrlP'
|
|
||||||
```
|
|
||||||
|
|
||||||
* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:ctrlp_working_path_mode = 'ra'
|
|
||||||
```
|
|
||||||
|
|
||||||
`'c'` - the directory of the current file.
|
|
||||||
`'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`
|
|
||||||
`'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.
|
|
||||||
`0` or `''` (empty string) - disable this feature.
|
|
||||||
|
|
||||||
Define additional root markers with the `g:ctrlp_root_markers` option.
|
|
||||||
|
|
||||||
* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
|
|
||||||
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
|
|
||||||
|
|
||||||
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
|
|
||||||
let g:ctrlp_custom_ignore = {
|
|
||||||
\ 'dir': '\v[\/]\.(git|hg|svn)$',
|
|
||||||
\ 'file': '\v\.(exe|so|dll)$',
|
|
||||||
\ 'link': 'some_bad_symbolic_links',
|
|
||||||
\ }
|
|
||||||
```
|
|
||||||
|
|
||||||
* Use a custom file listing command:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
|
|
||||||
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
|
|
||||||
```
|
|
||||||
|
|
||||||
Check `:help ctrlp-options` for other options.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
Use your favorite method or check the homepage for a [quick installation guide][3].
|
|
||||||
|
|
||||||
[1]: http://i.imgur.com/yIynr.png
|
|
||||||
[2]: https://github.com/kien/ctrlp.vim/tree/extensions
|
|
||||||
[3]: http://kien.github.com/ctrlp.vim#installation
|
|
@ -1,12 +0,0 @@
|
|||||||
# Below is a list of people and organizations that have contributed
|
|
||||||
# to the Dart project. Names should be added to the list like so:
|
|
||||||
#
|
|
||||||
# If you contributed to the project(s) in this repository, and would
|
|
||||||
# like your name included here, please contact misc@dartlang.org mailing list.
|
|
||||||
#
|
|
||||||
# Name/Organization <email address>
|
|
||||||
|
|
||||||
Google Inc.
|
|
||||||
|
|
||||||
Ladislav Thon <ladicek@gmail.com>
|
|
||||||
Nishino Naruhiko (@rbtnn) <naru123456789@gmail.com>
|
|
@ -1,24 +0,0 @@
|
|||||||
Copyright 2012, the Dart project authors. All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the following
|
|
||||||
disclaimer in the documentation and/or other materials provided
|
|
||||||
with the distribution.
|
|
||||||
* Neither the name of Google Inc. nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,37 +0,0 @@
|
|||||||
# Dart plugin for VIM
|
|
||||||
|
|
||||||
This is an (unsupported) plugin for using Dart with Vim. Pull requests welcome!
|
|
||||||
|
|
||||||
Looking for an IDE experience? Try [Dart Editor][1],
|
|
||||||
[Dart plugin for Eclipse][2], or [Dart plugin for IntelliJ/WebStorm][3].
|
|
||||||
|
|
||||||
License:
|
|
||||||
|
|
||||||
Copyright 2012, the Dart project authors. All rights reserved.
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the following
|
|
||||||
disclaimer in the documentation and/or other materials provided
|
|
||||||
with the distribution.
|
|
||||||
* Neither the name of Google Inc. nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
[1]: http://www.dartlang.org/editor
|
|
||||||
[2]: http://news.dartlang.org/2012/08/dart-plugin-for-eclipse-is-ready-for.html
|
|
||||||
[3]: http://plugins.intellij.net/plugin/?id=6351
|
|
@ -1 +0,0 @@
|
|||||||
autocmd BufRead,BufNewFile *.dart set filetype=dart
|
|
@ -1,25 +0,0 @@
|
|||||||
if exists('b:did_ftplugin')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let b:did_ftplugin = 1
|
|
||||||
|
|
||||||
" Enable automatic indentation (2 spaces)
|
|
||||||
setlocal expandtab
|
|
||||||
setlocal shiftwidth=2
|
|
||||||
setlocal softtabstop=2
|
|
||||||
|
|
||||||
setlocal formatoptions-=t
|
|
||||||
|
|
||||||
" Set 'comments' to format dashed lists in comments.
|
|
||||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
|
||||||
|
|
||||||
setlocal commentstring=//%s
|
|
||||||
let s:win_sep = (has('win32') || has('win64')) ? '/' : ''
|
|
||||||
let &l:errorformat =
|
|
||||||
\ join([
|
|
||||||
\ ' %#''file://' . s:win_sep . '%f'': %s: line %l pos %c:%m',
|
|
||||||
\ '%m'
|
|
||||||
\ ], ',')
|
|
||||||
|
|
||||||
|
|
||||||
let b:undo_ftplugin = 'setl et< fo< sw< sts< com< cms<'
|
|
@ -1,9 +0,0 @@
|
|||||||
if exists('b:did_indent')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let b:did_indent = 1
|
|
||||||
|
|
||||||
setlocal cindent
|
|
||||||
setlocal cinoptions+=j1,J1
|
|
||||||
|
|
||||||
let b:undo_indent = 'setl cin< cino<'
|
|
@ -1,106 +0,0 @@
|
|||||||
" Vim syntax file " Language: Dart
|
|
||||||
" Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
||||||
" for details. 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("g:main_syntax")
|
|
||||||
if version < 600
|
|
||||||
syntax clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:main_syntax = 'dart'
|
|
||||||
syntax region dartFold start="{" end="}" transparent fold
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Ensure long multiline strings are highlighted.
|
|
||||||
syntax sync fromstart
|
|
||||||
|
|
||||||
" keyword definitions
|
|
||||||
syntax keyword dartConditional if else switch
|
|
||||||
syntax keyword dartRepeat do while for
|
|
||||||
syntax keyword dartBoolean true false
|
|
||||||
syntax keyword dartConstant null
|
|
||||||
syntax keyword dartTypedef this super class typedef
|
|
||||||
syntax keyword dartOperator new is as in factory
|
|
||||||
syntax match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:"
|
|
||||||
syntax keyword dartType void var bool int double num dynamic
|
|
||||||
syntax keyword dartStatement return
|
|
||||||
syntax keyword dartStorageClass static abstract final const
|
|
||||||
syntax keyword dartExceptions throw rethrow try on catch finally
|
|
||||||
syntax keyword dartAssert assert
|
|
||||||
syntax keyword dartClassDecl extends with implements
|
|
||||||
syntax keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhite
|
|
||||||
syntax keyword dartKeyword get set operator call external
|
|
||||||
syntax match dartUserLabelRef "\k\+" contained
|
|
||||||
|
|
||||||
syntax region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":"
|
|
||||||
syntax keyword dartLabel default
|
|
||||||
|
|
||||||
syntax match dartLibrary "^\(import\|part of\|part\|export\|library\|show\|hide\)\s"
|
|
||||||
|
|
||||||
" Comments
|
|
||||||
syntax keyword dartTodo contained TODO FIXME XXX
|
|
||||||
syntax region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLink,@Spell
|
|
||||||
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
|
|
||||||
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
|
|
||||||
syntax region dartDocLink contained start=+\[+ end=+\]+
|
|
||||||
|
|
||||||
" Strings
|
|
||||||
syntax region dartString start=+\z(["']\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar
|
|
||||||
syntax region dartRawString start=+r\z(["']\)+ end=+\z1+ contains=@Spell
|
|
||||||
syntax region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar
|
|
||||||
syntax region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell
|
|
||||||
syntax match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)"
|
|
||||||
syntax match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)"
|
|
||||||
|
|
||||||
" Numbers
|
|
||||||
syntax match dartNumber "\<\d\+\(\.\d\+\)\=\>"
|
|
||||||
|
|
||||||
" TODO(antonm): consider conditional highlighting of corelib classes.
|
|
||||||
syntax keyword dartCoreClasses BidirectionalIterator Comparable DateTime Duration Expando Function Invocation Iterable Iterator List Map Match Object Pattern RegExp RuneIterator Runes Set StackTrace Stopwatch String StringBuffer StringSink Symbol Type
|
|
||||||
syntax keyword dartCoreTypedefs Comparator
|
|
||||||
syntax keyword dartCoreExceptions AbstractClassInstantiationError ArgumentError AssertionError CastError ConcurrentModificationError Error Exception FallThroughError FormatException IntegerDivisionByZeroException NoSuchMethodError NullThrownError OutOfMemoryError RangeError RuntimeError StackOverflowError StateError TypeError UnimplementedError UnsupportedError
|
|
||||||
|
|
||||||
|
|
||||||
" The default highlighting.
|
|
||||||
highlight default link dartBranch Conditional
|
|
||||||
highlight default link dartUserLabelRef dartUserLabel
|
|
||||||
highlight default link dartLabel Label
|
|
||||||
highlight default link dartUserLabel Label
|
|
||||||
highlight default link dartConditional Conditional
|
|
||||||
highlight default link dartRepeat Repeat
|
|
||||||
highlight default link dartExceptions Exception
|
|
||||||
highlight default link dartAssert Statement
|
|
||||||
highlight default link dartStorageClass StorageClass
|
|
||||||
highlight default link dartClassDecl dartStorageClass
|
|
||||||
highlight default link dartBoolean Boolean
|
|
||||||
highlight default link dartString String
|
|
||||||
highlight default link dartRawString String
|
|
||||||
highlight default link dartMultilineString String
|
|
||||||
highlight default link dartRawMultilineString String
|
|
||||||
highlight default link dartNumber Number
|
|
||||||
highlight default link dartStatement Statement
|
|
||||||
highlight default link dartOperator Operator
|
|
||||||
highlight default link dartComment Comment
|
|
||||||
highlight default link dartLineComment Comment
|
|
||||||
highlight default link dartLineDocComment Comment
|
|
||||||
highlight default link dartConstant Constant
|
|
||||||
highlight default link dartTypedef Typedef
|
|
||||||
highlight default link dartTodo Todo
|
|
||||||
highlight default link dartKeyword Keyword
|
|
||||||
highlight default link dartType Type
|
|
||||||
highlight default link dartInterpolation PreProc
|
|
||||||
highlight default link dartDocLink SpecialComment
|
|
||||||
highlight default link dartSpecialChar SpecialChar
|
|
||||||
highlight default link dartLibrary Include
|
|
||||||
highlight default link dartCoreClasses Type
|
|
||||||
highlight default link dartCoreTypedefs Typedef
|
|
||||||
highlight default link dartCoreExceptions Exception
|
|
||||||
|
|
||||||
let b:current_syntax = "dart"
|
|
||||||
let b:spell_options = "contained"
|
|
||||||
|
|
||||||
if g:main_syntax is# 'dart'
|
|
||||||
unlet g:main_syntax
|
|
||||||
endif
|
|
@ -1,13 +0,0 @@
|
|||||||
I started with the evening colorscheme included in the distro, and tweaked a
|
|
||||||
few colors to my liking. Then I decided to do a major overhaul and give the
|
|
||||||
whole thing a desert evening sort of feel. I find it a very pleasing,
|
|
||||||
easy-on-the-eyes theme.
|
|
||||||
|
|
||||||
Screenshot: http://hans.fugal.net/vim/colors/desert.html
|
|
||||||
|
|
||||||
Get the latest version at https://github.com/fugalh/desert.vim
|
|
||||||
Put in ~/.vim/colors or (<your-vim-dir>\vimfiles\colors on Windows) and do
|
|
||||||
:colorscheme desert
|
|
||||||
|
|
||||||
I mostly don't maintain this anymore. Occasionally someone has a tweak
|
|
||||||
suggestion - I recommend forking this and sending a pull request, or not.
|
|
@ -1,110 +0,0 @@
|
|||||||
" Vim color file
|
|
||||||
" Maintainer: Hans Fugal <hans@fugal.net>
|
|
||||||
" Last Change: $Date: 2003/07/24 00:57:11 $
|
|
||||||
" Last Change: $Date: 2003/07/24 00:57:11 $
|
|
||||||
" URL: http://hans.fugal.net/vim/colors/desert.vim
|
|
||||||
" Version: $Id: desert.vim,v 1.7 2003/07/24 00:57:11 fugalh Exp $
|
|
||||||
|
|
||||||
" cool help screens
|
|
||||||
" :he group-name
|
|
||||||
" :he highlight-groups
|
|
||||||
" :he cterm-colors
|
|
||||||
|
|
||||||
set background=dark
|
|
||||||
if version > 580
|
|
||||||
" no guarantees for version 5.8 and below, but this makes it stop
|
|
||||||
" complaining
|
|
||||||
hi clear
|
|
||||||
if exists("syntax_on")
|
|
||||||
syntax reset
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
let g:colors_name="desert"
|
|
||||||
|
|
||||||
hi Normal guifg=White guibg=grey20
|
|
||||||
|
|
||||||
" highlight groups
|
|
||||||
hi Cursor guibg=indianred guifg=khaki
|
|
||||||
"hi CursorIM
|
|
||||||
"hi Directory
|
|
||||||
"hi DiffAdd
|
|
||||||
"hi DiffChange
|
|
||||||
"hi DiffDelete
|
|
||||||
"hi DiffText
|
|
||||||
"hi ErrorMsg
|
|
||||||
hi VertSplit guibg=#c2bfa5 guifg=grey50 gui=none
|
|
||||||
hi Folded guibg=grey30 guifg=gold
|
|
||||||
hi FoldColumn guibg=grey30 guifg=tan
|
|
||||||
hi IncSearch guifg=slategrey guibg=khaki
|
|
||||||
"hi LineNr
|
|
||||||
hi ModeMsg guifg=goldenrod
|
|
||||||
hi MoreMsg guifg=SeaGreen
|
|
||||||
hi NonText guifg=LightBlue guibg=grey30
|
|
||||||
hi Question guifg=springgreen
|
|
||||||
hi Search guibg=grey30 guifg=#dfffdf
|
|
||||||
hi SpecialKey guifg=yellowgreen
|
|
||||||
hi StatusLine guibg=#c2bfa5 guifg=black gui=none
|
|
||||||
hi StatusLineNC guibg=#c2bfa5 guifg=grey50 gui=none
|
|
||||||
hi Title guifg=indianred
|
|
||||||
hi Visual gui=none guifg=khaki guibg=olivedrab
|
|
||||||
"hi VisualNOS
|
|
||||||
hi WarningMsg guifg=salmon
|
|
||||||
"hi WildMenu
|
|
||||||
"hi Menu
|
|
||||||
"hi Scrollbar
|
|
||||||
"hi Tooltip
|
|
||||||
hi MatchParen guibg=grey30 guifg=#dfffdf
|
|
||||||
|
|
||||||
" syntax highlighting groups
|
|
||||||
hi Comment guifg=SkyBlue
|
|
||||||
hi Constant guifg=#ffa0a0
|
|
||||||
hi Identifier guifg=palegreen
|
|
||||||
hi Statement guifg=khaki
|
|
||||||
hi PreProc guifg=indianred
|
|
||||||
hi Type guifg=darkkhaki
|
|
||||||
hi Special guifg=navajowhite
|
|
||||||
"hi Underlined
|
|
||||||
hi Ignore guifg=grey40
|
|
||||||
"hi Error
|
|
||||||
hi Todo guifg=orangered guibg=yellow2
|
|
||||||
|
|
||||||
" color terminal definitions
|
|
||||||
hi SpecialKey ctermfg=darkgreen
|
|
||||||
hi NonText cterm=bold ctermfg=darkblue
|
|
||||||
hi Directory ctermfg=darkcyan
|
|
||||||
hi ErrorMsg cterm=bold ctermfg=7 ctermbg=1
|
|
||||||
hi IncSearch cterm=NONE ctermfg=yellow ctermbg=green
|
|
||||||
hi Search cterm=NONE ctermfg=grey ctermbg=blue
|
|
||||||
hi MoreMsg ctermfg=darkgreen
|
|
||||||
hi ModeMsg cterm=NONE ctermfg=brown
|
|
||||||
hi LineNr ctermfg=3
|
|
||||||
hi Question ctermfg=green
|
|
||||||
hi StatusLine cterm=bold,reverse
|
|
||||||
hi StatusLineNC cterm=reverse
|
|
||||||
hi VertSplit cterm=reverse
|
|
||||||
hi Title ctermfg=5
|
|
||||||
hi Visual cterm=reverse
|
|
||||||
hi VisualNOS cterm=bold,underline
|
|
||||||
hi WarningMsg ctermfg=1
|
|
||||||
hi WildMenu ctermfg=0 ctermbg=3
|
|
||||||
hi Folded ctermfg=darkgrey ctermbg=NONE
|
|
||||||
hi FoldColumn ctermfg=darkgrey ctermbg=NONE
|
|
||||||
hi DiffAdd ctermbg=4
|
|
||||||
hi DiffChange ctermbg=5
|
|
||||||
hi DiffDelete cterm=bold ctermfg=4 ctermbg=6
|
|
||||||
hi DiffText cterm=bold ctermbg=1
|
|
||||||
hi Comment ctermfg=darkcyan
|
|
||||||
hi Constant ctermfg=brown
|
|
||||||
hi Special ctermfg=5
|
|
||||||
hi Identifier ctermfg=6
|
|
||||||
hi Statement ctermfg=3
|
|
||||||
hi PreProc ctermfg=5
|
|
||||||
hi Todo ctermfg=red ctermbg=NONE
|
|
||||||
hi Type ctermfg=2
|
|
||||||
hi Underlined cterm=underline ctermfg=5
|
|
||||||
hi Ignore cterm=bold ctermfg=7
|
|
||||||
hi Ignore ctermfg=darkgrey
|
|
||||||
hi Error cterm=bold ctermfg=7 ctermbg=1
|
|
||||||
|
|
||||||
|
|
||||||
"vim: sw=4
|
|
@ -1,22 +0,0 @@
|
|||||||
Copyright (c) 2013 Honza Pokorny
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,23 +0,0 @@
|
|||||||
dockerfile.vim
|
|
||||||
==============
|
|
||||||
|
|
||||||
Syntax highlighting for Dockerfiles
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
|
|
||||||
Via pathogen, the usual way...
|
|
||||||
|
|
||||||
Features
|
|
||||||
--------
|
|
||||||
|
|
||||||
The syntax highlighting includes:
|
|
||||||
|
|
||||||
* The directives (e.g. `FROM`)
|
|
||||||
* Strings
|
|
||||||
* Comments
|
|
||||||
|
|
||||||
License
|
|
||||||
-------
|
|
||||||
|
|
||||||
BSD, short and sweet
|
|
@ -1,18 +0,0 @@
|
|||||||
*dockerfile.txt* Syntax highlighting for Dockerfiles
|
|
||||||
|
|
||||||
Author: Honza Pokorny <http://honza.ca>
|
|
||||||
License: BSD
|
|
||||||
|
|
||||||
INSTALLATION *installation*
|
|
||||||
|
|
||||||
Drop it on your Pathogen path and you're all set.
|
|
||||||
|
|
||||||
FEATURES *features*
|
|
||||||
|
|
||||||
The syntax highlighting includes:
|
|
||||||
|
|
||||||
* The directives (e.g. FROM)
|
|
||||||
* Strings
|
|
||||||
* Comments
|
|
||||||
|
|
||||||
vim:tw=78:et:ft=help:norl:
|
|
@ -1 +0,0 @@
|
|||||||
au BufNewFile,BufRead Dockerfile set filetype=dockerfile
|
|
@ -1,22 +0,0 @@
|
|||||||
" dockerfile.vim - Syntax highlighting for Dockerfiles
|
|
||||||
" Maintainer: Honza Pokorny <http://honza.ca>
|
|
||||||
" Version: 0.5
|
|
||||||
|
|
||||||
|
|
||||||
if exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:current_syntax = "dockerfile"
|
|
||||||
|
|
||||||
syntax case ignore
|
|
||||||
|
|
||||||
syntax match dockerfileKeyword /\v^\s*(FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD)\s/
|
|
||||||
syntax match dockerfileKeyword /\v^\s*(ENTRYPOINT|VOLUME|USER|WORKDIR)\s/
|
|
||||||
highlight link dockerfileKeyword Keyword
|
|
||||||
|
|
||||||
syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/
|
|
||||||
highlight link dockerfileString String
|
|
||||||
|
|
||||||
syntax match dockerfileComment "\v^\s*#.*$"
|
|
||||||
highlight link dockerfileComment Comment
|
|
@ -1,9 +0,0 @@
|
|||||||
This is a mirror of http://www.vim.org/scripts/script.php?script_id=3225
|
|
||||||
|
|
||||||
Syntax highlighting for Adobe Flex 4 - mxml, actionscript 3 programming languages.
|
|
||||||
(Modified version 1.1)
|
|
||||||
|
|
||||||
Thanks to previous authors:
|
|
||||||
Johannes Zellner <johannes [at] zellner [dot] org>
|
|
||||||
Paul Siegmann <pauls [at] euronet [dot] nl>
|
|
||||||
Abdul Qabiz <mail [at] abdulqabiz [dot] com>
|
|
File diff suppressed because one or more lines are too long
@ -1,407 +0,0 @@
|
|||||||
" Vim syntax file
|
|
||||||
" Language: MXML (Adobe Flex 4)
|
|
||||||
" Maintainer: Abdul Qabiz <mail@abdulqabiz.com>
|
|
||||||
" Modified: Jaseem V V <jasevv@gmail.com>
|
|
||||||
" URL: http://www.abdulqabiz.com/files/vim/mxml.vim
|
|
||||||
" Author and previous maintainer:
|
|
||||||
" Johannes Zellner <johannes@zellner.org>
|
|
||||||
" Paul Siegmann <pauls@euronet.nl>
|
|
||||||
" Last Change: Monday, August 30, 2010 05:54 AM IST
|
|
||||||
" Filenames: *.mxml
|
|
||||||
" $Id: mxml.vim,v 1.1 2010/08/30 05:54 jaseemvv Exp $
|
|
||||||
|
|
||||||
" CHANGE LOG:
|
|
||||||
" Added support for highlighting Adobe Flex 4
|
|
||||||
"
|
|
||||||
" USAGE:
|
|
||||||
" Open your _vimrc file and add the below three lines:
|
|
||||||
" autocmd BufRead *.as set filetype=actionscript
|
|
||||||
" autocmd BufRead *.mxml set filetype=mxml
|
|
||||||
" syntax on
|
|
||||||
"
|
|
||||||
" CONFIGURATION:
|
|
||||||
" syntax folding can be turned on by
|
|
||||||
"
|
|
||||||
" let g:mxml_syntax_folding = 1
|
|
||||||
"
|
|
||||||
" before the syntax file gets loaded (e.g. in ~/.vimrc).
|
|
||||||
" This might slow down syntax highlighting significantly,
|
|
||||||
" especially for large files.
|
|
||||||
"
|
|
||||||
" CREDITS:
|
|
||||||
" The original version was derived by Johannes Zellner from
|
|
||||||
" Paul Siegmann's xml.vim.
|
|
||||||
" I have modified the file which inturn was modified by Abdul Quabiz.
|
|
||||||
"
|
|
||||||
" REFERENCES:
|
|
||||||
" [1] http://www.w3.org/TR/2000/REC-xml-20001006
|
|
||||||
" [2] http://www.w3.org/XML/1998/06/xmlspec-report-19980910.htm
|
|
||||||
"
|
|
||||||
"
|
|
||||||
" 2.3 Common Syntactic Constructs
|
|
||||||
" [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
|
|
||||||
" [5] Name ::= (Letter | '_' | ':') (NameChar)*
|
|
||||||
"
|
|
||||||
" NOTE:
|
|
||||||
" 1) empty tag delimiters "/>" inside attribute values (strings)
|
|
||||||
" confuse syntax highlighting.
|
|
||||||
" 2) for large files, folding can be pretty slow, especially when
|
|
||||||
" loading a file the first time and viewoptions contains 'folds'
|
|
||||||
" so that folds of previous sessions are applied.
|
|
||||||
" Don't use 'foldmethod=syntax' in this case.
|
|
||||||
|
|
||||||
|
|
||||||
" Quit when a syntax file was already loaded
|
|
||||||
|
|
||||||
if !exists("main_syntax")
|
|
||||||
if version < 600
|
|
||||||
syntax clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let main_syntax = 'mxml'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" don't use standard HiLink, it will not work with included syntax files
|
|
||||||
if version < 508
|
|
||||||
command! -nargs=+ MXMLHiLink hi link <args>
|
|
||||||
else
|
|
||||||
command! -nargs=+ MXMLHiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:mxml_cpo_save = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
syn case match
|
|
||||||
|
|
||||||
" mark illegal characters
|
|
||||||
syn match xmlError "[<&]"
|
|
||||||
|
|
||||||
" strings (inside tags) aka VALUES
|
|
||||||
"
|
|
||||||
" EXAMPLE:
|
|
||||||
"
|
|
||||||
" <tag foo.attribute = "value">
|
|
||||||
" ^^^^^^^
|
|
||||||
syn region xmlString contained start=+"+ end=+"+ contains=xmlEntity display
|
|
||||||
syn region xmlString contained start=+'+ end=+'+ contains=xmlEntity display
|
|
||||||
|
|
||||||
|
|
||||||
" punctuation (within attributes) e.g. <tag xml:foo.attribute ...>
|
|
||||||
" ^ ^
|
|
||||||
" syn match xmlAttribPunct +[-:._]+ contained display
|
|
||||||
syn match xmlAttribPunct +[:.]+ contained display
|
|
||||||
|
|
||||||
" no highlighting for xmlEqual (xmlEqual has no highlighting group)
|
|
||||||
syn match xmlEqual +=+ display
|
|
||||||
|
|
||||||
|
|
||||||
" attribute, everything before the '='
|
|
||||||
"
|
|
||||||
" PROVIDES: @xmlAttribHook
|
|
||||||
"
|
|
||||||
" EXAMPLE:
|
|
||||||
"
|
|
||||||
" <tag foo.attribute = "value">
|
|
||||||
" ^^^^^^^^^^^^^
|
|
||||||
"
|
|
||||||
syn match xmlAttrib
|
|
||||||
\ +[-'"<]\@<!\<[a-zA-Z:_][-.0-9a-zA-Z0-9:_]*\>\(['">]\@!\|$\)+
|
|
||||||
\ contained
|
|
||||||
\ contains=xmlAttribPunct,@xmlAttribHook
|
|
||||||
\ display
|
|
||||||
|
|
||||||
|
|
||||||
" namespace spec
|
|
||||||
"
|
|
||||||
" PROVIDES: @xmlNamespaceHook
|
|
||||||
"
|
|
||||||
" EXAMPLE:
|
|
||||||
"
|
|
||||||
" <xsl:for-each select = "lola">
|
|
||||||
" ^^^
|
|
||||||
"
|
|
||||||
if exists("g:mxml_namespace_transparent")
|
|
||||||
syn match xmlNamespace
|
|
||||||
\ +\(<\|</\)\@<=[^ /!?<>"':]\+[:]\@=+
|
|
||||||
\ contained
|
|
||||||
\ contains=@xmlNamespaceHook
|
|
||||||
\ transparent
|
|
||||||
\ display
|
|
||||||
else
|
|
||||||
syn match xmlNamespace
|
|
||||||
\ +\(<\|</\)\@<=[^ /!?<>"':]\+[:]\@=+
|
|
||||||
\ contained
|
|
||||||
\ contains=@xmlNamespaceHook
|
|
||||||
\ display
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" tag name
|
|
||||||
"
|
|
||||||
" PROVIDES: @xmlTagHook
|
|
||||||
"
|
|
||||||
" EXAMPLE:
|
|
||||||
"
|
|
||||||
" <tag foo.attribute = "value">
|
|
||||||
" ^^^
|
|
||||||
"
|
|
||||||
syn match xmlTagName
|
|
||||||
\ +[<]\@<=[^ /!?<>"']\++
|
|
||||||
\ contained
|
|
||||||
\ contains=xmlNamespace,xmlAttribPunct,@xmlTagHook
|
|
||||||
\ display
|
|
||||||
|
|
||||||
|
|
||||||
if exists('g:mxml_syntax_folding')
|
|
||||||
|
|
||||||
" start tag
|
|
||||||
" use matchgroup=xmlTag to skip over the leading '<'
|
|
||||||
"
|
|
||||||
" PROVIDES: @xmlStartTagHook
|
|
||||||
"
|
|
||||||
" EXAMPLE:
|
|
||||||
"
|
|
||||||
" <tag id="whoops">
|
|
||||||
" s^^^^^^^^^^^^^^^e
|
|
||||||
"
|
|
||||||
syn region xmlTag
|
|
||||||
\ matchgroup=xmlTag start=+<[^ /!?<>"']\@=+
|
|
||||||
\ matchgroup=xmlTag end=+>+
|
|
||||||
\ contained
|
|
||||||
\ contains=xmlError,xmlTagName,xmlAttrib,xmlEqual,xmlString,@xmlStartTagHook
|
|
||||||
|
|
||||||
|
|
||||||
" highlight the end tag
|
|
||||||
"
|
|
||||||
" PROVIDES: @xmlTagHook
|
|
||||||
" (should we provide a separate @xmlEndTagHook ?)
|
|
||||||
"
|
|
||||||
" EXAMPLE:
|
|
||||||
"
|
|
||||||
" </tag>
|
|
||||||
" ^^^^^^
|
|
||||||
"
|
|
||||||
syn match xmlEndTag
|
|
||||||
\ +</[^ /!?<>"']\+>+
|
|
||||||
\ contained
|
|
||||||
\ contains=xmlNamespace,xmlAttribPunct,@xmlTagHook
|
|
||||||
|
|
||||||
|
|
||||||
" tag elements with syntax-folding.
|
|
||||||
" NOTE: NO HIGHLIGHTING -- highlighting is done by contained elements
|
|
||||||
"
|
|
||||||
" PROVIDES: @xmlRegionHook
|
|
||||||
"
|
|
||||||
" EXAMPLE:
|
|
||||||
"
|
|
||||||
" <tag id="whoops">
|
|
||||||
" <!-- comment -->
|
|
||||||
" <another.tag></another.tag>
|
|
||||||
" <empty.tag/>
|
|
||||||
" some data
|
|
||||||
" </tag>
|
|
||||||
"
|
|
||||||
syn region xmlRegion
|
|
||||||
\ start=+<\z([^ /!?<>"']\+\)+
|
|
||||||
\ skip=+<!--\_.\{-}-->+
|
|
||||||
\ end=+</\z1\_\s\{-}>+
|
|
||||||
\ matchgroup=xmlEndTag end=+/>+
|
|
||||||
\ fold
|
|
||||||
\ contains=xmlTag,xmlEndTag,xmlCdata,xmlRegion,xmlComment,xmlEntity,xmlProcessing,@xmlRegionHook
|
|
||||||
\ keepend
|
|
||||||
\ extend
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
" no syntax folding:
|
|
||||||
" - contained attribute removed
|
|
||||||
" - xmlRegion not defined
|
|
||||||
"
|
|
||||||
syn region xmlTag
|
|
||||||
\ matchgroup=xmlTag start=+<[^ /!?<>"']\@=+
|
|
||||||
\ matchgroup=xmlTag end=+>+
|
|
||||||
\ contains=xmlError,xmlTagName,xmlAttrib,xmlEqual,xmlString,@xmlStartTagHook
|
|
||||||
|
|
||||||
syn match xmlEndTag
|
|
||||||
\ +</[^ /!?<>"']\+>+
|
|
||||||
\ contains=xmlNamespace,xmlAttribPunct,@xmlTagHook
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" &entities; compare with dtd
|
|
||||||
syn match xmlEntity "&[^; \t]*;" contains=xmlEntityPunct
|
|
||||||
syn match xmlEntityPunct contained "[&.;]"
|
|
||||||
|
|
||||||
if exists('g:mxml_syntax_folding')
|
|
||||||
|
|
||||||
" The real comments (this implements the comments as defined by xml,
|
|
||||||
" but not all xml pages actually conform to it. Errors are flagged.
|
|
||||||
syn region xmlComment
|
|
||||||
\ start=+<!+
|
|
||||||
\ end=+>+
|
|
||||||
\ contains=xmlCommentPart,xmlCommentError
|
|
||||||
\ extend
|
|
||||||
\ fold
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
" no syntax folding:
|
|
||||||
" - fold attribute removed
|
|
||||||
"
|
|
||||||
syn region xmlComment
|
|
||||||
\ start=+<!+
|
|
||||||
\ end=+>+
|
|
||||||
\ contains=xmlCommentPart,xmlCommentError
|
|
||||||
\ extend
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
syn keyword xmlTodo contained TODO FIXME XXX
|
|
||||||
syn match xmlCommentError contained "[^><!]"
|
|
||||||
syn region xmlCommentPart
|
|
||||||
\ start=+--+
|
|
||||||
\ end=+--+
|
|
||||||
\ contained
|
|
||||||
\ contains=xmlTodo,@xmlCommentHook
|
|
||||||
|
|
||||||
|
|
||||||
" CData sections
|
|
||||||
"
|
|
||||||
" PROVIDES: @xmlCdataHook
|
|
||||||
"
|
|
||||||
syn region xmlCdata
|
|
||||||
\ start=+<!\[CDATA\[+
|
|
||||||
\ end=+]]>+
|
|
||||||
\ contains=xmlCdataStart,xmlCdataEnd,@xmlCdataHook
|
|
||||||
\ keepend
|
|
||||||
\ extend
|
|
||||||
|
|
||||||
" using the following line instead leads to corrupt folding at CDATA regions
|
|
||||||
" syn match xmlCdata +<!\[CDATA\[\_.\{-}]]>+ contains=xmlCdataStart,xmlCdataEnd,@xmlCdataHook
|
|
||||||
syn match xmlCdataStart +<!\[CDATA\[+ contained contains=xmlCdataCdata
|
|
||||||
syn keyword xmlCdataCdata CDATA contained
|
|
||||||
syn match xmlCdataEnd +]]>+ contained
|
|
||||||
|
|
||||||
|
|
||||||
" Processing instructions
|
|
||||||
" This allows "?>" inside strings -- good idea?
|
|
||||||
syn region xmlProcessing matchgroup=xmlProcessingDelim start="<?" end="?>" contains=xmlAttrib,xmlEqual,xmlString
|
|
||||||
|
|
||||||
|
|
||||||
if exists('g:mxml_syntax_folding')
|
|
||||||
|
|
||||||
" DTD -- we use dtd.vim here
|
|
||||||
syn region xmlDocType matchgroup=xmlDocTypeDecl
|
|
||||||
\ start="<!DOCTYPE"he=s+2,rs=s+2 end=">"
|
|
||||||
\ fold
|
|
||||||
\ contains=xmlDocTypeKeyword,xmlInlineDTD,xmlString
|
|
||||||
else
|
|
||||||
|
|
||||||
" no syntax folding:
|
|
||||||
" - fold attribute removed
|
|
||||||
"
|
|
||||||
syn region xmlDocType matchgroup=xmlDocTypeDecl
|
|
||||||
\ start="<!DOCTYPE"he=s+2,rs=s+2 end=">"
|
|
||||||
\ contains=xmlDocTypeKeyword,xmlInlineDTD,xmlString
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
syn keyword xmlDocTypeKeyword contained DOCTYPE PUBLIC SYSTEM
|
|
||||||
syn region xmlInlineDTD contained matchgroup=xmlDocTypeDecl start="\[" end="]" contains=@xmlDTD
|
|
||||||
syn include @xmlDTD <sfile>:p:h/dtd.vim
|
|
||||||
unlet b:current_syntax
|
|
||||||
|
|
||||||
|
|
||||||
" synchronizing
|
|
||||||
" TODO !!! to be improved !!!
|
|
||||||
|
|
||||||
syn sync match xmlSyncDT grouphere xmlDocType +\_.\(<!DOCTYPE\)\@=+
|
|
||||||
" syn sync match xmlSyncDT groupthere NONE +]>+
|
|
||||||
|
|
||||||
if exists('g:mxml_syntax_folding')
|
|
||||||
syn sync match xmlSync grouphere xmlRegion +\_.\(<[^ /!?<>"']\+\)\@=+
|
|
||||||
" syn sync match xmlSync grouphere xmlRegion "<[^ /!?<>"']*>"
|
|
||||||
syn sync match xmlSync groupthere xmlRegion +</[^ /!?<>"']\+>+
|
|
||||||
endif
|
|
||||||
|
|
||||||
syn keyword mxmlSpecialTagName contained fx:Script fx:Style mx:Script mx:Style
|
|
||||||
if main_syntax != 'actionscript' || exists("actionscript")
|
|
||||||
" JAVA SCRIPT
|
|
||||||
syn include @mxmlScript syntax/actionscript.vim
|
|
||||||
unlet b:current_syntax
|
|
||||||
syn region Script start=+<fx:Script[^>]*>+ keepend end=+</fx:Script>+me=s-1 contains=@mxmlScript,mxmlCssStyleComment,mxmlScriptTag,@htmlPreproc
|
|
||||||
syn region mxmlScriptTag contained start=+<fx:Script+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
|
|
||||||
syn region Script start=+<mx:Script[^>]*>+ keepend end=+</mx:Script>+me=s-1 contains=@mxmlScript,mxmlCssStyleComment,mxmlScriptTag,@htmlPreproc
|
|
||||||
syn region mxmlScriptTag contained start=+<mx:Script+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent
|
|
||||||
MXMLHiLink mxmlScriptTag xmlTag
|
|
||||||
|
|
||||||
syn region mxmlEvent contained start=+\<on\a\+\s*=[\t ]*'+ end=+'+ keepend contains=mxmlEventSQ
|
|
||||||
syn region mxmlEvent contained start=+\<on\a\+\s*=[\t ]*"+ end=+"+ keepend contains=mxmlEventDQ
|
|
||||||
syn region mxmlEventSQ contained start=+'+ms=s+1 end=+'+me=s-1 contains=@mxmlScript
|
|
||||||
syn region mxmlEventDQ contained start=+"+ms=s+1 end=+"+me=s-1 contains=@mxmlScript
|
|
||||||
MXMLHiLink mxmlEventSQ mxmlEvent
|
|
||||||
MXMLHiLink mxmlEventDQ mxmlEvent
|
|
||||||
|
|
||||||
" a javascript expression is used as an arg value
|
|
||||||
syn region actionScriptExpression contained start=+&{+ keepend end=+};+ contains=@mxmlScript,@htmlPreproc
|
|
||||||
endif
|
|
||||||
syn sync minlines=100
|
|
||||||
|
|
||||||
syn cluster mxmlScript add=@htmlPreproc
|
|
||||||
|
|
||||||
if main_syntax == "mxml"
|
|
||||||
syn sync match mxmlHighlight groupthere NONE "<[/a-zA-Z]"
|
|
||||||
syn sync match mxmlHighlight groupthere Script "<fx:Script"
|
|
||||||
syn sync match mxmlHighlight groupthere Script "<mx:Script"
|
|
||||||
syn sync match mxmlHighlightSkip "^.*['\"].*$"
|
|
||||||
syn sync minlines=10
|
|
||||||
endif
|
|
||||||
|
|
||||||
" The default highlighting.
|
|
||||||
MXMLHiLink xmlTodo Todo
|
|
||||||
MXMLHiLink xmlTag Function
|
|
||||||
MXMLHiLink xmlTagName Function
|
|
||||||
MXMLHiLink xmlEndTag Identifier
|
|
||||||
if !exists("g:mxml_namespace_transparent")
|
|
||||||
MXMLHiLink xmlNamespace Tag
|
|
||||||
endif
|
|
||||||
MXMLHiLink xmlEntity Statement
|
|
||||||
MXMLHiLink xmlEntityPunct Type
|
|
||||||
|
|
||||||
MXMLHiLink xmlAttribPunct Comment
|
|
||||||
MXMLHiLink xmlAttrib Type
|
|
||||||
|
|
||||||
MXMLHiLink xmlString String
|
|
||||||
MXMLHiLink xmlComment Comment
|
|
||||||
MXMLHiLink xmlCommentPart Comment
|
|
||||||
MXMLHiLink xmlCommentError Error
|
|
||||||
MXMLHiLink xmlError Error
|
|
||||||
|
|
||||||
MXMLHiLink xmlProcessingDelim Comment
|
|
||||||
MXMLHiLink xmlProcessing Type
|
|
||||||
|
|
||||||
MXMLHiLink xmlCdata String
|
|
||||||
MXMLHiLink xmlCdataCdata Statement
|
|
||||||
MXMLHiLink xmlCdataStart Type
|
|
||||||
MXMLHiLink xmlCdataEnd Type
|
|
||||||
|
|
||||||
MXMLHiLink xmlDocTypeDecl Function
|
|
||||||
MXMLHiLink xmlDocTypeKeyword Statement
|
|
||||||
MXMLHiLink xmlInlineDTD Function
|
|
||||||
MXMLHiLink Script Special
|
|
||||||
MXMLHiLink actionScriptExpression Script
|
|
||||||
MXMLHiLink xmlCssStyleComment Comment
|
|
||||||
MXMLHiLink xmlCssDefinition Special
|
|
||||||
MXMLHiLink mxmlEvent Script
|
|
||||||
MXMLHiLink mxmlSpecialTagName Exception
|
|
||||||
|
|
||||||
|
|
||||||
let b:current_syntax = "mxml"
|
|
||||||
if main_syntax == 'mxml'
|
|
||||||
unlet main_syntax
|
|
||||||
endif
|
|
||||||
|
|
||||||
let &cpo = s:mxml_cpo_save
|
|
||||||
unlet s:mxml_cpo_save
|
|
@ -1 +0,0 @@
|
|||||||
/doc/tags
|
|
@ -1,18 +0,0 @@
|
|||||||
Before reporting a bug, you should try stripping down your Vim configuration
|
|
||||||
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`.
|
|
||||||
|
|
||||||
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
|
|
||||||
perverse knowledge of VimScript so vast that many would consider it a symptom
|
|
||||||
of mental illness. On the flip side, some ideas I'll reject no matter how
|
|
||||||
good the implementation is. "Send a patch" is an edge case answer in my book.
|
|
@ -1,120 +0,0 @@
|
|||||||
# fugitive.vim
|
|
||||||
|
|
||||||
I'm not going to lie to you; fugitive.vim may very well be the best
|
|
||||||
Git wrapper of all time. Check out these features:
|
|
||||||
|
|
||||||
View any blob, tree, commit, or tag in the repository with `:Gedit` (and
|
|
||||||
`:Gsplit`, `:Gvsplit`, `:Gtabedit`, ...). Edit a file in the index and
|
|
||||||
write to it to stage the changes. Use `:Gdiff` to bring up the staged
|
|
||||||
version of the file side by side with the working tree version and use
|
|
||||||
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!
|
|
||||||
|
|
||||||
`:Gblame` brings up an interactive vertical split with `git blame`
|
|
||||||
output. Press enter on a line to edit the commit where the line
|
|
||||||
changed, or `o` to open it in a split. When you're done, use `:Gedit`
|
|
||||||
in the historic buffer to go back to the work tree version.
|
|
||||||
|
|
||||||
`:Gmove` does a `git mv` on a file and simultaneously renames the
|
|
||||||
buffer. `:Gremove` does a `git rm` on a file and simultaneously deletes
|
|
||||||
the buffer.
|
|
||||||
|
|
||||||
Use `:Ggrep` to search the work tree (or any arbitrary commit) with
|
|
||||||
`git grep`, skipping over that which is not tracked in the repository.
|
|
||||||
`:Glog` loads all previous revisions of a file into the quickfix list so
|
|
||||||
you can iterate over them and watch the file evolve!
|
|
||||||
|
|
||||||
`:Gread` is a variant of `git checkout -- filename` that operates on the
|
|
||||||
buffer rather than the filename. This means you can use `u` to undo it
|
|
||||||
and you never get any warnings about the file changing outside Vim.
|
|
||||||
`:Gwrite` writes to both the work tree and index versions of a file,
|
|
||||||
making it like `git add` when called from a work tree file and like
|
|
||||||
`git checkout` when called from the index or a blob in history.
|
|
||||||
|
|
||||||
Use `:Gbrowse` to open the current file on GitHub, with optional line
|
|
||||||
range (try it in visual mode!). If your current repository isn't on
|
|
||||||
GitHub, `git instaweb` will be spun up instead.
|
|
||||||
|
|
||||||
Add `%{fugitive#statusline()}` to `'statusline'` to get an indicator
|
|
||||||
with the current branch in (surprise!) your statusline.
|
|
||||||
|
|
||||||
Last but not least, there's `:Git` for running any arbitrary command,
|
|
||||||
and `Git!` to open the output of a command in a temp file.
|
|
||||||
|
|
||||||
## Screencasts
|
|
||||||
|
|
||||||
* [A complement to command line git](http://vimcasts.org/e/31)
|
|
||||||
* [Working with the git index](http://vimcasts.org/e/32)
|
|
||||||
* [Resolving merge conflicts with vimdiff](http://vimcasts.org/e/33)
|
|
||||||
* [Browsing the git object database](http://vimcasts.org/e/34)
|
|
||||||
* [Exploring the history of a git repository](http://vimcasts.org/e/35)
|
|
||||||
|
|
||||||
## 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-fugitive.git
|
|
||||||
|
|
||||||
Once help tags have been generated, you can view the manual with
|
|
||||||
`:help fugitive`.
|
|
||||||
|
|
||||||
If your Vim version is below 7.2, I recommend also installing
|
|
||||||
[vim-git](https://github.com/tpope/vim-git) for syntax highlighting and
|
|
||||||
other Git niceties.
|
|
||||||
|
|
||||||
## FAQ
|
|
||||||
|
|
||||||
> I installed the plugin and started Vim. Why don't any of the commands
|
|
||||||
> exist?
|
|
||||||
|
|
||||||
Fugitive cares about the current file, not the current working
|
|
||||||
directory. Edit a file from the repository.
|
|
||||||
|
|
||||||
> I opened a new tab. Why don't any of the commands exist?
|
|
||||||
|
|
||||||
Fugitive cares about the current file, not the current working
|
|
||||||
directory. Edit a file from the repository.
|
|
||||||
|
|
||||||
> Why is `:Gbrowse` not using the right browser?
|
|
||||||
|
|
||||||
`:Gbrowse` delegates to `git web--browse`, which is less than perfect
|
|
||||||
when it comes to finding the right browser. You can tell it the correct
|
|
||||||
browser to use with `git config --global web.browser ...`. On OS X, for
|
|
||||||
example, you might want to set this to `open`. See `git web--browse --help`
|
|
||||||
for details.
|
|
||||||
|
|
||||||
> Here's a patch that automatically opens the quickfix window after
|
|
||||||
> `:Ggrep`.
|
|
||||||
|
|
||||||
This is a great example of why I recommend asking before patching.
|
|
||||||
There are valid arguments to be made both for and against automatically
|
|
||||||
opening the quickfix window. Whenever I have to make an arbitrary
|
|
||||||
decision like this, I ask what Vim would do. And Vim does not open a
|
|
||||||
quickfix window after `:grep`.
|
|
||||||
|
|
||||||
Luckily, it's easy to implement the desired behavior without changing
|
|
||||||
fugitive.vim. The following autocommand will cause the quickfix window
|
|
||||||
to open after any grep invocation:
|
|
||||||
|
|
||||||
autocmd QuickFixCmdPost *grep* cwindow
|
|
||||||
|
|
||||||
## Self-Promotion
|
|
||||||
|
|
||||||
Like fugitive.vim? Follow the repository on
|
|
||||||
[GitHub](https://github.com/tpope/vim-fugitive) and vote for it on
|
|
||||||
[vim.org](http://www.vim.org/scripts/script.php?script_id=2975). 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`.
|
|
@ -1,317 +0,0 @@
|
|||||||
*fugitive.txt* A Git wrapper so awesome, it should be illegal
|
|
||||||
|
|
||||||
Author: Tim Pope <http://tpo.pe/>
|
|
||||||
License: Same terms as Vim itself (see |license|)
|
|
||||||
|
|
||||||
This plugin is only available if 'compatible' is not set.
|
|
||||||
|
|
||||||
INTRODUCTION *fugitive*
|
|
||||||
|
|
||||||
Whenever you edit a file from a Git repository, a set of commands is defined
|
|
||||||
that serve as a gateway to Git.
|
|
||||||
|
|
||||||
COMMANDS *fugitive-commands*
|
|
||||||
|
|
||||||
These commands are local to the buffers in which they work (generally, buffers
|
|
||||||
that are part of Git repositories).
|
|
||||||
|
|
||||||
*fugitive-:Git*
|
|
||||||
:Git [args] Run an arbitrary git command. Similar to :!git [args]
|
|
||||||
but chdir to the repository tree first.
|
|
||||||
|
|
||||||
*fugitive-:Git!*
|
|
||||||
:Git! [args] Like |:Git|, but capture the output into a temp file,
|
|
||||||
and edit that temp file.
|
|
||||||
|
|
||||||
*fugitive-:Gcd*
|
|
||||||
:Gcd [directory] |:cd| relative to the repository.
|
|
||||||
|
|
||||||
*fugitive-:Glcd*
|
|
||||||
:Glcd [directory] |:lcd| relative to the repository.
|
|
||||||
|
|
||||||
*fugitive-:Gstatus*
|
|
||||||
:Gstatus Bring up the output of git-status in the preview
|
|
||||||
window. The following maps, which work on the cursor
|
|
||||||
line file where sensible, are provided:
|
|
||||||
|
|
||||||
<C-N> next file
|
|
||||||
<C-P> previous file
|
|
||||||
<CR> |:Gedit|
|
|
||||||
- |:Git| add
|
|
||||||
- |:Git| reset (staged files)
|
|
||||||
cA |:Gcommit| --amend --reuse-message=HEAD
|
|
||||||
ca |:Gcommit| --amend
|
|
||||||
cc |:Gcommit|
|
|
||||||
cva |:Gcommit| --amend --verbose
|
|
||||||
cvc |:Gcommit| --verbose
|
|
||||||
D |:Gdiff|
|
|
||||||
ds |:Gsdiff|
|
|
||||||
dp |:Git!| diff (p for patch; use :Gw to apply)
|
|
||||||
dp |:Git| add --intent-to-add (untracked files)
|
|
||||||
dv |:Gvdiff|
|
|
||||||
O |:Gtabedit|
|
|
||||||
o |:Gsplit|
|
|
||||||
p |:Git| add --patch
|
|
||||||
p |:Git| reset --patch (staged files)
|
|
||||||
q close status
|
|
||||||
R reload status
|
|
||||||
S |:Gvsplit|
|
|
||||||
|
|
||||||
*fugitive-:Gcommit*
|
|
||||||
:Gcommit [args] A wrapper around git-commit. If there is nothing
|
|
||||||
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.
|
|
||||||
|
|
||||||
*fugitive-:Ggrep*
|
|
||||||
:Ggrep [args] |:grep| with git-grep as 'grepprg'.
|
|
||||||
|
|
||||||
*fugitive-:Glgrep*
|
|
||||||
:Glgrep [args] |:lgrep| with git-grep as 'grepprg'.
|
|
||||||
|
|
||||||
*fugitive-:Glog*
|
|
||||||
:Glog [args] Load all previous revisions of the current file into
|
|
||||||
the quickfix list. Additional git-log arguments can
|
|
||||||
be given (for example, --reverse). If "--" appears as
|
|
||||||
an argument, no file specific filtering is done, and
|
|
||||||
previous commits rather than previous file revisions
|
|
||||||
are loaded.
|
|
||||||
|
|
||||||
*fugitive-:Gllog*
|
|
||||||
:Gllog [args] Like |:Glog|, but use the location list instead of the
|
|
||||||
quickfix list.
|
|
||||||
|
|
||||||
*fugitive-:Gedit* *fugitive-:Ge*
|
|
||||||
:Gedit [revision] |:edit| a |fugitive-revision|.
|
|
||||||
|
|
||||||
*fugitive-:Gsplit*
|
|
||||||
:Gsplit [revision] |:split| a |fugitive-revision|.
|
|
||||||
|
|
||||||
*fugitive-:Gvsplit*
|
|
||||||
:Gvsplit [revision] |:vsplit| a |fugitive-revision|.
|
|
||||||
|
|
||||||
*fugitive-:Gtabedit*
|
|
||||||
:Gtabedit [revision] |:tabedit| a |fugitive-revision|.
|
|
||||||
|
|
||||||
*fugitive-:Gpedit*
|
|
||||||
:Gpedit [revision] |:pedit| a |fugitive-revision|.
|
|
||||||
|
|
||||||
:Gsplit! [args] *fugitive-:Gsplit!* *fugitive-:Gvsplit!*
|
|
||||||
:Gvsplit! [args] *fugitive-:Gtabedit!* *fugitive-:Gpedit!*
|
|
||||||
:Gtabedit! [args] Like |:Git!|, but open the resulting temp file in a
|
|
||||||
:Gpedit! [args] split, tab, or preview window.
|
|
||||||
|
|
||||||
*fugitive-:Gread*
|
|
||||||
:Gread [revision] Empty the buffer and |:read| a |fugitive-revision|.
|
|
||||||
When the argument is omitted, this is similar to
|
|
||||||
git-checkout on a work tree file or git-add on a stage
|
|
||||||
file, but without writing anything to disk.
|
|
||||||
|
|
||||||
:{range}Gread [revision]
|
|
||||||
|:read| in a |fugitive-revision| after {range}.
|
|
||||||
|
|
||||||
*fugitive-:Gread!*
|
|
||||||
:Gread! [args] Empty the buffer and |:read| the output of a Git
|
|
||||||
command. For example, :Gread! show HEAD:%.
|
|
||||||
|
|
||||||
:{range}Gread! [args] |:read| the output of a Git command after {range}.
|
|
||||||
|
|
||||||
*fugitive-:Gw* *fugitive-:Gwrite*
|
|
||||||
:Gwrite Write to the current file's path and stage the results.
|
|
||||||
When run in a work tree file, it is effectively git
|
|
||||||
add. Elsewhere, it is effectively git-checkout. A
|
|
||||||
great deal of effort is expended to behave sensibly
|
|
||||||
when the work tree or index version of the file is
|
|
||||||
open in another buffer.
|
|
||||||
|
|
||||||
:Gwrite {path} You can give |:Gwrite| an explicit path of where in
|
|
||||||
the work tree to write. You can also give a path like
|
|
||||||
:0:foo.txt or even :0 to write to just that stage in
|
|
||||||
the index.
|
|
||||||
|
|
||||||
*fugitive-:Gwq*
|
|
||||||
:Gwq [path] Like |:Gwrite| followed by |:quit| if the write
|
|
||||||
succeeded.
|
|
||||||
|
|
||||||
:Gwq! [path] Like |:Gwrite|! followed by |:quit|! if the write
|
|
||||||
succeeded.
|
|
||||||
|
|
||||||
*fugitive-:Gdiff*
|
|
||||||
:Gdiff [revision] Perform a |vimdiff| against the current file in the
|
|
||||||
given revision. With no argument, the version in the
|
|
||||||
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".
|
|
||||||
|
|
||||||
*fugitive-:Gsdiff*
|
|
||||||
:Gsdiff [revision] Like |:Gdiff|, but split horizontally.
|
|
||||||
|
|
||||||
*fugitive-:Gvdiff*
|
|
||||||
:Gvdiff [revision] Identical to |:Gdiff|. For symmetry with |:Gsdiff|.
|
|
||||||
|
|
||||||
*fugitive-:Gmove*
|
|
||||||
:Gmove {destination} Wrapper around git-mv that renames the buffer
|
|
||||||
afterward. The destination is relative to the current
|
|
||||||
directory except when started with a /, in which case
|
|
||||||
it is relative to the work tree. Add a ! to pass -f.
|
|
||||||
|
|
||||||
*fugitive-:Gremove*
|
|
||||||
:Gremove Wrapper around git-rm that deletes the buffer
|
|
||||||
afterward. When invoked in an index file, --cached is
|
|
||||||
passed. Add a ! to pass -f and forcefully discard the
|
|
||||||
buffer.
|
|
||||||
|
|
||||||
*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:
|
|
||||||
|
|
||||||
A resize to end of author column
|
|
||||||
C resize to end of commit column
|
|
||||||
D resize to end of date/time column
|
|
||||||
q close blame and return to blamed window
|
|
||||||
gq q, then |:Gedit| to return to work tree version
|
|
||||||
<CR> q, then open commit
|
|
||||||
o open commit in horizontal split
|
|
||||||
O open commit in new tab
|
|
||||||
- reblame at commit
|
|
||||||
~ reblame at [count]th first grandparent
|
|
||||||
P reblame at [count]th parent (like HEAD^[count])
|
|
||||||
|
|
||||||
:[range]Gblame [flags] Run git-blame on the given range.
|
|
||||||
|
|
||||||
*fugitive-:Gbrowse*
|
|
||||||
:[range]Gbrowse If the remote for the current branch is on GitHub,
|
|
||||||
open the current file, blob, tree, commit, or tag
|
|
||||||
(with git-web--browse) on GitHub. Otherwise, open the
|
|
||||||
current file, blob, tree, commit, or tag in
|
|
||||||
git-instaweb (if you have issues, verify you can run
|
|
||||||
"git instaweb" from a terminal). If a range is given,
|
|
||||||
it is appropriately appended to the URL as an anchor.
|
|
||||||
|
|
||||||
To use with GitHub FI, point g:fugitive_github_domains
|
|
||||||
at a list of domains:
|
|
||||||
>
|
|
||||||
let g:fugitive_github_domains = ['https://example.com']
|
|
||||||
~
|
|
||||||
:[range]Gbrowse! Like :Gbrowse, but put the URL on the clipboard rather
|
|
||||||
than opening it.
|
|
||||||
|
|
||||||
:[range]Gbrowse {revision}
|
|
||||||
Like :Gbrowse, but for a given |fugitive-revision|. A
|
|
||||||
useful value here is -, which ties the URL to the
|
|
||||||
latest commit rather than a volatile branch.
|
|
||||||
|
|
||||||
:[range]Gbrowse [...]@{remote}
|
|
||||||
Force using the given remote rather than the remote
|
|
||||||
for the current branch. The remote is used to
|
|
||||||
determine which GitHub repository to link to.
|
|
||||||
|
|
||||||
MAPPINGS *fugitive-mappings*
|
|
||||||
|
|
||||||
These maps are available everywhere.
|
|
||||||
|
|
||||||
*fugitive-c_CTRL-R_CTRL-G*
|
|
||||||
<C-R><C-G> On the command line, recall the path to the current
|
|
||||||
object (that is, a representation of the object
|
|
||||||
recognized by |:Gedit|).
|
|
||||||
|
|
||||||
*fugitive-y_CTRL-G*
|
|
||||||
["x]y<C-G> Yank the commit SHA and path to the current object.
|
|
||||||
|
|
||||||
These maps are available in Git objects.
|
|
||||||
|
|
||||||
*fugitive-<CR>*
|
|
||||||
<CR> Jump to the revision under the cursor.
|
|
||||||
|
|
||||||
*fugitive-o*
|
|
||||||
o Jump to the revision under the cursor in a new split.
|
|
||||||
|
|
||||||
*fugitive-S*
|
|
||||||
S Jump to the revision under the cursor in a new
|
|
||||||
vertical split.
|
|
||||||
|
|
||||||
*fugitive-O*
|
|
||||||
O Jump to the revision under the cursor in a new tab.
|
|
||||||
|
|
||||||
*fugitive--*
|
|
||||||
- Go to the tree containing the current tree or blob.
|
|
||||||
|
|
||||||
*fugitive-~*
|
|
||||||
~ Go to the current file in the [count]th first
|
|
||||||
ancestor.
|
|
||||||
|
|
||||||
*fugitive-P*
|
|
||||||
P Go to the current file in the [count]th parent.
|
|
||||||
|
|
||||||
*fugitive-C*
|
|
||||||
C Go to the commit containing the current file.
|
|
||||||
|
|
||||||
*fugitive-.*
|
|
||||||
. Start a |:| command line with the current revision
|
|
||||||
prepopulated at the end of the line.
|
|
||||||
|
|
||||||
*fugitive-a*
|
|
||||||
a Show the current tag, commit, or tree in an alternate
|
|
||||||
format.
|
|
||||||
|
|
||||||
SPECIFYING REVISIONS *fugitive-revision*
|
|
||||||
|
|
||||||
Fugitive revisions are similar to Git revisions as defined in the "SPECIFYING
|
|
||||||
REVISIONS" section in the git-rev-parse man page. For commands that accept an
|
|
||||||
optional revision, the default is the file in the index for work tree files
|
|
||||||
and the work tree file for everything else. Example revisions follow.
|
|
||||||
|
|
||||||
Revision Meaning ~
|
|
||||||
HEAD .git/HEAD
|
|
||||||
master .git/refs/heads/master
|
|
||||||
HEAD^{} The commit referenced by HEAD
|
|
||||||
HEAD^ The parent of the commit referenced by HEAD
|
|
||||||
HEAD: The tree referenced by HEAD
|
|
||||||
/HEAD The file named HEAD in the work tree
|
|
||||||
Makefile The file named Makefile in the work tree
|
|
||||||
HEAD^:Makefile The file named Makefile in the parent of HEAD
|
|
||||||
:Makefile The file named Makefile in the index (writable)
|
|
||||||
- The current file in HEAD
|
|
||||||
^ The current file in the previous commit
|
|
||||||
~3 The current file 3 commits ago
|
|
||||||
: .git/index (Same as |:Gstatus|)
|
|
||||||
:0 The current file in the index
|
|
||||||
:1 The current file's common ancestor during a conflict
|
|
||||||
:2 The current file in the target branch during a conflict
|
|
||||||
:3 The current file in the merged branch during a conflict
|
|
||||||
:/foo The most recent commit with "foo" in the message
|
|
||||||
|
|
||||||
STATUSLINE *fugitive-statusline*
|
|
||||||
|
|
||||||
*fugitive#statusline()*
|
|
||||||
Add %{fugitive#statusline()} to your statusline to get an indicator including
|
|
||||||
the current branch and the currently edited file's commit. If you don't have
|
|
||||||
a statusline, this one matches the default when 'ruler' is set:
|
|
||||||
>
|
|
||||||
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
|
|
||||||
<
|
|
||||||
*fugitive#head(...)*
|
|
||||||
Use fugitive#head() to return the name of the current branch. If the current
|
|
||||||
HEAD is detached, fugitive#head() will return the empty string, unless the
|
|
||||||
optional argument is given, in which case the hash of the current commit will
|
|
||||||
be truncated to the given number of characters.
|
|
||||||
|
|
||||||
ABOUT *fugitive-about*
|
|
||||||
|
|
||||||
Grab the latest version or report a bug on GitHub:
|
|
||||||
|
|
||||||
http://github.com/tpope/vim-fugitive
|
|
||||||
|
|
||||||
vim:tw=78:et:ft=help:norl:
|
|
File diff suppressed because it is too large
Load Diff
@ -1,36 +0,0 @@
|
|||||||
### 0.0.2 (03-27-2012)
|
|
||||||
All changes for this release were made in the backend. Do `[sudo] npm -g update instant-markdown-d` to get them.
|
|
||||||
|
|
||||||
- Updated to the latest github styles!
|
|
||||||
- Performance should be slightly better as CSS is no longer generated at every update.
|
|
||||||
|
|
||||||
### 0.0.3 (04-26-2012)
|
|
||||||
Some changes for this release were made in the backend. Do `[sudo] npm -g update instant-markdown-d` to get them.
|
|
||||||
|
|
||||||
- Delay starting the `instant-markdown-d` server. This fixed the plugin for a few people who were getting empty browser windows.
|
|
||||||
- Display a message with configuration instructions when the preview window can't be closed due to Firefox restrictions.
|
|
||||||
|
|
||||||
### 0.0.4 (12-05-2012)
|
|
||||||
All these changes courtesy of @chreekat, THANKS!
|
|
||||||
|
|
||||||
- Is now an `after/ftplugin` plugin. Markdown filetype detection is left to Vim itself, or other plugins.
|
|
||||||
- Behavior when multiple markdown files are open has been improved
|
|
||||||
- No more weird characters taking over the status/command bar while editing
|
|
||||||
- Internals have been completely rewritten and are much more cleaner and adhere to vim script best practices
|
|
||||||
|
|
||||||
### 0.0.5 (12-05-2012)
|
|
||||||
These changes are _also_ courtesy of @chreekat!
|
|
||||||
|
|
||||||
- Plugin no longer breaks vim mouse scrolling
|
|
||||||
- No longer errors upon opening an empty markdown file
|
|
||||||
- `instant_markdown_slow` option to update preview less frequently
|
|
||||||
|
|
||||||
### 0.0.6 (03-02-2013)
|
|
||||||
All changes for this release were made in the backend. Do `[sudo] npm -g update instant-markdown-d` to get them.
|
|
||||||
|
|
||||||
- Fix for systems (such as Ubuntu, Debian) which use the `nodejs` executable instead of `node`.
|
|
||||||
|
|
||||||
### 0.0.7 (10-31-2013)
|
|
||||||
thanks to @terryma!
|
|
||||||
|
|
||||||
- Added option to only start previewing markdown on demand
|
|
@ -1,75 +0,0 @@
|
|||||||
vim-instant-markdown
|
|
||||||
====================
|
|
||||||
Want to instantly preview finnicky markdown files, but don't want to leave your favorite editor, or have to do it in some crappy browser textarea? **vim-instant-markdown** is your friend! When you open a markdown file in vim, a browser window will open which shows the compiled markdown in real-time, and closes once you close the file in vim.
|
|
||||||
|
|
||||||
As a bonus, [github-flavored-markdown][gfm] is supported, and styles used while previewing are the same as those github uses!
|
|
||||||
|
|
||||||
[![Screenshot][ss]][ssbig]
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
You first need to have Ruby with RubyGems, and node.js with npm installed. (In the future there might be a version which won't require node.js at all, making installation easier)
|
|
||||||
|
|
||||||
- `[sudo] gem install pygments.rb`
|
|
||||||
- If you're using Ruby 1.9.2 or later, `[sudo] gem install redcarpet`. Otherwise, `[sudo] gem install redcarpet -v 2.3.0`
|
|
||||||
- `[sudo] npm -g install instant-markdown-d`
|
|
||||||
- If you're on Linux, the `xdg-utils` package needs to be installed (is installed by default on Ubuntu).
|
|
||||||
- Copy the `after/ftplugin/markdown/instant-markdown.vim` file from this repo into your `~/.vim/after/ftplugin/markdown/` (creating directories as necessary), or use pathogen.
|
|
||||||
- Ensure you have the line `filetype plugin on` in your `.vimrc`
|
|
||||||
- Open a markdown file in vim and enjoy!
|
|
||||||
|
|
||||||
Configuration
|
|
||||||
-------------
|
|
||||||
### g:instant_markdown_slow
|
|
||||||
|
|
||||||
By default, vim-instant-markdown will update the display in realtime. If that taxes your system too much, you can specify
|
|
||||||
|
|
||||||
```
|
|
||||||
let g:instant_markdown_slow = 1
|
|
||||||
```
|
|
||||||
|
|
||||||
before loading the plugin (for example place that in your `~/.vimrc`). This will cause vim-instant-markdown to only refresh on the following events:
|
|
||||||
|
|
||||||
- No keys have been pressed for a while
|
|
||||||
- A while after you leave insert mode
|
|
||||||
- You save the file being edited
|
|
||||||
|
|
||||||
### g:instant_markdown_autostart
|
|
||||||
By default, vim-instant-markdown will automatically launch the preview window when you open a markdown file. If you want to manually control this behavior, you can specify
|
|
||||||
|
|
||||||
```
|
|
||||||
let g:instant_markdown_autostart = 0
|
|
||||||
```
|
|
||||||
|
|
||||||
in your .vimrc. You can then manually trigger preview via the command ```:InstantMarkdownPreview```. This command is only available inside markdown buffers and when the autostart option is turned off.
|
|
||||||
|
|
||||||
Supported Platforms
|
|
||||||
-------------------
|
|
||||||
OSX and Unix/Linuxes*.
|
|
||||||
|
|
||||||
<sub>*: One annoyance in Linux is that there's no way to reliably open a browser page in the background, so you'll likely have to manually refocus your vim session everytime you open a Markdown file. If you have ideas on how to address this I'd love to know!</sub>
|
|
||||||
|
|
||||||
FAQ
|
|
||||||
---
|
|
||||||
> Why don't my `<bla>.md` files trigger this plugin?
|
|
||||||
|
|
||||||
By default, vim (7.3 and above) only recognizes files ending with `.markdown`, `.mdown`, and `README.md` as markdown files. If you want `<anything>.md` to be recognized, I recommend installing one of many markdown plugins available, such as [this one][tpope-markdown].
|
|
||||||
|
|
||||||
> It's not working!
|
|
||||||
|
|
||||||
- Make sure all the dependencies are installed...
|
|
||||||
- Make sure `instant-markdown-d` was installed as a global module (e.g. using `npm -g install`)
|
|
||||||
- Make sure the ruby gems were installed under your default Ruby (i.e. if you're using RVM, use `gem install` and NOT `sudo gem install` as that might cause the gems to be installed under a non-RVM Ruby)
|
|
||||||
- If you're on OSX, and are using zsh and rbenv/rvm...
|
|
||||||
- Make sure that Vim is using the correct version of ruby. From vim, if ```:!which ruby``` returns an unexpected ruby, then see here for a solution: https://github.com/dotphiles/dotzsh#mac-os-x.
|
|
||||||
- Another thing to try would be to add `set shell=bash\ -i` in your `.vimrc` to set interactive bash as the default vim shell. (See [this issue](http://github.com/suan/vim-instant-markdown/issues/41))
|
|
||||||
|
|
||||||
etc.
|
|
||||||
---
|
|
||||||
If you're curious, the code for the mini-server component for this plugin can be found at http://github.com/suan/instant-markdown-d. A plugin can easily be written for any editor to interface with the server to get the same functionality found here.
|
|
||||||
|
|
||||||
|
|
||||||
[ss]: http://dl.dropbox.com/u/28956267/instant-markdown-demo_thumb.gif "Click for bigger preview"
|
|
||||||
[ssbig]: http://dl.dropbox.com/u/28956267/instant-markdown-demo.gif
|
|
||||||
[gfm]: http://github.github.com/github-flavored-markdown/
|
|
||||||
[tpope-markdown]: https://github.com/tpope/vim-markdown
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue