.vim/ updated

This commit is contained in:
Kolan Sh 2013-02-04 18:00:48 +04:00
parent 5715dce618
commit e561be78fc
40 changed files with 24638 additions and 0 deletions

200
.vim/after/syntax/vala.vim Normal file
View File

@ -0,0 +1,200 @@
" Vim syntax file
" Language: Vala
" Maintainers: Emmanuele Bassi <ebassi@gnome.org>
" Hans Vercammen <hveso3@gmail.com>
" pancake <pancake@nopcode.org>
" Sebastian Reichel <sre@ring0.de>
" Last Change: 2012-02-19
" Filenames: *.vala *.vapi
"
" REFERENCES:
" [1] http://live.gnome.org/Vala
"
" TODO: Possibly when reaching vala 1.0 release
" - validate code attributes
" - better error checking for known errors
" - full support for valadoc
"
" add vala in /usr/share/vim/vim73/scripts.vim below ruby
" to have shebang support
if exists("b:current_syntax")
finish
endif
let s:vala_cpo_save = &cpo
set cpo&vim
" Types
syn keyword valaType bool char double float size_t ssize_t string unichar void
syn keyword valaType int int8 int16 int32 int64 long short
syn keyword valaType uint uint8 uint16 uint32 uint64 ulong ushort
" Storage keywords
syn keyword valaStorage class delegate enum errordomain interface namespace struct
" repeat / condition / label
syn keyword valaRepeat break continue do for foreach return while
syn keyword valaConditional else if switch assert
" User Labels
syn keyword valaLabel case default
" Modifiers
syn keyword valaModifier abstract const dynamic ensures extern inline internal override
syn keyword valaModifier private protected public requires signal static virtual volatile weak
syn keyword valaModifier async owned unowned
" Constants
syn keyword valaConstant false null true
" Exceptions
syn keyword valaException try catch finally throw
" Unspecified Statements
syn keyword valaUnspecifiedStatement as base construct delete get in is lock new out params ref sizeof set this throws typeof using value var yield
" Comments
syn cluster valaCommentGroup contains=valaTodo
syn keyword valaTodo contained TODO FIXME XXX NOTE
" valadoc Comments (ported from javadoc comments in java.vim)
" TODO: need to verify valadoc syntax
if !exists("vala_ignore_valadoc")
syn cluster valaDocCommentGroup contains=valaDocTags,valaDocSeeTag
syn region valaDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}"
syn match valaDocTags contained "@\(param\|exception\|throws\|since\)\s\+\S\+" contains=valaDocParam
syn match valaDocParam contained "\s\S\+"
syn match valaDocTags contained "@\(author\|brief\|version\|return\|deprecated\)\>"
syn region valaDocSeeTag contained matchgroup=valaDocTags start="@see\s\+" matchgroup=NONE end="\_."re=e-1 contains=valaDocSeeTagParam
syn match valaDocSeeTagParam contained @"\_[^"]\+"\|<a\s\+\_.\{-}</a>\|\(\k\|\.\)*\(#\k\+\((\_[^)]\+)\)\=\)\=@ extend
endif
" Comment Strings (ported from c.vim)
if exists("vala_comment_strings")
syn match valaCommentSkip contained "^\s*\*\($\|\s\+\)"
syn region valaCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=valaSpecialChar,valaCommentSkip
syn region valaComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=valaSpecialChar
syn cluster valaCommentStringGroup contains=valaCommentString,valaCharacter,valaNumber
syn region valaCommentL start="//" end="$" keepend contains=@valaCommentGroup,valaComment2String,valaCharacter,valaNumber,valaSpaceError,@Spell
syn region valaComment matchgroup=valaCommentStart start="/\*" end="\*/" contains=@valaCommentGroup,@valaCommentStringGroup,valaCommentStartError,valaSpaceError,@Spell extend fold
if !exists("vala_ignore_valadoc")
syn region valaDocComment matchgroup=valaCommentStart start="/\*\*" end="\*/" keepend contains=@valaCommentGroup,@valaDocCommentGroup,@valaCommentStringGroup,valaCommentStartError,valaSpaceError,@Spell
endif
else
syn region valaCommentL start="//" end="$" keepend contains=@valaCommentGroup,valaSpaceError,@Spell
syn region valaComment matchgroup=valaCommentStart start="/\*" end="\*/" contains=@valaCommentGroup,valaCommentStartError,valaSpaceError,@Spell
if !exists("vala_ignore_valadoc")
syn region valaDocComment matchgroup=valaCommentStart start="/\*\*" end="\*/" keepend contains=@valaCommentGroup,@valaDocCommentGroup,valaCommentStartError,valaSpaceError,@Spell
endif
endif
syn region valaPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1
syn match valaPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
" Comment if 0 blocks (ported from c.vim)
if !exists("vala_no_if0")
syn region valaCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=valaCppOut2 fold
syn region valaCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=valaSpaceError,valaCppSkip
syn region valaCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=valaSpaceError,valaCppSkip
endif
" match comment errors
syntax match valaCommentError display "\*/"
syntax match valaCommentStartError display "/\*"me=e-1 contained
" match the special comment /**/
syn match valaComment "/\*\*/"
" Vala Code Attributes
syn region valaAttribute start="^\s*\[" end="\]$" contains=valaComment,valaString keepend
syn region valaAttribute start="\[CCode" end="\]" contains=valaComment,valaString
" Avoid escaped keyword matching
syn match valaUserContent display "@\I*"
" Strings and constants
syn match valaSpecialError contained "\\."
syn match valaSpecialCharError contained "[^']"
syn match valaSpecialChar contained +\\["\\'0abfnrtvx]+
syn region valaString start=+"+ end=+"+ end=+$+ contains=valaSpecialChar,valaSpecialError,valaUnicodeNumber,@Spell
syn region valaVerbatimString start=+"""+ end=+"""+ contains=@Spell
syn match valaUnicodeNumber +\\\(u\x\{4}\|U\x\{8}\)+ contained contains=valaUnicodeSpecifier
syn match valaUnicodeSpecifier +\\[uU]+ contained
syn match valaCharacter "'[^']*'" contains=valaSpecialChar,valaSpecialCharError
syn match valaCharacter "'\\''" contains=valaSpecialChar
syn match valaCharacter "'[^\\]'"
syn match valaNumber display "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
syn match valaNumber display "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
syn match valaNumber display "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
syn match valaNumber display "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
" when wanted, highlight trailing white space
if exists("vala_space_errors")
if !exists("vala_no_trail_space_error")
syn match valaSpaceError display excludenl "\s\+$"
endif
if !exists("vala_no_tab_space_error")
syn match valaSpaceError display " \+\t"me=e-1
endif
endif
" when wanted, set minimum lines for comment syntax syncing
if exists("vala_minlines")
let b:vala_minlines = vala_minlines
else
let b:vala_minlines = 50
endif
exec "syn sync ccomment valaComment minlines=" . b:vala_minlines
" code folding
syn region valaBlock start="{" end="}" transparent fold
" The default highlighting.
hi def link valaType Type
hi def link valaStorage StorageClass
hi def link valaRepeat Repeat
hi def link valaConditional Conditional
hi def link valaLabel Label
hi def link valaModifier StorageClass
hi def link valaConstant Constant
hi def link valaException Exception
hi def link valaUnspecifiedStatement Statement
hi def link valaUnspecifiedKeyword Keyword
hi def link valaContextualStatement Statement
hi def link valaCommentError Error
hi def link valaCommentStartError Error
hi def link valaSpecialError Error
hi def link valaSpecialCharError Error
hi def link valaSpaceError Error
hi def link valaTodo Todo
hi def link valaCommentL valaComment
hi def link valaCommentStart valaComment
hi def link valaCommentSkip valaComment
hi def link valaComment Comment
hi def link valaDocComment Comment
hi def link valaDocTags Special
hi def link valaDocParam Function
hi def link valaDocSeeTagParam Function
hi def link valaAttribute PreCondit
hi def link valaCommentString valaString
hi def link valaComment2String valaString
hi def link valaString String
hi def link valaVerbatimString String
hi def link valaCharacter Character
hi def link valaSpecialChar SpecialChar
hi def link valaNumber Number
hi def link valaUnicodeNumber SpecialChar
hi def link valaUnicodeSpecifier SpecialChar
hi def link valaPreCondit PreCondit
if !exists("vala_no_if0")
hi def link valaCppSkip valaCppOut
hi def link valaCppOut2 valaCppOut
hi def link valaCppOut Comment
endif
let b:current_syntax = "vala"
let &cpo = s:vala_cpo_save
unlet s:vala_cpo_save
" vim: ts=8

1046
.vim/autoload/fuf.vim Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
"=============================================================================
" Copyright (c) 2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#bookmarkdir#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#bookmarkdir#getSwitchOrder()
return g:fuf_bookmarkdir_switchOrder
endfunction
"
function fuf#bookmarkdir#getEditableDataNames()
return ['items']
endfunction
"
function fuf#bookmarkdir#renewCache()
endfunction
"
function fuf#bookmarkdir#requiresOnCommandPre()
return 0
endfunction
"
function fuf#bookmarkdir#onInit()
call fuf#defineLaunchCommand('FufBookmarkDir', s:MODE_NAME, '""', [])
command! -bang -narg=? FufBookmarkDirAdd call s:bookmark(<q-args>)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_DELETE = -1
"
function s:bookmark(word)
let item = {
\ 'time' : localtime(),
\ }
let item.path = l9#inputHl('Question', '[fuf] Directory to bookmark:',
\ fnamemodify(getcwd(), ':p:~'), 'dir')
if item.path !~ '\S'
call fuf#echoWarning('Canceled')
return
endif
let item.word = l9#inputHl('Question', '[fuf] Bookmark as:',
\ fnamemodify(getcwd(), ':p:~'))
if item.word !~ '\S'
call fuf#echoWarning('Canceled')
return
endif
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
call insert(items, item)
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
endfunction
"
function s:findItem(items, word)
for item in a:items
if item.word ==# a:word
return item
endif
endfor
return {}
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_bookmarkdir_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
if a:mode ==# s:OPEN_TYPE_DELETE
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
call filter(items, 'v:val.word !=# a:word')
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
let self.reservedMode = self.getModeName()
return
else
let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word)
if !empty(item)
execute ':cd ' . fnameescape(item.path)
endif
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
call fuf#defineKeyMappingInHandler(g:fuf_bookmarkdir_keyDelete,
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')')
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))')
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,199 @@
"=============================================================================
" Copyright (c) 2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#bookmarkfile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#bookmarkfile#getSwitchOrder()
return g:fuf_bookmarkfile_switchOrder
endfunction
"
function fuf#bookmarkfile#getEditableDataNames()
return ['items']
endfunction
"
function fuf#bookmarkfile#renewCache()
endfunction
"
function fuf#bookmarkfile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#bookmarkfile#onInit()
call fuf#defineLaunchCommand('FufBookmarkFile', s:MODE_NAME, '""', [])
command! -bang -narg=? FufBookmarkFileAdd call s:bookmarkHere(<q-args>)
command! -bang -narg=0 -range FufBookmarkFileAddAsSelectedText call s:bookmarkHere(l9#getSelectedText())
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_DELETE = -1
" opens a:path and jumps to the line matching to a:pattern from a:lnum within
" a:range. if not found, jumps to a:lnum.
function s:jumpToBookmark(path, mode, pattern, lnum)
call fuf#openFile(a:path, a:mode, g:fuf_reuseWindow)
call cursor(s:getMatchingLineNumber(getline(1, '$'), a:pattern, a:lnum), 0)
normal! zvzz
endfunction
"
function s:getMatchingLineNumber(lines, pattern, lnumBegin)
let l = min([a:lnumBegin, len(a:lines)])
for [l0, l1] in map(range(0, g:fuf_bookmarkfile_searchRange),
\ '[l + v:val, l - v:val]')
if l0 <= len(a:lines) && a:lines[l0 - 1] =~# a:pattern
return l0
elseif l1 >= 0 && a:lines[l1 - 1] =~# a:pattern
return l1
endif
endfor
return l
endfunction
"
function s:getLinePattern(lnum)
return '\C\V\^' . escape(getline(a:lnum), '\') . '\$'
endfunction
"
function s:bookmarkHere(word)
if !empty(&buftype) || expand('%') !~ '\S'
call fuf#echoWarning('Can''t bookmark this buffer.')
return
endif
let item = {
\ 'word' : (a:word =~# '\S' ? substitute(a:word, '\n', ' ', 'g')
\ : pathshorten(expand('%:p:~')) . '|' . line('.') . '| ' . getline('.')),
\ 'path' : expand('%:p'),
\ 'lnum' : line('.'),
\ 'pattern' : s:getLinePattern(line('.')),
\ 'time' : localtime(),
\ }
let item.word = l9#inputHl('Question', '[fuf] Bookmark as:', item.word)
if item.word !~ '\S'
call fuf#echoWarning('Canceled')
return
endif
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
call insert(items, item)
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
endfunction
"
function s:findItem(items, word)
for item in a:items
if item.word ==# a:word
return item
endif
endfor
return {}
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_bookmarkfile_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word)
let lines = fuf#getFileLines(item.path)
if empty(lines)
return []
endif
let index = s:getMatchingLineNumber(lines, item.pattern, item.lnum) - 1
return fuf#makePreviewLinesAround(
\ lines, [index], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
if a:mode ==# s:OPEN_TYPE_DELETE
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
call filter(items, 'v:val.word !=# a:word')
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
let self.reservedMode = self.getModeName()
return
else
let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word)
if !empty(item)
call s:jumpToBookmark(item.path, a:mode, item.pattern, item.lnum)
endif
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
call fuf#defineKeyMappingInHandler(g:fuf_bookmarkfile_keyDelete,
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')')
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))')
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,189 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#buffer#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#buffer#getSwitchOrder()
return g:fuf_buffer_switchOrder
endfunction
"
function fuf#buffer#getEditableDataNames()
return []
endfunction
"
function fuf#buffer#renewCache()
endfunction
"
function fuf#buffer#requiresOnCommandPre()
return 0
endfunction
"
function fuf#buffer#onInit()
call fuf#defineLaunchCommand('FufBuffer', s:MODE_NAME, '""', [])
augroup fuf#buffer
autocmd!
autocmd BufEnter * call s:updateBufTimes()
autocmd BufWritePost * call s:updateBufTimes()
augroup END
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_DELETE = -1
let s:bufTimes = {}
"
function s:updateBufTimes()
let s:bufTimes[bufnr('%')] = localtime()
endfunction
"
function s:makeItem(nr)
let fname = (empty(bufname(a:nr))
\ ? '[No Name]'
\ : fnamemodify(bufname(a:nr), ':p:~:.'))
let time = (exists('s:bufTimes[a:nr]') ? s:bufTimes[a:nr] : 0)
let item = fuf#makePathItem(fname, strftime(g:fuf_timeFormat, time), 0)
let item.index = a:nr
let item.bufNr = a:nr
let item.time = time
let item.abbrPrefix = s:getBufIndicator(a:nr) . ' '
return item
endfunction
"
function s:getBufIndicator(bufNr)
if !getbufvar(a:bufNr, '&modifiable')
return '[-]'
elseif getbufvar(a:bufNr, '&modified')
return '[+]'
elseif getbufvar(a:bufNr, '&readonly')
return '[R]'
else
return ' '
endif
endfunction
"
function s:compareTimeDescending(i1, i2)
return a:i1.time == a:i2.time ? 0 : a:i1.time > a:i2.time ? -1 : +1
endfunction
"
function s:findItem(items, word)
for item in a:items
if item.word ==# a:word
return item
endif
endfor
return {}
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_buffer_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let item = s:findItem(self.items, a:word)
if empty(item)
return []
endif
return fuf#makePreviewLinesForFile(item.bufNr, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
" not use bufnr(a:word) in order to handle unnamed buffer
let item = s:findItem(self.items, a:word)
if empty(item)
" do nothing
elseif a:mode ==# s:OPEN_TYPE_DELETE
execute item.bufNr . 'bdelete'
let self.reservedMode = self.getModeName()
else
call fuf#openBuffer(item.bufNr, a:mode, g:fuf_reuseWindow)
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
call fuf#defineKeyMappingInHandler(g:fuf_buffer_keyDelete,
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')')
let self.items = range(1, bufnr('$'))
call filter(self.items, 'buflisted(v:val) && v:val != self.bufNrPrev && v:val != bufnr("%")')
call map(self.items, 's:makeItem(v:val)')
if g:fuf_buffer_mruOrder
call sort(self.items, 's:compareTimeDescending')
call fuf#mapToSetSerialIndex(self.items, 1)
endif
let self.items = fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,300 @@
"=============================================================================
" Copyright (c) 2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#buffertag#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#buffertag#getSwitchOrder()
return g:fuf_buffertag_switchOrder
endfunction
"
function fuf#buffertag#getEditableDataNames()
return []
endfunction
"
function fuf#buffertag#renewCache()
let s:tagItemsCache = {}
let s:tagDataCache = {}
endfunction
"
function fuf#buffertag#requiresOnCommandPre()
return 0
endfunction
"
function fuf#buffertag#onInit()
call fuf#defineLaunchCommand('FufBufferTag', s:MODE_NAME, '""',
\ [['g:fuf_buffertag_forAll', 0]])
call fuf#defineLaunchCommand('FufBufferTagAll', s:MODE_NAME, '""',
\ [['g:fuf_buffertag_forAll', 1]])
call fuf#defineLaunchCommand('FufBufferTagWithCursorWord', s:MODE_NAME,
\ 'expand(''<cword>'')', [['g:fuf_buffertag_forAll', 0]])
call fuf#defineLaunchCommand('FufBufferTagAllWithCursorWord', s:MODE_NAME,
\ 'expand(''<cword>'')', [['g:fuf_buffertag_forAll', 1]])
call fuf#defineLaunchCommand('FufBufferTagWithSelectedText', s:MODE_NAME,
\ 'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 0]])
call fuf#defineLaunchCommand('FufBufferTagAllWithSelectedText', s:MODE_NAME,
\ 'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 1]])
call l9#defineVariableDefault('g:fuf_buffertag_forAll', 0) " private option
" the following settings originate from taglist.vim
call l9#defineVariableDefault('g:fuf_buffertag__asm' , '--language-force=asm --asm-types=dlmt')
call l9#defineVariableDefault('g:fuf_buffertag__aspperl' , '--language-force=asp --asp-types=fsv')
call l9#defineVariableDefault('g:fuf_buffertag__aspvbs' , '--language-force=asp --asp-types=fsv')
call l9#defineVariableDefault('g:fuf_buffertag__awk' , '--language-force=awk --awk-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__beta' , '--language-force=beta --beta-types=fsv')
call l9#defineVariableDefault('g:fuf_buffertag__c' , '--language-force=c --c-types=dgsutvf')
call l9#defineVariableDefault('g:fuf_buffertag__cpp' , '--language-force=c++ --c++-types=nvdtcgsuf')
call l9#defineVariableDefault('g:fuf_buffertag__cs' , '--language-force=c# --c#-types=dtncEgsipm')
call l9#defineVariableDefault('g:fuf_buffertag__cobol' , '--language-force=cobol --cobol-types=dfgpPs')
call l9#defineVariableDefault('g:fuf_buffertag__eiffel' , '--language-force=eiffel --eiffel-types=cf')
call l9#defineVariableDefault('g:fuf_buffertag__erlang' , '--language-force=erlang --erlang-types=drmf')
call l9#defineVariableDefault('g:fuf_buffertag__expect' , '--language-force=tcl --tcl-types=cfp')
call l9#defineVariableDefault('g:fuf_buffertag__fortran' , '--language-force=fortran --fortran-types=pbceiklmntvfs')
call l9#defineVariableDefault('g:fuf_buffertag__html' , '--language-force=html --html-types=af')
call l9#defineVariableDefault('g:fuf_buffertag__java' , '--language-force=java --java-types=pcifm')
call l9#defineVariableDefault('g:fuf_buffertag__javascript', '--language-force=javascript --javascript-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__lisp' , '--language-force=lisp --lisp-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__lua' , '--language-force=lua --lua-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__make' , '--language-force=make --make-types=m')
call l9#defineVariableDefault('g:fuf_buffertag__pascal' , '--language-force=pascal --pascal-types=fp')
call l9#defineVariableDefault('g:fuf_buffertag__perl' , '--language-force=perl --perl-types=clps')
call l9#defineVariableDefault('g:fuf_buffertag__php' , '--language-force=php --php-types=cdvf')
call l9#defineVariableDefault('g:fuf_buffertag__python' , '--language-force=python --python-types=cmf')
call l9#defineVariableDefault('g:fuf_buffertag__rexx' , '--language-force=rexx --rexx-types=s')
call l9#defineVariableDefault('g:fuf_buffertag__ruby' , '--language-force=ruby --ruby-types=cfFm')
call l9#defineVariableDefault('g:fuf_buffertag__scheme' , '--language-force=scheme --scheme-types=sf')
call l9#defineVariableDefault('g:fuf_buffertag__sh' , '--language-force=sh --sh-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__csh' , '--language-force=sh --sh-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__zsh' , '--language-force=sh --sh-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__slang' , '--language-force=slang --slang-types=nf')
call l9#defineVariableDefault('g:fuf_buffertag__sml' , '--language-force=sml --sml-types=ecsrtvf')
call l9#defineVariableDefault('g:fuf_buffertag__sql' , '--language-force=sql --sql-types=cFPrstTvfp')
call l9#defineVariableDefault('g:fuf_buffertag__tcl' , '--language-force=tcl --tcl-types=cfmp')
call l9#defineVariableDefault('g:fuf_buffertag__vera' , '--language-force=vera --vera-types=cdefgmpPtTvx')
call l9#defineVariableDefault('g:fuf_buffertag__verilog' , '--language-force=verilog --verilog-types=mcPertwpvf')
call l9#defineVariableDefault('g:fuf_buffertag__vim' , '--language-force=vim --vim-types=avf')
call l9#defineVariableDefault('g:fuf_buffertag__yacc' , '--language-force=yacc --yacc-types=l')
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:parseTagLine(line)
" tag W:\Win32\SRC7\NCSIM\NCVW32\CUBEFACE.H /^#define CUBEFACE_H$/;" macro line:4
let fields = matchlist(a:line, '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline\:(\d+)')
if empty(fields)
return {}
endif
return {
\ 'tag' : fields[1],
\ 'fname' : fields[2],
\ 'pattern': fields[3],
\ 'kind' : fields[4],
\ 'lnum' : str2nr(fields[5]),
\ }
endfunction
"
let s:TEMP_VARIABLES_GROUP = expand('<sfile>:p')
"
function s:getFileType(bufNr)
let ft = getbufvar(a:bufNr, '&filetype')
if !empty(ft) || bufloaded(a:bufNr)
return ft
endif
let ft = getbufvar(a:bufNr, 'fuf_buffertag_filetype')
if !empty(ft)
return ft
endif
call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&eventignore', 'FileType')
call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&filetype', &filetype)
" from taglist.vim
execute 'doautocmd filetypedetect BufRead ' . bufname(a:bufNr)
let ft = &filetype
call l9#tempvariables#end(s:TEMP_VARIABLES_GROUP)
call setbufvar(a:bufNr, 'fuf_buffertag_filetype', ft)
return ft
endfunction
"
function s:makeCtagsCmd(bufNr)
let ft = s:getFileType(a:bufNr)
if !exists('g:fuf_buffertag__{ft}')
return ''
endif
"
let cmd = join([g:fuf_buffertag_ctagsPath,
\ '-f - --sort=no --excmd=pattern --fields=nKs',
\ g:fuf_buffertag__{ft},
\ shellescape(fnamemodify(bufname(a:bufNr), ':p'))])
return cmd
endfunction
"
function s:getTagItems(bufNr)
let cmd = s:makeCtagsCmd(a:bufNr)
if empty(cmd)
return []
elseif !exists('s:tagItemsCache[cmd]') ||
\ s:tagItemsCache[cmd].time < getftime(expand(bufname(a:bufNr)))
let items = split(system(cmd), "\n")
if v:shell_error
call fuf#echoError([cmd] + items)
throw "Command error"
endif
call map(items, 's:parseTagLine(v:val)')
call filter(items, '!empty(v:val)')
let s:tagItemsCache[cmd] = {
\ 'time' : localtime(),
\ 'items' : items,
\ }
endif
return s:tagItemsCache[cmd].items
endfunction
"
function s:makeItem(tag, itemMap)
let menu = fnamemodify(a:itemMap[a:tag][0].fname, ':t')
\ . ' [' . a:itemMap[a:tag][0].kind . ']'
if len(a:itemMap[a:tag]) > 1
let menu .= ' (' . len(a:itemMap[a:tag]) . ')'
endif
let item = fuf#makeNonPathItem(a:tag, menu)
return item
endfunction
"
function s:getTagData(bufNrs)
let key = join([0] + sort(copy(a:bufNrs)), "\n")
let bufNames = map(copy(a:bufNrs), 'bufname(v:val)')
if !exists('s:tagDataCache[key]') ||
\ fuf#countModifiedFiles(bufNames, s:tagDataCache[key].time) > 0
let itemMap = {}
for item in l9#concat(map(copy(a:bufNrs), 's:getTagItems(v:val)'))
if !exists('itemMap[item.tag]')
let itemMap[item.tag] = []
endif
call add(itemMap[item.tag], item)
endfor
let items = sort(keys(itemMap))
call map(items, 's:makeItem(v:val, itemMap)')
call fuf#mapToSetSerialIndex(items, 1)
call map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
let s:tagDataCache[key] = {
\ 'time' : localtime(),
\ 'itemMap': itemMap,
\ 'items' : items,
\ }
endif
return [s:tagDataCache[key].items, s:tagDataCache[key].itemMap]
endfunction
"
function s:jumpToTag(item, mode)
call fuf#openFile(a:item.fname, a:mode, g:fuf_reuseWindow)
call cursor(a:item.lnum, 1)
normal! zvzz
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_buffertag_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
if !exists('self.itemMap[a:word][0]')
call fuf#echoError('Definition not found:' . a:word)
return
elseif len(self.itemMap[a:word]) == 1
let i = 0
else
let list = map(fuf#mapToSetSerialIndex(copy(self.itemMap[a:word]), 1),
\ 'printf(" %2d: %s|%d| [%s] %s",v:val.index, fnamemodify(v:val.fname, ":~:."), v:val.lnum, v:val.kind, v:val.pattern)')
let i = inputlist(['Select a definition of "' . a:word . '":'] + list) - 1
endif
if 0 <= i && i < len(self.itemMap[a:word])
call s:jumpToTag(self.itemMap[a:word][i], a:mode)
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
if g:fuf_buffertag_forAll
let bufNrs = filter(range(1, bufnr('$')), 'buflisted(v:val)')
else
let bufNrs = [self.bufNrPrev]
endif
let [self.items, self.itemMap] = s:getTagData(bufNrs)
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,137 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#callbackfile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#callbackfile#getSwitchOrder()
return -1
endfunction
"
function fuf#callbackfile#getEditableDataNames()
return []
endfunction
"
function fuf#callbackfile#renewCache()
let s:cache = {}
endfunction
"
function fuf#callbackfile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#callbackfile#onInit()
endfunction
"
function fuf#callbackfile#launch(initialPattern, partialMatching, prompt, exclude, listener)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:exclude = a:exclude
let s:listener = a:listener
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:enumItems(dir)
let key = getcwd() . g:fuf_ignoreCase . s:exclude . "\n" . a:dir
if !exists('s:cache[key]')
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, s:exclude)
if isdirectory(a:dir)
call insert(s:cache[key], fuf#makePathItem(a:dir . '.', '', 0))
endif
call fuf#mapToSetSerialIndex(s:cache[key], 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key])
endif
return s:cache[key]
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return a:enteredPattern =~# '[^/\\]$'
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
let items = copy(s:enumItems(fuf#splitPath(a:patternPrimary).head))
return filter(items, 'bufnr("^" . v:val.word . "$") != self.bufNrPrev')
endfunction
"
function s:handler.onOpen(word, mode)
call s:listener.onComplete(a:word, a:mode)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
if !a:opened && exists('s:listener.onAbort()')
call s:listener.onAbort()
endif
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,139 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#callbackitem#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#callbackitem#getSwitchOrder()
return -1
endfunction
"
function fuf#callbackitem#getEditableDataNames()
return []
endfunction
"
function fuf#callbackitem#renewCache()
endfunction
"
function fuf#callbackitem#requiresOnCommandPre()
return 0
endfunction
"
function fuf#callbackitem#onInit()
endfunction
"
function fuf#callbackitem#launch(initialPattern, partialMatching, prompt, listener, items, forPath)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:listener = a:listener
let s:forPath = a:forPath
let s:items = copy(a:items)
if s:forPath
call map(s:items, 'fuf#makePathItem(v:val, "", 1)')
call fuf#mapToSetSerialIndex(s:items, 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:items)
else
call map(s:items, 'fuf#makeNonPathItem(v:val, "")')
call fuf#mapToSetSerialIndex(s:items, 1)
call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endif
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
if s:forPath
return g:fuf_previewHeight
endif
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
let parser = (s:forPath
\ ? 's:interpretPrimaryPatternForPath'
\ : 's:interpretPrimaryPatternForNonPath')
return fuf#makePatternSet(a:patternBase, parser, self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
if s:forPath
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endif
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:items
endfunction
"
function s:handler.onOpen(word, mode)
call s:listener.onComplete(a:word, a:mode)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
if !a:opened && exists('s:listener.onAbort()')
call s:listener.onAbort()
endif
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,172 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#changelist#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#changelist#getSwitchOrder()
return g:fuf_changelist_switchOrder
endfunction
"
function fuf#changelist#getEditableDataNames()
return []
endfunction
"
function fuf#changelist#renewCache()
endfunction
"
function fuf#changelist#requiresOnCommandPre()
return 0
endfunction
"
function fuf#changelist#onInit()
call fuf#defineLaunchCommand('FufChangeList', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getChangesLines()
redir => result
:silent changes
redir END
return split(result, "\n")
endfunction
"
function s:parseChangesLine(line)
" return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$')
let elements = matchlist(a:line, '\v^(.)\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)$')
if empty(elements)
return {}
endif
return {
\ 'prefix': elements[1],
\ 'count' : elements[2],
\ 'lnum' : elements[3],
\ 'text' : printf('|%d:%d|%s', elements[3], elements[4], elements[5]),
\ }
endfunction
"
function s:makeItem(line)
let parsed = s:parseChangesLine(a:line)
if empty(parsed)
return {}
endif
let item = fuf#makeNonPathItem(parsed.text, '')
let item.abbrPrefix = parsed.prefix
let item.lnum = parsed.lnum
return item
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_changelist_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(self.items), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(self.bufNrPrev)
return fuf#makePreviewLinesAround(
\ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#prejump(a:mode)
let older = 0
for line in reverse(s:getChangesLines())
if stridx(line, '>') == 0
let older = 1
endif
let parsed = s:parseChangesLine(line)
if !empty(parsed) && parsed.text ==# a:word
if parsed.count != 0
execute 'normal! ' . parsed.count . (older ? 'g;' : 'g,') . 'zvzz'
endif
break
endif
endfor
endfunction
"
function s:handler.onModeEnterPre()
let self.items = s:getChangesLines()
endfunction
"
function s:handler.onModeEnterPost()
call map(self.items, 's:makeItem(v:val)')
call filter(self.items, '!empty(v:val)')
call reverse(self.items)
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,199 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#coveragefile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#coveragefile#getSwitchOrder()
return g:fuf_coveragefile_switchOrder
endfunction
"
function fuf#coveragefile#getEditableDataNames()
return ['coverages']
endfunction
"
function fuf#coveragefile#renewCache()
let s:cache = {}
endfunction
"
function fuf#coveragefile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#coveragefile#onInit()
call fuf#defineLaunchCommand('FufCoverageFile', s:MODE_NAME, '""', [])
call l9#defineVariableDefault('g:fuf_coveragefile_name', '') " private option
command! -bang -narg=0 FufCoverageFileRegister call s:registerCoverage()
command! -bang -narg=? FufCoverageFileChange call s:changeCoverage(<q-args>)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:enumItems()
let key = join([getcwd(), g:fuf_ignoreCase, g:fuf_coveragefile_exclude,
\ g:fuf_coveragefile_globPatterns], "\n")
if !exists('s:cache[key]')
let s:cache[key] = l9#concat(map(copy(g:fuf_coveragefile_globPatterns),
\ 'fuf#glob(v:val)'))
call filter(s:cache[key], 'filereadable(v:val)') " filter out directories
call map(s:cache[key], 'fuf#makePathItem(fnamemodify(v:val, ":~:."), "", 0)')
if len(g:fuf_coveragefile_exclude)
call filter(s:cache[key], 'v:val.word !~ g:fuf_coveragefile_exclude')
endif
call fuf#mapToSetSerialIndex(s:cache[key], 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key])
endif
return s:cache[key]
endfunction
"
function s:registerCoverage()
let patterns = []
while 1
let pattern = l9#inputHl('Question', '[fuf] Glob pattern for coverage (<Esc> and end):',
\ '', 'file')
if pattern !~ '\S'
break
endif
call add(patterns, pattern)
endwhile
if empty(patterns)
call fuf#echoWarning('Canceled')
return
endif
echo '[fuf] patterns: ' . string(patterns)
let name = l9#inputHl('Question', '[fuf] Coverage name:')
if name !~ '\S'
call fuf#echoWarning('Canceled')
return
endif
let coverages = fuf#loadDataFile(s:MODE_NAME, 'coverages')
call insert(coverages, {'name': name, 'patterns': patterns})
call fuf#saveDataFile(s:MODE_NAME, 'coverages', coverages)
endfunction
"
function s:createChangeCoverageListener()
let listener = {}
function listener.onComplete(name, method)
call s:changeCoverage(a:name)
endfunction
return listener
endfunction
"
function s:changeCoverage(name)
let coverages = fuf#loadDataFile(s:MODE_NAME, 'coverages')
if a:name !~ '\S'
let names = map(copy(coverages), 'v:val.name')
call fuf#callbackitem#launch('', 0, '>Coverage>', s:createChangeCoverageListener(), names, 0)
return
else
let name = a:name
endif
call filter(coverages, 'v:val.name ==# name')
if empty(coverages)
call fuf#echoError('Coverage not found: ' . name)
return
endif
call fuf#setOneTimeVariables(
\ ['g:fuf_coveragefile_globPatterns', coverages[0].patterns],
\ ['g:fuf_coveragefile_name' , a:name]
\ )
FufCoverageFile
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
let nameString = (empty(g:fuf_coveragefile_name) ? ''
\ : '[' . g:fuf_coveragefile_name . ']')
return fuf#formatPrompt(g:fuf_coveragefile_prompt, self.partialMatching,
\ nameString)
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':~:.')
let self.items = copy(s:enumItems())
call filter(self.items, 'v:val.word !=# bufNamePrev')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

132
.vim/autoload/fuf/dir.vim Normal file
View File

@ -0,0 +1,132 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#dir#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#dir#getSwitchOrder()
return g:fuf_dir_switchOrder
endfunction
"
function fuf#dir#getEditableDataNames()
return []
endfunction
"
function fuf#dir#renewCache()
let s:cache = {}
endfunction
"
function fuf#dir#requiresOnCommandPre()
return 0
endfunction
"
function fuf#dir#onInit()
call fuf#defineLaunchCommand('FufDir' , s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufDirWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', [])
call fuf#defineLaunchCommand('FufDirWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:enumItems(dir)
let key = getcwd() . g:fuf_ignoreCase . g:fuf_dir_exclude . "\n" . a:dir
if !exists('s:cache[key]')
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_dir_exclude)
call filter(s:cache[key], 'v:val.word =~# ''[/\\]$''')
if isdirectory(a:dir)
call insert(s:cache[key], fuf#makePathItem(a:dir . '.', '', 0))
endif
call fuf#mapToSetSerialIndex(s:cache[key], 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key])
endif
return s:cache[key]
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_dir_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return a:enteredPattern =~# '[^/\\]$'
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesAround(
\ fuf#glob(fnamemodify(a:word, ':p') . '*'),
\ [], a:count, self.getPreviewHeight())
return
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:enumItems(fuf#splitPath(a:patternPrimary).head)
endfunction
"
function s:handler.onOpen(word, mode)
execute ':cd ' . fnameescape(a:word)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

139
.vim/autoload/fuf/file.vim Normal file
View File

@ -0,0 +1,139 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#file#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#file#getSwitchOrder()
return g:fuf_file_switchOrder
endfunction
"
function fuf#file#getEditableDataNames()
return []
endfunction
"
function fuf#file#renewCache()
let s:cache = {}
endfunction
"
function fuf#file#requiresOnCommandPre()
return 0
endfunction
"
function fuf#file#onInit()
call fuf#defineLaunchCommand('FufFile' , s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufFileWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', [])
call fuf#defineLaunchCommand('FufFileWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:enumItems(dir)
let key = join([getcwd(), g:fuf_ignoreCase, g:fuf_file_exclude, a:dir], "\n")
if !exists('s:cache[key]')
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_file_exclude)
call fuf#mapToSetSerialIndex(s:cache[key], 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key])
endif
return s:cache[key]
endfunction
"
function s:enumNonCurrentItems(dir, bufNrPrev, cache)
let key = a:dir . 'AVOIDING EMPTY KEY'
if !exists('a:cache[key]')
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
let bufNamePrev = bufname(a:bufNrPrev)
let a:cache[key] =
\ filter(copy(s:enumItems(a:dir)), 'v:val.word !=# bufNamePrev')
endif
return a:cache[key]
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_file_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return a:enteredPattern =~# '[^/\\]$'
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:enumNonCurrentItems(
\ fuf#splitPath(a:patternPrimary).head, self.bufNrPrev, self.cache)
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let self.cache = {}
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,123 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#givencmd#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#givencmd#getSwitchOrder()
return -1
endfunction
"
function fuf#givencmd#getEditableDataNames()
return []
endfunction
"
function fuf#givencmd#renewCache()
endfunction
"
function fuf#givencmd#requiresOnCommandPre()
return 0
endfunction
"
function fuf#givencmd#onInit()
endfunction
"
function fuf#givencmd#launch(initialPattern, partialMatching, prompt, items)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:items = copy(a:items)
call map(s:items, 'fuf#makeNonPathItem(v:val, "")')
call fuf#mapToSetSerialIndex(s:items, 1)
call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:items
endfunction
"
function s:handler.onOpen(word, mode)
if a:word[0] =~# '[:/?]'
call histadd(a:word[0], a:word[1:])
endif
call feedkeys(a:word . "\<CR>", 'n')
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,123 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#givendir#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#givendir#getSwitchOrder()
return -1
endfunction
"
function fuf#givendir#getEditableDataNames()
return []
endfunction
"
function fuf#givendir#renewCache()
endfunction
"
function fuf#givendir#requiresOnCommandPre()
return 0
endfunction
"
function fuf#givendir#onInit()
endfunction
"
function fuf#givendir#launch(initialPattern, partialMatching, prompt, items)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:items = map(copy(a:items), 'substitute(v:val, ''[/\\]\?$'', "", "")')
let s:items = map(s:items, 'fuf#makePathItem(v:val, "", 0)')
call fuf#mapToSetSerialIndex(s:items, 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:items)
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesAround(
\ fuf#glob(fnamemodify(a:word, ':p') . '*'),
\ [], a:count, self.getPreviewHeight())
return
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:items
endfunction
"
function s:handler.onOpen(word, mode)
execute ':cd ' . fnameescape(a:word)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,121 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#givenfile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#givenfile#getSwitchOrder()
return -1
endfunction
"
function fuf#givenfile#getEditableDataNames()
return []
endfunction
"
function fuf#givenfile#renewCache()
endfunction
"
function fuf#givenfile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#givenfile#onInit()
endfunction
"
function fuf#givenfile#launch(initialPattern, partialMatching, prompt, items)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:items = map(copy(a:items), 'fuf#makePathItem(v:val, "", 0)')
call fuf#mapToSetSerialIndex(s:items, 1)
call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

198
.vim/autoload/fuf/help.vim Normal file
View File

@ -0,0 +1,198 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#help#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#help#getSwitchOrder()
return g:fuf_help_switchOrder
endfunction
"
function fuf#help#getEditableDataNames()
return []
endfunction
"
function fuf#help#renewCache()
let s:cache = {}
endfunction
"
function fuf#help#requiresOnCommandPre()
return 0
endfunction
"
function fuf#help#onInit()
call fuf#defineLaunchCommand('FufHelp' , s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufHelpWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getCurrentHelpTagFiles()
let prefix = 'doc' . l9#getPathSeparator()
let tagFiles = split(globpath(&runtimepath, prefix . 'tags' ), "\n")
\ + split(globpath(&runtimepath, prefix . 'tags-??'), "\n")
return sort(map(tagFiles, 'fnamemodify(v:val, ":p")'))
endfunction
"
function s:parseHelpTagEntry(line, tagFile)
let elements = split(a:line, "\t")
if len(elements) != 3 || elements[0][0] ==# '!'
return {}
endif
let suffix = matchstr(a:tagFile, '-\zs..$')
if empty(suffix)
let suffix = '@en'
else
let suffix = '@' . suffix
endif
let dir = fnamemodify(a:tagFile, ':h') . l9#getPathSeparator()
return {
\ 'word' : elements[0] . suffix,
\ 'path' : dir . elements[1],
\ 'pattern': elements[2][1:],
\ }
endfunction
"
function s:getHelpTagEntries(tagFile)
let names = map(l9#readFile(a:tagFile), 's:parseHelpTagEntry(v:val, a:tagFile)')
return filter(names, '!empty(v:val)')
endfunction
"
function s:parseHelpTagFiles(tagFiles, key)
let cacheName = 'cache-' . l9#hash224(a:key)
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName)
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0
return fuf#loadDataFile(s:MODE_NAME, cacheName)
endif
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getHelpTagEntries(v:val)')))
let items = map(items, 'extend(v:val, fuf#makeNonPathItem(v:val.word, ""))')
call fuf#mapToSetSerialIndex(items, 1)
let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
call fuf#saveDataFile(s:MODE_NAME, cacheName, items)
return items
endfunction
"
function s:enumHelpTags(tagFiles)
if !len(a:tagFiles)
return []
endif
let key = join([g:fuf_ignoreCase] + a:tagFiles, "\n")
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time)
let s:cache[key] = {
\ 'time' : localtime(),
\ 'items' : s:parseHelpTagFiles(a:tagFiles, key)
\ }
endif
return s:cache[key].items
endfunction
"
function s:getMatchingIndex(lines, pattern)
if empty(a:pattern)
return -1
endif
for i in range(len(a:lines))
if stridx(a:lines[i], a:pattern) >= 0
return i
endif
endfor
return -1
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_help_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(s:enumHelpTags(self.tagFiles)), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(items[0].path)
let index = s:getMatchingIndex(lines, items[0].pattern)
return [items[0].path . ':'] + fuf#makePreviewLinesAround(
\ lines, (index < 0 ? [] : [index]), a:count, self.getPreviewHeight() - 1)
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:enumHelpTags(self.tagFiles)
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openHelp(a:word, a:mode)
endfunction
"
function s:handler.onModeEnterPre()
let self.tagFiles = s:getCurrentHelpTagFiles()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,182 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#jumplist#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#jumplist#getSwitchOrder()
return g:fuf_jumplist_switchOrder
endfunction
"
function fuf#jumplist#getEditableDataNames()
return []
endfunction
"
function fuf#jumplist#renewCache()
endfunction
"
function fuf#jumplist#requiresOnCommandPre()
return 0
endfunction
"
function fuf#jumplist#onInit()
call fuf#defineLaunchCommand('FufJumpList', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getJumpsLines()
redir => result
:silent jumps
redir END
return split(result, "\n")
endfunction
"
function s:parseJumpsLine(line, bufnrPrev)
"return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$')
let elements = matchlist(a:line, '\v^(.)\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)$')
if empty(elements)
return {}
endif
let linePrevBuffer = join(getbufline(a:bufnrPrev, elements[3]))
if stridx(linePrevBuffer, elements[5]) >= 0
let fname = bufname(a:bufnrPrev)
let text = elements[5]
else
let fname = elements[5]
let text = join(getbufline('^' . elements[5] . '$', elements[3]))
endif
return {
\ 'prefix': elements[1],
\ 'count' : elements[2],
\ 'lnum' : elements[3],
\ 'fname' : fname,
\ 'text' : printf('%s|%d:%d|%s', fname, elements[3], elements[4], text),
\ }
endfunction
"
function s:makeItem(line, bufnrPrev)
let parsed = s:parseJumpsLine(a:line, a:bufnrPrev)
if empty(parsed)
return {}
endif
let item = fuf#makeNonPathItem(parsed.text, '')
let item.abbrPrefix = parsed.prefix
let item.lnum = parsed.lnum
let item.fname = parsed.fname
return item
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_jumplist_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(self.items), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(items[0].fname)
return fuf#makePreviewLinesAround(
\ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#prejump(a:mode)
let older = 0
for line in reverse(s:getJumpsLines())
if stridx(line, '>') == 0
let older = 1
endif
let parsed = s:parseJumpsLine(line, self.bufNrPrev)
if !empty(parsed) && parsed.text ==# a:word
if parsed.count != 0
execute 'normal! ' . parsed.count . (older ? "\<C-o>" : "\<C-i>") . 'zvzz'
endif
break
endif
endfor
endfunction
"
function s:handler.onModeEnterPre()
let self.items = s:getJumpsLines()
endfunction
"
function s:handler.onModeEnterPost()
call map(self.items, 's:makeItem(v:val, self.bufNrPrev)')
call filter(self.items, '!empty(v:val)')
call reverse(self.items)
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

135
.vim/autoload/fuf/line.vim Normal file
View File

@ -0,0 +1,135 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#line#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#line#getSwitchOrder()
return g:fuf_line_switchOrder
endfunction
"
function fuf#line#getEditableDataNames()
return []
endfunction
"
function fuf#line#renewCache()
endfunction
"
function fuf#line#requiresOnCommandPre()
return 0
endfunction
"
function fuf#line#onInit()
call fuf#defineLaunchCommand('FufLine', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_DELETE = -1
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_line_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(self.items), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(self.bufNrPrev)
return fuf#makePreviewLinesAround(
\ lines, [items[0].index - 1], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#prejump(a:mode)
call filter(self.items, 'v:val.word ==# a:word')
if empty(self.items)
return
execute 'cc ' . self.items[0].index
endif
call cursor(self.items[0].index, 0)
normal! zvzz
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let tab = repeat(' ', getbufvar(self.bufNrPrev, '&tabstop'))
let self.items = getbufline(self.bufNrPrev, 1, '$')
let lnumFormat = '%' . len(string(len(self.items) + 1)) . 'd|'
for i in range(len(self.items))
let self.items[i] = printf(lnumFormat, i + 1)
\ . substitute(self.items[i], "\t", tab, 'g')
endfor
call map(self.items, 'fuf#makeNonPathItem(v:val, "")')
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 0)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,134 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#mrucmd#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#mrucmd#getSwitchOrder()
return g:fuf_mrucmd_switchOrder
endfunction
"
function fuf#mrucmd#getEditableDataNames()
return ['items']
endfunction
"
function fuf#mrucmd#renewCache()
endfunction
"
function fuf#mrucmd#requiresOnCommandPre()
return 1
endfunction
"
function fuf#mrucmd#onInit()
call fuf#defineLaunchCommand('FufMruCmd', s:MODE_NAME, '""', [])
endfunction
"
function fuf#mrucmd#onCommandPre(cmd)
if getcmdtype() =~# '^[:/?]'
call s:updateInfo(a:cmd)
endif
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:updateInfo(cmd)
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
let items = fuf#updateMruList(
\ items, { 'word' : a:cmd, 'time' : localtime() },
\ g:fuf_mrucmd_maxItem, g:fuf_mrucmd_exclude)
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_mrucmd_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call s:updateInfo(a:word)
call histadd(a:word[0], a:word[1:])
call feedkeys(a:word . "\<CR>", 'n')
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))')
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,234 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#mrufile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#mrufile#getSwitchOrder()
return g:fuf_mrufile_switchOrder
endfunction
"
function fuf#mrufile#getEditableDataNames()
return ['items', 'itemdirs']
endfunction
"
function fuf#mrufile#renewCache()
let s:cache = {}
let s:aroundCache = {}
endfunction
"
function fuf#mrufile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#mrufile#onInit()
call fuf#defineLaunchCommand('FufMruFile', s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufMruFileInCwd', s:MODE_NAME,
\ '""', [['g:fuf_mrufile_underCwd', 1]])
call l9#defineVariableDefault('g:fuf_mrufile_underCwd', 0) " private option
call l9#defineVariableDefault('g:fuf_mrufile_searchAroundLevel', -1) " private option
augroup fuf#mrufile
autocmd!
autocmd BufEnter * call s:updateData()
autocmd BufWritePost * call s:updateData()
augroup END
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_EXPAND = -1
"
function s:updateData()
if !empty(&buftype) || !filereadable(expand('%'))
return
endif
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
let items = fuf#updateMruList(
\ items, { 'word' : expand('%:p'), 'time' : localtime() },
\ g:fuf_mrufile_maxItem, g:fuf_mrufile_exclude)
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
call s:removeItemFromCache(expand('%:p'))
let itemDirs = fuf#loadDataFile(s:MODE_NAME, 'itemdirs')
let itemDirs = fuf#updateMruList(
\ itemDirs, { 'word' : expand('%:p:h') },
\ g:fuf_mrufile_maxItemDir, g:fuf_mrufile_exclude)
call fuf#saveDataFile(s:MODE_NAME, 'itemdirs', itemDirs)
endfunction
"
function s:removeItemFromCache(word)
for items in values(s:cache)
if exists('items[a:word]')
unlet items[a:word]
endif
endfor
endfunction
" returns empty value if invalid item
function s:formatItemUsingCache(item)
if a:item.word !~ '\S'
return {}
endif
if !exists('s:cache[a:item.word]')
if filereadable(a:item.word)
let s:cache[a:item.word] = fuf#makePathItem(
\ fnamemodify(a:item.word, ':p:~'), strftime(g:fuf_timeFormat, a:item.time), 0)
else
let s:cache[a:item.word] = {}
endif
endif
return s:cache[a:item.word]
endfunction
"
function s:expandSearchDir(dir, level)
let dirs = [a:dir]
let dirPrev = a:dir
for i in range(a:level)
let dirPrev = l9#concatPaths([dirPrev, '*'])
call add(dirs, dirPrev)
endfor
let dirPrev = a:dir
for i in range(a:level)
let dirPrevPrev = dirPrev
let dirPrev = fnamemodify(dirPrev, ':h')
if dirPrevPrev ==# dirPrev
break
endif
call add(dirs, dirPrev)
endfor
return dirs
endfunction
"
function s:listAroundFiles(dir)
if !exists('s:aroundCache[a:dir]')
let s:aroundCache[a:dir] = [a:dir] +
\ fuf#glob(l9#concatPaths([a:dir, '*' ])) +
\ fuf#glob(l9#concatPaths([a:dir, '.*']))
call filter(s:aroundCache[a:dir], 'filereadable(v:val)')
call map(s:aroundCache[a:dir], 'fuf#makePathItem(fnamemodify(v:val, ":~"), "", 0)')
if len(g:fuf_mrufile_exclude)
call filter(s:aroundCache[a:dir], 'v:val.word !~ g:fuf_mrufile_exclude')
endif
endif
return s:aroundCache[a:dir]
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
let cwdString = (g:fuf_mrufile_underCwd ? '[CWD]' : '')
let levelString = (g:fuf_mrufile_searchAroundLevel < 0 ? ''
\ : '[Around:' . g:fuf_mrufile_searchAroundLevel . ']')
return fuf#formatPrompt(g:fuf_mrufile_prompt, self.partialMatching, cwdString . levelString)
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
if a:mode ==# s:OPEN_TYPE_EXPAND
let nextLevel = (self.searchAroundLevel < 0 ? 0 : self.searchAroundLevel + 1)
call fuf#setOneTimeVariables(['g:fuf_mrufile_searchAroundLevel', nextLevel])
let self.reservedMode = self.getModeName()
return
else
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let self.searchAroundLevel = g:fuf_mrufile_searchAroundLevel
call fuf#defineKeyMappingInHandler(g:fuf_mrufile_keyExpand,
\ 'onCr(' . s:OPEN_TYPE_EXPAND . ')')
if self.searchAroundLevel < 0
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
call map(self.items, 's:formatItemUsingCache(v:val)')
else
let self.items = fuf#loadDataFile(s:MODE_NAME, 'itemdirs')
call map(self.items, 's:expandSearchDir(v:val.word, g:fuf_mrufile_searchAroundLevel)')
let self.items = l9#concat(self.items)
let self.items = l9#unique(self.items)
call map(self.items, 's:listAroundFiles(v:val)')
let self.items = l9#concat(self.items)
endif
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~')
call filter(self.items, '!empty(v:val) && v:val.word !=# bufNamePrev')
if g:fuf_mrufile_underCwd
let cwd = fnamemodify(getcwd(), ':p:~')
call filter(self.items, 'stridx(v:val.word, cwd) == 0')
endif
call fuf#mapToSetSerialIndex(self.items, 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,154 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#quickfix#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#quickfix#getSwitchOrder()
return g:fuf_quickfix_switchOrder
endfunction
"
function fuf#quickfix#getEditableDataNames()
return []
endfunction
"
function fuf#quickfix#renewCache()
endfunction
"
function fuf#quickfix#requiresOnCommandPre()
return 0
endfunction
"
function fuf#quickfix#onInit()
call fuf#defineLaunchCommand('FufQuickfix', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getJumpsLines()
redir => result
:silent jumps
redir END
return split(result, "\n")
endfunction
"
function s:parseJumpsLine(line)
return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$')
endfunction
"
function s:makeItem(qfItem)
if !a:qfItem.valid
return {}
endif
let item = fuf#makeNonPathItem(
\ printf('%s|%d:%d|%s', bufname(a:qfItem.bufnr), a:qfItem.lnum,
\ a:qfItem.col, matchstr(a:qfItem.text, '\s*\zs.*\S'))
\ , '')
let item.bufnr = a:qfItem.bufnr
let item.lnum = a:qfItem.lnum
return item
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_quickfix_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(self.items), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(items[0].bufnr)
return fuf#makePreviewLinesAround(
\ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#prejump(a:mode)
call filter(self.items, 'v:val.word ==# a:word')
if !empty(self.items)
execute 'cc ' . self.items[0].index
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let self.items = getqflist()
call map(self.items, 's:makeItem(v:val)')
call fuf#mapToSetSerialIndex(self.items, 1)
call filter(self.items, 'exists("v:val.word")')
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

178
.vim/autoload/fuf/tag.vim Normal file
View File

@ -0,0 +1,178 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#tag#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#tag#getSwitchOrder()
return g:fuf_tag_switchOrder
endfunction
"
function fuf#tag#getEditableDataNames()
return []
endfunction
"
function fuf#tag#renewCache()
let s:cache = {}
endfunction
"
function fuf#tag#requiresOnCommandPre()
return 0
endfunction
"
function fuf#tag#onInit()
call fuf#defineLaunchCommand('FufTag' , s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufTagWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getTagNames(tagFile)
let names = map(l9#readFile(a:tagFile), 'matchstr(v:val, ''^[^!\t][^\t]*'')')
return filter(names, 'v:val =~# ''\S''')
endfunction
"
function s:parseTagFiles(tagFiles, key)
let cacheName = 'cache-' . l9#hash224(a:key)
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName)
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0
return fuf#loadDataFile(s:MODE_NAME, cacheName)
endif
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTagNames(v:val)')))
let items = map(items, 'fuf#makeNonPathItem(v:val, "")')
call fuf#mapToSetSerialIndex(items, 1)
let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
call fuf#saveDataFile(s:MODE_NAME, cacheName, items)
return items
endfunction
"
function s:enumTags(tagFiles)
if !len(a:tagFiles)
return []
endif
let key = join([g:fuf_ignoreCase] + a:tagFiles, "\n")
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time)
let s:cache[key] = {
\ 'time' : localtime(),
\ 'items' : s:parseTagFiles(a:tagFiles, key)
\ }
endif
return s:cache[key].items
endfunction
"
function s:getMatchingIndex(lines, cmd)
if a:cmd !~# '\D'
return str2nr(a:cmd)
endif
let pattern = matchstr(a:cmd, '^\/\^\zs.*\ze\$\/$')
if empty(pattern)
return -1
endif
for i in range(len(a:lines))
if a:lines[i] ==# pattern
return i
endif
endfor
return -1
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_tag_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
" 'cmd' is '/^hoge hoge$/' or line number
function s:handler.makePreviewLines(word, count)
let tags = taglist('^' . a:word . '$')
if empty(tags)
return []
endif
let i = a:count % len(tags)
let title = printf('(%d/%d) %s', i + 1, len(tags), tags[i].filename)
let lines = fuf#getFileLines(tags[i].filename)
let index = s:getMatchingIndex(lines, tags[i].cmd)
return [title] + fuf#makePreviewLinesAround(
\ lines, (index < 0 ? [] : [index]), 0, self.getPreviewHeight() - 1)
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:enumTags(self.tagFiles)
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openTag(a:word, a:mode)
endfunction
"
function s:handler.onModeEnterPre()
let self.tagFiles = fuf#getCurrentTagFiles()
endfunction
"
function s:handler.onModeEnterPost()
let &l:tags = join(self.tagFiles, ',')
endfunction
"
function s:handler.onModeLeavePost(opened)
let &l:tags = ''
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,159 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#taggedfile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#taggedfile#getSwitchOrder()
return g:fuf_taggedfile_switchOrder
endfunction
"
function fuf#taggedfile#getEditableDataNames()
return []
endfunction
"
function fuf#taggedfile#renewCache()
let s:cache = {}
endfunction
"
function fuf#taggedfile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#taggedfile#onInit()
call fuf#defineLaunchCommand('FufTaggedFile', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getTaggedFileList(tagfile)
execute 'cd ' . fnamemodify(a:tagfile, ':h')
let result = map(l9#readFile(a:tagfile), 'matchstr(v:val, ''^[^!\t][^\t]*\t\zs[^\t]\+'')')
call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":p")')
cd -
call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":~:.")')
return filter(result, 'v:val =~# ''[^/\\ ]$''')
endfunction
"
function s:parseTagFiles(tagFiles, key)
let cacheName = 'cache-' . l9#hash224(a:key)
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName)
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0
return fuf#loadDataFile(s:MODE_NAME, cacheName)
endif
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTaggedFileList(v:val)')))
call map(items, 'fuf#makePathItem(v:val, "", 0)')
call fuf#mapToSetSerialIndex(items, 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(items)
call fuf#saveDataFile(s:MODE_NAME, cacheName, items)
return items
endfunction
"
function s:enumTaggedFiles(tagFiles)
if !len(a:tagFiles)
return []
endif
let key = join([getcwd(), g:fuf_ignoreCase] + a:tagFiles, "\n")
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time)
let s:cache[key] = {
\ 'time' : localtime(),
\ 'items' : s:parseTagFiles(a:tagFiles, key)
\ }
endif
return s:cache[key].items
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_taggedfile_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endfunction
"
function s:handler.onModeEnterPre()
let self.tagFiles = fuf#getCurrentTagFiles()
endfunction
"
function s:handler.onModeEnterPost()
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~:.')
" NOTE: Don't do this in onModeEnterPre()
" because that should return in a short time.
let self.items = copy(s:enumTaggedFiles(self.tagFiles))
call filter(self.items, 'v:val.word !=# bufNamePrev')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

31
.vim/autoload/tagbar.vim Normal file
View File

@ -0,0 +1,31 @@
" Vala {{{3
let type_vala = {}
let type_vala.ctagstype = 'vala'
let type_vala.kinds = [
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0},
\ {'short' : 'd', 'long' : 'delegates', 'fold' : 0},
\ {'short' : 'e', 'long' : 'enumerations', 'fold' : 0},
\ {'short' : 'E', 'long' : 'error domains', 'fold' : 0},
\ {'short' : 'f', 'long' : 'fields', 'fold' : 0},
\ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0},
\ {'short' : 'm', 'long' : 'methods', 'fold' : 0},
\ {'short' : 'p', 'long' : 'properties', 'fold' : 0},
\ {'short' : 'r', 'long' : 'error codes', 'fold' : 0},
\ {'short' : 's', 'long' : 'structures', 'fold' : 0},
\ {'short' : 'S', 'long' : 'signals', 'fold' : 0},
\ {'short' : 'v', 'long' : 'enumeration values', 'fold' : 0}
\ ]
let type_vala.sro = '.'
let type_vala.kind2scope = {
\ 'i' : 'interface',
\ 'c' : 'class',
\ 's' : 'structure',
\ 'e' : 'enum'
\ }
let type_vala.scope2kind = {
\ 'interface' : 'i',
\ 'class' : 'c',
\ 'struct' : 's',
\ 'enum' : 'e'
\ }
let s:known_types.vala = type_vala

1291
.vim/doc/NERD_tree.txt Normal file

File diff suppressed because it is too large Load Diff

1405
.vim/doc/fuf.jax Normal file

File diff suppressed because it is too large Load Diff

1883
.vim/doc/fuf.txt Normal file

File diff suppressed because it is too large Load Diff

1501
.vim/doc/taglist.txt Normal file

File diff suppressed because it is too large Load Diff

4
.vim/ftdetect/vala.vim Normal file
View File

@ -0,0 +1,4 @@
au BufRead *.vala set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
au BufRead *.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
au BufRead,BufNewFile *.vala setf vala
au BufRead,BufNewFile *.vapi setf vala

15
.vim/indent/vala.vim Normal file
View File

@ -0,0 +1,15 @@
" Vim indent file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2005 Mar 27
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" C indenting is built-in, thus this is very simple
setlocal cindent
let b:undo_indent = "setl cin<"

View File

@ -0,0 +1,41 @@
" ============================================================================
" File: exec_menuitem.vim
" Description: plugin for NERD Tree that provides an execute file menu item
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
" Last Change: 22 July, 2009
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
if exists("g:loaded_nerdtree_exec_menuitem")
finish
endif
let g:loaded_nerdtree_exec_menuitem = 1
call NERDTreeAddMenuItem({
\ 'text': '(!)Execute file',
\ 'shortcut': '!',
\ 'callback': 'NERDTreeExecFile',
\ 'isActiveCallback': 'NERDTreeExecFileActive' })
function! NERDTreeExecFileActive()
let node = g:NERDTreeFileNode.GetSelected()
return !node.path.isDirectory && node.path.isExecutable
endfunction
function! NERDTreeExecFile()
let treenode = g:NERDTreeFileNode.GetSelected()
echo "==========================================================\n"
echo "Complete the command to execute (add arguments etc):\n"
let cmd = treenode.path.str({'escape': 1})
let cmd = input(':!', cmd . ' ')
if cmd != ''
exec ':!' . cmd
else
echo "Aborted"
endif
endfunction

View File

@ -0,0 +1,224 @@
" ============================================================================
" File: fs_menu.vim
" Description: plugin for the NERD Tree that provides a file system menu
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
" Last Change: 17 July, 2009
" License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
" ============================================================================
if exists("g:loaded_nerdtree_fs_menu")
finish
endif
let g:loaded_nerdtree_fs_menu = 1
call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'})
call NERDTreeAddMenuItem({'text': '(m)ove the current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
if has("gui_mac") || has("gui_macvim")
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
endif
if g:NERDTreePath.CopyingSupported()
call NERDTreeAddMenuItem({'text': '(c)copy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
endif
"FUNCTION: s:echo(msg){{{1
function! s:echo(msg)
redraw
echomsg "NERDTree: " . a:msg
endfunction
"FUNCTION: s:echoWarning(msg){{{1
function! s:echoWarning(msg)
echohl warningmsg
call s:echo(a:msg)
echohl normal
endfunction
"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1
"prints out the given msg and, if the user responds by pushing 'y' then the
"buffer with the given bufnum is deleted
"
"Args:
"bufnum: the buffer that may be deleted
"msg: a message that will be echoed to the user asking them if they wish to
" del the buffer
function! s:promptToDelBuffer(bufnum, msg)
echo a:msg
if nr2char(getchar()) ==# 'y'
exec "silent bdelete! " . a:bufnum
endif
endfunction
"FUNCTION: NERDTreeAddNode(){{{1
function! NERDTreeAddNode()
let curDirNode = g:NERDTreeDirNode.GetSelected()
let newNodeName = input("Add a childnode\n".
\ "==========================================================\n".
\ "Enter the dir/file name to be created. Dirs end with a '/'\n" .
\ "", curDirNode.path.str() . g:NERDTreePath.Slash(), "file")
if newNodeName ==# ''
call s:echo("Node Creation Aborted.")
return
endif
try
let newPath = g:NERDTreePath.Create(newNodeName)
let parentNode = b:NERDTreeRoot.findNode(newPath.getParent())
let newTreeNode = g:NERDTreeFileNode.New(newPath)
if parentNode.isOpen || !empty(parentNode.children)
call parentNode.addChild(newTreeNode, 1)
call NERDTreeRender()
call newTreeNode.putCursorHere(1, 0)
endif
catch /^NERDTree/
call s:echoWarning("Node Not Created.")
endtry
endfunction
"FUNCTION: NERDTreeMoveNode(){{{1
function! NERDTreeMoveNode()
let curNode = g:NERDTreeFileNode.GetSelected()
let newNodePath = input("Rename the current node\n" .
\ "==========================================================\n" .
\ "Enter the new path for the node: \n" .
\ "", curNode.path.str(), "file")
if newNodePath ==# ''
call s:echo("Node Renaming Aborted.")
return
endif
try
let bufnum = bufnr(curNode.path.str())
call curNode.rename(newNodePath)
call NERDTreeRender()
"if the node is open in a buffer, ask the user if they want to
"close that buffer
if bufnum != -1
let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
call s:promptToDelBuffer(bufnum, prompt)
endif
call curNode.putCursorHere(1, 0)
redraw
catch /^NERDTree/
call s:echoWarning("Node Not Renamed.")
endtry
endfunction
" FUNCTION: NERDTreeDeleteNode() {{{1
function! NERDTreeDeleteNode()
let currentNode = g:NERDTreeFileNode.GetSelected()
let confirmed = 0
if currentNode.path.isDirectory
let choice =input("Delete the current node\n" .
\ "==========================================================\n" .
\ "STOP! To delete this entire directory, type 'yes'\n" .
\ "" . currentNode.path.str() . ": ")
let confirmed = choice ==# 'yes'
else
echo "Delete the current node\n" .
\ "==========================================================\n".
\ "Are you sure you wish to delete the node:\n" .
\ "" . currentNode.path.str() . " (yN):"
let choice = nr2char(getchar())
let confirmed = choice ==# 'y'
endif
if confirmed
try
call currentNode.delete()
call NERDTreeRender()
"if the node is open in a buffer, ask the user if they want to
"close that buffer
let bufnum = bufnr(currentNode.path.str())
if buflisted(bufnum)
let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
call s:promptToDelBuffer(bufnum, prompt)
endif
redraw
catch /^NERDTree/
call s:echoWarning("Could not remove node")
endtry
else
call s:echo("delete aborted")
endif
endfunction
" FUNCTION: NERDTreeCopyNode() {{{1
function! NERDTreeCopyNode()
let currentNode = g:NERDTreeFileNode.GetSelected()
let newNodePath = input("Copy the current node\n" .
\ "==========================================================\n" .
\ "Enter the new path to copy the node to: \n" .
\ "", currentNode.path.str(), "file")
if newNodePath != ""
"strip trailing slash
let newNodePath = substitute(newNodePath, '\/$', '', '')
let confirmed = 1
if currentNode.path.copyingWillOverwrite(newNodePath)
call s:echo("Warning: copying may overwrite files! Continue? (yN)")
let choice = nr2char(getchar())
let confirmed = choice ==# 'y'
endif
if confirmed
try
let newNode = currentNode.copy(newNodePath)
if !empty(newNode)
call NERDTreeRender()
call newNode.putCursorHere(0, 0)
endif
catch /^NERDTree/
call s:echoWarning("Could not copy node")
endtry
endif
else
call s:echo("Copy aborted.")
endif
redraw
endfunction
function! NERDTreeQuickLook()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
endif
endfunction
function! NERDTreeRevealInFinder()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
let x = system("open -R '" . treenode.path.str() . "'")
endif
endfunction
function! NERDTreeExecuteFile()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
let x = system("open '" . treenode.path.str() . "'")
endif
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

4017
.vim/plugin/NERD_tree.vim Normal file

File diff suppressed because it is too large Load Diff

3538
.vim/plugin/VimExplorer.vim Normal file

File diff suppressed because it is too large Load Diff

840
.vim/plugin/a.vim Normal file
View File

@ -0,0 +1,840 @@
" Copyright (c) 1998-2006
" Michael Sharpe <feline@irendi.com>
"
" We grant permission to use, copy modify, distribute, and sell this
" software for any purpose without fee, provided that the above copyright
" notice and this text are not removed. We make no guarantee about the
" suitability of this software for any purpose and we are not liable
" for any damages resulting from its use. Further, we are under no
" obligation to maintain or extend this software. It is provided on an
" "as is" basis without any expressed or implied warranty.
" Directory & regex enhancements added by Bindu Wavell who is well known on
" vim.sf.net
"
" Patch for spaces in files/directories from Nathan Stien (also reported by
" Soeren Sonnenburg)
" Do not load a.vim if is has already been loaded.
if exists("loaded_alternateFile")
finish
endif
if (v:progname == "ex")
finish
endif
let loaded_alternateFile = 1
let alternateExtensionsDict = {}
" setup the default set of alternate extensions. The user can override in thier
" .vimrc if the defaults are not suitable. To override in a .vimrc simply set a
" g:alternateExtensions_<EXT> variable to a comma separated list of alternates,
" where <EXT> is the extension to map.
" E.g. let g:alternateExtensions_CPP = "inc,h,H,HPP,hpp"
" let g:alternateExtensions_{'aspx.cs'} = "aspx"
" This variable will be increased when an extension with greater number of dots
" is added by the AddAlternateExtensionMapping call.
let s:maxDotsInExtension = 1
" Function : AddAlternateExtensionMapping (PRIVATE)
" Purpose : simple helper function to add the default alternate extension
" mappings.
" Args : extension -- the extension to map
" alternates -- comma separated list of alternates extensions
" Returns : nothing
" Author : Michael Sharpe <feline@irendi.com>
function! <SID>AddAlternateExtensionMapping(extension, alternates)
" This code does not actually work for variables like foo{'a.b.c.d.e'}
"let varName = "g:alternateExtensions_" . a:extension
"if (!exists(varName))
" let g:alternateExtensions_{a:extension} = a:alternates
"endif
" This code handles extensions which contains a dot. exists() fails with
" such names.
"let v:errmsg = ""
" FIXME this line causes ex to return 1 instead of 0 for some reason??
"silent! echo g:alternateExtensions_{a:extension}
"if (v:errmsg != "")
"let g:alternateExtensions_{a:extension} = a:alternates
"endif
let g:alternateExtensionsDict[a:extension] = a:alternates
let dotsNumber = strlen(substitute(a:extension, "[^.]", "", "g"))
if s:maxDotsInExtension < dotsNumber
let s:maxDotsInExtension = dotsNumber
endif
endfunction
" Add all the default extensions
" Mappings for C and C++
call <SID>AddAlternateExtensionMapping('h',"c,cpp,cxx,cc,CC")
call <SID>AddAlternateExtensionMapping('H',"C,CPP,CXX,CC")
call <SID>AddAlternateExtensionMapping('hpp',"cpp,c")
call <SID>AddAlternateExtensionMapping('HPP',"CPP,C")
call <SID>AddAlternateExtensionMapping('c',"h")
call <SID>AddAlternateExtensionMapping('C',"H")
call <SID>AddAlternateExtensionMapping('cpp',"h,hpp")
call <SID>AddAlternateExtensionMapping('CPP',"H,HPP")
call <SID>AddAlternateExtensionMapping('cc',"h")
call <SID>AddAlternateExtensionMapping('CC',"H,h")
call <SID>AddAlternateExtensionMapping('cxx',"h")
call <SID>AddAlternateExtensionMapping('CXX',"H")
" Mappings for PSL7
call <SID>AddAlternateExtensionMapping('psl',"ph")
call <SID>AddAlternateExtensionMapping('ph',"psl")
" Mappings for ADA
call <SID>AddAlternateExtensionMapping('adb',"ads")
call <SID>AddAlternateExtensionMapping('ads',"adb")
" Mappings for lex and yacc files
call <SID>AddAlternateExtensionMapping('l',"y,yacc,ypp")
call <SID>AddAlternateExtensionMapping('lex',"yacc,y,ypp")
call <SID>AddAlternateExtensionMapping('lpp',"ypp,y,yacc")
call <SID>AddAlternateExtensionMapping('y',"l,lex,lpp")
call <SID>AddAlternateExtensionMapping('yacc',"lex,l,lpp")
call <SID>AddAlternateExtensionMapping('ypp',"lpp,l,lex")
" Mappings for OCaml
call <SID>AddAlternateExtensionMapping('ml',"mli")
call <SID>AddAlternateExtensionMapping('mli',"ml")
" ASP stuff
call <SID>AddAlternateExtensionMapping('aspx.cs', 'aspx')
call <SID>AddAlternateExtensionMapping('aspx.vb', 'aspx')
call <SID>AddAlternateExtensionMapping('aspx', 'aspx.cs,aspx.vb')
" Setup default search path, unless the user has specified
" a path in their [._]vimrc.
if (!exists('g:alternateSearchPath'))
let g:alternateSearchPath = 'sfr:../source,sfr:../src,sfr:../include,sfr:../inc'
endif
" If this variable is true then a.vim will not alternate to a file/buffer which
" does not exist. E.g while editing a.c and the :A will not swtich to a.h
" unless it exists.
if (!exists('g:alternateNoDefaultAlternate'))
" by default a.vim will alternate to a file which does not exist
let g:alternateNoDefaultAlternate = 0
endif
" If this variable is true then a.vim will convert the alternate filename to a
" filename relative to the current working directory.
" Feature by Nathan Huizinga
if (!exists('g:alternateRelativeFiles'))
" by default a.vim will not convert the filename to one relative to the
" current working directory
let g:alternateRelativeFiles = 0
endif
" Function : GetNthItemFromList (PRIVATE)
" Purpose : Support reading items from a comma seperated list
" Used to iterate all the extensions in an extension spec
" Used to iterate all path prefixes
" Args : list -- the list (extension spec, file paths) to iterate
" n -- the extension to get
" Returns : the nth item (extension, path) from the list (extension
" spec), or "" for failure
" Author : Michael Sharpe <feline@irendi.com>
" History : Renamed from GetNthExtensionFromSpec to GetNthItemFromList
" to reflect a more generic use of this function. -- Bindu
function! <SID>GetNthItemFromList(list, n)
let itemStart = 0
let itemEnd = -1
let pos = 0
let item = ""
let i = 0
while (i != a:n)
let itemStart = itemEnd + 1
let itemEnd = match(a:list, ",", itemStart)
let i = i + 1
if (itemEnd == -1)
if (i == a:n)
let itemEnd = strlen(a:list)
endif
break
endif
endwhile
if (itemEnd != -1)
let item = strpart(a:list, itemStart, itemEnd - itemStart)
endif
return item
endfunction
" Function : ExpandAlternatePath (PRIVATE)
" Purpose : Expand path info. A path with a prefix of "wdr:" will be
" treated as relative to the working directory (i.e. the
" directory where vim was started.) A path prefix of "abs:" will
" be treated as absolute. No prefix or "sfr:" will result in the
" path being treated as relative to the source file (see sfPath
" argument).
"
" A prefix of "reg:" will treat the pathSpec as a regular
" expression substitution that is applied to the source file
" path. The format is:
"
" reg:<sep><pattern><sep><subst><sep><flag><sep>
"
" <sep> seperator character, we often use one of [/|%#]
" <pattern> is what you are looking for
" <subst> is the output pattern
" <flag> can be g for global replace or empty
"
" EXAMPLE: 'reg:/inc/src/g/' will replace every instance
" of 'inc' with 'src' in the source file path. It is possible
" to use match variables so you could do something like:
" 'reg:|src/\([^/]*\)|inc/\1||' (see 'help :substitute',
" 'help pattern' and 'help sub-replace-special' for more details
"
" NOTE: a.vim uses ',' (comma) internally so DON'T use it
" in your regular expressions or other pathSpecs unless you update
" the rest of the a.vim code to use some other seperator.
"
" Args : pathSpec -- path component (or substitution patterns)
" sfPath -- source file path
" Returns : a path that can be used by AlternateFile()
" Author : Bindu Wavell <bindu@wavell.net>
function! <SID>ExpandAlternatePath(pathSpec, sfPath)
let prfx = strpart(a:pathSpec, 0, 4)
if (prfx == "wdr:" || prfx == "abs:")
let path = strpart(a:pathSpec, 4)
elseif (prfx == "reg:")
let re = strpart(a:pathSpec, 4)
let sep = strpart(re, 0, 1)
let patend = match(re, sep, 1)
let pat = strpart(re, 1, patend - 1)
let subend = match(re, sep, patend + 1)
let sub = strpart(re, patend+1, subend - patend - 1)
let flag = strpart(re, strlen(re) - 2)
if (flag == sep)
let flag = ''
endif
let path = substitute(a:sfPath, pat, sub, flag)
"call confirm('PAT: [' . pat . '] SUB: [' . sub . ']')
"call confirm(a:sfPath . ' => ' . path)
else
let path = a:pathSpec
if (prfx == "sfr:")
let path = strpart(path, 4)
endif
let path = a:sfPath . "/" . path
endif
return path
endfunction
" Function : FindFileInSearchPath (PRIVATE)
" Purpose : Searches for a file in the search path list
" Args : filename -- name of the file to search for
" pathList -- the path list to search
" relPathBase -- the path which relative paths are expanded from
" Returns : An expanded filename if found, the empty string otherwise
" Author : Michael Sharpe (feline@irendi.com)
" History : inline code written by Bindu Wavell originally
function! <SID>FindFileInSearchPath(fileName, pathList, relPathBase)
let filepath = ""
let m = 1
let pathListLen = strlen(a:pathList)
if (pathListLen > 0)
while (1)
let pathSpec = <SID>GetNthItemFromList(a:pathList, m)
if (pathSpec != "")
let path = <SID>ExpandAlternatePath(pathSpec, a:relPathBase)
let fullname = path . "/" . a:fileName
let foundMatch = <SID>BufferOrFileExists(fullname)
if (foundMatch)
let filepath = fullname
break
endif
else
break
endif
let m = m + 1
endwhile
endif
return filepath
endfunction
" Function : FindFileInSearchPathEx (PRIVATE)
" Purpose : Searches for a file in the search path list
" Args : filename -- name of the file to search for
" pathList -- the path list to search
" relPathBase -- the path which relative paths are expanded from
" count -- find the count'th occurence of the file on the path
" Returns : An expanded filename if found, the empty string otherwise
" Author : Michael Sharpe (feline@irendi.com)
" History : Based on <SID>FindFileInSearchPath() but with extensions
function! <SID>FindFileInSearchPathEx(fileName, pathList, relPathBase, count)
let filepath = ""
let m = 1
let spath = ""
let pathListLen = strlen(a:pathList)
if (pathListLen > 0)
while (1)
let pathSpec = <SID>GetNthItemFromList(a:pathList, m)
if (pathSpec != "")
let path = <SID>ExpandAlternatePath(pathSpec, a:relPathBase)
if (spath != "")
let spath = spath . ','
endif
let spath = spath . path
else
break
endif
let m = m + 1
endwhile
endif
if (&path != "")
if (spath != "")
let spath = spath . ','
endif
let spath = spath . &path
endif
let filepath = findfile(a:fileName, spath, a:count)
return filepath
endfunction
" Function : EnumerateFilesByExtension (PRIVATE)
" Purpose : enumerates all files by a particular list of alternate extensions.
" Args : path -- path of a file (not including the file)
" baseName -- base name of the file to be expanded
" extension -- extension whose alternates are to be enumerated
" Returns : comma separated list of files with extensions
" Author : Michael Sharpe <feline@irendi.com>
function! EnumerateFilesByExtension(path, baseName, extension)
let enumeration = ""
let extSpec = ""
let v:errmsg = ""
silent! echo g:alternateExtensions_{a:extension}
if (v:errmsg == "")
let extSpec = g:alternateExtensions_{a:extension}
endif
if (extSpec == "")
if (has_key(g:alternateExtensionsDict, a:extension))
let extSpec = g:alternateExtensionsDict[a:extension]
endif
endif
if (extSpec != "")
let n = 1
let done = 0
while (!done)
let ext = <SID>GetNthItemFromList(extSpec, n)
if (ext != "")
if (a:path != "")
let newFilename = a:path . "/" . a:baseName . "." . ext
else
let newFilename = a:baseName . "." . ext
endif
if (enumeration == "")
let enumeration = newFilename
else
let enumeration = enumeration . "," . newFilename
endif
else
let done = 1
endif
let n = n + 1
endwhile
endif
return enumeration
endfunction
" Function : EnumerateFilesByExtensionInPath (PRIVATE)
" Purpose : enumerates all files by expanding the path list and the extension
" list.
" Args : baseName -- base name of the file
" extension -- extension whose alternates are to be enumerated
" pathList -- the list of paths to enumerate
" relPath -- the path of the current file for expansion of relative
" paths in the path list.
" Returns : A comma separated list of paths with extensions
" Author : Michael Sharpe <feline@irendi.com>
function! EnumerateFilesByExtensionInPath(baseName, extension, pathList, relPathBase)
let enumeration = ""
let filepath = ""
let m = 1
let pathListLen = strlen(a:pathList)
if (pathListLen > 0)
while (1)
let pathSpec = <SID>GetNthItemFromList(a:pathList, m)
if (pathSpec != "")
let path = <SID>ExpandAlternatePath(pathSpec, a:relPathBase)
let pe = EnumerateFilesByExtension(path, a:baseName, a:extension)
if (enumeration == "")
let enumeration = pe
else
let enumeration = enumeration . "," . pe
endif
else
break
endif
let m = m + 1
endwhile
endif
return enumeration
endfunction
" Function : DetermineExtension (PRIVATE)
" Purpose : Determines the extension of a filename based on the register
" alternate extension. This allow extension which contain dots to
" be considered. E.g. foo.aspx.cs to foo.aspx where an alternate
" exists for the aspx.cs extension. Note that this will only accept
" extensions which contain less than 5 dots. This is only
" implemented in this manner for simplicity...it is doubtful that
" this will be a restriction in non-contrived situations.
" Args : The path to the file to find the extension in
" Returns : The matched extension if any
" Author : Michael Sharpe (feline@irendi.com)
" History : idea from Tom-Erik Duestad
" Notes : there is some magic occuring here. The exists() function does not
" work well when the curly brace variable has dots in it. And why
" should it, dots are not valid in variable names. But the exists
" function is wierd too. Lets say foo_c does exist. Then
" exists("foo_c.e.f") will be true...even though the variable does
" not exist. However the curly brace variables do work when the
" variable has dots in it. E.g foo_{'c'} is different from
" foo_{'c.d.e'}...and foo_{'c'} is identical to foo_c and
" foo_{'c.d.e'} is identical to foo_c.d.e right? Yes in the current
" implementation of vim. To trick vim to test for existence of such
" variables echo the curly brace variable and look for an error
" message.
function! DetermineExtension(path)
let mods = ":t"
let i = 0
while i <= s:maxDotsInExtension
let mods = mods . ":e"
let extension = fnamemodify(a:path, mods)
if (has_key(g:alternateExtensionsDict, extension))
return extension
endif
let v:errmsg = ""
silent! echo g:alternateExtensions_{extension}
if (v:errmsg == "")
return extension
endif
let i = i + 1
endwhile
return ""
endfunction
" Function : AlternateFile (PUBLIC)
" Purpose : Opens a new buffer by looking at the extension of the current
" buffer and finding the corresponding file. E.g. foo.c <--> foo.h
" Args : accepts one argument. If present it used the argument as the new
" extension.
" Returns : nothing
" Author : Michael Sharpe <feline@irendi.com>
" History : + When an alternate can't be found in the same directory as the
" source file, a search path will be traversed looking for the
" alternates.
" + Moved some code into a separate function, minor optimization
" + rework to favor files in memory based on complete enumeration of
" all files extensions and paths
function! AlternateFile(splitWindow, ...)
let extension = DetermineExtension(expand("%:p"))
let baseName = substitute(expand("%:t"), "\." . extension . '$', "", "")
let currentPath = expand("%:p:h")
if (a:0 != 0)
let newFullname = currentPath . "/" . baseName . "." . a:1
call <SID>FindOrCreateBuffer(newFullname, a:splitWindow, 0)
else
let allfiles = ""
if (extension != "")
let allfiles1 = EnumerateFilesByExtension(currentPath, baseName, extension)
let allfiles2 = EnumerateFilesByExtensionInPath(baseName, extension, g:alternateSearchPath, currentPath)
if (allfiles1 != "")
if (allfiles2 != "")
let allfiles = allfiles1 . ',' . allfiles2
else
let allfiles = allfiles1
endif
else
let allfiles = allfiles2
endif
endif
if (allfiles != "")
let bestFile = ""
let bestScore = 0
let score = 0
let n = 1
let onefile = <SID>GetNthItemFromList(allfiles, n)
let bestFile = onefile
while (onefile != "" && score < 2)
let score = <SID>BufferOrFileExists(onefile)
if (score > bestScore)
let bestScore = score
let bestFile = onefile
endif
let n = n + 1
let onefile = <SID>GetNthItemFromList(allfiles, n)
endwhile
if (bestScore == 0 && g:alternateNoDefaultAlternate == 1)
echo "No existing alternate available"
else
call <SID>FindOrCreateBuffer(bestFile, a:splitWindow, 1)
let b:AlternateAllFiles = allfiles
endif
else
echo "No alternate file/buffer available"
endif
endif
endfunction
" Function : AlternateOpenFileUnderCursor (PUBLIC)
" Purpose : Opens file under the cursor
" Args : splitWindow -- indicates how to open the file
" Returns : Nothing
" Author : Michael Sharpe (feline@irendi.com) www.irendi.com
function! AlternateOpenFileUnderCursor(splitWindow,...)
let cursorFile = (a:0 > 0) ? a:1 : expand("<cfile>")
let currentPath = expand("%:p:h")
let openCount = 1
let fileName = <SID>FindFileInSearchPathEx(cursorFile, g:alternateSearchPath, currentPath, openCount)
if (fileName != "")
call <SID>FindOrCreateBuffer(fileName, a:splitWindow, 1)
let b:openCount = openCount
let b:cursorFile = cursorFile
let b:currentPath = currentPath
else
echo "Can't find file"
endif
endfunction
" Function : AlternateOpenNextFile (PUBLIC)
" Purpose : Opens the next file corresponding to the search which found the
" current file
" Args : bang -- indicates what to do if the current file has not been
" saved
" Returns : nothing
" Author : Michael Sharpe (feline@irendi.com) www.irendi.com
function! AlternateOpenNextFile(bang)
let cursorFile = ""
if (exists("b:cursorFile"))
let cursorFile = b:cursorFile
endif
let currentPath = ""
if (exists("b:currentPath"))
let currentPath = b:currentPath
endif
let openCount = 0
if (exists("b:openCount"))
let openCount = b:openCount + 1
endif
if (cursorFile != "" && currentPath != "" && openCount != 0)
let fileName = <SID>FindFileInSearchPathEx(cursorFile, g:alternateSearchPath, currentPath, openCount)
if (fileName != "")
call <SID>FindOrCreateBuffer(fileName, "n".a:bang, 0)
let b:openCount = openCount
let b:cursorFile = cursorFile
let b:currentPath = currentPath
else
let fileName = <SID>FindFileInSearchPathEx(cursorFile, g:alternateSearchPath, currentPath, 1)
if (fileName != "")
call <SID>FindOrCreateBuffer(fileName, "n".a:bang, 0)
let b:openCount = 1
let b:cursorFile = cursorFile
let b:currentPath = currentPath
else
echo "Can't find next file"
endif
endif
endif
endfunction
comm! -nargs=? -bang IH call AlternateOpenFileUnderCursor("n<bang>", <f-args>)
comm! -nargs=? -bang IHS call AlternateOpenFileUnderCursor("h<bang>", <f-args>)
comm! -nargs=? -bang IHV call AlternateOpenFileUnderCursor("v<bang>", <f-args>)
comm! -nargs=? -bang IHT call AlternateOpenFileUnderCursor("t<bang>", <f-args>)
comm! -nargs=? -bang IHN call AlternateOpenNextFile("<bang>")
imap <Leader>ih <ESC>:IHS<CR>
nmap <Leader>ih :IHS<CR>
imap <Leader>is <ESC>:IHS<CR>:A<CR>
nmap <Leader>is :IHS<CR>:A<CR>
imap <Leader>ihn <ESC>:IHN<CR>
nmap <Leader>ihn :IHN<CR>
"function! <SID>PrintList(theList)
" let n = 1
" let oneFile = <SID>GetNthItemFromList(a:theList, n)
" while (oneFile != "")
" let n = n + 1
" let oneFile = <SID>GetNthItemFromList(a:theList, n)
" endwhile
"endfunction
" Function : NextAlternate (PUBLIC)
" Purpose : Used to cycle through any other alternate file which existed on
" the search path.
" Args : bang (IN) - used to implement the AN vs AN! functionality
" Returns : nothing
" Author : Michael Sharpe <feline@irendi.com>
function! NextAlternate(bang)
if (exists('b:AlternateAllFiles'))
let currentFile = expand("%")
let n = 1
let onefile = <SID>GetNthItemFromList(b:AlternateAllFiles, n)
while (onefile != "" && !<SID>EqualFilePaths(fnamemodify(onefile,":p"), fnamemodify(currentFile,":p")))
let n = n + 1
let onefile = <SID>GetNthItemFromList(b:AlternateAllFiles, n)
endwhile
if (onefile != "")
let stop = n
let n = n + 1
let foundAlternate = 0
let nextAlternate = ""
while (n != stop)
let nextAlternate = <SID>GetNthItemFromList(b:AlternateAllFiles, n)
if (nextAlternate == "")
let n = 1
continue
endif
let n = n + 1
if (<SID>EqualFilePaths(fnamemodify(nextAlternate, ":p"), fnamemodify(currentFile, ":p")))
continue
endif
if (filereadable(nextAlternate))
" on cygwin filereadable("foo.H") returns true if "foo.h" exists
if (has("unix") && $WINDIR != "" && fnamemodify(nextAlternate, ":p") ==? fnamemodify(currentFile, ":p"))
continue
endif
let foundAlternate = 1
break
endif
endwhile
if (foundAlternate == 1)
let s:AlternateAllFiles = b:AlternateAllFiles
"silent! execute ":e".a:bang." " . nextAlternate
call <SID>FindOrCreateBuffer(nextAlternate, "n".a:bang, 0)
let b:AlternateAllFiles = s:AlternateAllFiles
else
echo "Only this alternate file exists"
endif
else
echo "Could not find current file in alternates list"
endif
else
echo "No other alternate files exist"
endif
endfunction
comm! -nargs=? -bang A call AlternateFile("n<bang>", <f-args>)
comm! -nargs=? -bang AS call AlternateFile("h<bang>", <f-args>)
comm! -nargs=? -bang AV call AlternateFile("v<bang>", <f-args>)
comm! -nargs=? -bang AT call AlternateFile("t<bang>", <f-args>)
comm! -nargs=? -bang AN call NextAlternate("<bang>")
" Function : BufferOrFileExists (PRIVATE)
" Purpose : determines if a buffer or a readable file exists
" Args : fileName (IN) - name of the file to check
" Returns : 2 if it exists in memory, 1 if it exists, 0 otherwise
" Author : Michael Sharpe <feline@irendi.com>
" History : Updated code to handle buffernames using just the
" filename and not the path.
function! <SID>BufferOrFileExists(fileName)
let result = 0
let lastBuffer = bufnr("$")
let i = 1
while i <= lastBuffer
if <SID>EqualFilePaths(expand("#".i.":p"), a:fileName)
let result = 2
break
endif
let i = i + 1
endwhile
if (!result)
let bufName = fnamemodify(a:fileName,":t")
let memBufName = bufname(bufName)
if (memBufName != "")
let memBufBasename = fnamemodify(memBufName, ":t")
if (bufName == memBufBasename)
let result = 2
endif
endif
if (!result)
let result = bufexists(bufName) || bufexists(a:fileName) || filereadable(a:fileName)
endif
endif
if (!result)
let result = filereadable(a:fileName)
endif
return result
endfunction
" Function : FindOrCreateBuffer (PRIVATE)
" Purpose : searches the buffer list (:ls) for the specified filename. If
" found, checks the window list for the buffer. If the buffer is in
" an already open window, it switches to the window. If the buffer
" was not in a window, it switches to that buffer. If the buffer did
" not exist, it creates it.
" Args : filename (IN) -- the name of the file
" doSplit (IN) -- indicates whether the window should be split
" ("v", "h", "n", "v!", "h!", "n!", "t", "t!")
" findSimilar (IN) -- indicate weather existing buffers should be
" prefered
" Returns : nothing
" Author : Michael Sharpe <feline@irendi.com>
" History : + bufname() was not working very well with the possibly strange
" paths that can abound with the search path so updated this
" slightly. -- Bindu
" + updated window switching code to make it more efficient -- Bindu
" Allow ! to be applied to buffer/split/editing commands for more
" vim/vi like consistency
" + implemented fix from Matt Perry
function! <SID>FindOrCreateBuffer(fileName, doSplit, findSimilar)
" Check to see if the buffer is already open before re-opening it.
let FILENAME = escape(a:fileName, ' ')
let bufNr = -1
let lastBuffer = bufnr("$")
let i = 1
if (a:findSimilar)
while i <= lastBuffer
if <SID>EqualFilePaths(expand("#".i.":p"), a:fileName)
let bufNr = i
break
endif
let i = i + 1
endwhile
if (bufNr == -1)
let bufName = bufname(a:fileName)
let bufFilename = fnamemodify(a:fileName,":t")
if (bufName == "")
let bufName = bufname(bufFilename)
endif
if (bufName != "")
let tail = fnamemodify(bufName, ":t")
if (tail != bufFilename)
let bufName = ""
endif
endif
if (bufName != "")
let bufNr = bufnr(bufName)
let FILENAME = bufName
endif
endif
endif
if (g:alternateRelativeFiles == 1)
let FILENAME = fnamemodify(FILENAME, ":p:.")
endif
let splitType = a:doSplit[0]
let bang = a:doSplit[1]
if (bufNr == -1)
" Buffer did not exist....create it
let v:errmsg=""
if (splitType == "h")
silent! execute ":split".bang." " . FILENAME
elseif (splitType == "v")
silent! execute ":vsplit".bang." " . FILENAME
elseif (splitType == "t")
silent! execute ":tab split".bang." " . FILENAME
else
silent! execute ":e".bang." " . FILENAME
endif
if (v:errmsg != "")
echo v:errmsg
endif
else
" Find the correct tab corresponding to the existing buffer
let tabNr = -1
" iterate tab pages
for i in range(tabpagenr('$'))
" get the list of buffers in the tab
let tabList = tabpagebuflist(i + 1)
let idx = 0
" iterate each buffer in the list
while idx < len(tabList)
" if it matches the buffer we are looking for...
if (tabList[idx] == bufNr)
" ... save the number
let tabNr = i + 1
break
endif
let idx = idx + 1
endwhile
if (tabNr != -1)
break
endif
endfor
" switch the the tab containing the buffer
if (tabNr != -1)
execute "tabn ".tabNr
endif
" Buffer was already open......check to see if it is in a window
let bufWindow = bufwinnr(bufNr)
if (bufWindow == -1)
" Buffer was not in a window so open one
let v:errmsg=""
if (splitType == "h")
silent! execute ":sbuffer".bang." " . FILENAME
elseif (splitType == "v")
silent! execute ":vert sbuffer " . FILENAME
elseif (splitType == "t")
silent! execute ":tab sbuffer " . FILENAME
else
silent! execute ":buffer".bang." " . FILENAME
endif
if (v:errmsg != "")
echo v:errmsg
endif
else
" Buffer is already in a window so switch to the window
execute bufWindow."wincmd w"
if (bufWindow != winnr())
" something wierd happened...open the buffer
let v:errmsg=""
if (splitType == "h")
silent! execute ":split".bang." " . FILENAME
elseif (splitType == "v")
silent! execute ":vsplit".bang." " . FILENAME
elseif (splitType == "t")
silent! execute ":tab split".bang." " . FILENAME
else
silent! execute ":e".bang." " . FILENAME
endif
if (v:errmsg != "")
echo v:errmsg
endif
endif
endif
endif
endfunction
" Function : EqualFilePaths (PRIVATE)
" Purpose : Compares two paths. Do simple string comparison anywhere but on
" Windows. On Windows take into account that file paths could differ
" in usage of separators and the fact that case does not matter.
" "c:\WINDOWS" is the same path as "c:/windows". has("win32unix") Vim
" version does not count as one having Windows path rules.
" Args : path1 (IN) -- first path
" path2 (IN) -- second path
" Returns : 1 if path1 is equal to path2, 0 otherwise.
" Author : Ilya Bobir <ilya@po4ta.com>
function! <SID>EqualFilePaths(path1, path2)
if has("win16") || has("win32") || has("win64") || has("win95")
return substitute(a:path1, "\/", "\\", "g") ==? substitute(a:path2, "\/", "\\", "g")
else
return a:path1 == a:path2
endif
endfunction

165
.vim/plugin/cscope_maps.vim Normal file
View File

@ -0,0 +1,165 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CSCOPE settings for vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This file contains some boilerplate settings for vim's cscope interface,
" plus some keyboard mappings that I've found useful.
"
" USAGE:
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
" 'plugin' directory in some other directory that is in your
" 'runtimepath'.
"
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
" your ~/.vimrc file (or cut and paste it into your .vimrc).
"
" NOTE:
" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim
" keeps timing you out before you can complete them, try changing your timeout
" settings, as explained below.
"
" Happy cscoping,
"
" Jason Duell jduell@alumni.princeton.edu 2002/3/7
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" This tests to see if vim was configured with the '--enable-cscope' option
" when it was compiled. If it wasn't, time to recompile vim...
if has("cscope")
""""""""""""" Standard cscope/vim boilerplate
" use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
set cscopetag
" check cscope for definition of a symbol before checking ctags: set to 1
" if you want the reverse search order.
set csto=0
" add any cscope database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add the database pointed to by environment variable
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
" show msg when any other cscope db added
set cscopeverbose
""""""""""""" My cscope/vim key mappings
"
" The following maps all invoke one of the following cscope search types:
"
" 's' symbol: find all references to the token under cursor
" 'g' global: find global definition(s) of the token under cursor
" 'c' calls: find all calls to the function name under cursor
" 't' text: find all instances of the text under cursor
" 'e' egrep: egrep search for the word under cursor
" 'f' file: open the filename under cursor
" 'i' includes: find files that include the filename under cursor
" 'd' called: find functions that function under cursor calls
"
" Below are three sets of the maps: one set that just jumps to your
" search result, one that splits the existing vim window horizontally and
" diplays your search result in the new window, and one that does the same
" thing, but does a vertical split instead (vim 6 only).
"
" I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's
" unlikely that you need their default mappings (CTRL-\'s default use is
" as part of CTRL-\ CTRL-N typemap, which basically just does the same
" thing as hitting 'escape': CTRL-@ doesn't seem to have any default use).
" If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all
" of these maps to use other keys. One likely candidate is 'CTRL-_'
" (which also maps to CTRL-/, which is easier to type). By default it is
" used to switch between Hebrew and English keyboard mode.
"
" All of the maps involving the <cfile> macro use '^<cfile>$': this is so
" that searches over '#include <time.h>" return only references to
" 'time.h', and not 'sys/time.h', etc. (by default cscope will return all
" files that contain 'time.h' as part of their name).
" To do the first type of search, hit 'CTRL-\', followed by one of the
" cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope
" search will be displayed in the current window. You can use CTRL-T to
" go back to where you were before the search.
"
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type
" makes the vim window split horizontally, with search result displayed in
" the new window.
"
" (Note: earlier versions of vim may not have the :scs command, but it
" can be simulated roughly via:
" nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one (vim 6 and up only)
"
" (Note: you may wish to put a 'set splitright' in your .vimrc
" if you prefer the new window on the right instead of the left
nmap <C-@><C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@><C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@><C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
""""""""""""" key map timeouts
"
" By default Vim will only wait 1 second for each keystroke in a mapping.
" You may find that too short with the above typemaps. If so, you should
" either turn off mapping timeouts via 'notimeout'.
"
"set notimeout
"
" Or, you can keep timeouts, by uncommenting the timeoutlen line below,
" with your own personal favorite value (in milliseconds):
"
"set timeoutlen=4000
"
" Either way, since mapping timeout settings by default also set the
" timeouts for multicharacter 'keys codes' (like <F1>), you should also
" set ttimeout and ttimeoutlen: otherwise, you will experience strange
" delays as vim waits for a keystroke after you hit ESC (it will be
" waiting to see if the ESC is actually part of a key code like <F1>).
"
"set ttimeout
"
" personally, I find a tenth of a second to work well for key code
" timeouts. If you experience problems and have a slow terminal or network
" connection, set it higher. If you don't set ttimeoutlen, the value for
" timeoutlent (default: 1000 = 1 second, which is sluggish) is used.
"
"set ttimeoutlen=100
endif

158
.vim/plugin/fuf.vim Normal file
View File

@ -0,0 +1,158 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
" GetLatestVimScripts: 1984 1 :AutoInstall: FuzzyFinder
"=============================================================================
" LOAD GUARD {{{1
try
if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 101, [])
finish
endif
catch /E117/
echoerr '***** L9 library must be installed! *****'
finish
endtry
" }}}1
"=============================================================================
" LOCAL FUNCTIONS {{{1
"
function s:initialize()
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_modesDisable' , [ 'mrufile', 'mrucmd', ])
call l9#defineVariableDefault('g:fuf_keyOpen' , '<CR>')
call l9#defineVariableDefault('g:fuf_keyOpenSplit' , '<C-j>')
call l9#defineVariableDefault('g:fuf_keyOpenVsplit' , '<C-k>')
call l9#defineVariableDefault('g:fuf_keyOpenTabpage' , '<C-l>')
call l9#defineVariableDefault('g:fuf_keyPreview' , '<C-@>')
call l9#defineVariableDefault('g:fuf_keyNextMode' , '<C-t>')
call l9#defineVariableDefault('g:fuf_keyPrevMode' , '<C-y>')
call l9#defineVariableDefault('g:fuf_keyPrevPattern' , '<C-s>')
call l9#defineVariableDefault('g:fuf_keyNextPattern' , '<C-_>')
call l9#defineVariableDefault('g:fuf_keySwitchMatching', '<C-\><C-\>')
call l9#defineVariableDefault('g:fuf_dataDir' , '~/.vim-fuf-data')
call l9#defineVariableDefault('g:fuf_abbrevMap' , {})
call l9#defineVariableDefault('g:fuf_patternSeparator' , ';')
call l9#defineVariableDefault('g:fuf_promptHighlight' , 'Question')
call l9#defineVariableDefault('g:fuf_ignoreCase' , 1)
call l9#defineVariableDefault('g:fuf_splitPathMatching', 1)
call l9#defineVariableDefault('g:fuf_fuzzyRefining' , 0)
call l9#defineVariableDefault('g:fuf_smartBs' , 1)
call l9#defineVariableDefault('g:fuf_reuseWindow' , 1)
call l9#defineVariableDefault('g:fuf_timeFormat' , '(%Y-%m-%d %H:%M:%S)')
call l9#defineVariableDefault('g:fuf_learningLimit' , 100)
call l9#defineVariableDefault('g:fuf_enumeratingLimit' , 50)
call l9#defineVariableDefault('g:fuf_maxMenuWidth' , 78)
call l9#defineVariableDefault('g:fuf_previewHeight' , 0)
call l9#defineVariableDefault('g:fuf_autoPreview' , 0)
call l9#defineVariableDefault('g:fuf_useMigemo' , 0)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_buffer_prompt' , '>Buffer[]>')
call l9#defineVariableDefault('g:fuf_buffer_switchOrder', 10)
call l9#defineVariableDefault('g:fuf_buffer_mruOrder' , 1)
call l9#defineVariableDefault('g:fuf_buffer_keyDelete' , '<C-]>')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_file_prompt' , '>File[]>')
call l9#defineVariableDefault('g:fuf_file_switchOrder', 20)
call l9#defineVariableDefault('g:fuf_file_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_coveragefile_prompt' , '>CoverageFile[]>')
call l9#defineVariableDefault('g:fuf_coveragefile_switchOrder', 30)
call l9#defineVariableDefault('g:fuf_coveragefile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])')
call l9#defineVariableDefault('g:fuf_coveragefile_globPatterns', ['**/.*', '**/*'])
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_dir_prompt' , '>Dir[]>')
call l9#defineVariableDefault('g:fuf_dir_switchOrder', 40)
call l9#defineVariableDefault('g:fuf_dir_exclude' , '\v(^|[/\\])\.(hg|git|bzr)($|[/\\])')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_mrufile_prompt' , '>MRU-File[]>')
call l9#defineVariableDefault('g:fuf_mrufile_switchOrder', 50)
call l9#defineVariableDefault('g:fuf_mrufile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|^(\/\/|\\\\|\/mnt\/|\/media\/)')
call l9#defineVariableDefault('g:fuf_mrufile_maxItem' , 200)
call l9#defineVariableDefault('g:fuf_mrufile_maxItemDir' , 50)
call l9#defineVariableDefault('g:fuf_mrufile_keyExpand' , '<C-]>')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_mrucmd_prompt' , '>MRU-Cmd[]>')
call l9#defineVariableDefault('g:fuf_mrucmd_switchOrder', 60)
call l9#defineVariableDefault('g:fuf_mrucmd_exclude' , '^$')
call l9#defineVariableDefault('g:fuf_mrucmd_maxItem' , 200)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_bookmarkfile_prompt' , '>Bookmark-File[]>')
call l9#defineVariableDefault('g:fuf_bookmarkfile_switchOrder', 70)
call l9#defineVariableDefault('g:fuf_bookmarkfile_searchRange', 400)
call l9#defineVariableDefault('g:fuf_bookmarkfile_keyDelete' , '<C-]>')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_bookmarkdir_prompt' , '>Bookmark-Dir[]>')
call l9#defineVariableDefault('g:fuf_bookmarkdir_switchOrder', 80)
call l9#defineVariableDefault('g:fuf_bookmarkdir_keyDelete' , '<C-]>')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_tag_prompt' , '>Tag[]>')
call l9#defineVariableDefault('g:fuf_tag_switchOrder', 90)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_buffertag_prompt' , '>Buffer-Tag[]>')
call l9#defineVariableDefault('g:fuf_buffertag_switchOrder', 100)
call l9#defineVariableDefault('g:fuf_buffertag_ctagsPath' , 'ctags')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_taggedfile_prompt' , '>Tagged-File[]>')
call l9#defineVariableDefault('g:fuf_taggedfile_switchOrder', 110)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_jumplist_prompt' , '>Jump-List[]>')
call l9#defineVariableDefault('g:fuf_jumplist_switchOrder', 120)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_changelist_prompt' , '>Change-List[]>')
call l9#defineVariableDefault('g:fuf_changelist_switchOrder', 130)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_quickfix_prompt' , '>Quickfix[]>')
call l9#defineVariableDefault('g:fuf_quickfix_switchOrder', 140)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_line_prompt' , '>Line[]>')
call l9#defineVariableDefault('g:fuf_line_switchOrder', 150)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_help_prompt' , '>Help[]>')
call l9#defineVariableDefault('g:fuf_help_switchOrder', 160)
"---------------------------------------------------------------------------
command! -bang -narg=0 FufEditDataFile call fuf#editDataFile()
command! -bang -narg=0 FufRenewCache call s:renewCachesOfAllModes()
"---------------------------------------------------------------------------
call fuf#addMode('buffer')
call fuf#addMode('file')
call fuf#addMode('coveragefile')
call fuf#addMode('dir')
call fuf#addMode('mrufile')
call fuf#addMode('mrucmd')
call fuf#addMode('bookmarkfile')
call fuf#addMode('bookmarkdir')
call fuf#addMode('tag')
call fuf#addMode('buffertag')
call fuf#addMode('taggedfile')
call fuf#addMode('jumplist')
call fuf#addMode('changelist')
call fuf#addMode('quickfix')
call fuf#addMode('line')
call fuf#addMode('help')
call fuf#addMode('givenfile')
call fuf#addMode('givendir')
call fuf#addMode('givencmd')
call fuf#addMode('callbackfile')
call fuf#addMode('callbackitem')
"---------------------------------------------------------------------------
endfunction
"
function s:renewCachesOfAllModes()
for m in fuf#getModeNames()
call fuf#{m}#renewCache()
endfor
endfunction
" }}}1
"=============================================================================
" INITIALIZATION {{{1
call s:initialize()
" }}}1
"=============================================================================
" vim: set fdm=marker:

135
.vim/plugin/po.vim Normal file
View File

@ -0,0 +1,135 @@
" Vim syntax file
" Language: po (gettext)
" Maintainer: Dwayne Bailey <dwayne@translate.org.za>
" Last Change: 2008 Jan 08
" Contributors: Dwayne Bailey (Most advanced syntax highlighting)
" Leonardo Fontenelle (Spell checking)
" Nam SungHyun <namsh@kldp.org> (Original maintainer)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn sync minlines=10
" Identifiers
syn match poStatementMsgCTxt "^msgctxt"
syn match poStatementMsgidplural "^msgid_plural" contained
syn match poPluralCaseN "[0-9]" contained
syn match poStatementMsgstr "^msgstr\(\[[0-9]\]\)" contains=poPluralCaseN
" Simple HTML and XML highlighting
syn match poHtml "<\_[^<>]\+>" contains=poHtmlTranslatables,poLineBreak
syn match poHtmlNot +"<[^<]\+>"+ms=s+1,me=e-1
syn region poHtmlTranslatables start=+\(abbr\|alt\|content\|summary\|standby\|title\)=\\"+ms=e-1 end=+\\"+ contained contains=@Spell
syn match poLineBreak +"\n"+ contained
" Translation blocks
syn region poMsgCTxt matchgroup=poStatementMsgCTxt start=+^msgctxt "+rs=e-1 matchgroup=poStringCTxt end=+^msgid "+me=s-1 contains=poStringCTxt
syn region poMsgID matchgroup=poStatementMsgid start=+^msgid "+rs=e-1 matchgroup=poStringID end=+^msgstr\(\|\[[\]0\[]\]\) "+me=s-1 contains=poStringID,poStatementMsgidplural,poStatementMsgid
syn region poMsgSTR matchgroup=poStatementMsgstr start=+^msgstr\(\|\[[\]0\[]\]\) "+rs=e-1 matchgroup=poStringSTR end=+\n\n+me=s-1 contains=poStringSTR,poStatementMsgstr
syn region poStringCTxt start=+"+ skip=+\\\\\|\\"+ end=+"+
syn region poStringID start=+"+ skip=+\\\\\|\\"+ end=+"+ contained
\ contains=poSpecial,poFormat,poCommentKDE,poPluralKDE,poKDEdesktopFile,poHtml,poAcceleratorId,poHtmlNot,poVariable
syn region poStringSTR start=+"+ skip=+\\\\\|\\"+ end=+"+ contained
\ contains=@Spell,poSpecial,poFormat,poHeaderItem,poCommentKDEError,poHeaderUndefined,poPluralKDEError,poMsguniqError,poKDEdesktopFile,poHtml,poAcceleratorStr,poHtmlNot,poVariable
" Header and Copyright
syn match poHeaderItem "\(Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|MIME-Version\|Content-Type\|Content-Transfer-Encoding\|Plural-Forms\|X-Generator\): " contained
syn match poHeaderUndefined "\(PACKAGE VERSION\|YEAR-MO-DA HO:MI+ZONE\|FULL NAME <EMAIL@ADDRESS>\|LANGUAGE <LL@li.org>\|CHARSET\|ENCODING\|INTEGER\|EXPRESSION\)" contained
syn match poCopyrightUnset "SOME DESCRIPTIVE TITLE\|FIRST AUTHOR <EMAIL@ADDRESS>, YEAR\|Copyright (C) YEAR Free Software Foundation, Inc\|YEAR THE PACKAGE\'S COPYRIGHT HOLDER\|PACKAGE" contained
" Translation comment block including: translator comment, automatic coments, flags and locations
syn match poComment "^#.*$"
syn keyword poFlagFuzzy fuzzy contained
syn match poCommentTranslator "^# .*$" contains=poCopyrightUnset
syn match poCommentAutomatic "^#\..*$"
syn match poCommentSources "^#:.*$"
syn match poCommentFlags "^#,.*$" contains=poFlagFuzzy
" Translations (also includes header fields as they appear in a translation msgstr)
syn region poCommentKDE start=+"_: +ms=s+1 end="\\n" end="\"\n^msgstr"me=s-1 contained
syn region poCommentKDEError start=+"\(\|\s\+\)_:+ms=s+1 end="\\n" end=+"\n\n+me=s-1 contained
syn match poPluralKDE +"_n: +ms=s+1 contained
syn region poPluralKDEError start=+"\(\|\s\+\)_n:+ms=s+1 end="\"\n\n"me=s-1 contained
syn match poSpecial contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
syn match poFormat "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
syn match poFormat "%%" contained
" msguniq and msgcat conflicts
syn region poMsguniqError matchgroup=poMsguniqErrorMarkers start="#-#-#-#-#" end='#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)\\n' contained
" Obsolete messages
syn match poObsolete "^#\~.*$"
" KDE Name= handling
syn match poKDEdesktopFile "\"\(Name\|Comment\|GenericName\|Description\|Keywords\|About\)="ms=s+1,me=e-1
" Accelerator keys - this messes up if the preceding or following char is a multibyte unicode char
syn match poAcceleratorId contained "[^&_~][&_~]\(\a\|\d\)[^:]"ms=s+1,me=e-1
syn match poAcceleratorStr contained "[^&_~][&_~]\(\a\|\d\)[^:]"ms=s+1,me=e-1 contains=@Spell
" Variables simple
syn match poVariable contained "%\d"
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_po_syn_inits")
if version < 508
let did_po_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink poCommentSources PreProc
HiLink poComment Comment
HiLink poCommentAutomatic Comment
HiLink poCommentTranslator Comment
HiLink poCommentFlags Special
HiLink poCopyrightUnset Todo
HiLink poFlagFuzzy Todo
HiLink poObsolete Comment
HiLink poStatementMsgid Statement
HiLink poStatementMsgstr Statement
HiLink poStatementMsgidplural Statement
HiLink poStatementMsgCTxt Statement
HiLink poPluralCaseN Constant
HiLink poStringCTxt Comment
HiLink poStringID String
HiLink poStringSTR String
HiLink poCommentKDE Comment
HiLink poCommentKDEError Error
HiLink poPluralKDE Comment
HiLink poPluralKDEError Error
HiLink poHeaderItem Identifier
HiLink poHeaderUndefined Todo
HiLink poKDEdesktopFile Identifier
HiLink poHtml Identifier
HiLink poHtmlNot String
HiLink poHtmlTranslatables String
HiLink poLineBreak String
HiLink poFormat poSpecial
HiLink poSpecial Special
HiLink poAcceleratorId Special
HiLink poAcceleratorStr Special
HiLink poVariable Special
HiLink poMsguniqError Special
HiLink poMsguniqErrorMarkers Comment
delcommand HiLink
endif
let b:current_syntax = "po"
" vim:set ts=8 sts=2 sw=2 noet:

4546
.vim/plugin/taglist.vim Normal file

File diff suppressed because it is too large Load Diff

88
.vim/syntax/nerdtree.vim Normal file
View File

@ -0,0 +1,88 @@
let s:tree_up_dir_line = '.. (up a dir)'
"NERDTreeFlags are syntax items that should be invisible, but give clues as to
"how things should be highlighted
syn match NERDTreeFlag #\~#
syn match NERDTreeFlag #\[RO\]#
"highlighting for the .. (up dir) line at the top of the tree
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
"highlighting for the ~/+ symbols for the directory nodes
syn match NERDTreeClosable #\~\<#
syn match NERDTreeClosable #\~\.#
syn match NERDTreeOpenable #+\<#
syn match NERDTreeOpenable #+\.#he=e-1
"highlighting for the tree structural parts
syn match NERDTreePart #|#
syn match NERDTreePart #`#
syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
"quickhelp syntax elements
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
"highlighting for readonly files
syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
"highlighting for sym links
syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
"highlighing for directory nodes and file nodes
syn match NERDTreeDirSlash #/#
syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeCWD #^[</].*$#
"highlighting for bookmarks
syn match NERDTreeBookmark # {.*}#hs=s+1
"highlighting for the bookmarks table
syn match NERDTreeBookmarksLeader #^>#
syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
if exists("g:NERDChristmasTree") && g:NERDChristmasTree
hi def link NERDTreePart Special
hi def link NERDTreePartFile Type
hi def link NERDTreeFile Normal
hi def link NERDTreeExecFile Title
hi def link NERDTreeDirSlash Identifier
hi def link NERDTreeClosable Type
else
hi def link NERDTreePart Normal
hi def link NERDTreePartFile Normal
hi def link NERDTreeFile Normal
hi def link NERDTreeClosable Title
endif
hi def link NERDTreeBookmarksHeader statement
hi def link NERDTreeBookmarksLeader ignore
hi def link NERDTreeBookmarkName Identifier
hi def link NERDTreeBookmark normal
hi def link NERDTreeHelp String
hi def link NERDTreeHelpKey Identifier
hi def link NERDTreeHelpCommand Identifier
hi def link NERDTreeHelpTitle Macro
hi def link NERDTreeToggleOn Question
hi def link NERDTreeToggleOff WarningMsg
hi def link NERDTreeDir Directory
hi def link NERDTreeUp Directory
hi def link NERDTreeCWD Statement
hi def link NERDTreeLink Macro
hi def link NERDTreeOpenable Title
hi def link NERDTreeFlag ignore
hi def link NERDTreeRO WarningMsg
hi def link NERDTreeBookmark Statement
hi def link NERDTreeCurrentNode Search