1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 11:30:29 +01:00

Added branch pathogen

This commit is contained in:
2012-02-13 21:19:34 +01:00
parent b989a7b269
commit 5047146e53
261 changed files with 5724 additions and 3107 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,163 +0,0 @@
"=============================================================================
" 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

@@ -1,199 +0,0 @@
"=============================================================================
" 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

@@ -1,189 +0,0 @@
"=============================================================================
" 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

@@ -1,300 +0,0 @@
"=============================================================================
" 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

@@ -1,137 +0,0 @@
"=============================================================================
" 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

@@ -1,139 +0,0 @@
"=============================================================================
" 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

@@ -1,172 +0,0 @@
"=============================================================================
" 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

@@ -1,199 +0,0 @@
"=============================================================================
" 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:

View File

@@ -1,132 +0,0 @@
"=============================================================================
" 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:

View File

@@ -1,139 +0,0 @@
"=============================================================================
" 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

@@ -1,123 +0,0 @@
"=============================================================================
" 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

@@ -1,123 +0,0 @@
"=============================================================================
" 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

@@ -1,121 +0,0 @@
"=============================================================================
" 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:

View File

@@ -1,198 +0,0 @@
"=============================================================================
" 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

@@ -1,182 +0,0 @@
"=============================================================================
" 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:

View File

@@ -1,135 +0,0 @@
"=============================================================================
" 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

@@ -1,134 +0,0 @@
"=============================================================================
" 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

@@ -1,234 +0,0 @@
"=============================================================================
" 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

@@ -1,154 +0,0 @@
"=============================================================================
" 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:

View File

@@ -1,178 +0,0 @@
"=============================================================================
" 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

@@ -1,159 +0,0 @@
"=============================================================================
" 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:

View File

@@ -1,407 +0,0 @@
" ============================================================================
" File: gundo.vim
" Description: vim global plugin to visualize your undo tree
" Maintainer: Steve Losh <steve@stevelosh.com>
" License: GPLv2+ -- look it up.
" Notes: Much of this code was thiefed from Mercurial, and the rest was
" heavily inspired by scratch.vim and histwin.vim.
"
" ============================================================================
"{{{ Init
if v:version < '703'"{{{
function! s:GundoDidNotLoad()
echohl WarningMsg|echomsg "Gundo unavailable: requires Vim 7.3+"|echohl None
endfunction
command! -nargs=0 GundoToggle call s:GundoDidNotLoad()
finish
endif"}}}
if has('python')"{{{
let s:has_supported_python = 1
else
let s:has_supported_python = 0
endif
if !s:has_supported_python
function! s:GundoDidNotLoad()
echohl WarningMsg|echomsg "Gundo requires Vim to be compiled with Python 2.4+"|echohl None
endfunction
command! -nargs=0 GundoToggle call s:GundoDidNotLoad()
finish
endif"}}}
let s:plugin_path = escape(expand('<sfile>:p:h'), '\')
if !exists('g:gundo_width')"{{{
let g:gundo_width = 45
endif"}}}
if !exists('g:gundo_preview_height')"{{{
let g:gundo_preview_height = 15
endif"}}}
if !exists('g:gundo_preview_bottom')"{{{
let g:gundo_preview_bottom = 0
endif"}}}
if !exists('g:gundo_right')"{{{
let g:gundo_right = 0
endif"}}}
if !exists('g:gundo_help')"{{{
let g:gundo_help = 1
endif"}}}
if !exists("g:gundo_map_move_older")"{{{
let g:gundo_map_move_older = 'j'
endif"}}}
if !exists("g:gundo_map_move_newer")"{{{
let g:gundo_map_move_newer = 'k'
endif"}}}
if !exists("g:gundo_close_on_revert")"{{{
let g:gundo_close_on_revert = 0
endif"}}}
"}}}
"{{{ Gundo utility functions
function! s:GundoGetTargetState()"{{{
let target_line = matchstr(getline("."), '\v\[[0-9]+\]')
return matchstr(target_line, '\v[0-9]+')
endfunction"}}}
function! s:GundoGoToWindowForBufferName(name)"{{{
if bufwinnr(bufnr(a:name)) != -1
exe bufwinnr(bufnr(a:name)) . "wincmd w"
return 1
else
return 0
endif
endfunction"}}}
function! s:GundoIsVisible()"{{{
if bufwinnr(bufnr("__Gundo__")) != -1 || bufwinnr(bufnr("__Gundo_Preview__")) != -1
return 1
else
return 0
endif
endfunction"}}}
function! s:GundoInlineHelpLength()"{{{
if g:gundo_help
return 6
else
return 0
endif
endfunction"}}}
"}}}
"{{{ Gundo buffer settings
function! s:GundoMapGraph()"{{{
exec 'nnoremap <script> <silent> <buffer> ' . g:gundo_map_move_older . " :call <sid>GundoMove(1)<CR>"
exec 'nnoremap <script> <silent> <buffer> ' . g:gundo_map_move_newer . " :call <sid>GundoMove(-1)<CR>"
nnoremap <script> <silent> <buffer> <CR> :call <sid>GundoRevert()<CR>
nnoremap <script> <silent> <buffer> o :call <sid>GundoRevert()<CR>
nnoremap <script> <silent> <buffer> <down> :call <sid>GundoMove(1)<CR>
nnoremap <script> <silent> <buffer> <up> :call <sid>GundoMove(-1)<CR>
nnoremap <script> <silent> <buffer> gg gg:call <sid>GundoMove(1)<CR>
nnoremap <script> <silent> <buffer> P :call <sid>GundoPlayTo()<CR>
nnoremap <script> <silent> <buffer> p :call <sid>GundoRenderChangePreview()<CR>
nnoremap <script> <silent> <buffer> q :call <sid>GundoClose()<CR>
cabbrev <script> <silent> <buffer> q call <sid>GundoClose()
cabbrev <script> <silent> <buffer> quit call <sid>GundoClose()
nnoremap <script> <silent> <buffer> <2-LeftMouse> :call <sid>GundoMouseDoubleClick()<CR>
endfunction"}}}
function! s:GundoMapPreview()"{{{
nnoremap <script> <silent> <buffer> q :call <sid>GundoClose()<CR>
cabbrev <script> <silent> <buffer> q call <sid>GundoClose()
cabbrev <script> <silent> <buffer> quit call <sid>GundoClose()
endfunction"}}}
function! s:GundoSettingsGraph()"{{{
setlocal buftype=nofile
setlocal bufhidden=hide
setlocal noswapfile
setlocal nobuflisted
setlocal nomodifiable
setlocal filetype=gundo
setlocal nolist
setlocal nonumber
setlocal norelativenumber
setlocal nowrap
call s:GundoSyntaxGraph()
call s:GundoMapGraph()
endfunction"}}}
function! s:GundoSettingsPreview()"{{{
setlocal buftype=nofile
setlocal bufhidden=hide
setlocal noswapfile
setlocal nobuflisted
setlocal nomodifiable
setlocal filetype=diff
setlocal nonumber
setlocal norelativenumber
setlocal nowrap
setlocal foldlevel=20
setlocal foldmethod=diff
call s:GundoMapPreview()
endfunction"}}}
function! s:GundoSyntaxGraph()"{{{
let b:current_syntax = 'gundo'
syn match GundoCurrentLocation '@'
syn match GundoHelp '\v^".*$'
syn match GundoNumberField '\v\[[0-9]+\]'
syn match GundoNumber '\v[0-9]+' contained containedin=GundoNumberField
hi def link GundoCurrentLocation Keyword
hi def link GundoHelp Comment
hi def link GundoNumberField Comment
hi def link GundoNumber Identifier
endfunction"}}}
"}}}
"{{{ Gundo buffer/window management
function! s:GundoResizeBuffers(backto)"{{{
call s:GundoGoToWindowForBufferName('__Gundo__')
exe "vertical resize " . g:gundo_width
call s:GundoGoToWindowForBufferName('__Gundo_Preview__')
exe "resize " . g:gundo_preview_height
exe a:backto . "wincmd w"
endfunction"}}}
function! s:GundoOpenGraph()"{{{
let existing_gundo_buffer = bufnr("__Gundo__")
if existing_gundo_buffer == -1
call s:GundoGoToWindowForBufferName('__Gundo_Preview__')
exe "new __Gundo__"
if g:gundo_preview_bottom
if g:gundo_right
wincmd L
else
wincmd H
endif
endif
call s:GundoResizeBuffers(winnr())
else
let existing_gundo_window = bufwinnr(existing_gundo_buffer)
if existing_gundo_window != -1
if winnr() != existing_gundo_window
exe existing_gundo_window . "wincmd w"
endif
else
call s:GundoGoToWindowForBufferName('__Gundo_Preview__')
if g:gundo_preview_bottom
if g:gundo_right
exe "botright vsplit +buffer" . existing_gundo_buffer
else
exe "topleft vsplit +buffer" . existing_gundo_buffer
endif
else
exe "split +buffer" . existing_gundo_buffer
endif
call s:GundoResizeBuffers(winnr())
endif
endif
endfunction"}}}
function! s:GundoOpenPreview()"{{{
let existing_preview_buffer = bufnr("__Gundo_Preview__")
if existing_preview_buffer == -1
if g:gundo_preview_bottom
exe "botright new __Gundo_Preview__"
else
if g:gundo_right
exe "botright vnew __Gundo_Preview__"
else
exe "topleft vnew __Gundo_Preview__"
endif
endif
else
let existing_preview_window = bufwinnr(existing_preview_buffer)
if existing_preview_window != -1
if winnr() != existing_preview_window
exe existing_preview_window . "wincmd w"
endif
else
if g:gundo_preview_bottom
exe "botright split +buffer" . existing_preview_buffer
else
if g:gundo_right
exe "botright vsplit +buffer" . existing_preview_buffer
else
exe "topleft vsplit +buffer" . existing_preview_buffer
endif
endif
endif
endif
endfunction"}}}
function! s:GundoClose()"{{{
if s:GundoGoToWindowForBufferName('__Gundo__')
quit
endif
if s:GundoGoToWindowForBufferName('__Gundo_Preview__')
quit
endif
exe bufwinnr(g:gundo_target_n) . "wincmd w"
endfunction"}}}
function! s:GundoOpen()"{{{
if !exists('g:gundo_py_loaded')
exe 'pyfile ' . s:plugin_path . '/gundo.py'
python initPythonModule()
if !s:has_supported_python
function! s:GundoDidNotLoad()
echohl WarningMsg|echomsg "Gundo unavailable: requires Vim 7.3+"|echohl None
endfunction
command! -nargs=0 GundoToggle call s:GundoDidNotLoad()
call s:GundoDidNotLoad()
return
endif"
let g:gundo_py_loaded = 1
endif
" Save `splitbelow` value and set it to default to avoid problems with
" positioning new windows.
let saved_splitbelow = &splitbelow
let &splitbelow = 0
call s:GundoOpenPreview()
exe bufwinnr(g:gundo_target_n) . "wincmd w"
call s:GundoRenderGraph()
call s:GundoRenderPreview()
" Restore `splitbelow` value.
let &splitbelow = saved_splitbelow
endfunction"}}}
function! s:GundoToggle()"{{{
if s:GundoIsVisible()
call s:GundoClose()
else
let g:gundo_target_n = bufnr('')
let g:gundo_target_f = @%
call s:GundoOpen()
endif
endfunction"}}}
"}}}
"{{{ Gundo mouse handling
function! s:GundoMouseDoubleClick()"{{{
let start_line = getline('.')
if stridx(start_line, '[') == -1
return
else
call s:GundoRevert()
endif
endfunction"}}}
"}}}
"{{{ Gundo movement
function! s:GundoMove(direction) range"{{{
let start_line = getline('.')
if v:count1 == 0
let move_count = 1
else
let move_count = v:count1
endif
let distance = 2 * move_count
" If we're in between two nodes we move by one less to get back on track.
if stridx(start_line, '[') == -1
let distance = distance - 1
endif
let target_n = line('.') + (distance * a:direction)
" Bound the movement to the graph.
if target_n <= s:GundoInlineHelpLength() - 1
call cursor(s:GundoInlineHelpLength(), 0)
else
call cursor(target_n, 0)
endif
let line = getline('.')
" Move to the node, whether it's an @ or an o
let idx1 = stridx(line, '@')
let idx2 = stridx(line, 'o')
if idx1 != -1
call cursor(0, idx1 + 1)
else
call cursor(0, idx2 + 1)
endif
call s:GundoRenderPreview()
endfunction"}}}
"}}}
"{{{ Gundo rendering
function! s:GundoRenderGraph()"{{{
python GundoRenderGraph()
endfunction"}}}
function! s:GundoRenderPreview()"{{{
python GundoRenderPreview()
endfunction"}}}
function! s:GundoRenderChangePreview()"{{{
python GundoRenderChangePreview()
endfunction"}}}
"}}}
"{{{ Gundo undo/redo
function! s:GundoRevert()"{{{
python GundoRevert()
endfunction"}}}
function! s:GundoPlayTo()"{{{
python GundoPlayTo()
endfunction"}}}
"}}}
"{{{ Misc
function! gundo#GundoToggle()"{{{
call s:GundoToggle()
endfunction"}}}
function! gundo#GundoRenderGraph()"{{{
call s:GundoRenderGraph()
endfunction"}}}
augroup GundoAug
autocmd!
autocmd BufNewFile __Gundo__ call s:GundoSettingsGraph()
autocmd BufNewFile __Gundo_Preview__ call s:GundoSettingsPreview()
augroup END
"}}}

View File

@@ -1,570 +0,0 @@
"=============================================================================
" Copyright (c) 2009-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if exists('g:loaded_autoload_l9')
finish
endif
let g:loaded_autoload_l9 = 1
" }}}1
"=============================================================================
" COMPATIBILITY TEST {{{1
"
let s:L9_VERSION_CURRENT = 101
let s:L9_VERSION_PASSABLE = 101
" returns true if given version is compatible.
function l9#isCompatible(ver)
return
endfunction
let s:VERSION_FACTOR = str2float('0.01')
" returns false if the caller script should finish.
" a:vimVersion: if 0, don't check vim version
" a:l9Version: same rule as v:version
function l9#guardScriptLoading(path, vimVersion, l9Version, exprs)
let loadedVarName = 'g:loaded_' . substitute(a:path, '\W', '_', 'g')
if exists(loadedVarName)
return 0
elseif a:vimVersion > 0 && a:vimVersion > v:version
echoerr a:path . ' requires Vim version ' . string(a:vimVersion * s:VERSION_FACTOR)
return 0
elseif a:l9Version > 0 && (a:l9Version > s:L9_VERSION_CURRENT ||
\ a:l9Version < s:L9_VERSION_PASSABLE)
echoerr a:path . ' requires L9 library version ' . string(a:l9Version * s:VERSION_FACTOR)
return 0
endif
for expr in a:exprs
if !eval(expr)
echoerr a:path . ' requires: ' . expr
return 0
endif
endfor
let {loadedVarName} = 1
return 1
endfunction
"
function l9#getVersion()
return s:L9_VERSION_CURRENT
endfunction
" }}}1
"=============================================================================
" LIST {{{1
" Removes duplicates (unstable)
" This function doesn't change the list of argument.
function l9#unique(items)
let sorted = sort(a:items)
if len(sorted) < 2
return sorted
endif
let last = remove(sorted, 0)
let result = [last]
for item in sorted
if item != last
call add(result, item)
let last = item
endif
endfor
return result
endfunction
" Removes duplicates (stable)
" This function doesn't change the list of argument.
function l9#uniqueStably(items)
let result = []
for item in a:items
if count(result, item, &ignorecase) == 0
call add(result, item)
endif
endfor
return result
endfunction
" [ [0], [1,2], [3] ] -> [ 0, 1, 2, 3 ]
" This function doesn't change the list of argument.
function l9#concat(items)
let result = []
for l in a:items
let result += l
endfor
return result
endfunction
" [ [0,1,2], [3,4], [5,6,7,8] ] -> [ [0,3,5],[1,4,6] ]
" This function doesn't change the list of argument.
function l9#zip(items)
let result = []
for i in range(min(map(copy(a:items), 'len(v:val)')))
call add(result, map(copy(a:items), 'v:val[i]'))
endfor
return result
endfunction
" filter() with the maximum number of items
" This function doesn't change the list of argument.
function l9#filterWithLimit(items, expr, limit)
if a:limit <= 0
return filter(copy(a:items), a:expr)
endif
let result = []
let stride = a:limit * 3 / 2 " x1.5
for i in range(0, len(a:items) - 1, stride)
let result += filter(a:items[i : i + stride - 1], a:expr)
if len(result) >= a:limit
return remove(result, 0, a:limit - 1)
endif
endfor
return result
endfunction
" Removes if a:expr is evaluated as non-zero and returns removed items.
" This function change the list of argument.
function l9#removeIf(items, expr)
let removed = filter(copy(a:items), a:expr)
call filter(a:items, '!( ' . a:expr . ')')
return removed
endfunction
" }}}1
"=============================================================================
" NUMERIC {{{1
" }}}1
"=============================================================================
" STRING {{{1
" Snips a:str and add a:mask if the length of a:str is more than a:len
function l9#snipHead(str, len, mask)
if a:len >= len(a:str)
return a:str
elseif a:len <= len(a:mask)
return a:mask
endif
return a:mask . a:str[-a:len + len(a:mask):]
endfunction
" Snips a:str and add a:mask if the length of a:str is more than a:len
function l9#snipTail(str, len, mask)
if a:len >= len(a:str)
return a:str
elseif a:len <= len(a:mask)
return a:mask
endif
return a:str[:a:len - 1 - len(a:mask)] . a:mask
endfunction
" Snips a:str and add a:mask if the length of a:str is more than a:len
function l9#snipMid(str, len, mask)
if a:len >= len(a:str)
return a:str
elseif a:len <= len(a:mask)
return a:mask
endif
let len_head = (a:len - len(a:mask)) / 2
let len_tail = a:len - len(a:mask) - len_head
return (len_head > 0 ? a:str[: len_head - 1] : '') . a:mask .
\ (len_tail > 0 ? a:str[-len_tail :] : '')
endfunction
"
function l9#hash224(str)
let a = 0x00000800 " shift 11 bit (if unsigned)
let b = 0x001fffff " extract 11 bit (if unsigned)
let nHash = 7
let hashes = repeat([0], nHash)
for i in range(len(a:str))
let iHash = i % nHash
let hashes[iHash] = hashes[iHash] * a + hashes[iHash] / b
let hashes[iHash] += char2nr(a:str[i])
endfor
return join(map(hashes, 'printf("%08x", v:val)'), '')
endfunction
" wildcard -> regexp
function l9#convertWildcardToRegexp(expr)
let re = escape(a:expr, '\')
for [pat, sub] in [ [ '*', '\\.\\*' ], [ '?', '\\.' ], [ '[', '\\[' ], ]
let re = substitute(re, pat, sub, 'g')
endfor
return '\V' . re
endfunction
" }}}1
"=============================================================================
" LINES {{{1
" Removes from the line matching with a:begin first to the line matching with
" a:end next and returns removed lines.
" If matching range is not found, returns []
function l9#removeLinesBetween(lines, begin, end)
for i in range(len(a:lines) - 1)
if a:lines[i] =~ a:begin
break
endif
endfor
for j in range(i + 1, len(a:lines) - 1)
if a:lines[j] =~ a:end
let g:l0 += [a:lines[i : j]]
return remove(a:lines, i, j)
endif
endfor
return []
endfunction
" }}}1
"=============================================================================
" PATH {{{1
" returns the path separator charactor.
function l9#getPathSeparator()
return (!&shellslash && (has('win32') || has('win64')) ? '\' : '/')
endfunction
" [ 'a', 'b/', '/c' ] -> 'a/b/c'
function l9#concatPaths(paths)
let result = ''
for p in a:paths
if empty(p)
continue
elseif empty(result)
let result = p
else
let result = substitute(result, '[/\\]$', '', '') . l9#getPathSeparator()
\ . substitute(p, '^[/\\]', '', '')
endif
endfor
return result
endfunction
" path: '/a/b/c/d', dir: '/a/b' => 'c/d'
function l9#modifyPathRelativeToDir(path, dir)
let pathFull = fnamemodify(a:path, ':p')
let dirFull = fnamemodify(a:dir, ':p')
if len(pathFull) < len(dirFull) || pathFull[:len(dirFull) - 1] !=# dirFull
return pathFull
endif
return pathFull[len(dirFull):]
endfunction
" }}}1
"=============================================================================
" FILE {{{1
" Almost same as readfile().
function l9#readFile(...)
let args = copy(a:000)
let args[0] = expand(args[0])
try
return call('readfile', args)
catch
endtry
return []
endfunction
" Almost same as writefile().
function l9#writeFile(...)
let args = copy(a:000)
let args[1] = expand(args[1])
let dir = fnamemodify(args[1], ':h')
try
if !isdirectory(dir)
call mkdir(dir, 'p')
endif
return call('writefile', args)
catch
endtry
return -1 " -1 is error code.
endfunction
" }}}1
"=============================================================================
" BUFFER {{{1
" :wall/:wall! wrapper. Useful for writing readonly buffers.
function l9#writeAll()
try
silent update " NOTE: avoiding a problem with a buftype=acwrite buffer.
silent wall
catch /^Vim/ " E45, E505
if l9#inputHl('Question', v:exception . "\nWrite readonly files? (Y/N) : ", 'Y') ==? 'y'
redraw
:wall!
endif
endtry
endfunction
" Loads given files with :edit command
function l9#loadFilesToBuffers(files)
for file in filter(copy(a:files), '!bufloaded(v:val)')
execute 'edit ' . fnameescape(file)
if !exists('bufNrFirst')
let bufNrFirst = bufnr('%')
endif
endfor
if exists('bufNrFirst')
execute bufNrFirst . 'buffer'
endif
endfunction
" Deletes all buffers except given files with :bdelete command
function l9#deleteAllBuffersExcept(files)
let bufNrExcepts = map(copy(a:files), 'bufnr("^" . v:val . "$")')
for bufNr in filter(range(1, bufnr('$')), 'bufloaded(v:val)')
if count(bufNrExcepts, bufNr) == 0
execute bufNr . 'bdelete'
endif
endfor
endfunction
" }}}1
"=============================================================================
" WINDOW {{{1
" move current window to next tabpage.
function l9#shiftWinNextTabpage()
if tabpagenr('$') < 2
return
endif
let bufnr = bufnr('%')
tabnext
execute bufnr . 'sbuffer'
tabprevious
if winnr('$') > 1
close
tabnext
else
close " if tabpage is closed, next tabpage will become current
endif
endfunction
" move current window to previous tabpage.
function l9#shiftWinPrevTabpage()
if tabpagenr('$') < 2
return
endif
let bufnr = bufnr('%')
tabprevious
execute bufnr . 'sbuffer'
tabnext
close
tabprevious
endfunction
" move to a window containing specified buffer.
" returns 0 if the buffer is not found.
function l9#moveToBufferWindowInCurrentTabpage(bufNr)
if bufnr('%') == a:bufNr
return 1
elseif count(tabpagebuflist(), a:bufNr) == 0
return 0
endif
execute bufwinnr(a:bufNr) . 'wincmd w'
return 1
endfunction
" returns 0 if the buffer is not found.
function s:moveToOtherTabpageOpeningBuffer(bufNr)
for tabNr in range(1, tabpagenr('$'))
if tabNr != tabpagenr() && count(tabpagebuflist(tabNr), a:bufNr) > 0
execute 'tabnext ' . tabNr
return 1
endif
endfor
return 0
endfunction
" move to a window containing specified buffer.
" returns 0 if the buffer is not found.
function l9#moveToBufferWindowInOtherTabpage(bufNr)
if !s:moveToOtherTabpageOpeningBuffer(a:bufNr)
return 0
endif
return l9#moveToBufferWindowInCurrentTabpage(a:bufNr)
endfunction
" }}}1
"=============================================================================
" COMMAND LINE {{{1
" echo/echomsg with highlighting.
function l9#echoHl(hl, msg, prefix, addingHistory)
let echoCmd = (a:addingHistory ? 'echomsg' : 'echo')
execute "echohl " . a:hl
try
for l in (type(a:msg) == type([]) ? a:msg : split(a:msg, "\n"))
execute echoCmd . ' a:prefix . l'
endfor
finally
echohl None
endtry
endfunction
" input() with highlighting.
" This function can take list as {completion} argument.
function l9#inputHl(hl, ...)
execute "echohl " . a:hl
try
let args = copy(a:000)
if len(args) > 2 && type(args[2]) == type([])
let s:candidatesForInputHl = args[2]
let args[2] = 'custom,l9#completeForInputHl'
endif
let s = call('input', args)
unlet! s:candidatesForInputHl
finally
echohl None
endtry
redraw " needed to show following echo to next line.
return s
endfunction
" only called by l9#inputHl() for completion.
function l9#completeForInputHl(lead, line, pos)
return join(s:candidatesForInputHl, "\n")
endfunction
" }}}1
"=============================================================================
" VISUAL MODE {{{1
" returns last selected text in Visual mode.
function l9#getSelectedText()
let reg_ = [@", getregtype('"')]
let regA = [@a, getregtype('a')]
if mode() =~# "[vV\<C-v>]"
silent normal! "aygv
else
let pos = getpos('.')
silent normal! gv"ay
call setpos('.', pos)
endif
let text = @a
call setreg('"', reg_[0], reg_[1])
call setreg('a', regA[0], regA[1])
return text
endfunction
" }}}1
"=============================================================================
" EVAL {{{1
" loads given text as Vim script with :source command
function l9#loadScript(text)
let lines = (type(a:text) == type([]) ? a:text : split(a:text, "\n"))
let fname = tempname()
call writefile(lines, fname)
source `=fname`
call delete(fname)
endfunction
" }}}1
"=============================================================================
" VARIABLES {{{1
"
function l9#defineVariableDefault(name, default)
if !exists(a:name)
let {a:name} = a:default
endif
endfunction
" }}}1
"=============================================================================
" GREP {{{1
" Execute :vimgrep and opens the quickfix window if matches are found.
"
" a:pattern: search pattern. If ommitted, last search pattern (@/) is used.
" a:files: List of files
function l9#grepFiles(pattern, files)
let target = join(map(a:files, 'escape(v:val, " ")'), ' ')
let pattern = (a:pattern[0] ==# '/' ? a:pattern[1:] : a:pattern)
let pattern = (empty(pattern) ? @/ : pattern)
try
execute printf('vimgrep/%s/j %s', pattern, target)
catch /^Vim/
call setqflist([])
endtry
call l9#quickfix#sort()
call l9#quickfix#openIfNotEmpty(1, 0)
endfunction
" Execute :vimgrep for buffers using l9#grepFiles()
" See also: :L9GrepBuffer :L9GrepBufferAll
function l9#grepBuffers(pattern, bufNrs)
let files = map(filter(a:bufNrs, 'bufloaded(v:val)'), 'bufname(v:val)')
call l9#grepFiles(a:pattern, files)
endfunction
" }}}1
"=============================================================================
" SIGN {{{1
" Highlights lines using :sign define and :sign place.
"
" a:linehl, a:text, a:texthl: See |signs|. Ignored if empty string.
" a:locations: List of [{buffer number}, {line number}] for highlighting
function l9#placeSign(linehl, text, texthl, locations)
let argLinehl = (empty(a:linehl) ? '' : 'linehl=' . a:linehl)
let argText = (empty(a:text) ? '' : 'text=' . a:text)
let argTexthl = (empty(a:texthl) ? '' : 'texthl=' . a:texthl)
let name = 'l9--' . a:linehl . '--' . a:text . '--' . a:texthl
execute printf('sign define %s linehl=%s text=%s texthl=%s',
\ name, a:linehl, a:text, a:texthl)
for [bufNr, lnum] in a:locations
execute printf('sign place 1 line=%d name=%s buffer=%d', lnum, name, bufNr)
endfor
endfunction
" }}}1
"=============================================================================
" NOTIFY EXTERNALLY {{{1
" Notify a message using an external program.
" Currently supports Balloonly, Screen, and Tmux.
function l9#notifyExternally(msg)
return l9#notifyBalloonly(a:msg)
\ || l9#notifyScreen(a:msg)
\ || l9#notifyTmux(a:msg)
endfunction
"
function l9#notifyBalloonly(msg)
if !(has('win32') || has('win64')) || !executable(g:l9_balloonly)
return 0
endif
execute 'silent !start ' . shellescape(g:l9_balloonly) . ' 4000 "l9" ' . shellescape(a:msg)
return 1
endfunction
"
function l9#notifyScreen(msg)
if !has('unix') || has('gui_running') || $WINDOW !~ '\d' || !executable('screen')
return 0
endif
call system('screen -X wall ' . shellescape('l9: ' . a:msg))
return 1
endfunction
"
function l9#notifyTmux(msg)
if !has('unix') || has('gui_running') || empty($TMUX) || !executable('tmux')
return 0
endif
call system('tmux display-message ' . shellescape('l9: ' . a:msg))
return 1
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@@ -1,92 +0,0 @@
#!/usr/bin/env python
from __future__ import with_statement
import vim
import os
import subprocess
import threading
import Queue
class Asyncer:
def __init__(self):
self._workers = {}
def execute(self, var_key, var_command, var_cwd, var_input, var_appends):
key = vim.eval(var_key)
command = vim.eval(var_command)
cwd = vim.eval(var_cwd)
input = vim.eval(var_input)
appends = vim.eval(var_appends)
if key not in self._workers:
self._workers[key] = Worker()
self._workers[key].start()
self._workers[key].put(Executor(command, cwd, input, appends))
def print_output(self, var_key):
key = vim.eval(var_key)
if key not in self._workers:
return
for l in self._workers[key].copy_outputs():
print l,
def print_worker_keys(self):
for k in self._workers.keys():
print k
def print_active_worker_keys(self):
for k in self._workers.keys():
print k
class Worker(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self._queue = Queue.Queue()
self._lines = []
self._lock = threading.Lock()
def run(self):
while True:
self._queue.get().execute(self)
self._queue.task_done()
def put(self, executor):
self._queue.put(executor)
def clear_outputs(self):
with self._lock:
self._lines = []
def record_output(self, line):
with self._lock:
self._lines.append(line)
def copy_outputs(self):
with self._lock:
return self._lines[:]
class Executor:
def __init__(self, command, cwd, input, appends):
self._command = command
self._cwd = cwd
self._input = input
self._appends = appends
def execute(self, worker):
if not self._appends:
worker.clear_outputs()
os.chdir(self._cwd)
p = subprocess.Popen(self._command, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
p.stdin.write(self._input)
line = p.stdout.readline()
while line:
worker.record_output(line)
line = p.stdout.readline()

View File

@@ -1,67 +0,0 @@
"=============================================================================
" Copyright (C) 2009-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, ['has("python")'])
finish
endif
" }}}1
"=============================================================================
" ASYNC EXECUTE {{{1
"
function s:checkKey(key)
if a:key =~ '\n' || a:key !~ '\S'
throw "Asyncer: Invalid key: " . a:key
endif
endfunction
"
function l9#async#execute(key, cmd, cwd, input, appends)
call s:checkKey(a:key)
python asyncer.execute('a:key', 'a:cmd', 'a:cwd', 'a:input', 'a:appends')
endfunction
"
function l9#async#read(key)
call s:checkKey(a:key)
redir => result
silent python asyncer.print_output('a:key')
redir END
" NOTE: "\n" is somehow inserted by redir.
return (result[0] ==# "\n" ? result[1:] : result)
endfunction
"
function l9#async#listWorkers()
redir => result
silent python asyncer.print_worker_keys()
redir END
return split(result, "\n")
endfunction
"
function l9#async#listActiveWorkers()
redir => result
silent python asyncer.print_active_worker_keys()
redir END
return split(result, "\n")
endfunction
" }}}1
"=============================================================================
" INITIALIZATION {{{1
let s:ASYNC_PY_PATH = fnamemodify(expand('<sfile>:p:h'), ':p') . 'async.py'
pyfile `=s:ASYNC_PY_PATH`
python asyncer = Asyncer()
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@@ -1,107 +0,0 @@
"=============================================================================
" Copyright (C) 2009-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" QUICKFIX {{{1
" Returns non-zero if quickfix window is opened.
function l9#quickfix#isWindowOpened()
return count(map(range(1, winnr('$')), 'getwinvar(v:val, "&buftype")'), 'quickfix') > 0
endfunction
" Opens quickfix window if quickfix is not empty, and echo the number of errors.
"
" a:onlyRecognized: if non-zero, opens only if quickfix has recognized errors.
" a:holdCursor: if non-zero, the cursor won't move to quickfix window.
function l9#quickfix#openIfNotEmpty(onlyRecognized, holdCursor)
let numErrors = len(filter(getqflist(), 'v:val.valid'))
let numOthers = len(getqflist()) - numErrors
if numErrors > 0 || (!a:onlyRecognized && numOthers > 0)
copen
if a:holdCursor
wincmd p
endif
else
cclose
endif
redraw
if numOthers > 0
echo printf('Quickfix: %d(+%d)', numErrors, numOthers)
else
echo printf('Quickfix: %d', numErrors)
endif
endfunction
" Toggles Quickfix window
function l9#quickfix#toggleWindow()
if l9#quickfix#isWindowOpened()
cclose
else
call l9#quickfix#openIfNotEmpty(0, 0)
endif
endfunction
" Creates quickfix list form given lines and opens the quickfix window if
" errors exists.
"
" a:lines:
" a:jump: if non-zero, jump to the first error.
function l9#quickfix#setMakeResult(lines)
cexpr a:lines
call l9#quickfix#openIfNotEmpty(0, 1)
endfunction
" Compares quickfix entries for sorting.
function l9#quickfix#compareEntries(e0, e1)
if a:e0.bufnr != a:e1.bufnr
let i0 = bufname(a:e0.bufnr)
let i1 = bufname(a:e1.bufnr)
elseif a:e0.lnum != a:e1.lnum
let i0 = a:e0.lnum
let i1 = a:e1.lnum
elseif a:e0.col != a:e1.col
let i0 = a:e0.col
let i1 = a:e1.col
else
return 0
endif
return (i0 > i1 ? +1 : -1)
endfunction
" Sorts quickfix
function l9#quickfix#sort()
call setqflist(sort(getqflist(), 'l9#quickfix#compareEntries'), 'r')
endfunction
" Highlights Quickfix lines by :sign.
" Inspired by errormarker plugin.
"
" You can customize the highlighting via L9ErrorLine and L9WarningLine
" highlight groups.
function l9#quickfix#placeSign()
let warnings = []
let errors = []
for e in filter(getqflist(), 'v:val.valid')
let warning = (e.type ==? 'w' || e.text =~? '^\s*warning:')
call add((warning ? warnings : errors), [e.bufnr, e.lnum])
endfor
sign unplace *
call l9#placeSign('L9WarningLine', '>>', '', warnings)
call l9#placeSign('L9ErrorLine', '>>', '', errors)
endfunction
highlight default L9ErrorLine ctermfg=white ctermbg=52 guibg=#5F0000
highlight default L9WarningLine ctermfg=white ctermbg=17 guibg=#00005F
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@@ -1,112 +0,0 @@
"=============================================================================
" Copyright (C) 2009-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" TEMPORARY BUFFER {{{1
" each key is a buffer name.
let s:dataMap = {}
"
function s:onBufDelete(bufname)
if exists('s:dataMap[a:bufname].listener.onClose')
call s:dataMap[a:bufname].listener.onClose(s:dataMap[a:bufname].written)
endif
if bufnr('%') == s:dataMap[a:bufname].bufNr && winnr('#') != 0
" if winnr('#') returns 0, "wincmd p" causes ringing the bell.
wincmd p
endif
endfunction
"
function s:onBufWriteCmd(bufname)
if !exists('s:dataMap[a:bufname].listener.onWrite') ||
\ s:dataMap[a:bufname].listener.onWrite(getline(1, '$'))
setlocal nomodified
let s:dataMap[a:bufname].written = 1
call l9#tempbuffer#close(a:bufname)
else
endif
endfunction
" a:bufname:
" a:height: Window height. If 0, default height is used.
" If less than 0, the window becomes full-screen.
" a:listener:
" a:listener.onClose(written)
function l9#tempbuffer#openScratch(bufname, filetype, lines, topleft, vertical, height, listener)
let openCmdPrefix = (a:topleft ? 'topleft ' : '')
\ . (a:vertical ? 'vertical ' : '')
\ . (a:height > 0 ? a:height : '')
if !exists('s:dataMap[a:bufname]') || !bufexists(s:dataMap[a:bufname].bufNr)
execute openCmdPrefix . 'new'
else
call l9#tempbuffer#close(a:bufname)
execute openCmdPrefix . 'split'
execute 'silent ' . s:dataMap[a:bufname].bufNr . 'buffer'
endif
if a:height < 0
only
endif
setlocal buflisted noswapfile bufhidden=delete modifiable noreadonly buftype=nofile
let &l:filetype = a:filetype
silent file `=a:bufname`
call setline(1, a:lines)
setlocal nomodified
augroup L9TempBuffer
autocmd! * <buffer>
execute printf('autocmd BufDelete <buffer> call s:onBufDelete (%s)', string(a:bufname))
execute printf('autocmd BufWriteCmd <buffer> nested call s:onBufWriteCmd(%s)', string(a:bufname))
augroup END
let s:dataMap[a:bufname] = {
\ 'bufNr': bufnr('%'),
\ 'written': 0,
\ 'listener': a:listener,
\ }
endfunction
"
function l9#tempbuffer#openReadOnly(bufname, filetype, lines, topleft, vertical, height, listener)
call l9#tempbuffer#openScratch(a:bufname, a:filetype, a:lines, a:topleft, a:vertical, a:height, a:listener)
setlocal nomodifiable readonly
endfunction
" a:listener:
" a:listener.onClose(written)
" a:listener.onWrite(lines)
function l9#tempbuffer#openWritable(bufname, filetype, lines, topleft, vertical, height, listener)
call l9#tempbuffer#openScratch(a:bufname, a:filetype, a:lines, a:topleft, a:vertical, a:height, a:listener)
setlocal buftype=acwrite
endfunction
" makes specified temp buffer current.
function l9#tempbuffer#moveTo(bufname)
return l9#moveToBufferWindowInCurrentTabpage(s:dataMap[a:bufname].bufNr) ||
\ l9#moveToBufferWindowInOtherTabpage(s:dataMap[a:bufname].bufNr)
endfunction
"
function l9#tempbuffer#close(bufname)
if !l9#tempbuffer#isOpen(a:bufname)
return
endif
execute printf('%dbdelete!', s:dataMap[a:bufname].bufNr)
endfunction
"
function l9#tempbuffer#isOpen(bufname)
return exists('s:dataMap[a:bufname]') && bufloaded(s:dataMap[a:bufname].bufNr)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@@ -1,60 +0,0 @@
"=============================================================================
" Copyright (C) 2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" TEMPORARY VARIABLES {{{1
"
let s:origMap = {}
" set temporary variables
function l9#tempvariables#set(group, name, value)
if !exists('s:origMap[a:group]')
let s:origMap[a:group] = {}
endif
if !exists('s:origMap[a:group][a:name]')
let s:origMap[a:group][a:name] = eval(a:name)
endif
execute 'let ' . a:name . ' = a:value'
endfunction
" set temporary variables
function l9#tempvariables#setList(group, variables)
for [name, value] in a:variables
call l9#tempvariables#set(a:group, name, value)
unlet value " to avoid E706
endfor
endfunction
" get temporary variables
function l9#tempvariables#getList(group)
if !exists('s:origMap[a:group]')
return []
endif
return map(keys(s:origMap[a:group]), '[v:val, eval(v:val)]')
endfunction
" restore original variables and clean up.
function l9#tempvariables#end(group)
if !exists('s:origMap[a:group]')
return
endif
for [name, value] in items(s:origMap[a:group])
execute 'let ' . name . ' = value'
unlet value " to avoid E706
endfor
unlet s:origMap[a:group]
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@@ -1,127 +0,0 @@
Lorem ipsum dolor sit amet...
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis splople autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
Nunc varius risus quis nulla. Vivamus vel magna. Ut rutrum. Aenean dignissim, leo quis faucibus semper, massa est faucibus massa, sit amet pharetra arcu nunc et sem. Aliquam tempor. Nam lobortis sem non urna. Pellentesque et urna sit amet leo accumsan volutpat. Nam molestie lobortis lorem. Quisque eu nulla. Donec id orci in ligula dapibus egestas. Donec sed velit ac lectus mattis sagittis.
In hac habitasse platea dictumst. Maecenas in ligula. Duis tincidunt odio sollicitudin quam. Nullam non mauris. Phasellus lacinia, velit sit amet bibendum euismod, leo diam interdum ligula, eu scelerisque sem purus in tellus.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In sit amet nunc id quam porta varius. Ut aliquet facilisis turpis. Etiam pellentesque quam et erat. Praesent suscipit justo.
Cras nec metus pulvinar sem tempor hendrerit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nullam in nulla. Mauris elementum. Curabitur tempor, quam ac rutrum placerat, nunc augue ullamcorper est, vitae molestie neque nunc a nunc. Integer justo dolor, consequat id, rutrum auctor, ullamcorper sed, orci. In hac habitasse platea dictumst. Fusce euismod semper orci. Integer venenatis quam non nunc. Vivamus in lorem a nisi aliquet commodo. Suspendisse massa lorem, dignissim at, vehicula et, ornare non, libero. Donec molestie, velit quis dictum scelerisque, est lectus hendrerit lorem, eget dignissim orci nisl sit amet massa. Etiam volutpat lobortis eros. Nunc ac tellus in sapien molestie rhoncus. Pellentesque nisl. Praesent venenatis blandit velit. Fusce rutrum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque vitae erat. Vivamus porttitor cursus lacus. Pellentesque tellus. Nunc aliquam interdum felis. Nulla imperdiet leo. Mauris hendrerit, sem at mollis pharetra, leo sapien pretium elit, a faucibus sapien dolor vel pede. Vestibulum et enim ut nulla sollicitudin adipiscing. Suspendisse malesuada venenatis mauris. Curabitur ornare mollis velit. Sed vitae metus. Morbi posuere mi id odio. Donec elit sem, tempor at, pharetra eu, sodales sit amet, elit.
Curabitur urna tellus, aliquam vitae, ultrices eget, vehicula nec, diam. Integer elementum, felis non faucibus euismod, erat massa dictum eros, eu ornare ligula tortor et mauris. Cras molestie magna in nibh. Aenean et tellus. Fusce adipiscing commodo erat. In eu justo. Nulla dictum, erat sed blandit venenatis, arcu dolor molestie dolor, vitae congue orci risus a nulla. Pellentesque sit amet arcu. In mattis laoreet enim. Pellentesque id augue et arcu blandit tincidunt. Pellentesque elit ante, rhoncus quis, dapibus sit amet, tincidunt eu, nibh. In imperdiet. Nunc lectus neque, commodo eget, porttitor quis, fringilla quis, purus.
Duis sagittis dignissim eros. In sit amet lectus. Fusce lacinia mauris vitae nisl interdum condimentum. Etiam in magna ac nibh ultrices vehicula. Maecenas commodo facilisis lectus. Praesent sed mi. Phasellus ipsum. Donec quis tellus id lectus faucibus molestie. Praesent vel ligula. Nam venenatis neque quis mauris. Proin felis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam quam. Nam felis velit, semper nec, aliquam nec, iaculis vel, mi. Nullam et augue vitae nunc tristique vehicula. Suspendisse eget elit. Duis adipiscing dui non quam.
Duis posuere tortor sit amet est iaculis egestas. Ut at magna. Etiam dui nisi, blandit quis, fermentum vitae, auctor vel, sem. Cras et leo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin luctus, odio eu porttitor adipiscing, ante elit tristique tortor, sit amet malesuada tortor nisi sit amet neque. Praesent rhoncus eros non velit. Pellentesque mattis. Sed sit amet ante. Mauris ac nibh eget risus volutpat tempor. Praesent volutpat sollicitudin dui. Sed in tellus id urna viverra commodo. Vestibulum enim felis, interdum non, sollicitudin in, posuere a, sem. Cras nibh.
Sed facilisis ultrices dolor. Vestibulum pretium mauris sed turpis. Phasellus a pede id odio interdum elementum. Nam urna felis, sodales ut, luctus vel, condimentum vitae, est. Vestibulum ut augue. Nunc laoreet sapien quis neque semper dictum. Phasellus rhoncus est id turpis. Vestibulum in elit at odio pellentesque volutpat. Nam nec tortor. Suspendisse porttitor consequat nulla. Morbi suscipit tincidunt nisi. Sed laoreet, mauris et tincidunt facilisis, est nisi pellentesque ligula, sit amet convallis neque dolor at sapien. Aenean viverra justo ac sem.
Pellentesque at dolor non lectus sagittis semper. Donec quis mi. Duis eget pede. Phasellus arcu tellus, ultricies id, consequat id, lobortis nec, diam. Suspendisse sed nunc. Pellentesque id magna. Morbi interdum quam at est. Maecenas eleifend mi in urna. Praesent et lectus ac nibh luctus viverra. In vel dolor sed nibh sollicitudin tincidunt. Ut consequat nisi sit amet nibh. Nunc mi tortor, tristique sit amet, rhoncus porta, malesuada elementum, nisi. Integer vitae enim quis risus aliquet gravida. Curabitur vel lorem vel erat dapibus lobortis. Donec dignissim tellus at arcu. Quisque molestie pulvinar sem.
Nulla magna neque, ullamcorper tempus, luctus eget, malesuada ut, velit. Morbi felis. Praesent in purus at ipsum cursus posuere. Morbi bibendum facilisis eros. Phasellus aliquam sapien in erat. Praesent venenatis diam dignissim dui. Praesent risus erat, iaculis ac, dapibus sed, imperdiet ac, erat. Nullam sed ipsum. Phasellus non dolor. Donec ut elit.
Sed risus.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum sem lacus, commodo vitae, aliquam ut, posuere eget, dui. Praesent massa dui, mattis et, vehicula auctor, iaculis id, diam. Morbi viverra neque sit amet risus. Nunc pellentesque aliquam orci. Proin neque elit, mollis vel, tristique nec, varius consectetuer, lorem. Nam malesuada ornare nunc. Duis turpis turpis, fermentum a, aliquet quis, sodales at, dolor. Duis eget velit eget risus fringilla hendrerit. Nulla facilisi. Mauris turpis pede, aliquet ac, mattis sed, consequat in, massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam egestas posuere metus. Aliquam erat volutpat. Donec non tortor. Vivamus posuere nisi mollis dolor. Quisque porttitor nisi ac elit. Nullam tincidunt ligula vitae nulla.
Vivamus sit amet risus et ipsum viverra malesuada. Duis luctus. Curabitur adipiscing metus et felis. Vestibulum tortor. Pellentesque purus. Donec pharetra, massa quis malesuada auctor, tortor ipsum lobortis ipsum, eget facilisis ante nisi eget lectus. Sed a est. Aliquam nec felis eu sem euismod viverra. Suspendisse felis mi, dictum id, convallis ac, mattis non, nibh. Donec sagittis quam eu mauris. Phasellus et leo at quam dapibus pellentesque. In non lacus. Nullam tristique nunc ut arcu scelerisque aliquam. Nullam viverra magna vitae leo. Vestibulum in lacus sit amet lectus tempus aliquet. Duis cursus nisl ac orci. Donec non nisl. Mauris lacus sapien, congue a, facilisis at, egestas vel, quam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.
Phasellus ipsum odio, suscipit nec, fringilla at, vehicula quis, tellus. Phasellus gravida condimentum dui. Aenean imperdiet arcu vitae ipsum. Duis dapibus, nisi non porttitor iaculis, ligula odio sollicitudin mauris, non luctus nunc massa a velit. Fusce ac nisi. Integer volutpat elementum metus. Vivamus luctus ultricies diam. Curabitur euismod. Vivamus quam. Nunc ante. Nulla mi nulla, vehicula nec, ultrices a, tincidunt vel, enim.
Suspendisse potenti. Aenean sed velit. Nunc a urna quis turpis imperdiet sollicitudin. Mauris aliquam mauris ut tortor. Pellentesque tincidunt mattis nibh. In id lectus eu magna vulputate ultrices. Aliquam interdum varius enim. Maecenas at mauris. Sed sed nibh. Nam non turpis. Maecenas fermentum nibh in est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Duis sagittis fermentum nunc. Nullam elementum erat. Quisque dapibus, augue nec dapibus bibendum, velit enim scelerisque sem, accumsan suscipit lectus odio ac justo. Fusce in felis a enim rhoncus placerat. Cras nec eros et mi egestas facilisis. In hendrerit tincidunt neque. Maecenas tellus. Fusce sollicitudin molestie dui. Sed magna orci, accumsan nec, viverra non, pharetra id, dui.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam placerat mi vitae felis. In porta, quam sit amet sodales elementum, elit dolor aliquam elit, a commodo nisi felis nec nibh. Nulla facilisi. Etiam at tortor. Vivamus quis sapien nec magna scelerisque lobortis.
Curabitur tincidunt viverra justo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed eros ante, mattis ullamcorper, posuere quis, tempor vel, metus. Maecenas cursus cursus lacus. Sed risus magna, aliquam sed, suscipit sit amet, porttitor quis, odio. Suspendisse cursus justo nec urna. Suspendisse potenti. In hac habitasse platea dictumst. Cras quis lacus. Vestibulum rhoncus congue lacus. Vivamus euismod, felis quis commodo viverra, dolor elit dictum ante, et mollis eros augue at est. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nulla lectus sem, tristique sed, semper in, hendrerit non, sem. Vivamus dignissim massa in ipsum. Morbi fringilla ullamcorper ligula. Nunc turpis. Mauris vitae sapien. Nunc luctus bibendum velit.
Morbi faucibus volutpat sapien. Nam ac mauris at justo adipiscing facilisis. Nunc et velit. Donec auctor, nulla id laoreet volutpat, pede erat feugiat ante, auctor facilisis dui augue non turpis. Suspendisse mattis metus et justo. Aliquam erat volutpat. Suspendisse potenti. Nam hendrerit lorem commodo metus laoreet ullamcorper. Proin vel nunc a felis sollicitudin pretium. Maecenas in metus at mi mollis posuere. Quisque ac quam sed massa adipiscing rutrum. Vestibulum ipsum. Phasellus porta sapien. Maecenas venenatis tellus vel tellus.
Aliquam aliquam dolor at justo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi pretium purus a magna. Nullam dui tellus, blandit eu, facilisis non, pharetra consectetuer, leo. Maecenas sit amet ante sagittis magna imperdiet pulvinar. Vestibulum a lacus at sapien suscipit tempus. Proin pulvinar velit sed nulla. Curabitur aliquet leo ac massa. Praesent posuere lectus vitae odio. Donec imperdiet urna vel ante. In semper accumsan diam. Vestibulum porta justo. Suspendisse egestas commodo eros.
Suspendisse tincidunt mi vel metus. Vivamus non urna in nisi gravida congue. Aenean semper orci a eros. Praesent dictum. Maecenas pharetra odio ut dui. Pellentesque ut orci. Sed lobortis, velit at laoreet suscipit, quam est sagittis nibh, id varius ipsum quam ac metus. Phasellus est nibh, bibendum non, dictum sed, vehicula in, sem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris sollicitudin. Duis congue tincidunt orci. Integer blandit neque ut quam. Morbi mollis. Integer lacinia. Praesent blandit elementum sapien. Praesent enim mauris, suscipit a, auctor et, lacinia vitae, nunc. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent lacus diam, auctor quis, venenatis in, hendrerit at, est. Vivamus eget eros. Phasellus congue, sapien ac iaculis feugiat, lacus lacus accumsan lorem, quis volutpat justo turpis ac mauris.
Duis velit magna, scelerisque vitae, varius ut, aliquam vel, justo. Proin ac augue. Nullam auctor lectus vitae arcu. Vestibulum porta justo placerat purus. Ut sem nunc, vestibulum nec, sodales vitae, vehicula eget, ipsum. Sed nec tortor. Aenean malesuada. Nunc convallis, massa eu vestibulum commodo, quam mauris interdum arcu, at pellentesque diam metus ut nulla. Vestibulum eu dolor sit amet lacus varius fermentum. Morbi dolor enim, pulvinar eget, lobortis ac, fringilla ac, turpis. Duis ac erat. Etiam consequat. Integer sed est eu elit pellentesque dapibus. Duis venenatis magna feugiat nisi. Vestibulum et turpis. Maecenas a enim. Suspendisse ultricies ornare justo. Fusce sit amet nisi sed arcu condimentum venenatis. Vivamus dui. Nunc accumsan, quam a fermentum mattis, magna sapien iaculis pede, at porttitor quam odio at est.
Proin eleifend nisi et nibh. Maecenas a lacus. Mauris porta quam non massa molestie scelerisque. Nulla sed ante at lorem suscipit rutrum. Nam quis tellus. Cras elit nisi, ornare a, condimentum vitae, rutrum sit amet, tellus. Maecenas a dolor. Praesent tempor, felis eget gravida blandit, urna lacus faucibus velit, in consectetuer sapien erat nec quam. Integer bibendum odio sit amet neque. Integer imperdiet rhoncus mi. Pellentesque malesuada purus id purus. Quisque viverra porta lectus. Sed lacus leo, feugiat at, consectetuer eu, luctus quis, risus. Suspendisse faucibus orci et nunc. Nullam vehicula fermentum risus. Fusce felis nibh, dignissim vulputate, ultrices quis, lobortis et, arcu. Duis aliquam libero non diam.
Vestibulum placerat tincidunt tortor. Ut vehicula ligula quis lectus. In eget velit. Quisque vel risus. Mauris pede. Nullam ornare sapien sit amet nisl. Cras tortor. Donec tortor lorem, dignissim sit amet, pulvinar eget, mattis eu, metus. Cras vestibulum erat ultrices neque. Praesent rhoncus, dui blandit pellentesque congue, mauris mi ullamcorper odio, eget ultricies nunc felis in augue. Nullam porta nunc. Donec in pede ac mauris mattis eleifend. Cras a libero vel est lacinia dictum. In hac habitasse platea dictumst. Nullam malesuada molestie lorem. Nunc non mauris. Nam accumsan tortor gravida elit. Cras porttitor.
Praesent vel enim sed eros luctus imperdiet. Mauris neque ante, placerat at, mollis vitae, faucibus quis, leo. Ut feugiat. Vivamus urna quam, congue vulputate, convallis non, cursus cursus, risus. Quisque aliquet. Donec vulputate egestas elit. Morbi dictum, sem sit amet aliquam euismod, odio tortor pellentesque odio, ac ultrices enim nibh sed quam. Integer tortor velit, condimentum a, vestibulum eget, sagittis nec, neque. Aenean est urna, bibendum et, imperdiet at, rhoncus in, arcu. In hac habitasse platea dictumst. Vestibulum blandit dignissim dui. Maecenas vitae magna non felis ornare consectetuer. Sed lorem. Nam leo. In eget pede. Donec porta.
Etiam facilisis. Nam suscipit. Ut consectetuer leo vehicula augue. Aliquam cursus. Integer pharetra rhoncus massa. Cras et ligula vel quam tristique commodo. Sed est lectus, mollis quis, lacinia id, sollicitudin nec, eros. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi urna dui, fermentum quis, feugiat imperdiet, imperdiet id, sapien. Phasellus auctor nunc. Vivamus eget augue quis neque vestibulum placerat. Duis placerat. Maecenas accumsan rutrum lacus. Vestibulum lacinia semper nibh. Aenean diam odio, scelerisque at, ullamcorper nec, tincidunt dapibus, quam. Duis vel ante nec tortor porta mollis. Praesent orci. Cras dignissim vulputate metus.
Phasellus eu quam. Quisque interdum cursus purus. In orci. Maecenas vehicula. Sed et mauris. Praesent feugiat viverra lacus. Suspendisse pulvinar lacus ut nunc. Quisque nisi. Suspendisse id risus nec nisi ultrices ornare. Donec eget tellus. Nullam molestie placerat felis. Aenean facilisis. Nunc erat. Integer in tellus. Mauris volutpat, neque vel ornare porttitor, dolor nisi sagittis dolor, sit amet bibendum orci leo blandit lacus.
In id velit sodales arcu iaculis venenatis. Etiam at leo. Vivamus vitae sem. Mauris volutpat congue risus. Curabitur leo. Aenean tempor tortor eget ligula. Aenean vel augue. Vestibulum ac justo. In hac habitasse platea dictumst. Nam dignissim nisi non mauris. Donec et tortor. Morbi felis. Donec aliquet, erat eu ultrices tincidunt, lorem mi sagittis lectus, ut feugiat pede lacus quis sapien. Suspendisse porta, felis a fermentum interdum, dui nisl sodales felis, ut fermentum sapien nibh eu nunc.
Lorem ipsum dolor sit amet. Integer sed magna. Duis nisl nulla, porta ut, molestie sit amet, tincidunt eu, enim. Cras eu mauris. Cras iaculis, nisi vel tempor fringilla, nisl dolor imperdiet dolor, id lobortis ligula nunc sed dolor.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur eu dui vitae nulla tempor consectetuer. Suspendisse ligula dolor, varius nec, vulputate id, luctus sed, lacus. Pellentesque purus urna, porta molestie, mattis non, posuere et, velit. Curabitur diam mauris, dictum vel, lacinia congue, molestie at, nisi. Proin tempus diam ut ligula. Mauris dictum, metus dapibus iaculis sollicitudin, leo ligula cursus sem, eu congue metus ligula sed justo. Suspendisse potenti. Donec sodales elementum turpis. Duis dolor elit, dapibus sed, placerat vitae, auctor sit amet, nunc. Donec nisl quam, hendrerit vitae, porttitor et, imperdiet id, quam. Quisque dolor. Nulla tincidunt, lacus id dapibus ullamcorper, turpis diam fringilla eros, quis aliquet dolor felis at lorem. Pellentesque et lacus. Vestibulum tempor lectus at est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed vitae eros. Nulla pulvinar turpis eget nunc. Sed bibendum pellentesque nunc. Integer tristique, lorem ac faucibus tempor, lorem dolor mollis turpis, a consectetuer nunc justo ac nisl.
Nam vitae purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent semper magna. In eu justo. Nunc vitae risus nec sem scelerisque consequat. In hac habitasse platea dictumst. Nam posuere ultricies turpis. Pellentesque a pede. Duis sed tortor. Phasellus egestas porta lectus. Aliquam dignissim consequat diam. Pellentesque pede.
Ut varius tincidunt tellus. Curabitur ornare ipsum. Aenean laoreet posuere orci. Etiam id nisl. Suspendisse volutpat elit molestie orci. Suspendisse vel augue at felis tincidunt sollicitudin. Fusce arcu. Duis a tortor. Duis et odio et leo sollicitudin consequat. Aliquam lobortis. Phasellus condimentum. Ut porttitor bibendum libero. Integer euismod lacinia velit. Donec velit justo, sodales varius, cursus sed, mattis a, arcu.
Maecenas accumsan, sem iaculis egestas gravida, odio nunc aliquet dui, eget cursus diam purus vel augue. Donec eros nisi, imperdiet quis, volutpat ac, sollicitudin sed, arcu. Aenean vel mauris. Mauris tincidunt. Nullam euismod odio at velit. Praesent elit purus, porttitor id, facilisis in, consequat ut, libero. Morbi imperdiet, magna quis ullamcorper malesuada, mi massa pharetra lectus, a pellentesque urna urna id turpis. Nam posuere lectus vitae nibh. Etiam tortor orci, sagittis malesuada, rhoncus quis, hendrerit eget, libero. Quisque commodo nulla at nunc. Mauris consequat, enim vitae venenatis sollicitudin, dolor orci bibendum enim, a sagittis nulla nunc quis elit. Phasellus augue. Nunc suscipit, magna tincidunt lacinia faucibus, lacus tellus ornare purus, a pulvinar lacus orci eget nibh. Maecenas sed nibh non lacus tempor faucibus. In hac habitasse platea dictumst. Vivamus a orci at nulla tristique condimentum. Donec arcu quam, dictum accumsan, convallis accumsan, cursus sit amet, ipsum. In pharetra sagittis nunc.
Donec consequat mi. Quisque vitae dolor. Integer lobortis. Maecenas id nulla. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed volutpat felis vitae dui. Vestibulum et est ac ligula dapibus elementum. Nunc suscipit nisl eu felis. Duis nec tortor. Nullam diam libero, semper id, consequat in, consectetuer ut, metus. Phasellus dui purus, vehicula sed, venenatis a, rutrum at, nunc. Pellentesque interdum sapien nec neque.
Vivamus sagittis, sem sit amet porttitor lobortis, turpis sapien consequat orci, sed commodo nulla pede eget sem. Phasellus sollicitudin. Proin orci erat, blandit ut, molestie sed, fringilla non, odio. Nulla porta, tortor non suscipit gravida, velit enim aliquam quam, nec condimentum orci augue vel magna. Nulla facilisi. Donec ipsum enim, congue in, tempus id, pulvinar sagittis, leo. Donec et elit in nunc blandit auctor. Nulla congue urna quis lorem. Nam rhoncus pede sed nunc. Etiam vitae quam. Fusce feugiat pede vel quam. In et augue.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Phasellus mollis dictum nulla. Integer vitae neque vitae eros fringilla rutrum. Vestibulum in pede adipiscing mi dapibus condimentum. Etiam felis risus, condimentum in, malesuada eget, pretium ut, sapien. Suspendisse placerat lectus venenatis lorem. Sed accumsan aliquam enim. Etiam hendrerit, metus eu semper rutrum, nisl elit pharetra purus, non interdum nibh enim eget augue. Sed mauris. Nam varius odio a sapien. Aenean rutrum dictum sapien. Fusce pharetra elementum ligula. Nunc eu mi non augue iaculis facilisis. Morbi interdum. Donec nisi arcu, rhoncus ac, vestibulum ut, pellentesque nec, risus. Maecenas tempus facilisis neque. Nulla mattis odio vitae tortor. Fusce iaculis. Aliquam rhoncus, diam quis tincidunt facilisis, sem quam luctus augue, ut posuere neque sem vitae neque.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nunc faucibus posuere turpis. Sed laoreet, est sed gravida tempor, nibh enim fringilla quam, et dapibus mi enim sit amet risus. Nulla sollicitudin eros sit amet diam. Aliquam ante. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut et est. Donec semper nulla in ipsum. Integer elit. In pharetra lorem vel ante.
Sed sed justo. Curabitur consectetuer arcu. Etiam placerat est eget odio. Nulla facilisi. Nulla facilisi. Mauris non neque. Suspendisse et diam. Sed vestibulum malesuada ipsum. Cras id magna. Nunc pharetra velit vitae eros. Vivamus ac risus. Mauris ac pede laoreet felis pharetra ultricies. Proin et neque. Aliquam dignissim placerat felis. Mauris porta ante sagittis purus.
Pellentesque quis leo eget ante tempor cursus. Pellentesque sagittis, diam ut dictum accumsan, magna est viverra erat, vitae imperdiet neque mauris aliquam nisl. Suspendisse blandit quam quis felis. Praesent turpis nunc, vehicula in, bibendum vitae, blandit ac, turpis. Duis rhoncus. Vestibulum metus. Morbi consectetuer felis id tortor. Etiam augue leo, cursus eget, ornare et, ornare sagittis, tellus. Fusce felis tellus, consectetuer nec, consequat at, ornare non, arcu. Maecenas condimentum sodales odio. Sed eu orci.
Nullam adipiscing eros sit amet ante. Vestibulum ante. Sed quis ipsum non ligula dignissim luctus. Integer quis justo id tortor accumsan tempus. Cras vitae magna. Nunc bibendum lacinia tellus. Quisque porttitor ligula et pede. Nam erat nibh, fringilla ac, rutrum sit amet, rhoncus in, ipsum. Mauris rhoncus, lacus eu convallis sagittis, quam magna placerat est, vitae imperdiet mauris arcu ac dui. In ac urna non justo posuere mattis. Suspendisse egestas bibendum nulla. In erat nunc, posuere sed, auctor quis, pulvinar quis, mi. Mauris at est. Phasellus lacinia eros in arcu. Maecenas lobortis, tellus vel gravida tincidunt, elit erat suscipit arcu, in varius erat risus vel magna. Fusce nec ante quis dolor vestibulum bibendum. Pellentesque sit amet urna.
Curabitur eget nisi at lectus placerat gravida. Vivamus nulla. Donec luctus. Sed quis tellus. Quisque lobortis faucibus mi. Aenean vitae risus ut arcu malesuada ornare. Maecenas nec erat. Sed rhoncus, elit laoreet sagittis luctus, nulla leo faucibus lectus, vitae accumsan est diam id felis. Nunc dui pede, vestibulum eu, elementum et, gravida quis, sapien. Donec blandit. Donec sed magna. Curabitur a risus. Nullam nibh libero, sagittis vel, hendrerit accumsan, pulvinar consequat, tellus. Donec varius dictum nisl. Vestibulum suscipit enim ac nulla. Proin tincidunt. Proin sagittis. Curabitur auctor metus non mauris. Nunc condimentum nisl non augue. Donec leo urna, dignissim vitae, porttitor ut, iaculis sit amet, sem.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Suspendisse potenti. Quisque augue metus, hendrerit sit amet, commodo vel, scelerisque ut, ante. Praesent euismod euismod risus. Mauris ut metus sit amet mi cursus commodo. Morbi congue mauris ac sapien. Donec justo. Sed congue nunc vel mauris. Pellentesque vehicula orci id libero. In hac habitasse platea dictumst. Nulla sollicitudin, purus id elementum dictum, dolor augue hendrerit ante, vel semper metus enim et dolor. Pellentesque molestie nunc id enim. Etiam mollis tempus neque. Duis tincidunt commodo elit.
Aenean pellentesque purus eu mi. Proin commodo, massa commodo dapibus elementum, libero lacus pulvinar eros, ut tincidunt nisl elit ut velit. Cras rutrum porta purus. Vivamus lorem. Sed turpis enim, faucibus quis, pharetra in, sagittis sed, magna. Curabitur ultricies felis ut libero. Nullam tincidunt enim eu nibh. Nunc eget ipsum in sem facilisis convallis. Proin fermentum risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vestibulum hendrerit malesuada odio. Fusce ut elit ut augue sollicitudin blandit. Phasellus volutpat lorem. Duis non pede et neque luctus tincidunt. Duis interdum tempus elit.
Aenean metus. Vestibulum ac lacus. Vivamus porttitor, massa ut hendrerit bibendum, metus augue aliquet turpis, vitae pellentesque velit est vitae metus. Duis eros enim, fermentum at, sagittis id, lacinia eget, tellus. Nunc consequat pede et nulla. Donec nibh. Pellentesque cursus orci vitae urna. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque risus turpis, aliquet ac, accumsan vel, iaculis eget, enim. Pellentesque nibh neque, malesuada id, tempor vel, aliquet ut, eros. In hac habitasse platea dictumst. Integer neque purus, congue sed, mattis sed, vulputate ac, pede. Donec vestibulum purus non tortor. Integer at nunc.
Suspendisse fermentum velit quis sem. Phasellus suscipit nunc in risus. Nulla sed lectus. Morbi sollicitudin, diam ac bibendum scelerisque, enim tortor rhoncus sapien, vel posuere dolor neque in sem. Pellentesque tellus augue, tempus nec, laoreet at, porttitor blandit, leo. Phasellus in odio. Duis lobortis, metus eu laoreet tristique, pede mi congue mi, quis posuere augue nulla a augue. Pellentesque sed est. Mauris cursus urna id lectus. Integer dignissim feugiat eros. Sed tempor volutpat dolor. Vestibulum vel lectus nec mauris semper adipiscing.
Aliquam tincidunt enim sit amet tellus. Sed mauris nulla, semper tincidunt, luctus a, sodales eget, leo. Sed ligula augue, cursus et, posuere non, mollis sit amet, est. Mauris massa. Proin hendrerit massa. Phasellus eu purus. Donec est neque, dignissim a, eleifend vitae, lobortis ut, nibh. Nullam sed lorem. Proin laoreet augue quis eros. Suspendisse vehicula nunc ac nisi.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce mi. Vivamus enim velit, condimentum sit amet, laoreet quis, fermentum non, ipsum. Etiam quis felis. Curabitur tincidunt, sapien et luctus faucibus, nibh nisi commodo arcu, vitae cursus neque ante sed elit. Sed sit amet erat. Phasellus luctus cursus risus. Phasellus ac felis. Proin nec eros quis ipsum pellentesque congue. Curabitur et diam sed odio accumsan cursus. Pellentesque ultricies. Quisque aliquam. Sed nisi velit, consectetuer eget, dictum ac, molestie a, magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Curabitur consequat leo et dui. Aenean ligula mi, dignissim ut, imperdiet tristique, interdum a, dolor.
Vestibulum elit nibh, rhoncus non, euismod sit amet, pretium eu, enim. Nunc commodo ultricies dui. Cras gravida rutrum massa. Donec accumsan mattis turpis. Quisque sem. Quisque elementum sapien iaculis augue. In dui sem, congue sit amet, feugiat quis, lobortis at, eros.
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin interdum vehicula purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Aenean risus dui, volutpat non, posuere vitae, sollicitudin in, urna. Nam eget eros a enim pulvinar rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla facilisis massa ut massa. Sed nisi purus, malesuada eu, porta vulputate, suscipit auctor, nunc. Vestibulum convallis, augue eu luctus malesuada, mi ante mattis odio, ac venenatis neque sem vitae nisi. Donec pellentesque purus a lorem. Etiam in massa. Nam ut metus. In rhoncus venenatis tellus. Etiam aliquam. Ut aliquam lectus ut lectus. Nam turpis lacus, tristique sit amet, convallis sollicitudin, commodo a, purus. Nulla vitae eros a diam blandit mollis. Proin luctus feugiat eros. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis ultricies urna. Etiam enim urna, pharetra suscipit, varius et, congue quis, odio. Donec lobortis, elit bibendum euismod faucibus, velit nibh egestas libero, vitae pellentesque elit augue ut massa.
Nulla consequat erat at massa. Vivamus id mi. Morbi purus enim, dapibus a, facilisis non, tincidunt at, enim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis imperdiet eleifend arcu. Cras magna ligula, consequat at, tempor non, posuere nec, libero. Vestibulum vel ipsum. Praesent congue justo et nunc. Vestibulum nec felis vitae nisl pharetra sollicitudin. Quisque nec arcu vel tellus tristique vestibulum. Aenean vel lacus. Mauris dolor erat, commodo ut, dapibus vehicula, lobortis sit amet, orci. Aliquam augue. In semper nisi nec libero. Cras magna ipsum, scelerisque et, tempor eget, gravida nec, lacus. Fusce eros nisi, ullamcorper blandit, ultricies eget, elementum eget, pede. Phasellus id risus vitae nisl ullamcorper congue. Proin est.
Sed eleifend odio sed leo. Mauris tortor turpis, dignissim vel, ornare ac, ultricies quis, magna. Phasellus lacinia, augue ac dictum tempor, nisi felis ornare magna, eu vehicula tellus enim eu neque. Fusce est eros, sagittis eget, interdum a, ornare suscipit, massa. Sed vehicula elementum ligula. Aliquam erat volutpat. Donec odio. Quisque nunc. Integer cursus feugiat magna. Fusce ac elit ut elit aliquam suscipit. Duis leo est, interdum nec, varius in, facilisis vitae, odio. Phasellus eget leo at urna adipiscing vulputate. Nam eu erat vel arcu tristique mattis. Nullam placerat lorem non augue. Cras et velit. Morbi sapien nulla, volutpat a, tristique eu, molestie ac, felis.
Suspendisse sit amet tellus non odio porta pellentesque. Nulla facilisi. Integer iaculis condimentum augue. Nullam urna nulla, vestibulum quis, lacinia eget, ullamcorper eu, dui. Quisque dignissim consequat nisl. Pellentesque porta augue in diam. Duis mattis. Aliquam et mi quis turpis pellentesque consequat. Suspendisse nulla erat, lacinia nec, pretium vitae, feugiat ac, quam. Etiam sed tellus vel est ultrices condimentum. Vestibulum euismod. Vivamus blandit. Pellentesque eu urna. Vestibulum consequat sem vitae dui. In dictum feugiat quam. Phasellus placerat. In sem nisl, elementum vitae, venenatis nec, lacinia ac, arcu. Pellentesque gravida egestas mi. Integer rutrum tincidunt libero.
Duis viverra. Nulla diam lectus, tincidunt et, scelerisque vitae, aliquam vitae, justo. Quisque eget erat. Donec aliquet porta magna. Sed nisl. Ut tellus. Suspendisse quis mi eget dolor sagittis tristique. Aenean non pede eget nisl bibendum gravida. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi laoreet. Suspendisse potenti. Donec accumsan porta felis.
Fusce tristique leo quis pede. Cras nibh. Sed eget est vitae tortor mollis ullamcorper. Suspendisse placerat dolor a dui. Vestibulum condimentum dui et elit. Pellentesque porttitor ipsum at ipsum. Nam massa. Duis lorem. Donec porta. Proin ligula. Aenean nunc massa, dapibus quis, imperdiet id, commodo a, lacus. Cras sit amet erat et nulla varius aliquet. Aliquam erat volutpat. Praesent feugiat vehicula pede. Suspendisse pulvinar, orci in sollicitudin venenatis, nibh libero hendrerit sem, eu tempor nisi felis et metus. Etiam gravida sem ut mi. Integer volutpat, enim eu varius gravida, risus urna venenatis lectus, ac ultrices quam nulla eu leo. Duis arcu. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
Vivamus lacus libero, aliquam eget, iaculis quis, tristique adipiscing, diam. Vivamus nec massa non justo iaculis pellentesque. Aenean accumsan elit sit amet nibh feugiat semper. Cras tempor ornare purus. Integer id nisi. Phasellus dui velit, ultrices vel, ullamcorper mattis, hendrerit in, erat. Aenean vel quam at eros mattis commodo. Aenean feugiat iaculis justo. Maecenas accumsan justo ut nibh. Donec ac lectus vitae odio lobortis tristique. Donec vestibulum mattis lectus. Donec et lorem.
Cras sit amet mauris. Curabitur a quam. Aliquam neque. Nam nunc nunc, lacinia sed, varius quis, iaculis eget, ante. Nulla dictum justo eu lacus. Phasellus sit amet quam. Nullam sodales. Cras non magna eu est consectetuer faucibus. Donec tempor lobortis turpis. Sed tellus velit, ullamcorper ac, fringilla vitae, sodales nec, purus. Morbi aliquet risus in mi.
Curabitur cursus volutpat neque. Proin posuere mauris ut ipsum. Praesent scelerisque tortor a justo. Quisque consequat libero eu erat. In eros augue, sollicitudin sed, tempus tincidunt, pulvinar a, lectus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas interdum purus id risus. Ut ultricies cursus dui. In nec enim at odio aliquam iaculis. Fusce nisl. Pellentesque sagittis. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean placerat tellus. In semper sagittis enim. Aliquam risus neque, pretium in, fermentum vitae, vulputate et, massa. Nulla sed erat vel eros ornare venenatis.
In hac habitasse platea dictumst. Sed nisl nunc, suscipit id, feugiat vel, tristique sit amet, sapien. Phasellus vestibulum. Nam quis justo. Nulla sit amet mauris sed lacus pharetra fringilla. In mollis orci ultrices.
Lorem ipsum dolor sit amet.

View File

@@ -1,157 +0,0 @@
" loremipsum.vim
" @Author: Thomas Link (mailto:micathom AT gmail com?subject=[vim])
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2008-07-10.
" @Last Change: 2008-07-11.
" @Revision: 0.0.138
if &cp || exists("loaded_loremipsum_autoload")
finish
endif
let loaded_loremipsum_autoload = 1
let s:save_cpo = &cpo
set cpo&vim
" http://www.lorem-ipsum-dolor-sit-amet.com/lorem-ipsum-dolor-sit-amet.html
let s:data = expand('<sfile>:p:h') .'/loremipsum.txt'
function! s:GetWords(nwords, splitrx, join) "{{{3
if exists('b:loremipsum_file')
let file = b:loremipsum_file
else
let file = get(g:loremipsum_files, &spelllang, s:data)
endif
let text = split(join(readfile(file), "\n"), a:splitrx)
let start = (localtime() * -23) % (len(text) - a:nwords)
let start = start < 0 ? -start : start
let out = join(text[start : start + a:nwords], a:join)
let out = substitute(out, '^\s*\zs\S', '\u&', '')
if out !~ '\.\s*$'
let out = substitute(out, '[[:punct:][:space:]]*$', '.', '')
endif
return out
endf
function! s:NoInline(flags) "{{{3
return get(a:flags, 0, 0)
endf
function! s:WrapMarker(marker, text) "{{{3
if len(a:marker) >= 2
let [pre, post; flags] = a:marker
if type(a:text) == 1
if s:NoInline(flags)
return a:text
else
return pre . a:text . post
endif
else
call insert(a:text, pre)
call add(a:text, post)
return a:text
endif
else
return a:text
endif
endf
function! loremipsum#Generate(nwords, template) "{{{3
let out = s:GetWords(a:nwords, '\s\+\zs', '')
let paras = split(out, '\n')
if empty(a:template) || a:template == '*'
let template = get(g:loremipsum_paragraph_template, &filetype, '')
elseif a:template == '_'
let template = ''
else
let template = a:template
endif
if !empty(template)
call map(paras, 'v:val =~ ''\S'' ? printf(template, v:val) : v:val')
end
return paras
endf
function! loremipsum#GenerateInline(nwords) "{{{3
let out = s:GetWords(a:nwords, '[[:space:]\n]\+', ' ')
" let out = substitute(out, '[[:punct:][:space:]]*$', '', '')
" let out = substitute(out, '[.?!]\(\s*.\)', ';\L\1', 'g')
return out
endf
" :display: loremipsum#Insert(?inline=0, ?nwords=100, " ?template='', ?pre='', ?post='')
function! loremipsum#Insert(...) "{{{3
let inline = a:0 >= 1 ? !empty(a:1) : 0
let nwords = a:0 >= 2 ? a:2 : g:loremipsum_words
let template = a:0 >= 3 ? a:3 : ''
if a:0 >= 5
let marker = [a:4, a:5]
elseif a:0 >= 4
if a:4 == '_'
let marker = []
else
echoerr 'Loremipsum: No postfix defined'
endif
else
let marker = get(g:loremipsum_marker, &filetype, [])
endif
" TLogVAR inline, nwords, template
if inline
let t = @t
try
let @t = s:WrapMarker(marker, loremipsum#GenerateInline(nwords))
norm! "tp
finally
let @t = t
endtry
else
let text = s:WrapMarker(marker, loremipsum#Generate(nwords, template))
let lno = line('.')
if getline(lno) !~ '\S'
let lno -= 1
endif
call append(lno, text)
exec 'norm! '. lno .'gggq'. len(text) ."j"
endif
endf
function! loremipsum#Replace(...) "{{{3
let replace = a:0 >= 1 ? a:1 : ''
if a:0 >= 3
let marker = [a:2, a:3]
else
let marker = get(g:loremipsum_marker, &filetype, [])
endif
if len(marker) >= 2
let [pre, post; flags] = marker
let pre = escape(pre, '\/')
let post = escape(post, '\/')
if s:NoInline(flags)
let pre = '\^\s\*'. pre .'\s\*\n'
let post = '\n\s\*'. post .'\s\*\n'
let replace .= "\<c-m>"
endif
let rx = '\V'. pre .'\_.\{-}'. post
let rpl = escape(replace, '\&~/')
let sr = @/
try
" TLogVAR rx, rpl
exec '%s/'. rx .'/'. rpl .'/ge'
finally
let @/ = sr
endtry
else
echoerr 'Loremipsum: No marker for '. &filetype
endif
endf
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@@ -1,783 +0,0 @@
" Script Name: mark.vim
" Description: Highlight several words in different colors simultaneously.
"
" Copyright: (C) 2005-2008 by Yuheng Xie
" (C) 2008-2011 by Ingo Karkat
" The VIM LICENSE applies to this script; see ':help copyright'.
"
" Maintainer: Ingo Karkat <ingo@karkat.de>
"
" Dependencies:
" - SearchSpecial.vim autoload script (optional, for improved search messages).
"
" Version: 2.5.2
" Changes:
"
" 09-Nov-2011, Ingo Karkat
" - BUG: With a single match and 'wrapscan' set, a search error was issued
" instead of the wrap message. Add check for l:isStuckAtCurrentMark &&
" l:isWrapped in the no-match part of s:Search().
" - FIX: In backwards search with single match, the :break short-circuits the
" l:isWrapped logic, resets l:line and therefore also confuses the logic and
" leads to wrong error message instead of wrap message. Don't reset l:line,
" set l:isWrapped instead.
" - FIX: Wrong logic for determining l:isWrapped lets wrap-around go undetected
" when v:count >= number of total matches. [l:startLine, l:startCol] must
" be updated on every iteration.
"
" 17-May-2011, Ingo Karkat
" - Make s:GetVisualSelection() public to allow use in suggested
" <Plug>MarkSpaceIndifferent vmap.
" - FIX: == comparison in s:DoMark() leads to wrong regexp (\A vs. \a) being
" cleared when 'ignorecase' is set. Use case-sensitive comparison ==# instead.
"
" 10-May-2011, Ingo Karkat
" - Refine :MarkLoad messages: Differentiate between nonexistent and empty
" g:MARK_MARKS; add note when marks are disabled.
"
" 06-May-2011, Ingo Karkat
" - Also print status message on :MarkClear to be consistent with :MarkToggle.
"
" 21-Apr-2011, Ingo Karkat
" - Implement toggling of mark display (keeping the mark patterns, unlike the
" clearing of marks), determined by s:enable. s:DoMark() now toggles on empty
" regexp, affecting the \n mapping and :Mark. Introduced
" s:EnableAndMarkScope() wrapper to correctly handle the highlighting updates
" depending on whether marks were previously disabled.
" - Implement persistence of s:enable via g:MARK_ENABLED.
" - Generalize s:Enable() and combine with intermediate s:Disable() into
" s:MarkEnable(), which also performs the persistence of s:enabled.
" - Implement lazy-loading of disabled persistent marks via g:mwDoDeferredLoad
" flag passed from plugin/mark.vim.
"
" 20-Apr-2011, Ingo Karkat
" - Extract setting of s:pattern into s:SetPattern() and implement the automatic
" persistence there.
"
" 19-Apr-2011, Ingo Karkat
" - ENH: Add enabling functions for mark persistence: mark#Load() and
" mark#ToPatternList().
" - Implement :MarkLoad and :MarkSave commands in mark#LoadCommand() and
" mark#SaveCommand().
" - Remove superfluous update autocmd on VimEnter: Persistent marks trigger the
" update themselves, same for :Mark commands which could potentially be issued
" e.g. in .vimrc. Otherwise, when no marks are defined after startup, the
" autosource script isn't even loaded yet, so the autocmd on the VimEnter
" event isn't yet defined.
"
" 18-Apr-2011, Ingo Karkat
" - BUG: Include trailing newline character in check for current mark, so that a
" mark that matches the entire line (e.g. created by V<Leader>m) can be
" cleared via <Leader>n. Thanks to ping for reporting this.
" - Minor restructuring of mark#MarkCurrentWord().
" - FIX: On overlapping marks, mark#CurrentMark() returned the lowest, not the
" highest visible mark. So on overlapping marks, the one that was not visible
" at the cursor position was removed; very confusing! Use reverse iteration
" order.
" - FIX: To avoid an arbitrary ordering of highlightings when the highlighting
" group names roll over, and to avoid order inconsistencies across different
" windows and tabs, we assign a different priority based on the highlighting
" group.
" - Rename s:cycleMax to s:markNum; the previous name was too
" implementation-focused and off-by-one with regards to the actual value.
"
" 16-Apr-2011, Ingo Karkat
" - Move configuration variable g:mwHistAdd to plugin/mark.vim (as is customary)
" and make the remaining g:mw... variables script-local, as these contain
" internal housekeeping information that does not need to be accessible by the
" user.
" - Add :MarkSave warning if 'viminfo' doesn't enable global variable
" persistence.
"
" 15-Apr-2011, Ingo Karkat
" - Robustness: Move initialization of w:mwMatch from mark#UpdateMark() to
" s:MarkMatch(), where the variable is actually used. I had encountered cases
" where it w:mwMatch was undefined when invoked through mark#DoMark() ->
" s:MarkScope() -> s:MarkMatch(). This can be forced by :unlet w:mwMatch
" followed by :Mark foo.
" - Robustness: Checking for s:markNum == 0 in mark#DoMark(), trying to
" re-detect the mark highlightings and finally printing an error instead of
" choking. This can happen when somehow no mark highlightings are defined.
"
" 14-Jan-2011, Ingo Karkat
" - FIX: Capturing the visual selection could still clobber the blockwise yank
" mode of the unnamed register.
"
" 13-Jan-2011, Ingo Karkat
" - FIX: Using a named register for capturing the visual selection on
" {Visual}<Leader>m and {Visual}<Leader>r clobbered the unnamed register. Now
" using the unnamed register.
"
" 13-Jul-2010, Ingo Karkat
" - ENH: The MarkSearch mappings (<Leader>[*#/?]) add the original cursor
" position to the jump list, like the built-in [/?*#nN] commands. This allows
" to use the regular jump commands for mark matches, like with regular search
" matches.
"
" 19-Feb-2010, Andy Wokula
" - BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results
" in endless loop. Thanks to Andy Wokula for the patch.
"
" 17-Nov-2009, Ingo Karkat + Andy Wokula
" - BUG: Creation of literal pattern via '\V' in {Visual}<Leader>m mapping
" collided with individual escaping done in <Leader>m mapping so that an
" escaped '\*' would be interpreted as a multi item when both modes are used
" for marking. Replaced \V with s:EscapeText() to be consistent. Replaced the
" (overly) generic mark#GetVisualSelectionEscaped() with
" mark#GetVisualSelectionAsRegexp() and
" mark#GetVisualSelectionAsLiteralPattern(). Thanks to Andy Wokula for the
" patch.
"
" 06-Jul-2009, Ingo Karkat
" - Re-wrote s:AnyMark() in functional programming style.
" - Now resetting 'smartcase' before the search, this setting should not be
" considered for *-command-alike searches and cannot be supported because all
" mark patterns are concatenated into one large regexp, anyway.
"
" 04-Jul-2009, Ingo Karkat
" - Re-wrote s:Search() to handle v:count:
" - Obsoleted s:current_mark_position; mark#CurrentMark() now returns both the
" mark text and start position.
" - s:Search() now checks for a jump to the current mark during a backward
" search; this eliminates a lot of logic at its calling sites.
" - Reverted negative logic at calling sites; using empty() instead of != "".
" - Now passing a:isBackward instead of optional flags into s:Search() and
" around its callers.
" - ':normal! zv' moved from callers into s:Search().
" - Removed delegation to SearchSpecial#ErrorMessage(), because the fallback
" implementation is perfectly fine and the SearchSpecial routine changed its
" output format into something unsuitable anyway.
" - Using descriptive text instead of "@" (and appropriate highlighting) when
" querying for the pattern to mark.
"
" 02-Jul-2009, Ingo Karkat
" - Split off functions into autoload script.
"- functions ------------------------------------------------------------------
function! s:EscapeText( text )
return substitute( escape(a:text, '\' . '^$.*[~'), "\n", '\\n', 'ge' )
endfunction
" Mark the current word, like the built-in star command.
" If the cursor is on an existing mark, remove it.
function! mark#MarkCurrentWord()
let l:regexp = mark#CurrentMark()[0]
if empty(l:regexp)
let l:cword = expand('<cword>')
if ! empty(l:cword)
let l:regexp = s:EscapeText(l:cword)
" The star command only creates a \<whole word\> search pattern if the
" <cword> actually only consists of keyword characters.
if l:cword =~# '^\k\+$'
let l:regexp = '\<' . l:regexp . '\>'
endif
endif
endif
if ! empty(l:regexp)
call mark#DoMark(l:regexp)
endif
endfunction
function! mark#GetVisualSelection()
let save_clipboard = &clipboard
set clipboard= " Avoid clobbering the selection and clipboard registers.
let save_reg = getreg('"')
let save_regmode = getregtype('"')
silent normal! gvy
let res = getreg('"')
call setreg('"', save_reg, save_regmode)
let &clipboard = save_clipboard
return res
endfunction
function! mark#GetVisualSelectionAsLiteralPattern()
return s:EscapeText(mark#GetVisualSelection())
endfunction
function! mark#GetVisualSelectionAsRegexp()
return substitute(mark#GetVisualSelection(), '\n', '', 'g')
endfunction
" Manually input a regular expression.
function! mark#MarkRegex( regexpPreset )
call inputsave()
echohl Question
let l:regexp = input('Input pattern to mark: ', a:regexpPreset)
echohl None
call inputrestore()
if ! empty(l:regexp)
call mark#DoMark(l:regexp)
endif
endfunction
function! s:Cycle( ... )
let l:currentCycle = s:cycle
let l:newCycle = (a:0 ? a:1 : s:cycle) + 1
let s:cycle = (l:newCycle < s:markNum ? l:newCycle : 0)
return l:currentCycle
endfunction
" Set match / clear matches in the current window.
function! s:MarkMatch( indices, expr )
if ! exists('w:mwMatch')
let w:mwMatch = repeat([0], s:markNum)
endif
for l:index in a:indices
if w:mwMatch[l:index] > 0
silent! call matchdelete(w:mwMatch[l:index])
let w:mwMatch[l:index] = 0
endif
endfor
if ! empty(a:expr)
let l:index = a:indices[0] " Can only set one index for now.
" Info: matchadd() does not consider the 'magic' (it's always on),
" 'ignorecase' and 'smartcase' settings.
" Make the match according to the 'ignorecase' setting, like the star command.
" (But honor an explicit case-sensitive regexp via the /\C/ atom.)
let l:expr = ((&ignorecase && a:expr !~# '\\\@<!\\C') ? '\c' . a:expr : a:expr)
" To avoid an arbitrary ordering of highlightings, we assign a different
" priority based on the highlighting group, and ensure that the highest
" priority is -10, so that we do not override the 'hlsearch' of 0, and still
" allow other custom highlightings to sneak in between.
let l:priority = -10 - s:markNum + 1 + l:index
let w:mwMatch[l:index] = matchadd('MarkWord' . (l:index + 1), l:expr, l:priority)
endif
endfunction
" Initialize mark colors in a (new) window.
function! mark#UpdateMark()
let i = 0
while i < s:markNum
if ! s:enabled || empty(s:pattern[i])
call s:MarkMatch([i], '')
else
call s:MarkMatch([i], s:pattern[i])
endif
let i += 1
endwhile
endfunction
" Set / clear matches in all windows.
function! s:MarkScope( indices, expr )
let l:currentWinNr = winnr()
" By entering a window, its height is potentially increased from 0 to 1 (the
" minimum for the current window). To avoid any modification, save the window
" sizes and restore them after visiting all windows.
let l:originalWindowLayout = winrestcmd()
noautocmd windo call s:MarkMatch(a:indices, a:expr)
execute l:currentWinNr . 'wincmd w'
silent! execute l:originalWindowLayout
endfunction
" Update matches in all windows.
function! mark#UpdateScope()
let l:currentWinNr = winnr()
" By entering a window, its height is potentially increased from 0 to 1 (the
" minimum for the current window). To avoid any modification, save the window
" sizes and restore them after visiting all windows.
let l:originalWindowLayout = winrestcmd()
noautocmd windo call mark#UpdateMark()
execute l:currentWinNr . 'wincmd w'
silent! execute l:originalWindowLayout
endfunction
function! s:MarkEnable( enable, ...)
if s:enabled != a:enable
" En-/disable marks and perform a full refresh in all windows, unless
" explicitly suppressed by passing in 0.
let s:enabled = a:enable
if g:mwAutoSaveMarks
let g:MARK_ENABLED = s:enabled
endif
if ! a:0 || ! a:1
call mark#UpdateScope()
endif
endif
endfunction
function! s:EnableAndMarkScope( indices, expr )
if s:enabled
" Marks are already enabled, we just need to push the changes to all
" windows.
call s:MarkScope(a:indices, a:expr)
else
call s:MarkEnable(1)
endif
endfunction
" Toggle visibility of marks, like :nohlsearch does for the regular search
" highlighting.
function! mark#Toggle()
if s:enabled
call s:MarkEnable(0)
echo 'Disabled marks'
else
call s:MarkEnable(1)
let l:markCnt = len(filter(copy(s:pattern), '! empty(v:val)'))
echo 'Enabled' (l:markCnt > 0 ? l:markCnt . ' ' : '') . 'marks'
endif
endfunction
" Mark or unmark a regular expression.
function! s:SetPattern( index, pattern )
let s:pattern[a:index] = a:pattern
if g:mwAutoSaveMarks
call s:SavePattern()
endif
endfunction
function! mark#ClearAll()
let i = 0
let indices = []
while i < s:markNum
if ! empty(s:pattern[i])
call s:SetPattern(i, '')
call add(indices, i)
endif
let i += 1
endwhile
let s:lastSearch = ''
" Re-enable marks; not strictly necessary, since all marks have just been
" cleared, and marks will be re-enabled, anyway, when the first mark is added.
" It's just more consistent for mark persistence. But save the full refresh, as
" we do the update ourselves.
call s:MarkEnable(0, 0)
call s:MarkScope(l:indices, '')
if len(indices) > 0
echo 'Cleared all' len(indices) 'marks'
else
echo 'All marks cleared'
endif
endfunction
function! mark#DoMark(...) " DoMark(regexp)
let regexp = (a:0 ? a:1 : '')
" Disable marks if regexp is empty. Otherwise, we will be either removing a
" mark or adding one, so marks will be re-enabled.
if empty(regexp)
call mark#Toggle()
return
endif
" clear the mark if it has been marked
let i = 0
while i < s:markNum
if regexp ==# s:pattern[i]
if s:lastSearch ==# s:pattern[i]
let s:lastSearch = ''
endif
call s:SetPattern(i, '')
call s:EnableAndMarkScope([i], '')
return
endif
let i += 1
endwhile
if s:markNum <= 0
" Uh, somehow no mark highlightings were defined. Try to detect them again.
call mark#Init()
if s:markNum <= 0
" Still no mark highlightings; complain.
let v:errmsg = 'No mark highlightings defined'
echohl ErrorMsg
echomsg v:errmsg
echohl None
return
endif
endif
" add to history
if stridx(g:mwHistAdd, '/') >= 0
call histadd('/', regexp)
endif
if stridx(g:mwHistAdd, '@') >= 0
call histadd('@', regexp)
endif
" choose an unused mark group
let i = 0
while i < s:markNum
if empty(s:pattern[i])
call s:SetPattern(i, regexp)
call s:Cycle(i)
call s:EnableAndMarkScope([i], regexp)
return
endif
let i += 1
endwhile
" choose a mark group by cycle
let i = s:Cycle()
if s:lastSearch ==# s:pattern[i]
let s:lastSearch = ''
endif
call s:SetPattern(i, regexp)
call s:EnableAndMarkScope([i], regexp)
endfunction
" Return [mark text, mark start position] of the mark under the cursor (or
" ['', []] if there is no mark).
" The mark can include the trailing newline character that concludes the line,
" but marks that span multiple lines are not supported.
function! mark#CurrentMark()
let line = getline('.') . "\n"
" Highlighting groups with higher numbers take precedence over lower numbers,
" and therefore its marks appear "above" other marks. To retrieve the visible
" mark in case of overlapping marks, we need to check from highest to lowest
" highlighting group.
let i = s:markNum - 1
while i >= 0
if ! empty(s:pattern[i])
" Note: col() is 1-based, all other indexes zero-based!
let start = 0
while start >= 0 && start < strlen(line) && start < col('.')
let b = match(line, s:pattern[i], start)
let e = matchend(line, s:pattern[i], start)
if b < col('.') && col('.') <= e
return [s:pattern[i], [line('.'), (b + 1)]]
endif
if b == e
break
endif
let start = e
endwhile
endif
let i -= 1
endwhile
return ['', []]
endfunction
" Search current mark.
function! mark#SearchCurrentMark( isBackward )
let [l:markText, l:markPosition] = mark#CurrentMark()
if empty(l:markText)
if empty(s:lastSearch)
call mark#SearchAnyMark(a:isBackward)
let s:lastSearch = mark#CurrentMark()[0]
else
call s:Search(s:lastSearch, a:isBackward, [], 'same-mark')
endif
else
call s:Search(l:markText, a:isBackward, l:markPosition, (l:markText ==# s:lastSearch ? 'same-mark' : 'new-mark'))
let s:lastSearch = l:markText
endif
endfunction
silent! call SearchSpecial#DoesNotExist() " Execute a function to force autoload.
if exists('*SearchSpecial#WrapMessage')
function! s:WrapMessage( searchType, searchPattern, isBackward )
redraw
call SearchSpecial#WrapMessage(a:searchType, a:searchPattern, a:isBackward)
endfunction
function! s:EchoSearchPattern( searchType, searchPattern, isBackward )
call SearchSpecial#EchoSearchPattern(a:searchType, a:searchPattern, a:isBackward)
endfunction
else
function! s:Trim( message )
" Limit length to avoid "Hit ENTER" prompt.
return strpart(a:message, 0, (&columns / 2)) . (len(a:message) > (&columns / 2) ? "..." : "")
endfunction
function! s:WrapMessage( searchType, searchPattern, isBackward )
redraw
let v:warningmsg = printf('%s search hit %s, continuing at %s', a:searchType, (a:isBackward ? 'TOP' : 'BOTTOM'), (a:isBackward ? 'BOTTOM' : 'TOP'))
echohl WarningMsg
echo s:Trim(v:warningmsg)
echohl None
endfunction
function! s:EchoSearchPattern( searchType, searchPattern, isBackward )
let l:message = (a:isBackward ? '?' : '/') . a:searchPattern
echohl SearchSpecialSearchType
echo a:searchType
echohl None
echon s:Trim(l:message)
endfunction
endif
function! s:ErrorMessage( searchType, searchPattern, isBackward )
if &wrapscan
let v:errmsg = a:searchType . ' not found: ' . a:searchPattern
else
let v:errmsg = printf('%s search hit %s without match for: %s', a:searchType, (a:isBackward ? 'TOP' : 'BOTTOM'), a:searchPattern)
endif
echohl ErrorMsg
echomsg v:errmsg
echohl None
endfunction
" Wrapper around search() with additonal search and error messages and "wrapscan" warning.
function! s:Search( pattern, isBackward, currentMarkPosition, searchType )
let l:save_view = winsaveview()
" searchpos() obeys the 'smartcase' setting; however, this setting doesn't
" make sense for the mark search, because all patterns for the marks are
" concatenated as branches in one large regexp, and because patterns that
" result from the *-command-alike mappings should not obey 'smartcase' (like
" the * command itself), anyway. If the :Mark command wants to support
" 'smartcase', it'd have to emulate that into the regular expression.
let l:save_smartcase = &smartcase
set nosmartcase
let l:count = v:count1
let l:isWrapped = 0
let l:isMatch = 0
let l:line = 0
while l:count > 0
let [l:startLine, l:startCol] = [line('.'), col('.')]
" Search for next match, 'wrapscan' applies.
let [l:line, l:col] = searchpos( a:pattern, (a:isBackward ? 'b' : '') )
"****D echomsg '****' a:isBackward string([l:line, l:col]) string(a:currentMarkPosition) l:count
if a:isBackward && l:line > 0 && [l:line, l:col] == a:currentMarkPosition && l:count == v:count1
" On a search in backward direction, the first match is the start of the
" current mark (if the cursor was positioned on the current mark text, and
" not at the start of the mark text).
" In contrast to the normal search, this is not considered the first
" match. The mark text is one entity; if the cursor is positioned anywhere
" inside the mark text, the mark text is considered the current mark. The
" built-in '*' and '#' commands behave in the same way; the entire <cword>
" text is considered the current match, and jumps move outside that text.
" In normal search, the cursor can be positioned anywhere (via offsets)
" around the search, and only that single cursor position is considered
" the current match.
" Thus, the search is retried without a decrease of l:count, but only if
" this was the first match; repeat visits during wrapping around count as
" a regular match. The search also must not be retried when this is the
" first match, but we've been here before (i.e. l:isMatch is set): This
" means that there is only the current mark in the buffer, and we must
" break out of the loop and indicate that search wrapped around and no
" other mark was found.
if l:isMatch
let l:isWrapped = 1
break
endif
" The l:isMatch flag is set so if the final mark cannot be reached, the
" original cursor position is restored. This flag also allows us to detect
" whether we've been here before, which is checked above.
let l:isMatch = 1
elseif l:line > 0
let l:isMatch = 1
let l:count -= 1
" Note: No need to check 'wrapscan'; the wrapping can only occur if
" 'wrapscan' is actually on.
if ! a:isBackward && (l:startLine > l:line || l:startLine == l:line && l:startCol >= l:col)
let l:isWrapped = 1
elseif a:isBackward && (l:startLine < l:line || l:startLine == l:line && l:startCol <= l:col)
let l:isWrapped = 1
endif
else
break
endif
endwhile
let &smartcase = l:save_smartcase
" We're not stuck when the search wrapped around and landed on the current
" mark; that's why we exclude a possible wrap-around via v:count1 == 1.
let l:isStuckAtCurrentMark = ([l:line, l:col] == a:currentMarkPosition && v:count1 == 1)
"****D echomsg '****' l:line l:isStuckAtCurrentMark l:isWrapped l:isMatch string([l:line, l:col]) string(a:currentMarkPosition)
if l:line > 0 && ! l:isStuckAtCurrentMark
let l:matchPosition = getpos('.')
" Open fold at the search result, like the built-in commands.
normal! zv
" Add the original cursor position to the jump list, like the
" [/?*#nN] commands.
" Implementation: Memorize the match position, restore the view to the state
" before the search, then jump straight back to the match position. This
" also allows us to set a jump only if a match was found. (:call
" setpos("''", ...) doesn't work in Vim 7.2)
call winrestview(l:save_view)
normal! m'
call setpos('.', l:matchPosition)
" Enable marks (in case they were disabled) after arriving at the mark (to
" avoid unnecessary screen updates) but before the error message (to avoid
" it getting lost due to the screen updates).
call s:MarkEnable(1)
if l:isWrapped
call s:WrapMessage(a:searchType, a:pattern, a:isBackward)
else
call s:EchoSearchPattern(a:searchType, a:pattern, a:isBackward)
endif
return 1
else
if l:isMatch
" The view has been changed by moving through matches until the end /
" start of file, when 'nowrapscan' forced a stop of searching before the
" l:count'th match was found.
" Restore the view to the state before the search.
call winrestview(l:save_view)
endif
" Enable marks (in case they were disabled) after arriving at the mark (to
" avoid unnecessary screen updates) but before the error message (to avoid
" it getting lost due to the screen updates).
call s:MarkEnable(1)
if l:line > 0 && l:isStuckAtCurrentMark && l:isWrapped
call s:WrapMessage(a:searchType, a:pattern, a:isBackward)
return 1
else
call s:ErrorMessage(a:searchType, a:pattern, a:isBackward)
return 0
endif
endif
endfunction
" Combine all marks into one regexp.
function! s:AnyMark()
return join(filter(copy(s:pattern), '! empty(v:val)'), '\|')
endfunction
" Search any mark.
function! mark#SearchAnyMark( isBackward )
let l:markPosition = mark#CurrentMark()[1]
let l:markText = s:AnyMark()
call s:Search(l:markText, a:isBackward, l:markPosition, 'any-mark')
let s:lastSearch = ""
endfunction
" Search last searched mark.
function! mark#SearchNext( isBackward )
let l:markText = mark#CurrentMark()[0]
if empty(l:markText)
return 0
else
if empty(s:lastSearch)
call mark#SearchAnyMark(a:isBackward)
else
call mark#SearchCurrentMark(a:isBackward)
endif
return 1
endif
endfunction
" Load mark patterns from list.
function! mark#Load( pattern, enabled )
if s:markNum > 0 && len(a:pattern) > 0
" Initialize mark patterns with the passed list. Ensure that, regardless of
" the list length, s:pattern contains exactly s:markNum elements.
let s:pattern = a:pattern[0:(s:markNum - 1)]
let s:pattern += repeat([''], (s:markNum - len(s:pattern)))
let s:enabled = a:enabled
call mark#UpdateScope()
" The list of patterns may be sparse, return only the actual patterns.
return len(filter(copy(a:pattern), '! empty(v:val)'))
endif
return 0
endfunction
" Access the list of mark patterns.
function! mark#ToPatternList()
" Trim unused patterns from the end of the list, the amount of available marks
" may differ on the next invocation (e.g. due to a different number of
" highlight groups in Vim and GVIM). We want to keep empty patterns in the
" front and middle to maintain the mapping to highlight groups, though.
let l:highestNonEmptyIndex = s:markNum -1
while l:highestNonEmptyIndex >= 0 && empty(s:pattern[l:highestNonEmptyIndex])
let l:highestNonEmptyIndex -= 1
endwhile
return (l:highestNonEmptyIndex < 0 ? [] : s:pattern[0:l:highestNonEmptyIndex])
endfunction
" :MarkLoad command.
function! mark#LoadCommand( isShowMessages )
if exists('g:MARK_MARKS')
try
" Persistent global variables cannot be of type List, so we actually store
" the string representation, and eval() it back to a List.
execute 'let l:loadedMarkNum = mark#Load(' . g:MARK_MARKS . ', ' . (exists('g:MARK_ENABLED') ? g:MARK_ENABLED : 1) . ')'
if a:isShowMessages
if l:loadedMarkNum == 0
echomsg 'No persistent marks defined'
else
echomsg printf('Loaded %d mark%s', l:loadedMarkNum, (l:loadedMarkNum == 1 ? '' : 's')) . (s:enabled ? '' : '; marks currently disabled')
endif
endif
catch /^Vim\%((\a\+)\)\=:E/
let v:errmsg = 'Corrupted persistent mark info in g:MARK_MARKS and g:MARK_ENABLED'
echohl ErrorMsg
echomsg v:errmsg
echohl None
unlet! g:MARK_MARKS
unlet! g:MARK_ENABLED
endtry
elseif a:isShowMessages
let v:errmsg = 'No persistent marks found'
echohl ErrorMsg
echomsg v:errmsg
echohl None
endif
endfunction
" :MarkSave command.
function! s:SavePattern()
let l:savedMarks = mark#ToPatternList()
let g:MARK_MARKS = string(l:savedMarks)
let g:MARK_ENABLED = s:enabled
return ! empty(l:savedMarks)
endfunction
function! mark#SaveCommand()
if index(split(&viminfo, ','), '!') == -1
let v:errmsg = "Cannot persist marks, need ! flag in 'viminfo': :set viminfo+=!"
echohl ErrorMsg
echomsg v:errmsg
echohl None
return
endif
if ! s:SavePattern()
let v:warningmsg = 'No marks defined'
echohl WarningMsg
echomsg v:warningmsg
echohl None
endif
endfunction
"- initializations ------------------------------------------------------------
augroup Mark
autocmd!
autocmd WinEnter * if ! exists('w:mwMatch') | call mark#UpdateMark() | endif
autocmd TabEnter * call mark#UpdateScope()
augroup END
" Define global variables and initialize current scope.
function! mark#Init()
let s:markNum = 0
while hlexists('MarkWord' . (s:markNum + 1))
let s:markNum += 1
endwhile
let s:pattern = repeat([''], s:markNum)
let s:cycle = 0
let s:lastSearch = ''
let s:enabled = 1
endfunction
call mark#Init()
if exists('g:mwDoDeferredLoad') && g:mwDoDeferredLoad
unlet g:mwDoDeferredLoad
call mark#LoadCommand(0)
else
call mark#UpdateScope()
endif
" vim: ts=2 sw=2

230
autoload/pathogen.vim Normal file
View File

@@ -0,0 +1,230 @@
" pathogen.vim - path option manipulation
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.0
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" For management of individually installed plugins in ~/.vim/bundle (or
" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc
" prior to `fileype plugin indent on` is the only other setup necessary.
"
" The API is documented inline below. For maximum ease of reading,
" :set foldmethod=marker
if exists("g:loaded_pathogen") || &cp
finish
endif
let g:loaded_pathogen = 1
" Point of entry for basic default usage. Give a directory name to invoke
" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path
" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards,
" pathogen#cycle_filetype() is invoked.
function! pathogen#infect(...) abort " {{{1
let source_path = a:0 ? a:1 : 'bundle'
if source_path =~# '[\\/]'
call pathogen#runtime_prepend_subdirectories(source_path)
else
call pathogen#runtime_append_all_bundles(source_path)
endif
call pathogen#cycle_filetype()
endfunction " }}}1
" Split a path into a list.
function! pathogen#split(path) abort " {{{1
if type(a:path) == type([]) | return a:path | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction " }}}1
" Convert a list to a path.
function! pathogen#join(...) abort " {{{1
if type(a:1) == type(1) && a:1
let i = 1
let space = ' '
else
let i = 0
let space = ''
endif
let path = ""
while i < a:0
if type(a:000[i]) == type([])
let list = a:000[i]
let j = 0
while j < len(list)
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
let path .= ',' . escaped
let j += 1
endwhile
else
let path .= "," . a:000[i]
endif
let i += 1
endwhile
return substitute(path,'^,','','')
endfunction " }}}1
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort " {{{1
return call('pathogen#join',[1] + a:000)
endfunction " }}}1
" Remove duplicates from a list.
function! pathogen#uniq(list) abort " {{{1
let i = 0
let seen = {}
while i < len(a:list)
if has_key(seen,a:list[i])
call remove(a:list,i)
else
let seen[a:list[i]] = 1
let i += 1
endif
endwhile
return a:list
endfunction " }}}1
" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#separator() abort " {{{1
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction " }}}1
" Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort " {{{1
let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
endfunction "}}}1
" Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort " {{{1
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction "}}}1
" Turn filetype detection off and back on again if it was already enabled.
function! pathogen#cycle_filetype() " {{{1
if exists('g:did_load_filetypes')
filetype off
filetype on
endif
endfunction " }}}1
" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if
" its 'basename()' is included in g:pathogen_disabled[]' or ends in a tilde.
function! pathogen#is_disabled(path) " {{{1
if a:path =~# '\~$'
return 1
elseif !exists("g:pathogen_disabled")
return 0
endif
let sep = pathogen#separator()
return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1
endfunction "}}}1
" Prepend all subdirectories of path to the rtp, and append all 'after'
" directories in those subdirectories.
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
let sep = pathogen#separator()
let before = filter(pathogen#glob_directories(a:path.sep."*"), '!pathogen#is_disabled(v:val)')
let after = filter(pathogen#glob_directories(a:path.sep."*".sep."after"), '!pathogen#is_disabled(v:val[0:-7])')
let rtp = pathogen#split(&rtp)
let path = expand(a:path)
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
return &rtp
endfunction " }}}1
" For each directory in rtp, check for a subdirectory named dir. If it
" exists, add all subdirectories of that subdirectory to the rtp, immediately
" after the original directory. If no argument is given, 'bundle' is used.
" Repeated calls with the same arguments are ignored.
function! pathogen#runtime_append_all_bundles(...) " {{{1
let sep = pathogen#separator()
let name = a:0 ? a:1 : 'bundle'
if "\n".s:done_bundles =~# "\\M\n".name."\n"
return ""
endif
let s:done_bundles .= name . "\n"
let list = []
for dir in pathogen#split(&rtp)
if dir =~# '\<after$'
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
else
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))
return 1
endfunction
let s:done_bundles = ''
" }}}1
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() " {{{1
let sep = pathogen#separator()
for dir in pathogen#split(&rtp)
if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.'/doc') == 2 && !empty(glob(dir.'/doc/*')) && (!filereadable(dir.'/doc/tags') || filewritable(dir.'/doc/tags'))
helptags `=dir.'/doc'`
endif
endfor
endfunction " }}}1
command! -bar Helptags :call pathogen#helptags()
" Like findfile(), but hardcoded to use the runtimepath.
function! pathogen#rtpfindfile(file,count) "{{{1
let rtp = pathogen#join(1,pathogen#split(&rtp))
return fnamemodify(findfile(a:file,rtp,a:count),':p')
endfunction " }}}1
function! s:find(count,cmd,file,...) " {{{1
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
let file = pathogen#rtpfindfile(a:file,a:count)
if file ==# ''
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
elseif a:0
let path = file[0:-strlen(a:file)-2]
execute a:1.' `=path`'
return a:cmd.' '.fnameescape(a:file)
else
return a:cmd.' '.fnameescape(file)
endif
endfunction " }}}1
function! s:Findcomplete(A,L,P) " {{{1
let sep = pathogen#separator()
let cheats = {
\'a': 'autoload',
\'d': 'doc',
\'f': 'ftplugin',
\'i': 'indent',
\'p': 'plugin',
\'s': 'syntax'}
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
let request = cheats[a:A[0]].a:A[1:-1]
else
let request = a:A
endif
let pattern = substitute(request,'\'.sep,'*'.sep,'g').'*'
let found = {}
for path in pathogen#split(&runtimepath)
let matches = split(glob(path.sep.pattern),"\n")
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
call map(matches,'v:val[strlen(path)+1:-1]')
for match in matches
let found[match] = 1
endfor
endfor
return sort(keys(found))
endfunction " }}}1
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split<bang>',<q-args>)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit<bang>',<q-args>)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit<bang>',<q-args>)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit<bang>',<q-args>)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read<bang>',<q-args>)
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,'lcd')
" vim:set ft=vim ts=8 sw=2 sts=2:

View File

@@ -1,433 +0,0 @@
fun! Filename(...)
let filename = expand('%:t:r')
if filename == '' | return a:0 == 2 ? a:2 : '' | endif
return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g')
endf
fun s:RemoveSnippet()
unl! g:snipPos s:curPos s:snipLen s:endCol s:endLine s:prevLen
\ s:lastBuf s:oldWord
if exists('s:update')
unl s:startCol s:origWordLen s:update
if exists('s:oldVars') | unl s:oldVars s:oldEndCol | endif
endif
aug! snipMateAutocmds
endf
fun snipMate#expandSnip(snip, col)
let lnum = line('.') | let col = a:col
let snippet = s:ProcessSnippet(a:snip)
" Avoid error if eval evaluates to nothing
if snippet == '' | return '' | endif
" Expand snippet onto current position with the tab stops removed
let snipLines = split(substitute(snippet, '$\d\+\|${\d\+.\{-}}', '', 'g'), "\n", 1)
let line = getline(lnum)
let afterCursor = strpart(line, col - 1)
" Keep text after the cursor
if afterCursor != "\t" && afterCursor != ' '
let line = strpart(line, 0, col - 1)
let snipLines[-1] .= afterCursor
else
let afterCursor = ''
" For some reason the cursor needs to move one right after this
if line != '' && col == 1 && &ve != 'all' && &ve != 'onemore'
let col += 1
endif
endif
call setline(lnum, line.snipLines[0])
" Autoindent snippet according to previous indentation
let indent = matchend(line, '^.\{-}\ze\(\S\|$\)') + 1
call append(lnum, map(snipLines[1:], "'".strpart(line, 0, indent - 1)."'.v:val"))
" Open any folds snippet expands into
if &fen | sil! exe lnum.','.(lnum + len(snipLines) - 1).'foldopen' | endif
let [g:snipPos, s:snipLen] = s:BuildTabStops(snippet, lnum, col - indent, indent)
if s:snipLen
aug snipMateAutocmds
au CursorMovedI * call s:UpdateChangedSnip(0)
au InsertEnter * call s:UpdateChangedSnip(1)
aug END
let s:lastBuf = bufnr(0) " Only expand snippet while in current buffer
let s:curPos = 0
let s:endCol = g:snipPos[s:curPos][1]
let s:endLine = g:snipPos[s:curPos][0]
call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
let s:prevLen = [line('$'), col('$')]
if g:snipPos[s:curPos][2] != -1 | return s:SelectWord() | endif
else
unl g:snipPos s:snipLen
" Place cursor at end of snippet if no tab stop is given
let newlines = len(snipLines) - 1
call cursor(lnum + newlines, indent + len(snipLines[-1]) - len(afterCursor)
\ + (newlines ? 0: col - 1))
endif
return ''
endf
" Prepare snippet to be processed by s:BuildTabStops
fun s:ProcessSnippet(snip)
let snippet = a:snip
" Evaluate eval (`...`) expressions.
" Using a loop here instead of a regex fixes a bug with nested "\=".
if stridx(snippet, '`') != -1
while match(snippet, '`.\{-}`') != -1
let snippet = substitute(snippet, '`.\{-}`',
\ substitute(eval(matchstr(snippet, '`\zs.\{-}\ze`')),
\ "\n\\%$", '', ''), '')
endw
let snippet = substitute(snippet, "\r", "\n", 'g')
endif
" Place all text after a colon in a tab stop after the tab stop
" (e.g. "${#:foo}" becomes "${:foo}foo").
" This helps tell the position of the tab stops later.
let snippet = substitute(snippet, '${\d\+:\(.\{-}\)}', '&\1', 'g')
" Update the a:snip so that all the $# become the text after
" the colon in their associated ${#}.
" (e.g. "${1:foo}" turns all "$1"'s into "foo")
let i = 1
while stridx(snippet, '${'.i) != -1
let s = matchstr(snippet, '${'.i.':\zs.\{-}\ze}')
if s != ''
let snippet = substitute(snippet, '$'.i, s.'&', 'g')
endif
let i += 1
endw
if &et " Expand tabs to spaces if 'expandtab' is set.
return substitute(snippet, '\t', repeat(' ', &sts ? &sts : &sw), 'g')
endif
return snippet
endf
" Counts occurences of haystack in needle
fun s:Count(haystack, needle)
let counter = 0
let index = stridx(a:haystack, a:needle)
while index != -1
let index = stridx(a:haystack, a:needle, index+1)
let counter += 1
endw
return counter
endf
" Builds a list of a list of each tab stop in the snippet containing:
" 1.) The tab stop's line number.
" 2.) The tab stop's column number
" (by getting the length of the string between the last "\n" and the
" tab stop).
" 3.) The length of the text after the colon for the current tab stop
" (e.g. "${1:foo}" would return 3). If there is no text, -1 is returned.
" 4.) If the "${#:}" construct is given, another list containing all
" the matches of "$#", to be replaced with the placeholder. This list is
" composed the same way as the parent; the first item is the line number,
" and the second is the column.
fun s:BuildTabStops(snip, lnum, col, indent)
let snipPos = []
let i = 1
let withoutVars = substitute(a:snip, '$\d\+', '', 'g')
while stridx(a:snip, '${'.i) != -1
let beforeTabStop = matchstr(withoutVars, '^.*\ze${'.i.'\D')
let withoutOthers = substitute(withoutVars, '${\('.i.'\D\)\@!\d\+.\{-}}', '', 'g')
let j = i - 1
call add(snipPos, [0, 0, -1])
let snipPos[j][0] = a:lnum + s:Count(beforeTabStop, "\n")
let snipPos[j][1] = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze${'.i.'\D'))
if snipPos[j][0] == a:lnum | let snipPos[j][1] += a:col | endif
" Get all $# matches in another list, if ${#:name} is given
if stridx(withoutVars, '${'.i.':') != -1
let snipPos[j][2] = len(matchstr(withoutVars, '${'.i.':\zs.\{-}\ze}'))
let dots = repeat('.', snipPos[j][2])
call add(snipPos[j], [])
let withoutOthers = substitute(a:snip, '${\d\+.\{-}}\|$'.i.'\@!\d\+', '', 'g')
while match(withoutOthers, '$'.i.'\(\D\|$\)') != -1
let beforeMark = matchstr(withoutOthers, '^.\{-}\ze'.dots.'$'.i.'\(\D\|$\)')
call add(snipPos[j][3], [0, 0])
let snipPos[j][3][-1][0] = a:lnum + s:Count(beforeMark, "\n")
let snipPos[j][3][-1][1] = a:indent + (snipPos[j][3][-1][0] > a:lnum
\ ? len(matchstr(beforeMark, '.*\n\zs.*'))
\ : a:col + len(beforeMark))
let withoutOthers = substitute(withoutOthers, '$'.i.'\ze\(\D\|$\)', '', '')
endw
endif
let i += 1
endw
return [snipPos, i - 1]
endf
fun snipMate#jumpTabStop(backwards)
let leftPlaceholder = exists('s:origWordLen')
\ && s:origWordLen != g:snipPos[s:curPos][2]
if leftPlaceholder && exists('s:oldEndCol')
let startPlaceholder = s:oldEndCol + 1
endif
if exists('s:update')
call s:UpdatePlaceholderTabStops()
else
call s:UpdateTabStops()
endif
" Don't reselect placeholder if it has been modified
if leftPlaceholder && g:snipPos[s:curPos][2] != -1
if exists('startPlaceholder')
let g:snipPos[s:curPos][1] = startPlaceholder
else
let g:snipPos[s:curPos][1] = col('.')
let g:snipPos[s:curPos][2] = 0
endif
endif
let s:curPos += a:backwards ? -1 : 1
" Loop over the snippet when going backwards from the beginning
if s:curPos < 0 | let s:curPos = s:snipLen - 1 | endif
if s:curPos == s:snipLen
let sMode = s:endCol == g:snipPos[s:curPos-1][1]+g:snipPos[s:curPos-1][2]
call s:RemoveSnippet()
return sMode ? "\<tab>" : TriggerSnippet()
endif
call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
let s:endLine = g:snipPos[s:curPos][0]
let s:endCol = g:snipPos[s:curPos][1]
let s:prevLen = [line('$'), col('$')]
return g:snipPos[s:curPos][2] == -1 ? '' : s:SelectWord()
endf
fun s:UpdatePlaceholderTabStops()
let changeLen = s:origWordLen - g:snipPos[s:curPos][2]
unl s:startCol s:origWordLen s:update
if !exists('s:oldVars') | return | endif
" Update tab stops in snippet if text has been added via "$#"
" (e.g., in "${1:foo}bar$1${2}").
if changeLen != 0
let curLine = line('.')
for pos in g:snipPos
if pos == g:snipPos[s:curPos] | continue | endif
let changed = pos[0] == curLine && pos[1] > s:oldEndCol
let changedVars = 0
let endPlaceholder = pos[2] - 1 + pos[1]
" Subtract changeLen from each tab stop that was after any of
" the current tab stop's placeholders.
for [lnum, col] in s:oldVars
if lnum > pos[0] | break | endif
if pos[0] == lnum
if pos[1] > col || (pos[2] == -1 && pos[1] == col)
let changed += 1
elseif col < endPlaceholder
let changedVars += 1
endif
endif
endfor
let pos[1] -= changeLen * changed
let pos[2] -= changeLen * changedVars " Parse variables within placeholders
" e.g., "${1:foo} ${2:$1bar}"
if pos[2] == -1 | continue | endif
" Do the same to any placeholders in the other tab stops.
for nPos in pos[3]
let changed = nPos[0] == curLine && nPos[1] > s:oldEndCol
for [lnum, col] in s:oldVars
if lnum > nPos[0] | break | endif
if nPos[0] == lnum && nPos[1] > col
let changed += 1
endif
endfor
let nPos[1] -= changeLen * changed
endfor
endfor
endif
unl s:endCol s:oldVars s:oldEndCol
endf
fun s:UpdateTabStops()
let changeLine = s:endLine - g:snipPos[s:curPos][0]
let changeCol = s:endCol - g:snipPos[s:curPos][1]
if exists('s:origWordLen')
let changeCol -= s:origWordLen
unl s:origWordLen
endif
let lnum = g:snipPos[s:curPos][0]
let col = g:snipPos[s:curPos][1]
" Update the line number of all proceeding tab stops if <cr> has
" been inserted.
if changeLine != 0
let changeLine -= 1
for pos in g:snipPos
if pos[0] >= lnum
if pos[0] == lnum | let pos[1] += changeCol | endif
let pos[0] += changeLine
endif
if pos[2] == -1 | continue | endif
for nPos in pos[3]
if nPos[0] >= lnum
if nPos[0] == lnum | let nPos[1] += changeCol | endif
let nPos[0] += changeLine
endif
endfor
endfor
elseif changeCol != 0
" Update the column of all proceeding tab stops if text has
" been inserted/deleted in the current line.
for pos in g:snipPos
if pos[1] >= col && pos[0] == lnum
let pos[1] += changeCol
endif
if pos[2] == -1 | continue | endif
for nPos in pos[3]
if nPos[0] > lnum | break | endif
if nPos[0] == lnum && nPos[1] >= col
let nPos[1] += changeCol
endif
endfor
endfor
endif
endf
fun s:SelectWord()
let s:origWordLen = g:snipPos[s:curPos][2]
let s:oldWord = strpart(getline('.'), g:snipPos[s:curPos][1] - 1,
\ s:origWordLen)
let s:prevLen[1] -= s:origWordLen
if !empty(g:snipPos[s:curPos][3])
let s:update = 1
let s:endCol = -1
let s:startCol = g:snipPos[s:curPos][1] - 1
endif
if !s:origWordLen | return '' | endif
let l = col('.') != 1 ? 'l' : ''
if &sel == 'exclusive'
return "\<esc>".l.'v'.s:origWordLen."l\<c-g>"
endif
return s:origWordLen == 1 ? "\<esc>".l.'gh'
\ : "\<esc>".l.'v'.(s:origWordLen - 1)."l\<c-g>"
endf
" This updates the snippet as you type when text needs to be inserted
" into multiple places (e.g. in "${1:default text}foo$1bar$1",
" "default text" would be highlighted, and if the user types something,
" UpdateChangedSnip() would be called so that the text after "foo" & "bar"
" are updated accordingly)
"
" It also automatically quits the snippet if the cursor is moved out of it
" while in insert mode.
fun s:UpdateChangedSnip(entering)
if exists('g:snipPos') && bufnr(0) != s:lastBuf
call s:RemoveSnippet()
elseif exists('s:update') " If modifying a placeholder
if !exists('s:oldVars') && s:curPos + 1 < s:snipLen
" Save the old snippet & word length before it's updated
" s:startCol must be saved too, in case text is added
" before the snippet (e.g. in "foo$1${2}bar${1:foo}").
let s:oldEndCol = s:startCol
let s:oldVars = deepcopy(g:snipPos[s:curPos][3])
endif
let col = col('.') - 1
if s:endCol != -1
let changeLen = col('$') - s:prevLen[1]
let s:endCol += changeLen
else " When being updated the first time, after leaving select mode
if a:entering | return | endif
let s:endCol = col - 1
endif
" If the cursor moves outside the snippet, quit it
if line('.') != g:snipPos[s:curPos][0] || col < s:startCol ||
\ col - 1 > s:endCol
unl! s:startCol s:origWordLen s:oldVars s:update
return s:RemoveSnippet()
endif
call s:UpdateVars()
let s:prevLen[1] = col('$')
elseif exists('g:snipPos')
if !a:entering && g:snipPos[s:curPos][2] != -1
let g:snipPos[s:curPos][2] = -2
endif
let col = col('.')
let lnum = line('.')
let changeLine = line('$') - s:prevLen[0]
if lnum == s:endLine
let s:endCol += col('$') - s:prevLen[1]
let s:prevLen = [line('$'), col('$')]
endif
if changeLine != 0
let s:endLine += changeLine
let s:endCol = col
endif
" Delete snippet if cursor moves out of it in insert mode
if (lnum == s:endLine && (col > s:endCol || col < g:snipPos[s:curPos][1]))
\ || lnum > s:endLine || lnum < g:snipPos[s:curPos][0]
call s:RemoveSnippet()
endif
endif
endf
" This updates the variables in a snippet when a placeholder has been edited.
" (e.g., each "$1" in "${1:foo} $1bar $1bar")
fun s:UpdateVars()
let newWordLen = s:endCol - s:startCol + 1
let newWord = strpart(getline('.'), s:startCol, newWordLen)
if newWord == s:oldWord || empty(g:snipPos[s:curPos][3])
return
endif
let changeLen = g:snipPos[s:curPos][2] - newWordLen
let curLine = line('.')
let startCol = col('.')
let oldStartSnip = s:startCol
let updateTabStops = changeLen != 0
let i = 0
for [lnum, col] in g:snipPos[s:curPos][3]
if updateTabStops
let start = s:startCol
if lnum == curLine && col <= start
let s:startCol -= changeLen
let s:endCol -= changeLen
endif
for nPos in g:snipPos[s:curPos][3][(i):]
" This list is in ascending order, so quit if we've gone too far.
if nPos[0] > lnum | break | endif
if nPos[0] == lnum && nPos[1] > col
let nPos[1] -= changeLen
endif
endfor
if lnum == curLine && col > start
let col -= changeLen
let g:snipPos[s:curPos][3][i][1] = col
endif
let i += 1
endif
" "Very nomagic" is used here to allow special characters.
call setline(lnum, substitute(getline(lnum), '\%'.col.'c\V'.
\ escape(s:oldWord, '\'), escape(newWord, '\&'), ''))
endfor
if oldStartSnip != s:startCol
call cursor(0, startCol + s:startCol - oldStartSnip)
endif
let s:oldWord = newWord
let g:snipPos[s:curPos][2] = newWordLen
endf
" vim:noet:sw=4:ts=4:ft=vim

File diff suppressed because it is too large Load Diff

View File

@@ -1,233 +0,0 @@
"""
Copyright (c) 2005 - 2011, Eric Van Dewoestine
All rights reserved.
Redistribution and use of this software in source and binary forms, with
or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of Eric Van Dewoestine nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission of
Eric Van Dewoestine.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
import os
import re
import subprocess
import tempfile
import vim
def ctags(lang, types, filename):
ctags = vim.eval('g:Tlist_Ctags_Cmd')
startupinfo = None
if os.name == 'nt':
startupinfo = subprocess.STARTUPINFO()
if hasattr(subprocess, '_subprocess'):
startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW
else:
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
stdoutfile = tempfile.TemporaryFile()
stderrfile = tempfile.TemporaryFile()
try:
process = subprocess.Popen(
[
ctags,
'-f', '-',
'--format=2',
'--excmd=pattern',
'--fields=nks',
'--sort=no',
'--language-force=%s' % lang,
'--%s-types=%s' % (lang, types),
filename,
],
stdout=stdoutfile,
stderr=stderrfile,
stdin=subprocess.PIPE,
startupinfo=startupinfo,
)
retcode = process.wait()
if retcode != 0:
stderrfile.seek(0)
return (retcode, stderrfile.read())
stdoutfile.seek(0)
return (retcode, stdoutfile.read())
finally:
stdoutfile.close()
stderrfile.close()
def jsctags(filename):
jsctags = vim.eval('g:Tlist_JSctags_Cmd')
startupinfo = None
if os.name == 'nt':
startupinfo = subprocess.STARTUPINFO()
if hasattr(subprocess, '_subprocess'):
startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW
else:
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
temp = tempfile.mkstemp()[1]
try:
process = subprocess.Popen(
[
jsctags,
'-o', temp,
filename,
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
startupinfo=startupinfo,
)
retcode = process.wait()
if retcode != 0:
return (retcode, process.communicate()[1].strip())
return (retcode, open(temp).read())
finally:
os.unlink(temp)
def parse(filename, patterns):
f = open(filename, 'r')
contents = f.read()
f.close()
for i, info in enumerate(patterns):
flags = re.DOTALL | re.MULTILINE
if len(info) > 3:
if info[3] == 'i':
flags |= re.IGNORECASE
info = info[:3]
patterns[i] = info
try:
info[1] = re.compile(info[1], flags)
except:
print 'Failed to parse pattern: %s' % info[1]
raise
offsets = FileOffsets.compile(filename)
results = []
for ptype, regex, group in patterns:
for match in regex.finditer(contents):
start = match.start()
end = match.end()
line = offsets.offsetToLineColumn(start)[0]
col = 1
if group.isdigit():
name = match.group(int(group))
else:
matched = contents[start:end]
name = regex.sub(group, matched)
first = offsets.getLineStart(line)
last = offsets.getLineEnd(offsets.offsetToLineColumn(end)[0])
pattern = contents[first:last]
# pattern cannot span lines
if '\n' in pattern:
lines = pattern.split('\n')
for i, l in enumerate(lines):
if name in l:
pattern = l
line += i
col = l.index(name) + 1
break
# still multiline, so just use the first one
if '\n' in pattern:
pattern = lines[0]
elif name in pattern:
col = pattern.index(name) + 1
# remove ctrl-Ms
pattern = pattern.replace('\r', '')
results.append({
'type': ptype,
'name': name,
'pattern': '^%s$' % pattern,
'line': line,
'column': col,
})
return results
class FileOffsets(object):
def __init__(self):
self.offsets = []
@staticmethod
def compile(filename):
offsets = FileOffsets()
offsets.compileOffsets(filename)
return offsets;
def compileOffsets(self, filename):
f = file(filename, 'r')
try:
self.offsets.append(0);
offset = 0;
for line in f:
offset += len(line)
self.offsets.append(offset)
finally:
f.close()
def offsetToLineColumn(self, offset):
if offset <= 0:
return [1, 1]
bot = -1
top = len(self.offsets) - 1
while (top - bot) > 1:
mid = (top + bot) / 2
if self.offsets[mid] < offset:
bot = mid
else:
top = mid
if self.offsets[top] > offset:
top -= 1
line = top + 1
column = 1 + offset - self.offsets[top]
return [line, column]
def getLineStart(self, line):
return self.offsets[line - 1]
def getLineEnd(self, line):
if len(self.offsets) == line:
return self.offsets[len(self.offsets) - 1]
return self.offsets[line] - 1;

View File

@@ -1,48 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#ant#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['p', "<project\\s+(?:[^>]*)name\\s*=\\s*['\"](.*?)['\"]", 1],
\ ['i', "<import\\s+(?:[^>]*)file\\s*=\\s*['\"](.*?)['\"]", 1],
\ ['t', "<target\\s+(?:[^>]*)name\\s*=\\s*['\"](.*?)['\"]", 1],
\ ['r', "<property\\s+(?:[^>]*)name\\s*=\\s*['\"](.*?)['\"]", 1],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,45 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#dtd#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['e', '^\s*<!ELEMENT\s+(.*?)(\s|\s*$)', 1],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,46 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#html#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['a', "<a\\s+[^>]*?name=['\"](.*?)['\"]", 1],
\ ['i', "<([a-z]*?)\\s+[^>]*?id=['\"](.*?)['\"]", '\1 \2'],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,47 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#htmldjango#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['a', "<a\\s+[^>]*?name=['\"](.*?)['\"]", 1],
\ ['i', "<([a-z]*?)\\s+[^>]*?id=['\"](.*?)['\"]", '\1 \2'],
\ ['b', '\{%?\s*block\s+(\w+)', 1],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,48 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#htmljinja#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['a', "<a\\s+[^>]*?name=['\"](.*?)['\"]", 1],
\ ['i', "<([a-z]*?)\\s+[^>]*?id=['\"](.*?)['\"]", '\1 \2'],
\ ['b', '\{%?\s*block\s+(\w+)', 1],
\ ['m', '\{%-?\s*macro\s+(\w+)\s*\(', 1],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,90 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Format(types, tags) {{{
function! taglisttoo#lang#java#Format(types, tags)
let formatter = taglisttoo#util#Formatter(a:tags)
call formatter.filename()
let package = filter(copy(a:tags), 'v:val.type == "p"')
call formatter.format(a:types['p'], package, '')
let classes = filter(copy(a:tags), 'v:val.type == "c"')
" sort classes alphabetically except for the primary containing class.
if len(classes) > 1 && g:Tlist_Sort_Type == 'name'
let classes = [classes[0]] + sort(classes[1:], 'taglisttoo#util#SortTags')
endif
for class in classes
call formatter.blank()
let visibility = taglisttoo#util#GetVisibility(class)
call formatter.heading(a:types['c'], class, '')
let fields = filter(copy(a:tags),
\ 'v:val.type == "f" && v:val.parent =~ "class:.*\\<" . class.name . "$"')
call formatter.format(a:types['f'], fields, "\t")
let methods = filter(copy(a:tags),
\ 'v:val.type == "m" && v:val.parent =~ "class:.*\\<" . class.name . "$"')
call formatter.format(a:types['m'], methods, "\t")
endfor
let interfaces = filter(copy(a:tags), 'v:val.type == "i"')
if g:Tlist_Sort_Type == 'name'
call sort(interfaces, 'taglisttoo#util#SortTags')
endif
for interface in interfaces
call formatter.blank()
let visibility = taglisttoo#util#GetVisibility(interface)
call formatter.heading(a:types['i'], interface, '')
let fields = filter(copy(a:tags),
\ 'v:val.type == "f" && v:val.parent =~ "interface:.*\\<" . interface.name . "$"')
call formatter.format(a:types['f'], fields, "\t")
let methods = filter(copy(a:tags),
\ 'v:val.type == "m" && v:val.parent =~ "interface:.*\\<" . interface.name . "$"')
call formatter.format(a:types['m'], methods, "\t")
endfor
return formatter
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,303 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2011, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Global Variabls {{{
if !exists('g:TaglistTooJSctags')
let g:TaglistTooJSctags = 1
endif
" }}}
function! taglisttoo#lang#javascript#Format(types, tags) " {{{
if !g:TaglistTooJSctags || !exists('g:Tlist_JSctags_Cmd')
return s:FormatRegexResults(a:types, a:tags)
endif
return s:FormatJSctagsResults(a:types, a:tags)
endfunction " }}}
function! s:FormatJSctagsResults(types, tags) " {{{
let formatter = taglisttoo#util#Formatter(a:tags)
call formatter.filename()
let functions = filter(copy(a:tags), 'v:val.type == "f" && v:val.namespace == ""')
if len(functions) > 0
call formatter.blank()
call formatter.format(a:types['f'], functions, '')
endif
let members = filter(copy(a:tags), 'v:val.name == "includeScript"')
let objects = filter(copy(a:tags), 'v:val.jstype == "Object"')
for object in objects
if object.namespace != ''
let object.name = object.namespace . '.' . object.name
endif
call formatter.blank()
call formatter.heading(a:types['o'], object, '')
let members = filter(copy(a:tags), 'v:val.type == "f" && v:val.namespace == object.name')
call formatter.format(a:types['f'], members, "\t")
endfor
return formatter
endfunction " }}}
function! s:FormatRegexResults(types, tags) " {{{
let pos = getpos('.')
let formatter = taglisttoo#util#Formatter(a:tags)
call formatter.filename()
let object_contents = []
let objects = filter(copy(a:tags), 'v:val.type == "o"')
let members = filter(copy(a:tags), 'v:val.type == "m"')
let functions = filter(copy(a:tags),
\ 'v:val.type == "f" && v:val.pattern =~ "\\<function\\>"')
let object_bounds = {}
for object in objects
let object_start = object.line
call cursor(object_start, 1)
while search('{', 'W') && s:SkipComments()
" no op
endwhile
let object_end = searchpair('{', '', '}', 'W', 's:SkipComments()')
let methods = []
let indexes = []
let index = 0
for fct in members
if len(fct) > 3
let fct_line = fct.line
if fct_line > object_start && fct_line < object_end
call add(methods, fct)
elseif fct_line > object_end
break
elseif fct_line < object_end
call add(indexes, index)
endif
endif
let index += 1
endfor
call reverse(indexes)
for i in indexes
call remove(members, i)
endfor
let indexes = []
let index = 0
for fct in functions
if len(fct) > 3
let fct_line = fct.line
if fct_line > object_start && fct_line < object_end
call add(methods, fct)
call add(indexes, index)
elseif fct_line == object_start
call add(indexes, index)
elseif fct_line > object_end
break
endif
endif
let index += 1
endfor
call reverse(indexes)
for i in indexes
call remove(functions, i)
endfor
if len(methods) > 0
let parent_object = s:GetParentObject(
\ object_contents, object_bounds, object_start, object_end)
" remove methods from the parent if necessary
if len(parent_object)
call filter(parent_object.methods, 'index(methods, v:val) == -1')
endif
let object_bounds[string(object)] = [object_start, object_end]
call add(object_contents, {'object': object, 'methods': methods})
endif
endfor
if len(functions) > 0
call formatter.blank()
call formatter.format(a:types['f'], functions, '')
endif
if g:Tlist_Sort_Type == 'name'
call sort(object_contents, function('s:ObjectComparator'))
endif
for object_content in object_contents
call formatter.blank()
call formatter.heading(a:types['o'], object_content.object, '')
call formatter.format(a:types['f'], object_content.methods, "\t")
endfor
call setpos('.', pos)
return formatter
endfunction " }}}
function! taglisttoo#lang#javascript#Parse(file, settings) " {{{
if g:TaglistTooJSctags && !exists('g:Tlist_JSctags_Cmd')
if executable('jsctags')
let g:Tlist_JSctags_Cmd = 'jsctags'
elseif executable('javascripttags')
let g:Tlist_JSctags_Cmd = 'javascripttags'
endif
endif
if !g:TaglistTooJSctags || !exists('g:Tlist_JSctags_Cmd')
return s:ParseRegex(a:file, a:settings)
endif
return s:ParseJSctags(a:file, a:settings)
endfunction " }}}
function! s:ParseJSctags(file, settings) " {{{
python << PYTHONEOF
retcode, result = taglisttoo.jsctags(vim.eval('a:file'))
vim.command('let retcode = %i' % retcode)
vim.command("let result = '%s'" % result.replace("'", "''"))
PYTHONEOF
if retcode
call s:EchoError('jsctags failed with error code: ' . retcode)
return
endif
if has('win32') || has('win64') || has('win32unix')
let result = substitute(result, "\<c-m>\n", '\n', 'g')
endif
let results = split(result, '\n')
while len(results) && results[0] =~ '^!_'
call remove(results, 0)
endwhile
let types = keys(a:settings.tags)
let parsed_results = []
for result in results
" some results use <lnum>G;" (e.g. 1956G;") as the pattern... skip those
" for now since taglist expects actual patterns.
if result !~ '\t\/\^'
continue
endif
let pre = substitute(result, '\(.\{-}\)\t\/\^.*', '\1', '')
let pattern = substitute(result, '.\{-}\(\/\^.*\/;"\).*', '\1', '')
let post = substitute(result, '.\{-}\/\^.*\/;"\t', '', '')
let [name, filename] = split(pre, '\t')
let parts = split(post, '\t')
let [type, line_str] = parts[:1]
exec 'let line = ' . substitute(line_str, 'lineno:', '', '')
let pattern = substitute(pattern, '^/\(.*\)/;"$', '\1', '')
let jstypes = filter(copy(parts), 'v:val =~ "^type:"')
let namespaces = filter(copy(parts), 'v:val =~ "^namespace:"')
let jstype = len(jstypes) ? substitute(jstypes[0], '^type:', '', '') : ''
let ns = len(namespaces) ? substitute(namespaces[0], '^namespace:', '', '') : ''
call add(parsed_results, {
\ 'type': type,
\ 'name': name,
\ 'pattern': pattern,
\ 'line': line,
\ 'namespace': ns,
\ 'jstype': jstype,
\ })
endfor
return parsed_results
endfunction " }}}
function! s:ParseRegex(file, settings) " {{{
let patterns = []
" Match Objects/Classes
call add(patterns, ['o', '([A-Za-z0-9_.]+)\s*=\s*\{(\s*[^}]|$)', 1])
" prototype.js has Object.extend to extend existing objects.
call add(patterns, ['o', '(?:var\s+)?\b([A-Z][A-Za-z0-9_.]+)\s*=\s*Object\.extend\s*\(', 1])
call add(patterns, ['o', '\bObject\.extend\s*\(\b([A-Z][A-Za-z0-9_.]+)\s*,\s*\{', 1])
" mootools uses 'new Class'
call add(patterns, ['o', '(?:var\s+)?\b([A-Z][A-Za-z0-9_.]+)\s*=\s*new\s+Class\s*\(', 1])
" firebug uses extend
call add(patterns, ['o', '(?:var\s+)?\b([A-Z][A-Za-z0-9_.]+)\s*=\s*extend\s*\(', 1])
" vimperator uses function MyClass ()
call add(patterns, ['o', 'function\s+\b([A-Z][A-Za-z0-9_.]+)\s*\(', 1])
" vimperator uses var = (function()
call add(patterns, ['o', '([A-Za-z0-9_.]+)\s*=\s*\(function\s*\(', 1])
" Match Functions
call add(patterns, ['f', '\bfunction\s+([a-zA-Z0-9_.\$]+?)\s*\(', 1])
call add(patterns, ['f', '([a-zA-Z0-9_.\$]+?)\s*=\s*function\s*\(', 1])
" Match Members
call add(patterns, ['m', '\b([a-zA-Z0-9_.\$]+?)\s*:\s*function\s*\(', 1])
return taglisttoo#util#Parse(a:file, patterns)
endfunction " }}}
function s:ObjectComparator(o1, o2) " {{{
let n1 = a:o1['object'].name
let n2 = a:o2['object'].name
return n1 == n2 ? 0 : n1 > n2 ? 1 : -1
endfunction " }}}
function s:SkipComments() " {{{
let synname = synIDattr(synID(line('.'), col('.'), 1), "name")
return synname =~? '\(comment\|string\)'
endfunction " }}}
function s:GetParentObject(objects, bounds, start, end) " {{{
for key in keys(a:bounds)
let range = a:bounds[key]
if range[0] < a:start && range[1] > a:end
for object_content in a:objects
if string(object_content.object) == key
return object_content
endif
endfor
break
endif
endfor
return {}
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,43 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#jproperties#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [['p', '^\s*([^#]+?)\s*=', 1]])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,48 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#log4j#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['a', "<appender\\s+[^>]*?name=['\"](.*?)['\"]", 1],
\ ['c', "<category\\s+[^>]*?name=['\"](.*?)['\"]", 1],
\ ['l', "<logger\\s+[^>]*?name=['\"](.*?)['\"]", 1],
\ ['r', "<(root)\\s*>", 1],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,142 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Format(types, tags) {{{
function! taglisttoo#lang#php#Format(types, tags)
let pos = getpos('.')
let formatter = taglisttoo#util#Formatter(a:tags)
call formatter.filename()
let top_functions = filter(copy(a:tags), 'v:val.type == "f"')
let class_contents = []
let classes = filter(copy(a:tags), 'v:val.type == "c"')
if g:Tlist_Sort_Type == 'name'
call sort(classes, 'taglisttoo#util#SortTags')
endif
for class in classes
let object_start = class.line
call cursor(object_start, 1)
call search('{', 'W')
let object_end = searchpair('{', '', '}', 'W')
let functions = []
let indexes = []
let index = 0
for fct in top_functions
if len(fct) > 3
let fct_line = fct.line
if fct_line > object_start && fct_line < object_end
call add(functions, fct)
call add(indexes, index)
endif
endif
let index += 1
endfor
call reverse(indexes)
for i in indexes
call remove(top_functions, i)
endfor
call add(class_contents, {'class': class, 'functions': functions})
endfor
let interface_contents = []
let interfaces = filter(copy(a:tags), 'v:val.type == "i"')
if g:Tlist_Sort_Type == 'name'
call sort(interfaces, 'taglisttoo#util#SortTags')
endif
for interface in interfaces
let object_start = interface.line
call cursor(object_start, 1)
call search('{', 'W')
let object_end = searchpair('{', '', '}', 'W')
let functions = []
let indexes = []
let index = 0
for fct in top_functions
if len(fct) > 3
let fct_line = fct.line
if fct_line > object_start && fct_line < object_end
call add(functions, fct)
call add(indexes, index)
endif
endif
let index += 1
endfor
call reverse(indexes)
for i in indexes
call remove(top_functions, i)
endfor
call add(interface_contents, {'interface': interface, 'functions': functions})
endfor
if len(top_functions) > 0
call formatter.blank()
call formatter.format(a:types['f'], top_functions, '')
endif
for class_content in class_contents
call formatter.blank()
call formatter.heading(a:types['c'], class_content.class, '')
call formatter.format(a:types['f'], class_content.functions, "\t")
endfor
for interface_content in interface_contents
call formatter.blank()
call formatter.heading(a:types['i'], interface_content.interface, '')
call formatter.format(a:types['f'], interface_content.functions, "\t")
endfor
call setpos('.', pos)
return formatter
endfunction " }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#php#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['f', '\bfunction\s+([a-zA-Z0-9_]+)\s*\(', 1],
\ ['c', '\bclass\s+([a-zA-Z0-9_]+)', 1],
\ ['i', '\binterface\s+([a-zA-Z0-9_]+)', 1],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,66 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Format(types, tags) {{{
function! taglisttoo#lang#python#Format(types, tags)
let formatter = taglisttoo#util#Formatter(a:tags)
call formatter.filename()
let functions = filter(copy(a:tags), 'v:val.type == "f"')
if len(functions)
call formatter.blank()
call formatter.format(a:types['f'], functions, '')
endif
let classes = filter(copy(a:tags), 'v:val.type == "c"')
if g:Tlist_Sort_Type == 'name'
call sort(classes, 'taglisttoo#util#SortTags')
endif
for class in classes
call formatter.blank()
call formatter.heading(a:types['c'], class, '')
let members = filter(copy(a:tags),
\ 'v:val.type == "m" && v:val.parent == "class:" . class.name')
call formatter.format(a:types['m'], members, "\t")
endfor
return formatter
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,46 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#rst#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['a', '^\s*\.\.\s_((\\:|[^:])+):\s*\n', 1],
\ ['s', '^([^\n]+)\n[=^-]{4,}', 1],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,57 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#sql#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['g', 'create\s+(?:group|role)\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ['u', 'create\s+user\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ['p', 'create\s+(?:tablespace|dbspace)\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ['s', 'create\s+schema\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ['t', 'create\s+(?:temporary\s+)?table\s+(?:if\s+not\s+exists\s+)?[`]?([a-zA-Z0-9_.]+)[`]?', 1, 'i'],
\ ['v', 'create\s+(?:or\s+replace\s+)?view\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ['q', 'create\s+sequence\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ['x', 'create\s+(?:or\s+replace\s+)?trigger\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ['f', 'create\s+(?:or\s+replace\s+)?function\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ['c', 'create\s+(?:or\s+replace\s+)?procedure\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ['r', "exec\\s+sp_addrole\\s+['\"]([a-zA-Z0-9_.]+)['\"]", 1, 'i'],
\ ['m', "exec\\s+sp_addlogin\\s+@loginname=['\"](.*?)['\"]", 1, 'i'],
\ ['z', 'alter\s+database.*add\s+filegroup\s+([a-zA-Z0-9_.]+)', 1, 'i'],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

View File

@@ -1,46 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2010, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
" Parse(file, settings) {{{
function! taglisttoo#lang#xsd#Parse(file, settings)
return taglisttoo#util#Parse(a:file, [
\ ['e', "<(?:xs[d]?:)?element\\s+[^>]*?name=['\"](.*?)['\"]", 1],
\ ['t', "<(?:xs[d]?:)?complexType\\s+[^>]*?name=['\"](.*?)['\"]", 1],
\ ])
endfunction " }}}
" vim:ft=vim:fdm=marker

File diff suppressed because it is too large Load Diff

View File

@@ -1,131 +0,0 @@
" Author: Eric Van Dewoestine
"
" License: {{{
" Copyright (c) 2005 - 2011, Eric Van Dewoestine
" All rights reserved.
"
" Redistribution and use of this software in source and binary forms, with
" or without modification, are permitted provided that the following
" conditions are met:
"
" * Redistributions of source code must retain the above
" copyright notice, this list of conditions and the
" following disclaimer.
"
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the
" following disclaimer in the documentation and/or other
" materials provided with the distribution.
"
" * Neither the name of Eric Van Dewoestine nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission of
" Eric Van Dewoestine.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
" IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" }}}
function! taglisttoo#util#Formatter(tags) " {{{
let formatter = {'lines': [], 'content': [], 'syntax': [], 'tags': a:tags}
function! formatter.filename() dict " {{{
call add(self.content, expand('%:t'))
call add(self.lines, -1)
endfunction " }}}
function! formatter.format(type, values, indent) dict " {{{
if len(a:values) > 0
if g:Tlist_Sort_Type == 'name'
call sort(a:values, 'taglisttoo#util#SortTags')
endif
call self.heading(a:type, {}, a:indent)
for value in a:values
let visibility = taglisttoo#util#GetVisibility(value)
call add(self.content, "\t" . a:indent . visibility . value.name)
call add(self.lines, index(self.tags, value))
endfor
endif
endfunction " }}}
function! formatter.heading(type, tag, indent) dict " {{{
if len(a:tag)
call add(self.lines, index(self.tags, a:tag))
call add(self.content, a:indent . a:type . ' ' . a:tag.name)
call add(self.syntax,
\ 'syn match TagListKeyword "^\s*' . a:type . '\%' . len(self.lines) . 'l"')
else
call add(self.lines, 'label')
call add(self.content, a:indent . a:type)
call add(self.syntax, 'syn match TagListKeyword "^.*\%' . len(self.lines) . 'l.*"')
endif
endfunction " }}}
function! formatter.blank() dict " {{{
call add(self.content, '')
call add(self.lines, -1)
endfunction " }}}
return formatter
endfunction " }}}
function! taglisttoo#util#GetVisibility(tag) " {{{
let pattern = a:tag.pattern
if pattern =~ '\<public\>'
if pattern =~ '\<static\>'
return '*'
endif
return '+'
elseif pattern =~ '\<protected\>'
return '#'
elseif pattern =~ '\<private\>'
return '-'
endif
return ''
endfunction " }}}
function! taglisttoo#util#Parse(file, patterns) " {{{
python << PYTHONEOF
filename = vim.eval('a:file')
patterns = vim.eval('a:patterns')
result = taglisttoo.parse(filename, patterns)
vim.command('let results = %s' % ('%r' % result).replace("\\'", "''"))
PYTHONEOF
let tags = []
if len(results)
for result in results
" filter false positives found in comments or strings
let lnum = result.line
let line = getline(lnum)
let col = len(line) - len(substitute(line, '^\s*', '', '')) + 1
if synIDattr(synID(lnum, col, 1), 'name') =~? '\(comment\|string\)' ||
\ synIDattr(synIDtrans(synID(lnum, col, 1)), 'name') =~? '\(comment\|string\)'
continue
endif
call add(tags, result)
endfor
endif
return tags
endfunction " }}}
function! taglisttoo#util#SortTags(tag1, tag2) " {{{
let name1 = tolower(a:tag1.name)
let name2 = tolower(a:tag2.name)
return name1 == name2 ? 0 : name1 > name2 ? 1 : -1
endfunction " }}}
" vim:ft=vim:fdm=marker

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="Stylesheet" type="text/css" href="%root_path%%css%">
<title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%encoding%">
</head>
<body>
%content%
</body>
</html>

View File

@@ -1,286 +0,0 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file
" Desc: Handle diary notes
" Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/
" Load only once {{{
if exists("g:loaded_vimwiki_diary_auto") || &cp
finish
endif
let g:loaded_vimwiki_diary_auto = 1
"}}}
function! s:prefix_zero(num) "{{{
if a:num < 10
return '0'.a:num
endif
return a:num
endfunction "}}}
function! s:desc(d1, d2) "{{{
return a:d1 == a:d2 ? 0 : a:d1 < a:d2 ? 1 : -1
endfunction "}}}
function! s:get_date_link(fmt) "{{{
return strftime(a:fmt)
endfunction "}}}
function! s:link_exists(lines, link) "{{{
let link_exists = 0
for line in a:lines
if line =~ escape(a:link, '[]\')
let link_exists = 1
break
endif
endfor
return link_exists
endfunction "}}}
function! s:diary_path() "{{{
return VimwikiGet('path').VimwikiGet('diary_rel_path')
endfunction "}}}
function! s:diary_index() "{{{
return s:diary_path().VimwikiGet('diary_index').VimwikiGet('ext')
endfunction "}}}
function! s:get_diary_range(lines, header) "{{{
let rx = '\[\[\d\{4}-\d\d-\d\d\]\]'
let idx = 0
let ln_start = -1
let ln_end = -1
for line in a:lines
if ln_start != -1
if line =~ '^\s*\(=\)\+.*\1\s*$' || (line !~ rx && line !~ '^\s*$')
break
endif
endif
if line =~ '^\s*\(=\)\+\s*'.a:header.'\s*\1\s*$'
let ln_start = idx + 1
endif
let idx += 1
endfor
let ln_end = idx
return [ln_start, ln_end]
endfunction "}}}
function! s:diary_date_link() "{{{
return s:get_date_link(VimwikiGet('diary_link_fmt'))
endfunction "}}}
function! s:get_file_contents(file_name) "{{{
let lines = []
let bufnr = bufnr(expand(a:file_name))
if bufnr != -1
let lines = getbufline(bufnr, 1, '$')
else
try
let lines = readfile(expand(a:file_name))
catch
endtry
endif
return [lines, bufnr]
endfunction "}}}
function! s:get_links() "{{{
let rx = '\d\{4}-\d\d-\d\d'
let s_links = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').
\ '*'.VimwikiGet('ext'))
let s_links = substitute(s_links, '\'.VimwikiGet('ext'), "", "g")
let links = split(s_links, '\n')
" remove backup files (.wiki~)
call filter(links, 'v:val !~ ''.*\~$''')
" remove paths
call map(links, 'fnamemodify(v:val, ":t")')
call filter(links, 'v:val =~ "'.escape(rx, '\').'"')
return links
endfunction "}}}
function! s:get_position_links(link) "{{{
let idx = -1
let links = []
if a:link =~ '\d\{4}-\d\d-\d\d'
let links = s:get_links()
" include 'today' into links
if index(links, s:diary_date_link()) == -1
call add(links, s:diary_date_link())
endif
call sort(links)
let idx = index(links, a:link)
endif
return [idx, links]
endfunction "}}}
function! s:format_links(links) "{{{
let lines = []
let line = '| '
let idx = 0
let trigger = 0
while idx < len(a:links)
if idx/VimwikiGet('diary_link_count') > trigger
let trigger = idx/VimwikiGet('diary_link_count')
call add(lines, substitute(line, '\s\+$', '', ''))
let line = '| '
endif
let line .= a:links[idx].' | '
let idx += 1
endwhile
call add(lines, substitute(line, '\s\+$', '', ''))
call extend(lines, [''])
return lines
endfunction "}}}
function! s:add_link(page, header, link) "{{{
let [lines, bufnr] = s:get_file_contents(a:page)
let [ln_start, ln_end] = s:get_diary_range(lines, a:header)
let link = '[['.a:link.']]'
let link_exists = s:link_exists(lines[ln_start : ln_end], link)
if !link_exists
if ln_start == -1
call insert(lines, '= '.a:header.' =')
let ln_start = 1
let ln_end = 1
endif
" removing 'old' links
let idx = ln_end - ln_start
while idx > 0
call remove(lines, ln_start)
let idx -= 1
endwhile
" get all diary links from filesystem
let links = s:get_links()
call map(links, '"[[".v:val."]]"')
" add current link
if index(links, link) == -1
call add(links, link)
endif
let links = sort(links, 's:desc')
call extend(lines, s:format_links(links), ln_start)
if bufnr != -1
exe 'buffer '.bufnr
if !&readonly
1,$delete _
call append(1, lines)
1,1delete _
endif
else
call writefile(lines, expand(a:page))
endif
endif
endfunction "}}}
function! s:make_date_link(...) "{{{
if a:0
let link = a:1
else
let link = s:diary_date_link()
endif
let header = VimwikiGet('diary_header')
call s:add_link(s:diary_index(), header, link)
return VimwikiGet('diary_rel_path').link
endfunction "}}}
function! vimwiki#diary#make_note(index, ...) "{{{
call vimwiki#base#select(a:index)
call vimwiki#base#mkdir(VimwikiGet('path').VimwikiGet('diary_rel_path'))
if a:0
let link = s:make_date_link(a:1)
else
let link = s:make_date_link()
endif
call vimwiki#base#open_link(':e ', link, s:diary_index())
endfunction "}}}
function! vimwiki#diary#goto_index(index) "{{{
call vimwiki#base#select(a:index)
call vimwiki#base#edit_file(':e', s:diary_index())
endfunction "}}}
" Calendar.vim callback function.
function! vimwiki#diary#calendar_action(day, month, year, week, dir) "{{{
let day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month)
let link = a:year.'-'.month.'-'.day
if winnr('#') == 0
if a:dir == 'V'
vsplit
else
split
endif
else
wincmd p
if !&hidden && &modified
new
endif
endif
" Create diary note for a selected date in default wiki.
call vimwiki#diary#make_note(1, link)
endfunction "}}}
" Calendar.vim sign function.
function vimwiki#diary#calendar_sign(day, month, year) "{{{
let day = s:prefix_zero(a:day)
let month = s:prefix_zero(a:month)
let sfile = VimwikiGet('path').VimwikiGet('diary_rel_path').
\ a:year.'-'.month.'-'.day.VimwikiGet('ext')
return filereadable(expand(sfile))
endfunction "}}}
function! vimwiki#diary#goto_next_day() "{{{
let link = ''
let [idx, links] = s:get_position_links(expand('%:t:r'))
if idx == (len(links) - 1)
return
endif
if idx != -1 && idx < len(links) - 1
let link = VimwikiGet('diary_rel_path').links[idx+1]
else
" goto today
let link = VimwikiGet('diary_rel_path').s:diary_date_link()
endif
if len(link)
call vimwiki#base#open_link(':e ', link)
endif
endfunction "}}}
function! vimwiki#diary#goto_prev_day() "{{{
let link = ''
let [idx, links] = s:get_position_links(expand('%:t:r'))
if idx == 0
return
endif
if idx > 0
let link = VimwikiGet('diary_rel_path').links[idx-1]
else
" goto today
let link = VimwikiGet('diary_rel_path').s:diary_date_link()
endif
if len(link)
call vimwiki#base#open_link(':e ', link)
endif
endfunction "}}}

File diff suppressed because it is too large Load Diff

View File

@@ -1,369 +0,0 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file
" Todo lists related stuff here.
" Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/
if exists("g:loaded_vimwiki_list_auto") || &cp
finish
endif
let g:loaded_vimwiki_lst_auto = 1
" Script variables {{{
let s:rx_li_box = '\[.\?\]'
" }}}
" Script functions {{{
" Get checkbox regexp
function! s:rx_li_symbol(rate) "{{{
let result = ''
if a:rate == 100
let result = g:vimwiki_listsyms[4]
elseif a:rate == 0
let result = g:vimwiki_listsyms[0]
elseif a:rate >= 67
let result = g:vimwiki_listsyms[3]
elseif a:rate >= 34
let result = g:vimwiki_listsyms[2]
else
let result = g:vimwiki_listsyms[1]
endif
return '\['.result.'\]'
endfunction "}}}
" Get regexp of the list item.
function! s:rx_list_item() "{{{
return '\('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)'
endfunction "}}}
" Get regexp of the list item with checkbox.
function! s:rx_cb_list_item() "{{{
return s:rx_list_item().'\s*\zs\[.\?\]'
endfunction "}}}
" Get level of the list item.
function! s:get_level(lnum) "{{{
if VimwikiGet('syntax') == 'media'
let level = vimwiki#base#count_first_sym(getline(a:lnum))
else
let level = indent(a:lnum)
endif
return level
endfunction "}}}
" Get previous list item.
" Returns: line number or 0.
function! s:prev_list_item(lnum) "{{{
let c_lnum = a:lnum - 1
while c_lnum >= 1
let line = getline(c_lnum)
if line =~ s:rx_list_item()
return c_lnum
endif
if line =~ '^\s*$'
return 0
endif
let c_lnum -= 1
endwhile
return 0
endfunction "}}}
" Get next list item in the list.
" Returns: line number or 0.
function! s:next_list_item(lnum) "{{{
let c_lnum = a:lnum + 1
while c_lnum <= line('$')
let line = getline(c_lnum)
if line =~ s:rx_list_item()
return c_lnum
endif
if line =~ '^\s*$'
return 0
endif
let c_lnum += 1
endwhile
return 0
endfunction "}}}
" Find next list item in the buffer.
" Returns: line number or 0.
function! s:find_next_list_item(lnum) "{{{
let c_lnum = a:lnum + 1
while c_lnum <= line('$')
let line = getline(c_lnum)
if line =~ s:rx_list_item()
return c_lnum
endif
let c_lnum += 1
endwhile
return 0
endfunction "}}}
" Set state of the list item on line number "lnum" to [ ] or [x]
function! s:set_state(lnum, rate) "{{{
let line = getline(a:lnum)
let state = s:rx_li_symbol(a:rate)
let line = substitute(line, s:rx_li_box, state, '')
call setline(a:lnum, line)
endfunction "}}}
" Get state of the list item on line number "lnum"
function! s:get_state(lnum) "{{{
let state = 0
let line = getline(a:lnum)
let opt = matchstr(line, s:rx_cb_list_item())
if opt =~ s:rx_li_symbol(100)
let state = 100
elseif opt =~ s:rx_li_symbol(0)
let state = 0
elseif opt =~ s:rx_li_symbol(25)
let state = 25
elseif opt =~ s:rx_li_symbol(50)
let state = 50
elseif opt =~ s:rx_li_symbol(75)
let state = 75
endif
return state
endfunction "}}}
" Returns 1 if there is checkbox on a list item, 0 otherwise.
function! s:is_cb_list_item(lnum) "{{{
return getline(a:lnum) =~ s:rx_cb_list_item()
endfunction "}}}
" Returns start line number of list item, 0 if it is not a list.
function! s:is_list_item(lnum) "{{{
let c_lnum = a:lnum
while c_lnum >= 1
let line = getline(c_lnum)
if line =~ s:rx_list_item()
return c_lnum
endif
if line =~ '^\s*$'
return 0
endif
if indent(c_lnum) > indent(a:lnum)
return 0
endif
let c_lnum -= 1
endwhile
return 0
endfunction "}}}
" Returns char column of checkbox. Used in parent/child checks.
function! s:get_li_pos(lnum) "{{{
return stridx(getline(a:lnum), '[')
endfunction "}}}
" Returns list of line numbers of parent and all its child items.
function! s:get_child_items(lnum) "{{{
let result = []
let lnum = a:lnum
let p_pos = s:get_level(lnum)
" add parent
call add(result, lnum)
let lnum = s:next_list_item(lnum)
while lnum != 0 && s:is_list_item(lnum) && s:get_level(lnum) > p_pos
call add(result, lnum)
let lnum = s:next_list_item(lnum)
endwhile
return result
endfunction "}}}
" Returns list of line numbers of all items of the same level.
function! s:get_sibling_items(lnum) "{{{
let result = []
let lnum = a:lnum
let ind = s:get_level(lnum)
while lnum != 0 && s:get_level(lnum) >= ind
if s:get_level(lnum) == ind && s:is_cb_list_item(lnum)
call add(result, lnum)
endif
let lnum = s:next_list_item(lnum)
endwhile
let lnum = s:prev_list_item(a:lnum)
while lnum != 0 && s:get_level(lnum) >= ind
if s:get_level(lnum) == ind && s:is_cb_list_item(lnum)
call add(result, lnum)
endif
let lnum = s:prev_list_item(lnum)
endwhile
return result
endfunction "}}}
" Returns line number of the parent of lnum item
function! s:get_parent_item(lnum) "{{{
let lnum = a:lnum
let ind = s:get_level(lnum)
let lnum = s:prev_list_item(lnum)
while lnum != 0 && s:is_list_item(lnum) && s:get_level(lnum) >= ind
let lnum = s:prev_list_item(lnum)
endwhile
if s:is_cb_list_item(lnum)
return lnum
else
return a:lnum
endif
endfunction "}}}
" Creates checkbox in a list item.
function! s:create_cb_list_item(lnum) "{{{
let line = getline(a:lnum)
let m = matchstr(line, s:rx_list_item())
if m != ''
let li_content = substitute(strpart(line, len(m)), '^\s*', '', '')
let line = substitute(m, '\s*$', ' ', '').'[ ] '.li_content
call setline(a:lnum, line)
endif
endfunction "}}}
" Tells if all of the sibling list items are checked or not.
function! s:all_siblings_checked(lnum) "{{{
let result = 0
let cnt = 0
let siblings = s:get_sibling_items(a:lnum)
for lnum in siblings
let cnt += s:get_state(lnum)
endfor
let result = cnt/len(siblings)
return result
endfunction "}}}
" Creates checkbox on a list item if there is no one.
function! s:TLI_create_checkbox(lnum) "{{{
if a:lnum && !s:is_cb_list_item(a:lnum)
if g:vimwiki_auto_checkbox
call s:create_cb_list_item(a:lnum)
endif
return 1
endif
return 0
endfunction "}}}
" Switch state of the child list items.
function! s:TLI_switch_child_state(lnum) "{{{
let current_state = s:get_state(a:lnum)
if current_state == 100
let new_state = 0
else
let new_state = 100
endif
for lnum in s:get_child_items(a:lnum)
call s:set_state(lnum, new_state)
endfor
endfunction "}}}
" Switch state of the parent list items.
function! s:TLI_switch_parent_state(lnum) "{{{
let c_lnum = a:lnum
while s:is_cb_list_item(c_lnum)
let parent_lnum = s:get_parent_item(c_lnum)
if parent_lnum == c_lnum
break
endif
call s:set_state(parent_lnum, s:all_siblings_checked(c_lnum))
let c_lnum = parent_lnum
endwhile
endfunction "}}}
function! s:TLI_toggle(lnum) "{{{
if !s:TLI_create_checkbox(a:lnum)
call s:TLI_switch_child_state(a:lnum)
endif
call s:TLI_switch_parent_state(a:lnum)
endfunction "}}}
" Script functions }}}
" Toggle list item between [ ] and [X]
function! vimwiki#lst#ToggleListItem(line1, line2) "{{{
let line1 = a:line1
let line2 = a:line2
if line1 != line2 && !s:is_list_item(line1)
let line1 = s:find_next_list_item(line1)
endif
let c_lnum = line1
while c_lnum != 0 && c_lnum <= line2
let li_lnum = s:is_list_item(c_lnum)
if li_lnum
let li_level = s:get_level(li_lnum)
if c_lnum == line1
let start_li_level = li_level
endif
if li_level <= start_li_level
call s:TLI_toggle(li_lnum)
let start_li_level = li_level
endif
endif
let c_lnum = s:find_next_list_item(c_lnum)
endwhile
endfunction "}}}
function! vimwiki#lst#kbd_cr() "{{{
" This function is heavily relies on proper 'set comments' option.
let cr = "\<CR>"
if getline('.') =~ s:rx_cb_list_item()
let cr .= '[ ] '
endif
return cr
endfunction "}}}
function! vimwiki#lst#kbd_oO(cmd) "{{{
" cmd should be 'o' or 'O'
let l:count = v:count1
while l:count > 0
let beg_lnum = foldclosed('.')
let end_lnum = foldclosedend('.')
if end_lnum != -1 && a:cmd ==# 'o'
let lnum = end_lnum
let line = getline(beg_lnum)
else
let line = getline('.')
let lnum = line('.')
endif
" let line = substitute(m, '\s*$', ' ', '').'[ ] '.li_content
let m = matchstr(line, s:rx_list_item())
let res = ''
if line =~ s:rx_cb_list_item()
let res = substitute(m, '\s*$', ' ', '').'[ ] '
elseif line =~ s:rx_list_item()
let res = substitute(m, '\s*$', ' ', '')
elseif &autoindent || &smartindent
let res = matchstr(line, '^\s*')
endif
if a:cmd ==# 'o'
call append(lnum, res)
call cursor(lnum + 1, col('$'))
else
call append(lnum - 1, res)
call cursor(lnum, col('$'))
endif
let l:count -= 1
endwhile
startinsert!
endfunction "}}}

View File

@@ -1,39 +0,0 @@
body {font-family: Tahoma, Geneva, sans-serif; margin: 1em 2em 1em 2em; font-size: 100%; line-height: 130%;}
h1, h2, h3, h4, h5, h6 {font-family: Trebuchet MS, Helvetica, sans-serif; font-weight: bold; line-height:100%; margin-top: 1.5em; margin-bottom: 0.5em;}
h1 {font-size: 2.6em; color: #000000;}
h2 {font-size: 2.2em; color: #404040;}
h3 {font-size: 1.8em; color: #707070;}
h4 {font-size: 1.4em; color: #909090;}
h5 {font-size: 1.3em; color: #989898;}
h6 {font-size: 1.2em; color: #9c9c9c;}
p, pre, blockquote, table, ul, ol, dl {margin-top: 1em; margin-bottom: 1em;}
ul ul, ul ol, ol ol, ol ul {margin-top: 0.5em; margin-bottom: 0.5em;}
li {margin: 0.3em auto;}
ul {margin-left: 2em; padding-left: 0.5em;}
dt {font-weight: bold;}
img {border: none;}
pre {border-left: 1px solid #ccc; margin-left: 2em; padding-left: 0.5em;}
blockquote {padding: 0.4em; background-color: #f6f5eb;}
th, td {border: 1px solid #ccc; padding: 0.3em;}
th {background-color: #f0f0f0;}
hr {border: none; border-top: 1px solid #ccc; width: 100%;}
del {text-decoration: line-through; color: #777777;}
.toc li {list-style-type: none;}
.todo {font-weight: bold; background-color: #f0ece8; color: #a03020;}
.justleft {text-align: left;}
.justright {text-align: right;}
.justcenter {text-align: center;}
.center {margin-left: auto; margin-right: auto;}
/* classes for items of todo lists */
.done0:before {content: "\2592\2592\2592\2592"; color: SkyBlue;}
.done1:before {content: "\2588\2592\2592\2592"; color: SkyBlue;}
.done2:before {content: "\2588\2588\2592\2592"; color: SkyBlue;}
.done3:before {content: "\2588\2588\2588\2592"; color: SkyBlue;}
.done4:before {content: "\2588\2588\2588\2588"; color: SkyBlue;}
/* comment the next four or five lines out *
* if you do not want color-coded todo lists */
.done0 {color: #c00000;}
.done1 {color: #c08000;}
.done2 {color: #80a000;}
.done3 {color: #00c000;}
.done4 {color: #7f7f7f; text-decoration: line-through;}

View File

@@ -1,510 +0,0 @@
" vim:tabstop=2:shiftwidth=2:expandtab:foldmethod=marker:textwidth=79
" Vimwiki autoload plugin file
" Desc: Tables
" | Easily | manageable | text | tables | ! |
" |--------+------------+-------+--------+---------|
" | Have | fun! | Drink | tea | Period. |
"
" Author: Maxim Kim <habamax@gmail.com>
" Home: http://code.google.com/p/vimwiki/
" Load only once {{{
if exists("g:loaded_vimwiki_tbl_auto") || &cp
finish
endif
let g:loaded_vimwiki_tbl_auto = 1
"}}}
let s:textwidth = &tw
" Misc functions {{{
function! s:wide_len(str) "{{{
" vim73 has new function that gives correct string width.
if exists("*strdisplaywidth")
return strdisplaywidth(a:str)
endif
" get str display width in vim ver < 7.2
if !g:vimwiki_CJK_length
let ret = strlen(substitute(a:str, '.', 'x', 'g'))
else
let savemodified = &modified
let save_cursor = getpos('.')
exe "norm! o\<esc>"
call setline(line("."), a:str)
let ret = virtcol("$") - 1
d
call setpos('.', save_cursor)
let &modified = savemodified
endif
return ret
endfunction "}}}
function! s:is_table(line) "{{{
return a:line =~ '^\s*\%(|[^|]\+\)\+|\s*$' || s:is_separator(a:line)
endfunction "}}}
function! s:is_separator(line) "{{{
return a:line =~ '^\s*[|+]\s*--[-|+]\+'
endfunction "}}}
function! s:is_last_column(lnum, cnum) "{{{
return strpart(getline(a:lnum), a:cnum - 1) =~ '^[^|]*|\s*$'
endfunction "}}}
function! s:is_first_column(lnum, cnum) "{{{
let line = strpart(getline(a:lnum), 0, a:cnum - 1)
return line =~ '^\s*|[^|]*$' || line =~ '^\s*$'
endfunction "}}}
function! s:count_separators_up(lnum) "{{{
let lnum = a:lnum - 1
while lnum > 1
if !s:is_separator(getline(lnum))
break
endif
let lnum -= 1
endwhile
return (a:lnum-lnum)
endfunction "}}}
function! s:count_separators_down(lnum) "{{{
let lnum = a:lnum + 1
while lnum < line('$')
if !s:is_separator(getline(lnum))
break
endif
let lnum += 1
endwhile
return (lnum-a:lnum)
endfunction "}}}
function! s:create_empty_row(cols) "{{{
let first_cell = "| |"
let cell = " |"
let row = first_cell
for c in range(a:cols - 1)
let row .= cell
endfor
return row
endfunction "}}}
function! s:create_row_sep(cols) "{{{
let first_cell = "|---+"
let cell = "---+"
let last_cell = "---|"
if a:cols < 2
return "|---|"
endif
let row = first_cell
for c in range(a:cols - 2)
let row .= cell
endfor
let row .= last_cell
return row
endfunction "}}}
function! s:get_values(line) "{{{
return split(a:line, '\s*|\s*', 1)[1:-2]
endfunction "}}}
function! s:col_count(lnum) "{{{
let line = getline(a:lnum)
if !s:is_separator(line)
return len(split(line, '\s*|\s*', 1)[1:-2])
else
return len(split(line, '-+-', 1))
endif
endfunction "}}}
function! s:get_indent(lnum) "{{{
if !s:is_table(getline(a:lnum))
return
endif
let indent = 0
let lnum = a:lnum - 1
while lnum > 1
let line = getline(lnum)
if !s:is_table(line)
let indent = indent(lnum+1)
break
endif
let lnum -= 1
endwhile
return indent
endfunction " }}}
function! s:get_rows(lnum) "{{{
if !s:is_table(getline(a:lnum))
return
endif
let upper_rows = []
let lower_rows = []
let lnum = a:lnum - 1
while lnum > 1
let line = getline(lnum)
if s:is_table(line)
call add(upper_rows, [lnum, line])
else
break
endif
let lnum -= 1
endwhile
call reverse(upper_rows)
let lnum = a:lnum
while lnum <= line('$')
let line = getline(lnum)
if s:is_table(line)
call add(lower_rows, [lnum, line])
else
break
endif
let lnum += 1
endwhile
return upper_rows + lower_rows
endfunction "}}}
function! s:get_cell_max_lens(lnum) "{{{
let max_lens = {}
for [lnum, row] in s:get_rows(a:lnum)
if s:is_separator(row)
continue
endif
let cells = s:get_values(row)
for idx in range(len(cells))
let value = cells[idx]
if has_key(max_lens, idx)
let max_lens[idx] = max([s:wide_len(value), max_lens[idx]])
else
let max_lens[idx] = s:wide_len(value)
endif
endfor
endfor
return max_lens
endfunction "}}}
function! s:get_aligned_rows(lnum, col1, col2) "{{{
let max_lens = s:get_cell_max_lens(a:lnum)
let rows = []
for [lnum, row] in s:get_rows(a:lnum)
if s:is_separator(row)
let new_row = s:fmt_sep(max_lens, a:col1, a:col2)
else
let new_row = s:fmt_row(row, max_lens, a:col1, a:col2)
endif
call add(rows, [lnum, new_row])
endfor
return rows
endfunction "}}}
" Number of the current column. Starts from 0.
function! s:cur_column() "{{{
let line = getline('.')
if !s:is_table(line)
return -1
endif
if s:is_separator(line)
let sep = '[+|]'
else
let sep = '|'
endif
let curs_pos = col('.')
let mpos = match(line, '|', 0)
let col = -1
while mpos < curs_pos && mpos != -1
let mpos = match(line, sep, mpos+1)
if mpos != -1
let col += 1
endif
endwhile
return col
endfunction "}}}
" }}}
" Format functions {{{
function! s:fmt_cell(cell, max_len) "{{{
let cell = ' '.a:cell.' '
let diff = a:max_len - s:wide_len(a:cell)
if diff == 0 && empty(a:cell)
let diff = 1
endif
let cell .= repeat(' ', diff)
return cell
endfunction "}}}
function! s:fmt_row(line, max_lens, col1, col2) "{{{
let new_line = '|'
let cells = s:get_values(a:line)
for idx in range(len(cells))
if idx == a:col1
let idx = a:col2
elseif idx == a:col2
let idx = a:col1
endif
let value = cells[idx]
let new_line .= s:fmt_cell(value, a:max_lens[idx]).'|'
endfor
let idx = len(cells)
while idx < len(a:max_lens)
let new_line .= s:fmt_cell('', a:max_lens[idx]).'|'
let idx += 1
endwhile
return new_line
endfunction "}}}
function! s:fmt_cell_sep(max_len) "{{{
if a:max_len == 0
return repeat('-', 3)
else
return repeat('-', a:max_len+2)
endif
endfunction "}}}
function! s:fmt_sep(max_lens, col1, col2) "{{{
let sep = '|'
for idx in range(len(a:max_lens))
if idx == a:col1
let idx = a:col2
elseif idx == a:col2
let idx = a:col1
endif
let sep .= s:fmt_cell_sep(a:max_lens[idx]).'+'
endfor
let sep = substitute(sep, '+$', '|', '')
return sep
endfunction "}}}
"}}}
" Keyboard functions "{{{
function! s:kbd_create_new_row(cols, goto_first) "{{{
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
let cmd .= "\<ESC>:call vimwiki#tbl#format(line('.'))\<CR>"
if a:goto_first
let cmd .= "\<ESC>0:call search('|', 'c', line('.'))\<CR>la"
else
let cmd .= "0".(col('.')-1)."lT|a"
endif
return cmd
endfunction "}}}
function! s:kbd_goto_next_row() "{{{
let cmd = "\<ESC>jt|T|a"
return cmd
endfunction "}}}
function! s:kbd_goto_prev_row() "{{{
let cmd = "\<ESC>jt|T|a"
return cmd
endfunction "}}}
function! s:kbd_goto_next_col(last) "{{{
if a:last
let seps = s:count_separators_down(line('.'))
let cmd = "\<ESC>".seps."j0:call search('|', 'c', line('.'))\<CR>la"
else
let cmd = "\<ESC>:call search('|', 'c', line('.'))\<CR>la"
endif
return cmd
endfunction "}}}
function! s:kbd_goto_prev_col(first) "{{{
if a:first
let seps = s:count_separators_up(line('.'))
let cmd = "\<ESC>".seps."k$:call search('|', 'b', line('.'))\<CR>la"
else
let cmd = "\<ESC>2F|la"
endif
return cmd
endfunction "}}}
"}}}
" Global functions {{{
function! vimwiki#tbl#kbd_cr() "{{{
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<CR>"
endif
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
let cols = len(s:get_values(getline(lnum)))
return s:kbd_create_new_row(cols, 0)
else
return s:kbd_goto_next_row()
endif
endfunction "}}}
function! vimwiki#tbl#kbd_tab() "{{{
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<Tab>"
endif
let last = s:is_last_column(lnum, col('.'))
if last && !s:is_table(getline(lnum+1))
let cols = len(s:get_values(getline(lnum)))
return s:kbd_create_new_row(cols, 1)
endif
return s:kbd_goto_next_col(last)
endfunction "}}}
function! vimwiki#tbl#kbd_shift_tab() "{{{
let lnum = line('.')
if !s:is_table(getline(lnum))
return "\<S-Tab>"
endif
let first = s:is_first_column(lnum, col('.'))
if first && !s:is_table(getline(lnum-1))
return ""
endif
return s:kbd_goto_prev_col(first)
endfunction "}}}
function! vimwiki#tbl#format(lnum, ...) "{{{
let line = getline(a:lnum)
if !s:is_table(line)
return
endif
if a:0 == 2
let col1 = a:1
let col2 = a:2
else
let col1 = 0
let col2 = 0
endif
let indent = s:get_indent(a:lnum)
for [lnum, row] in s:get_aligned_rows(a:lnum, col1, col2)
let row = repeat(' ', indent).row
call setline(lnum, row)
endfor
let &tw = s:textwidth
endfunction "}}}
function! vimwiki#tbl#create(...) "{{{
if a:0 > 1
let cols = a:1
let rows = a:2
elseif a:0 == 1
let cols = a:1
let rows = 2
elseif a:0 == 0
let cols = 5
let rows = 2
endif
if cols < 1
let cols = 5
endif
if rows < 1
let rows = 2
endif
let lines = []
let row = s:create_empty_row(cols)
call add(lines, row)
if rows > 1
call add(lines, s:create_row_sep(cols))
endif
for r in range(rows - 1)
call add(lines, row)
endfor
call append(line('.'), lines)
endfunction "}}}
function! vimwiki#tbl#align_or_cmd(cmd) "{{{
if s:is_table(getline('.'))
call vimwiki#tbl#format(line('.'))
else
exe 'normal! '.a:cmd
endif
endfunction "}}}
function! vimwiki#tbl#reset_tw(lnum) "{{{
let line = getline(a:lnum)
if !s:is_table(line)
return
endif
let s:textwidth = &tw
let &tw = 0
endfunction "}}}
" TODO: move_column_left and move_column_right are good candidates to be
" refactored.
function! vimwiki#tbl#move_column_left() "{{{
if !s:is_table(getline('.'))
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col > 0
call vimwiki#tbl#format(line('.'), cur_col-1, cur_col)
call cursor(line('.'), 1)
if !s:is_separator(getline('.'))
call search('\%(|[^|]\+\)\{'.(cur_col-1).'}| .', 'eW')
else
call search('|\%([^+]\++\)\{'.(cur_col-1).'}--', 'eW')
endif
endif
endfunction "}}}
function! vimwiki#tbl#move_column_right() "{{{
if !s:is_table(getline('.'))
return
endif
let cur_col = s:cur_column()
if cur_col == -1
return
endif
if cur_col < s:col_count(line('.'))-1
call vimwiki#tbl#format(line('.'), cur_col, cur_col+1)
call cursor(line('.'), 1)
if !s:is_separator(getline('.'))
call search('\%(|[^|]\+\)\{'.(cur_col+1).'}| .', 'eW')
else
call search('|\%([^+]\++\)\{'.(cur_col+1).'}--', 'eW')
endif
endif
endfunction "}}}
function! vimwiki#tbl#get_rows(lnum) "{{{
return s:get_rows(a:lnum)
endfunction "}}}
"}}}

View File

@@ -1,99 +0,0 @@
body { color: #000; background-color: #fff; margin: 0px 10%; min-width: 720px; font-family: Verdana, sans-serif;
counter-reset: chapter section subsection subsubsection paragraph lchapter lsection lsubsection lsubsubsection lparagraph}
div.footnote { border-left: 1px solid #000; margin-left: 0em; clear: both }
div.ftext { position: relative; margin-left: 50px }
div.fnumber { float: left; width: 40px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
div.fnumber a { margin: 0px; padding: 0px }
div.ctext { position: relative; margin-left: 100px }
div.cnumber { float: left; width: 90px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
div.cnumber a { margin: 0px; padding: 0px }
div.tip { border: 2px solid #0d0; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
div.warning, div.caution, div.danger, div.error { border: 2px solid #f00; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
div.note, div.hint, div.important { border: 2px solid #000; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
div.figure { display: block; padding: 1em; width: 400px; clear: both}
div.topic { margin: 2em }
div.vstsidebar, div.sidebar { border: 2px solid #aaa; color: #000; background-color: #ffffee; float: right; width: 40%; margin-left: 1em; margin-right: -1em; padding: 1em }
span.strike { text-decoration: line-through }
span.big { font-size: large }
span.small { font-size: small }
span.title { font-style: italic }
span.notetitle { font-size: large; font-weight: 900; font-family: Verdana, sans-serif }
p.toc { font-size: large; font-weight: 900 }
p.notesubtitle { font-weight: 900; font-family: Verdana, sans-serif }
p.attribution { font-style: italic; margin-left: 8em; text-indent: -1.4em }
.vstright { float: right; margin: 1em }
.vstleft { float: left; margin: 1em }
.vstcenter { margin: 1em auto }
blockquote.pull { font-size: large }
p.rubric { font-size: large; margin-left: 2em }
dd.normal { margin-bottom: 0.5em }
dt.option { float: left; margin: 0em 0em 5px 2em; padding: 0px; font-family: monospace }
dd.option { padding: 0px; margin: 0em 0em 5px 10em; text-indent: 0.5em }
dd.option > p { margin: 0px }
dd.normal > p { margin: 0px }
table { border-collapse: collapse; margin: 0.5em 0em }
thead, tfoot { text-align: center; font-weight: bold }
td { border: 1px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
td blockquote p{ margin: 0px; padding: 0px}
td blockquote { margin: 0px; padding: 0px}
table.vstbless td { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
td > p { margin: 0px }
table.field { border: 0px solid #000; margin-left: 2em; padding: 0.25em; _top: 0%; vertical-align: top }
td.fkey { font-weight: 900 }
td.fval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
td.fkey { font-weight: 900; border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
td.fdkey { text-align: center; font-weight: 900 }
td.fdval { text-align: center; font-style: italic }
td.fakey { text-align: center; font-weight: 900 }
td.faval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
hr { width: 80%; margin: 1.5em auto }
h1 { text-align: center; clear: both }
h2, h3, h4, h5, h6 { text-align: left; margin-top: 1em; clear: both }
h2 { counter-reset: section subsection subsubsection paragraph }
h3 { counter-reset: subsection subsubsection paragraph }
h4 { counter-reset: subsubsection paragraph }
h5 { counter-reset: paragraph }
h1 a { color: #000; background-color: transparent }
h2 a { color: #000; background-color: transparent }
h3 a { color: #000; background-color: transparent }
h4 a { color: #000; background-color: transparent }
h5 a { color: #000; background-color: transparent }
h6 a { color: #000; background-color: transparent }
p.subh1 { text-align: center; font-size: 120%; font-variant: small-caps }
p.subh2, p.subh3, p.subh4, p.subh5, p.subh6 { text-align: left; font-size: 120%; font-variant: small-caps }
h2:before { content: counter(chapter)" "; counter-increment: chapter }
h3:before { content: counter(chapter)"."counter(section)" "; counter-increment: section }
h4:before { content: counter(chapter)"."counter(section)"."counter(subsection)" "; counter-increment: subsection }
h5:before { content: counter(chapter)"."counter(section)"."counter(subsection)"."counter(subsubsection)" "; counter-increment: subsubsection }
h6:before { content: counter(chapter)"."counter(section)"."counter(subsection)"."counter(subsubsection)"."counter(paragraph)" "; counter-increment: paragraph}
li.h1 { margin-left: 0em }
li.h2 { margin-left: 1em; counter-reset: lsection lsubsection lsubsubsection lparagraph }
li.h3 { margin-left: 2em; counter-reset: lsubsection lsubsubsection lparagraph }
li.h4 { margin-left: 3em; counter-reset: lsubsubsection lparagraph }
li.h5 { margin-left: 4em; counter-reset: lparagraph }
li.h2:before { content: counter(lchapter)" "; counter-increment: lchapter }
li.h3:before { content: counter(lchapter)"."counter(lsection)" "; counter-increment: lsection }
li.h4:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)" "; counter-increment: lsubsection }
li.h5:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)"."counter(lsubsubsection)" "; counter-increment: lsubsubsection }
li.h6:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)"."counter(lsubsubsection)"."counter(lparagraph)" "; counter-increment: lparagraph}
li.h6 { margin-left: 5em }
ol, ul { margin-bottom: 0.5em; margin-top: 0.5em }
ol.loweralpha { list-style-type: lower-alpha }
ol.upperalpha { list-style-type: upper-alpha }
ol.lowerroman { list-style-type: lower-roman }
ol.upperroman { list-style-type: upper-roman }
ol.decimal { list-style-type: decimal }
ul.square { list-style-type: square }
ul.circle { list-style-type: circle }
ul.disc { list-style-type: disc }
li > p { margin: 0em }
img { border: 1px solid #000; padding: 0em; display: block; margin: 1em auto }
img.inline { border: 1px solid #000; padding: 0em; margin: 0em; display: inline }
pre { color: #000; background-color: #eee; margin-left: 2em; clear: both; overflow: auto }
div.unknown { font-family: monospace; color: #000; background-color: #fff; margin: 1em; padding: 1em; clear: both; border: 3px solid red}
pre.quoted { color: #000; background-color: #eee; margin-left: 0em; clear: both; overflow: auto }
pre.rawlatex { color: #000; background-color: #ddd; border: 1px solid #000; padding: 0.1em; clear: both; overflow: auto }
pre.address { font-family: Verdana, sans-serif; display: inline; margin: 0px; color: #000; background-color: #fff; overflow: auto }
span.target { text-decoration: underline }
div.vstfooter hr { width: 100%; margin: 0px }
div.vstfooter p { margin: 0px }

View File

@@ -1,110 +0,0 @@
/* Vim reStructured Text CSS */
body { background-color: #fff; margin: 0px 10%; width: 45em; font-family: Georgia, serif;}
div.footnote { border-left: 1px solid silver; margin-left: 0em; clear: both }
div.ftext { position: relative; margin-left: 50px }
div.fnumber { float: left; width: 40px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
div.fnumber a { margin: 0px; padding: 0px }
div.ctext { position: relative; margin-left: 100px }
div.cnumber { float: left; width: 90px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
div.cnumber a { margin: 0px; padding: 0px }
div.tip { border: 2px solid #0d0; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
div.warning, div.caution, div.danger, div.error { border: 2px solid #f00; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
div.note, div.hint, div.important { border: 2px solid silver; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
div.figure { display: block; padding: 1em; width: 400px; clear: both}
div.topic { margin: 2em }
div.vstsidebar, div.sidebar { border: 2px solid #aaa; background-color: #ffffee; float: right; width: 40%; margin-left: 1em; margin-right: -1em; padding: 1em }
span.strike { text-decoration: line-through }
span.big { font-size: large }
span.small { font-size: small }
span.title { font-style: italic }
span.toc { font-size: large; font-weight: 900 }
span.notetitle { font-size: large; font-weight: 900; font-family: Arial, sans-serif }
p.notesubtitle { font-weight: 900; font-family: Arial, sans-serif }
p.attribution { font-style: italic; margin-left: 8em; text-indent: -1.4em }
.vstright { float: right; margin: 1em }
.vstleft { float: left; margin: 1em }
.vstcenter { margin: 1em; margin-left: auto; margin-right: auto }
blockquote.pull { font-size: large }
p.rubric { font-size: large; margin-left: 2em }
dd.normal { margin-bottom: 0.5em }
dt.option { float: left; margin: 0em 0em 5px 2em; padding: 0px; font-family: monospace }
dd.option { margin: 0px; padding: 0px; margin: 0em 0em 5px 10em; text-indent: 0.5em }
dd.option > p { margin: 0px }
dd.normal > p { margin: 0px }
table { border-collapse: collapse; border-top: 1px solid navy; border-bottom: 1px solid navy; margin: 0.5em; margin-left: 0em; margin-right: 0em }
thead, tfoot { text-align: center; font-weight: bold }
thead { font-family: Arial, sans-serif; border-bottom: 1px solid silver; }
td { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
td blockquote p{ margin: 0px; padding: 0px}
td blockquote { margin: 0px; padding: 0px}
table.vstbless { border: 0px solid #000; }
table.vstbless thead { border: 0px solid #000; }
table.vstbless td { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
td > p { margin: 0px }
table.field { border: 0px solid #000; margin-left: 2em; padding: 0.25em; _top: 0%; vertical-align: top }
td.fkey { font-weight: 900 }
td.fval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
td.fkey { font-weight: 900; border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
td.fdkey { text-align: center; font-weight: 900 }
td.fdval { text-align: center; font-style: italic }
td.fakey { text-align: center; font-weight: 900 }
td.faval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
hr { width: 80%; margin: 1.5em auto; border: 1px solid silver }
h1 { border-bottom: 2px solid silver; text-align: center; clear: both }
h2, h3, h4, h5, h6 { text-align: left; margin-top: 1em; clear: both; padding-top: 0.5em;}
h2, h3 { border-bottom: 1px solid silver; }
h1 a { color: dodgerblue4 }
h2 a { color: dodgerblue4 }
h3 a { color: dodgerblue4 }
h4 a { color: dodgerblue4 }
h5 a { color: dodgerblue4 }
h6 a { color: dodgerblue4 }
p.subh1 { text-align: center; font-size: 120%; font-variant: small-caps }
p.subh2, p.subh3, p.subh4, p.subh5, p.subh6 { text-align: left; font-size: 120%; font-variant: small-caps }
li.h1 { margin-left: 0em }
li.h2 { margin-left: 1em;}
li.h3 { margin-left: 2em;}
li.h4 { margin-left: 3em;}
li.h5 { margin-left: 4em;}
li.h6 { margin-left: 5em }
ol, ul { margin-bottom: 0.5em; margin-top: 0.5em }
ol.loweralpha { list-style-type: lower-alpha }
ol.upperalpha { list-style-type: upper-alpha }
ol.lowerroman { list-style-type: lower-roman }
ol.upperroman { list-style-type: upper-roman }
ol.decimal { list-style-type: decimal }
ul.square { list-style-type: square }
ul.circle { list-style-type: circle }
ul.disc { list-style-type: disc }
li > p { margin: 0em }
img { border: 1px solid #000; padding: 0em; display: block; margin: 1em; margin-left: auto; margin-right: auto }
img.inline { border: 1px solid #000; padding: 0em; margin: 0em; display: inline }
pre { background-color: #f9f9f9; margin-left: 2em; clear: both; overflow: auto }
div.unknown { font-family: monospace; background-color: #fff; margin: 1em; padding: 1em; clear: both; border: 3px solid red}
pre.quoted { background-color: #eee; margin-left: 0em; clear: both; overflow: auto }
pre.rawlatex { background-color: #ddd; border: 1px solid #000; padding: 0.1em; clear: both; overflow: auto }
pre.address { font-family: Georgia, serif; display: inline; margin: 0px; background-color: #fff; overflow: auto }
span.target { text-decoration: underline }
div.vstfooter hr { width: 100%; margin: 0px; margin-top: 0em }
div.vstfooter p { margin: 0px }
/* Debug borders */
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
/*
border: 1px solid red;
*/
}
a { color: dodgerblue4; }
a:visited { color: fuchsia; }
tt { color: dodgerblue4; }
h1, h2, h3, h4, h5, h6 {
color: dodgerblue4;
font-family: Arial, sans-serif;
margin-top: 1.2em;
margin-bottom: 0.5em;
line-height: 1.3;
}

View File

@@ -1,18 +0,0 @@
" Author: Mikolaj Machowski
" Example of macro for g:vst_html_post file
call cursor(1,1)
while search('^\s*{read\w\{-}:.\{-}}\s*$', 'W')
let data = matchlist(getline('.'), '^\s*{read\(\w\{-}\):\(.\{-}\)}\s*$')
silent s/.*//ge
if data[1] == ''
let output = readfile(data[2])
else
if data[1] == 'bang'
let data[1] = ''
endif
let output = split(system(data[1].' '.data[2]), "\n")
endif
call map(output, "' '.v:val")
let jout = "<pre>\n".join(output, "\n")."\n</pre>"
put =jout
endwhile

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 B

View File

@@ -1,23 +0,0 @@
/* The following styles size, place, and layer the slide components.
Edit these if you want to change the overall slide layout.
The commented lines can be uncommented (and modified, if necessary)
to help you with the rearrangement process. */
/* target = 1024x768 */
div#header, div#footer, .slide {width: 100%; top: 0; left: 0;}
div#header {top: 0; height: 3em; z-index: 1;}
div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}
.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}
div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}
div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
margin: 0;}
#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}
html>body #currentSlide {position: fixed;}
/*
div#header {background: #FCC;}
div#footer {background: #CCF;}
div#controls {background: #BBD;}
div#currentSlide {background: #FFC;}
*/

View File

@@ -1,42 +0,0 @@
<public:component>
<public:attach event="onpropertychange" onevent="doFix()" />
<script>
// IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com
// Free usage permitted as long as this notice remains intact.
// This must be a path to a blank image. That's all the configuration you need here.
var blankImg = 'v11rc1/default/blank.gif';
var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
function filt(s, m) {
if (filters[f]) {
filters[f].enabled = s ? true : false;
if (s) with (filters[f]) { src = s; sizingMethod = m }
} else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
}
function doFix() {
if ((parseFloat(navigator.userAgent.match(/MSIE (\S+)/)[1]) < 5.5) ||
(event && !/(background|src)/.test(event.propertyName))) return;
if (tagName == 'IMG') {
if ((/\.png$/i).test(src)) {
filt(src, 'image'); // was 'scale'
src = blankImg;
} else if (src.indexOf(blankImg) < 0) filt();
} else if (style.backgroundImage) {
if (style.backgroundImage.match(/^url[("']+(.*\.png)[)"']+$/i)) {
var s = RegExp.$1;
style.backgroundImage = '';
filt(s, 'crop');
} else filt();
}
}
doFix();
</script>
</public:component>

View File

@@ -1,7 +0,0 @@
/* DO NOT CHANGE THESE unless you really want to break Opera Show */
.slide {
visibility: visible !important;
position: static !important;
page-break-before: always;
}
#slide0 {page-break-before: avoid;}

View File

@@ -1,15 +0,0 @@
/* don't change this unless you want the layout stuff to show up in the outline view! */
.layout div, #footer *, #controlForm * {display: none;}
#footer, #controls, #controlForm, #navLinks, #toggle {
display: block; visibility: visible; margin: 0; padding: 0;}
#toggle {float: right; padding: 0.5em;}
html>body #toggle {position: fixed; top: 0; right: 0;}
/* making the outline look pretty-ish */
#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}
#slide0 h1 {padding-top: 1.5em;}
.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;
border-top: 1px solid #888; border-bottom: 1px solid #AAA;}
#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}

View File

@@ -1,86 +0,0 @@
/* Following are the presentation styles -- edit away! */
body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}
:link, :visited {text-decoration: none; color: #00C;}
#controls :active {color: #88A !important;}
#controls :focus {outline: 1px dotted #227;}
h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}
ul, pre {margin: 0; line-height: 1em;}
html, body {margin: 0; padding: 0;}
blockquote, q {font-style: italic;}
blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}
blockquote p {margin: 0;}
blockquote i {font-style: normal;}
blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}
blockquote b i {font-style: italic;}
kbd {font-weight: bold; font-size: 1em;}
sup {font-size: smaller; line-height: 1px;}
.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}
.slide code.bad, code del {color: red;}
.slide code.old {color: silver;}
.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}
.slide pre code {display: block;}
.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}
.slide li {margin-top: 0.75em; margin-right: 0;}
.slide ul ul {line-height: 1;}
.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}
.slide img.leader {display: block; margin: 0 auto;}
div#header, div#footer {background: #005; color: #AAB;
font-family: Verdana, Helvetica, sans-serif;}
div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;
line-height: 1px;}
div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}
#footer h1, #footer h2 {display: block; padding: 0 1em;}
#footer h2 {font-style: italic;}
div.long {font-size: 0.75em;}
.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;
margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;
font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;
color: #DDE; background: #005;}
.slide h3 {font-size: 130%;}
h1 abbr {font-variant: small-caps;}
div#controls {position: absolute; left: 50%; bottom: 0;
width: 50%;
text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}
html>body div#controls {position: fixed; padding: 0 0 1em 0;
top: auto;}
div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
margin: 0; padding: 0;}
#controls #navLinks a {padding: 0; margin: 0 0.5em;
background: #005; border: none; color: #779;
cursor: pointer;}
#controls #navList {height: 1em;}
#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}
#currentSlide {text-align: center; font-size: 0.5em; color: #449;}
#slide0 {padding-top: 3.5em; font-size: 90%;}
#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;
font: bold 2em Helvetica, sans-serif; white-space: normal;
color: #000; background: transparent;}
#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}
#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}
#slide0 h4 {margin-top: 0; font-size: 1em;}
ul.urls {list-style: none; display: inline; margin: 0;}
.urls li {display: inline; margin: 0;}
.note {display: none;}
.external {border-bottom: 1px dotted gray;}
html>body .external {border-bottom: none;}
.external:after {content: " \274F"; font-size: smaller; color: #77B;}
.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}
img.incremental {visibility: hidden;}
.slide .current {color: #B02;}
/* diagnostics
li:after {content: " [" attr(class) "]"; color: #F88;}
*/

View File

@@ -1 +0,0 @@
/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */

View File

@@ -1,9 +0,0 @@
/* Do not edit or override these styles! The system will likely break if you do. */
div#header, div#footer, div#controls, .slide {position: absolute;}
html>body div#header, html>body div#footer,
html>body div#controls, html>body .slide {position: fixed;}
.handout {display: none;}
.layout {display: block;}
.slide, .hideme, .incremental {visibility: hidden;}
#slide0 {visibility: visible;}

View File

@@ -1,3 +0,0 @@
@import url(s5-core.css); /* required to make the slide show run at all */
@import url(framing.css); /* sets basic placement and size of slide components */
@import url(pretty.css); /* stuff that makes the slides look better than blah */

View File

@@ -1,552 +0,0 @@
// S5 v1.1 slides.js -- released into the Public Domain
//
// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
// about all the wonderful and talented contributors to this code!
var undef;
var slideCSS = '';
var snum = 0;
var smax = 1;
var incpos = 0;
var number = undef;
var s5mode = true;
var defaultView = 'slideshow';
var controlVis = 'visible';
var isIE = navigator.appName == 'Microsoft Internet Explorer' ? 1 : 0;
var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
function hasClass(object, className) {
if (!object.className) return false;
return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
}
function hasValue(object, value) {
if (!object) return false;
return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
}
function removeClass(object,className) {
if (!object) return;
object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
}
function addClass(object,className) {
if (!object || hasClass(object, className)) return;
if (object.className) {
object.className += ' '+className;
} else {
object.className = className;
}
}
function GetElementsWithClassName(elementName,className) {
var allElements = document.getElementsByTagName(elementName);
var elemColl = new Array();
for (var i = 0; i< allElements.length; i++) {
if (hasClass(allElements[i], className)) {
elemColl[elemColl.length] = allElements[i];
}
}
return elemColl;
}
function isParentOrSelf(element, id) {
if (element == null || element.nodeName=='BODY') return false;
else if (element.id == id) return true;
else return isParentOrSelf(element.parentNode, id);
}
function nodeValue(node) {
var result = "";
if (node.nodeType == 1) {
var children = node.childNodes;
for (var i = 0; i < children.length; ++i) {
result += nodeValue(children[i]);
}
}
else if (node.nodeType == 3) {
result = node.nodeValue;
}
return(result);
}
function slideLabel() {
var slideColl = GetElementsWithClassName('*','slide');
var list = document.getElementById('jumplist');
smax = slideColl.length;
for (var n = 0; n < smax; n++) {
var obj = slideColl[n];
var did = 'slide' + n.toString();
obj.setAttribute('id',did);
if (isOp) continue;
var otext = '';
var menu = obj.firstChild;
if (!menu) continue; // to cope with empty slides
while (menu && menu.nodeType == 3) {
menu = menu.nextSibling;
}
if (!menu) continue; // to cope with slides with only text nodes
var menunodes = menu.childNodes;
for (var o = 0; o < menunodes.length; o++) {
otext += nodeValue(menunodes[o]);
}
list.options[list.length] = new Option(n + ' : ' + otext, n);
}
}
function currentSlide() {
var cs;
if (document.getElementById) {
cs = document.getElementById('currentSlide');
} else {
cs = document.currentSlide;
}
cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
'<span id="csSep">\/<\/span> ' +
'<span id="csTotal">' + (smax-1) + '<\/span>';
if (snum == 0) {
cs.style.visibility = 'hidden';
} else {
cs.style.visibility = 'visible';
}
}
function go(step) {
if (document.getElementById('slideProj').disabled || step == 0) return;
var jl = document.getElementById('jumplist');
var cid = 'slide' + snum;
var ce = document.getElementById(cid);
if (incrementals[snum].length > 0) {
for (var i = 0; i < incrementals[snum].length; i++) {
removeClass(incrementals[snum][i], 'current');
removeClass(incrementals[snum][i], 'incremental');
}
}
if (step != 'j') {
snum += step;
lmax = smax - 1;
if (snum > lmax) snum = lmax;
if (snum < 0) snum = 0;
} else
snum = parseInt(jl.value);
var nid = 'slide' + snum;
var ne = document.getElementById(nid);
if (!ne) {
ne = document.getElementById('slide0');
snum = 0;
}
if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
if (incrementals[snum].length > 0 && incpos == 0) {
for (var i = 0; i < incrementals[snum].length; i++) {
if (hasClass(incrementals[snum][i], 'current'))
incpos = i + 1;
else
addClass(incrementals[snum][i], 'incremental');
}
}
if (incrementals[snum].length > 0 && incpos > 0)
addClass(incrementals[snum][incpos - 1], 'current');
ce.style.visibility = 'hidden';
ne.style.visibility = 'visible';
jl.selectedIndex = snum;
currentSlide();
number = 0;
}
function goTo(target) {
if (target >= smax || target == snum) return;
go(target - snum);
}
function subgo(step) {
if (step > 0) {
removeClass(incrementals[snum][incpos - 1],'current');
removeClass(incrementals[snum][incpos], 'incremental');
addClass(incrementals[snum][incpos],'current');
incpos++;
} else {
incpos--;
removeClass(incrementals[snum][incpos],'current');
addClass(incrementals[snum][incpos], 'incremental');
addClass(incrementals[snum][incpos - 1],'current');
}
}
function toggle() {
var slideColl = GetElementsWithClassName('*','slide');
var slides = document.getElementById('slideProj');
var outline = document.getElementById('outlineStyle');
if (!slides.disabled) {
slides.disabled = true;
outline.disabled = false;
s5mode = false;
fontSize('1em');
for (var n = 0; n < smax; n++) {
var slide = slideColl[n];
slide.style.visibility = 'visible';
}
} else {
slides.disabled = false;
outline.disabled = true;
s5mode = true;
fontScale();
for (var n = 0; n < smax; n++) {
var slide = slideColl[n];
slide.style.visibility = 'hidden';
}
slideColl[snum].style.visibility = 'visible';
}
}
function showHide(action) {
var obj = GetElementsWithClassName('*','hideme')[0];
switch (action) {
case 's': obj.style.visibility = 'visible'; break;
case 'h': obj.style.visibility = 'hidden'; break;
case 'k':
if (obj.style.visibility != 'visible') {
obj.style.visibility = 'visible';
} else {
obj.style.visibility = 'hidden';
}
break;
}
}
// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)
function keys(key) {
if (!key) {
key = event;
key.which = key.keyCode;
}
if (key.which == 84) {
toggle();
return;
}
if (s5mode) {
switch (key.which) {
case 10: // return
case 13: // enter
if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
if (key.target && isParentOrSelf(key.target, 'controls')) return;
if(number != undef) {
goTo(number);
break;
}
case 32: // spacebar
case 34: // page down
case 39: // rightkey
case 40: // downkey
if(number != undef) {
go(number);
} else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
go(1);
} else {
subgo(1);
}
break;
case 33: // page up
case 37: // leftkey
case 38: // upkey
if(number != undef) {
go(-1 * number);
} else if (!incrementals[snum] || incpos <= 0) {
go(-1);
} else {
subgo(-1);
}
break;
case 36: // home
goTo(0);
break;
case 35: // end
goTo(smax-1);
break;
case 67: // c
showHide('k');
break;
}
if (key.which < 48 || key.which > 57) {
number = undef;
} else {
if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
if (key.target && isParentOrSelf(key.target, 'controls')) return;
number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
}
}
return false;
}
function clicker(e) {
number = undef;
var target;
if (window.event) {
target = window.event.srcElement;
e = window.event;
} else target = e.target;
if (target.href != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target, 'object')) return true;
if (!e.which || e.which == 1) {
if (!incrementals[snum] || incpos >= incrementals[snum].length) {
go(1);
} else {
subgo(1);
}
}
}
function findSlide(hash) {
var target = null;
var slides = GetElementsWithClassName('*','slide');
for (var i = 0; i < slides.length; i++) {
var targetSlide = slides[i];
if ( (targetSlide.name && targetSlide.name == hash)
|| (targetSlide.id && targetSlide.id == hash) ) {
target = targetSlide;
break;
}
}
while(target != null && target.nodeName != 'BODY') {
if (hasClass(target, 'slide')) {
return parseInt(target.id.slice(5));
}
target = target.parentNode;
}
return null;
}
function slideJump() {
if (window.location.hash == null) return;
var sregex = /^#slide(\d+)$/;
var matches = sregex.exec(window.location.hash);
var dest = null;
if (matches != null) {
dest = parseInt(matches[1]);
} else {
dest = findSlide(window.location.hash.slice(1));
}
if (dest != null)
go(dest - snum);
}
function fixLinks() {
var thisUri = window.location.href;
thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
var aelements = document.getElementsByTagName('A');
for (var i = 0; i < aelements.length; i++) {
var a = aelements[i].href;
var slideID = a.match('\#slide[0-9]{1,2}');
if ((slideID) && (slideID[0].slice(0,1) == '#')) {
var dest = findSlide(slideID[0].slice(1));
if (dest != null) {
if (aelements[i].addEventListener) {
aelements[i].addEventListener("click", new Function("e",
"if (document.getElementById('slideProj').disabled) return;" +
"go("+dest+" - snum); " +
"if (e.preventDefault) e.preventDefault();"), true);
} else if (aelements[i].attachEvent) {
aelements[i].attachEvent("onclick", new Function("",
"if (document.getElementById('slideProj').disabled) return;" +
"go("+dest+" - snum); " +
"event.returnValue = false;"));
}
}
}
}
}
function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName('a');
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.href && hasValue(anchor.rel, 'external')) {
anchor.target = '_blank';
addClass(anchor,'external');
}
}
}
function createControls() {
var controlsDiv = document.getElementById("controls");
if (!controlsDiv) return;
var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
var hideDiv, hideList = '';
if (controlVis == 'hidden') {
hideDiv = hider;
} else {
hideList = hider;
}
controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
'<div id="navLinks">' +
'<a accesskey="t" id="toggle" href="javascript:toggle();">&#216;<\/a>' +
'<a accesskey="z" id="prev" href="javascript:go(-1);">&laquo;<\/a>' +
'<a accesskey="x" id="next" href="javascript:go(1);">&raquo;<\/a>' +
'<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
'<\/div><\/form>';
if (controlVis == 'hidden') {
var hidden = document.getElementById('navLinks');
} else {
var hidden = document.getElementById('jumplist');
}
addClass(hidden,'hideme');
}
function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
if (!s5mode) return false;
var vScale = 22; // both yield 32 (after rounding) at 1024x768
var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
if (window.innerHeight) {
var vSize = window.innerHeight;
var hSize = window.innerWidth;
} else if (document.documentElement.clientHeight) {
var vSize = document.documentElement.clientHeight;
var hSize = document.documentElement.clientWidth;
} else if (document.body.clientHeight) {
var vSize = document.body.clientHeight;
var hSize = document.body.clientWidth;
} else {
var vSize = 700; // assuming 1024x768, minus chrome and such
var hSize = 1024; // these do not account for kiosk mode or Opera Show
}
var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
fontSize(newSize + 'px');
if (isGe) { // hack to counter incremental reflow bugs
var obj = document.getElementsByTagName('body')[0];
obj.style.display = 'none';
obj.style.display = 'block';
}
}
function fontSize(value) {
if (!(s5ss = document.getElementById('s5ss'))) {
if (!isIE) {
document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
s5ss.setAttribute('media','screen, projection');
s5ss.setAttribute('id','s5ss');
} else {
document.createStyleSheet();
document.s5ss = document.styleSheets[document.styleSheets.length - 1];
}
}
if (!isIE) {
while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
} else {
document.s5ss.addRule('body','font-size: ' + value + ' !important;');
}
}
function notOperaFix() {
slideCSS = document.getElementById('slideProj').href;
var slides = document.getElementById('slideProj');
var outline = document.getElementById('outlineStyle');
slides.setAttribute('media','screen');
outline.disabled = true;
if (isGe) {
slides.setAttribute('href','null'); // Gecko fix
slides.setAttribute('href',slideCSS); // Gecko fix
}
if (isIE && document.styleSheets && document.styleSheets[0]) {
document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
}
}
function getIncrementals(obj) {
var incrementals = new Array();
if (!obj)
return incrementals;
var children = obj.childNodes;
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (hasClass(child, 'incremental')) {
if (child.nodeName == 'OL' || child.nodeName == 'UL') {
removeClass(child, 'incremental');
for (var j = 0; j < child.childNodes.length; j++) {
if (child.childNodes[j].nodeType == 1) {
addClass(child.childNodes[j], 'incremental');
}
}
} else {
incrementals[incrementals.length] = child;
removeClass(child,'incremental');
}
}
if (hasClass(child, 'show-first')) {
if (child.nodeName == 'OL' || child.nodeName == 'UL') {
removeClass(child, 'show-first');
if (child.childNodes[isGe].nodeType == 1) {
removeClass(child.childNodes[isGe], 'incremental');
}
} else {
incrementals[incrementals.length] = child;
}
}
incrementals = incrementals.concat(getIncrementals(child));
}
return incrementals;
}
function createIncrementals() {
var incrementals = new Array();
for (var i = 0; i < smax; i++) {
incrementals[i] = getIncrementals(document.getElementById('slide'+i));
}
return incrementals;
}
function defaultCheck() {
var allMetas = document.getElementsByTagName('meta');
for (var i = 0; i< allMetas.length; i++) {
if (allMetas[i].name == 'defaultView') {
defaultView = allMetas[i].content;
}
if (allMetas[i].name == 'controlVis') {
controlVis = allMetas[i].content;
}
}
}
// Key trap fix, new function body for trap()
function trap(e) {
if (!e) {
e = event;
e.which = e.keyCode;
}
try {
modifierKey = e.ctrlKey || e.altKey || e.metaKey;
}
catch(e) {
modifierKey = false;
}
return modifierKey || e.which == 0;
}
function startup() {
defaultCheck();
if (!isOp) createControls();
slideLabel();
fixLinks();
externalLinks();
fontScale();
if (!isOp) {
notOperaFix();
incrementals = createIncrementals();
slideJump();
if (defaultView == 'outline') {
toggle();
}
document.onkeyup = keys;
document.onkeypress = trap;
document.onclick = clicker;
}
}
window.onload = startup;
window.onresize = function(){setTimeout('fontScale()', 50);}

File diff suppressed because it is too large Load Diff