mirror of
https://github.com/gryf/.vim.git
synced 2025-12-18 12:00:30 +01:00
- updated FuzzyFinder
- moved Pydoc to ftplugin/python - updated pyflakes - added Pygments feature into rst functions
This commit is contained in:
237
plugin/fuf.vim
237
plugin/fuf.vim
@@ -1,17 +1,18 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
" Copyright (c) 2007-2010 Takeshi NISHIDA
|
||||
"
|
||||
" GetLatestVimScripts: 1984 1 :AutoInstall: FuzzyFinder
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_fuf')
|
||||
try
|
||||
if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 101, [])
|
||||
finish
|
||||
endif
|
||||
catch /E117/
|
||||
echoerr '***** L9 library must be installed! *****'
|
||||
finish
|
||||
elseif v:version < 702
|
||||
echoerr 'FuzzyFinder does not support this version of vim (' . v:version . ').'
|
||||
finish
|
||||
endif
|
||||
let g:loaded_fuf = 1
|
||||
endtry
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
@@ -20,152 +21,132 @@ let g:loaded_fuf = 1
|
||||
"
|
||||
function s:initialize()
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_modes' , [
|
||||
\ 'buffer', 'file', 'dir', 'mrufile', 'mrucmd',
|
||||
\ 'bookmark', 'tag', 'taggedfile',
|
||||
\ 'jumplist', 'changelist', 'quickfix', 'line', 'help',
|
||||
\ 'givenfile', 'givendir', 'givencmd',
|
||||
\ 'callbackfile', 'callbackitem',
|
||||
\ ])
|
||||
call s:defineOption('g:fuf_modesDisable' , [ 'mrufile', 'mrucmd', ])
|
||||
call s:defineOption('g:fuf_keyOpen' , '<CR>')
|
||||
call s:defineOption('g:fuf_keyOpenSplit' , '<C-j>')
|
||||
call s:defineOption('g:fuf_keyOpenVsplit' , '<C-k>')
|
||||
call s:defineOption('g:fuf_keyOpenTabpage' , '<C-l>')
|
||||
call s:defineOption('g:fuf_keyPreview' , '<C-@>')
|
||||
call s:defineOption('g:fuf_keyNextMode' , '<C-t>')
|
||||
call s:defineOption('g:fuf_keyPrevMode' , '<C-y>')
|
||||
call s:defineOption('g:fuf_keyPrevPattern' , '<C-s>')
|
||||
call s:defineOption('g:fuf_keyNextPattern' , '<C-_>')
|
||||
call s:defineOption('g:fuf_keySwitchMatching', '<C-\><C-\>')
|
||||
call s:defineOption('g:fuf_infoFile' , '~/.vim-fuf')
|
||||
call s:defineOption('g:fuf_abbrevMap' , {})
|
||||
call s:defineOption('g:fuf_patternSeparator' , ';')
|
||||
call s:defineOption('g:fuf_promptHighlight' , 'Question')
|
||||
call s:defineOption('g:fuf_ignoreCase' , 1)
|
||||
call s:defineOption('g:fuf_splitPathMatching', 1)
|
||||
call s:defineOption('g:fuf_smartBs' , 1)
|
||||
call s:defineOption('g:fuf_reuseWindow' , 1)
|
||||
call s:defineOption('g:fuf_timeFormat' , '(%Y-%m-%d %H:%M:%S)')
|
||||
call s:defineOption('g:fuf_learningLimit' , 100)
|
||||
call s:defineOption('g:fuf_enumeratingLimit' , 50)
|
||||
call s:defineOption('g:fuf_maxMenuWidth' , 78)
|
||||
call s:defineOption('g:fuf_previewHeight' , 10)
|
||||
call s:defineOption('g:fuf_useMigemo' , 0)
|
||||
call l9#defineVariableDefault('g:fuf_modesDisable' , [ 'mrufile', 'mrucmd', ])
|
||||
call l9#defineVariableDefault('g:fuf_keyOpen' , '<CR>')
|
||||
call l9#defineVariableDefault('g:fuf_keyOpenSplit' , '<C-j>')
|
||||
call l9#defineVariableDefault('g:fuf_keyOpenVsplit' , '<C-k>')
|
||||
call l9#defineVariableDefault('g:fuf_keyOpenTabpage' , '<C-l>')
|
||||
call l9#defineVariableDefault('g:fuf_keyPreview' , '<C-@>')
|
||||
call l9#defineVariableDefault('g:fuf_keyNextMode' , '<C-t>')
|
||||
call l9#defineVariableDefault('g:fuf_keyPrevMode' , '<C-y>')
|
||||
call l9#defineVariableDefault('g:fuf_keyPrevPattern' , '<C-s>')
|
||||
call l9#defineVariableDefault('g:fuf_keyNextPattern' , '<C-_>')
|
||||
call l9#defineVariableDefault('g:fuf_keySwitchMatching', '<C-\><C-\>')
|
||||
call l9#defineVariableDefault('g:fuf_dataDir' , '~/.vim-fuf-data')
|
||||
call l9#defineVariableDefault('g:fuf_abbrevMap' , {})
|
||||
call l9#defineVariableDefault('g:fuf_patternSeparator' , ';')
|
||||
call l9#defineVariableDefault('g:fuf_promptHighlight' , 'Question')
|
||||
call l9#defineVariableDefault('g:fuf_ignoreCase' , 1)
|
||||
call l9#defineVariableDefault('g:fuf_splitPathMatching', 1)
|
||||
call l9#defineVariableDefault('g:fuf_fuzzyRefining' , 0)
|
||||
call l9#defineVariableDefault('g:fuf_smartBs' , 1)
|
||||
call l9#defineVariableDefault('g:fuf_reuseWindow' , 1)
|
||||
call l9#defineVariableDefault('g:fuf_timeFormat' , '(%Y-%m-%d %H:%M:%S)')
|
||||
call l9#defineVariableDefault('g:fuf_learningLimit' , 100)
|
||||
call l9#defineVariableDefault('g:fuf_enumeratingLimit' , 50)
|
||||
call l9#defineVariableDefault('g:fuf_maxMenuWidth' , 78)
|
||||
call l9#defineVariableDefault('g:fuf_previewHeight' , 0)
|
||||
call l9#defineVariableDefault('g:fuf_autoPreview' , 0)
|
||||
call l9#defineVariableDefault('g:fuf_useMigemo' , 0)
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_buffer_prompt' , '>Buffer[]>')
|
||||
call s:defineOption('g:fuf_buffer_switchOrder', 10)
|
||||
call s:defineOption('g:fuf_buffer_mruOrder' , 1)
|
||||
call l9#defineVariableDefault('g:fuf_buffer_prompt' , '>Buffer[]>')
|
||||
call l9#defineVariableDefault('g:fuf_buffer_switchOrder', 10)
|
||||
call l9#defineVariableDefault('g:fuf_buffer_mruOrder' , 1)
|
||||
call l9#defineVariableDefault('g:fuf_buffer_keyDelete' , '<C-]>')
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_file_prompt' , '>File[]>')
|
||||
call s:defineOption('g:fuf_file_switchOrder', 20)
|
||||
call s:defineOption('g:fuf_file_exclude' , '\v\~$|\.(o|exe|dll|bak|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])')
|
||||
call l9#defineVariableDefault('g:fuf_file_prompt' , '>File[]>')
|
||||
call l9#defineVariableDefault('g:fuf_file_switchOrder', 20)
|
||||
call l9#defineVariableDefault('g:fuf_file_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])')
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_dir_prompt' , '>Dir[]>')
|
||||
call s:defineOption('g:fuf_dir_switchOrder', 30)
|
||||
call s:defineOption('g:fuf_dir_exclude' , '\v(^|[/\\])\.(hg|git|bzr)($|[/\\])')
|
||||
call l9#defineVariableDefault('g:fuf_coveragefile_prompt' , '>CoverageFile[]>')
|
||||
call l9#defineVariableDefault('g:fuf_coveragefile_switchOrder', 30)
|
||||
call l9#defineVariableDefault('g:fuf_coveragefile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])')
|
||||
call l9#defineVariableDefault('g:fuf_coveragefile_globPatterns', ['**/.*', '**/*'])
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_mrufile_prompt' , '>Mru-File[]>')
|
||||
call s:defineOption('g:fuf_mrufile_switchOrder', 40)
|
||||
call s:defineOption('g:fuf_mrufile_exclude' , '\v\~$|\.(bak|sw[po])$|^(\/\/|\\\\|\/mnt\/|\/media\/)')
|
||||
call s:defineOption('g:fuf_mrufile_maxItem' , 200)
|
||||
call l9#defineVariableDefault('g:fuf_dir_prompt' , '>Dir[]>')
|
||||
call l9#defineVariableDefault('g:fuf_dir_switchOrder', 40)
|
||||
call l9#defineVariableDefault('g:fuf_dir_exclude' , '\v(^|[/\\])\.(hg|git|bzr)($|[/\\])')
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_mrucmd_prompt' , '>Mru-Cmd[]>')
|
||||
call s:defineOption('g:fuf_mrucmd_switchOrder', 50)
|
||||
call s:defineOption('g:fuf_mrucmd_exclude' , '^$')
|
||||
call s:defineOption('g:fuf_mrucmd_maxItem' , 200)
|
||||
call l9#defineVariableDefault('g:fuf_mrufile_prompt' , '>MRU-File[]>')
|
||||
call l9#defineVariableDefault('g:fuf_mrufile_switchOrder', 50)
|
||||
call l9#defineVariableDefault('g:fuf_mrufile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|^(\/\/|\\\\|\/mnt\/|\/media\/)')
|
||||
call l9#defineVariableDefault('g:fuf_mrufile_maxItem' , 200)
|
||||
call l9#defineVariableDefault('g:fuf_mrufile_maxItemDir' , 50)
|
||||
call l9#defineVariableDefault('g:fuf_mrufile_keyExpand' , '<C-]>')
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_bookmark_prompt' , '>Bookmark[]>')
|
||||
call s:defineOption('g:fuf_bookmark_switchOrder', 60)
|
||||
call s:defineOption('g:fuf_bookmark_searchRange', 400)
|
||||
call s:defineOption('g:fuf_bookmark_keyDelete' , '<C-]>')
|
||||
call l9#defineVariableDefault('g:fuf_mrucmd_prompt' , '>MRU-Cmd[]>')
|
||||
call l9#defineVariableDefault('g:fuf_mrucmd_switchOrder', 60)
|
||||
call l9#defineVariableDefault('g:fuf_mrucmd_exclude' , '^$')
|
||||
call l9#defineVariableDefault('g:fuf_mrucmd_maxItem' , 200)
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_tag_prompt' , '>Tag[]>')
|
||||
call s:defineOption('g:fuf_tag_switchOrder', 70)
|
||||
call s:defineOption('g:fuf_tag_cache_dir' , '~/.vim-fuf-cache/tag')
|
||||
call l9#defineVariableDefault('g:fuf_bookmarkfile_prompt' , '>Bookmark-File[]>')
|
||||
call l9#defineVariableDefault('g:fuf_bookmarkfile_switchOrder', 70)
|
||||
call l9#defineVariableDefault('g:fuf_bookmarkfile_searchRange', 400)
|
||||
call l9#defineVariableDefault('g:fuf_bookmarkfile_keyDelete' , '<C-]>')
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_taggedfile_prompt' , '>Tagged-File[]>')
|
||||
call s:defineOption('g:fuf_taggedfile_switchOrder', 80)
|
||||
call s:defineOption('g:fuf_taggedfile_cache_dir' , '~/.vim-fuf-cache/taggedfile')
|
||||
call l9#defineVariableDefault('g:fuf_bookmarkdir_prompt' , '>Bookmark-Dir[]>')
|
||||
call l9#defineVariableDefault('g:fuf_bookmarkdir_switchOrder', 80)
|
||||
call l9#defineVariableDefault('g:fuf_bookmarkdir_keyDelete' , '<C-]>')
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_jumplist_prompt' , '>Jump-List[]>')
|
||||
call s:defineOption('g:fuf_jumplist_switchOrder', 90)
|
||||
call l9#defineVariableDefault('g:fuf_tag_prompt' , '>Tag[]>')
|
||||
call l9#defineVariableDefault('g:fuf_tag_switchOrder', 90)
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_changelist_prompt' , '>Change-List[]>')
|
||||
call s:defineOption('g:fuf_changelist_switchOrder', 100)
|
||||
call l9#defineVariableDefault('g:fuf_buffertag_prompt' , '>Buffer-Tag[]>')
|
||||
call l9#defineVariableDefault('g:fuf_buffertag_switchOrder', 100)
|
||||
call l9#defineVariableDefault('g:fuf_buffertag_ctagsPath' , 'ctags')
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_quickfix_prompt' , '>Quickfix[]>')
|
||||
call s:defineOption('g:fuf_quickfix_switchOrder', 110)
|
||||
call l9#defineVariableDefault('g:fuf_taggedfile_prompt' , '>Tagged-File[]>')
|
||||
call l9#defineVariableDefault('g:fuf_taggedfile_switchOrder', 110)
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_line_prompt' , '>Line[]>')
|
||||
call s:defineOption('g:fuf_line_switchOrder', 120)
|
||||
call l9#defineVariableDefault('g:fuf_jumplist_prompt' , '>Jump-List[]>')
|
||||
call l9#defineVariableDefault('g:fuf_jumplist_switchOrder', 120)
|
||||
"---------------------------------------------------------------------------
|
||||
call s:defineOption('g:fuf_help_prompt' , '>Help[]>')
|
||||
call s:defineOption('g:fuf_help_switchOrder', 130)
|
||||
call s:defineOption('g:fuf_help_cache_dir' , '~/.vim-fuf-cache/help')
|
||||
call l9#defineVariableDefault('g:fuf_changelist_prompt' , '>Change-List[]>')
|
||||
call l9#defineVariableDefault('g:fuf_changelist_switchOrder', 130)
|
||||
"---------------------------------------------------------------------------
|
||||
call filter(g:fuf_modes, 'count(g:fuf_modesDisable, v:val) == 0')
|
||||
for m in g:fuf_modes
|
||||
call fuf#{m}#renewCache()
|
||||
call fuf#{m}#onInit()
|
||||
endfor
|
||||
call l9#defineVariableDefault('g:fuf_quickfix_prompt' , '>Quickfix[]>')
|
||||
call l9#defineVariableDefault('g:fuf_quickfix_switchOrder', 140)
|
||||
"---------------------------------------------------------------------------
|
||||
command! -bang -narg=0 FufEditInfo call fuf#editInfoFile()
|
||||
command! -bang -narg=0 FufRenewCache call s:renewCachesOfAllModes()
|
||||
call l9#defineVariableDefault('g:fuf_line_prompt' , '>Line[]>')
|
||||
call l9#defineVariableDefault('g:fuf_line_switchOrder', 150)
|
||||
"---------------------------------------------------------------------------
|
||||
for m in g:fuf_modes
|
||||
if fuf#{m}#requiresOnCommandPre()
|
||||
" cnoremap has a problem, which doesn't expand cabbrev.
|
||||
cmap <silent> <expr> <CR> <SID>onCommandPre()
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
call l9#defineVariableDefault('g:fuf_help_prompt' , '>Help[]>')
|
||||
call l9#defineVariableDefault('g:fuf_help_switchOrder', 160)
|
||||
"---------------------------------------------------------------------------
|
||||
command! -bang -narg=0 FufEditDataFile call fuf#editDataFile()
|
||||
command! -bang -narg=0 FufRenewCache call s:renewCachesOfAllModes()
|
||||
"---------------------------------------------------------------------------
|
||||
call fuf#addMode('buffer')
|
||||
call fuf#addMode('file')
|
||||
call fuf#addMode('coveragefile')
|
||||
call fuf#addMode('dir')
|
||||
call fuf#addMode('mrufile')
|
||||
call fuf#addMode('mrucmd')
|
||||
call fuf#addMode('bookmarkfile')
|
||||
call fuf#addMode('bookmarkdir')
|
||||
call fuf#addMode('tag')
|
||||
call fuf#addMode('buffertag')
|
||||
call fuf#addMode('taggedfile')
|
||||
call fuf#addMode('jumplist')
|
||||
call fuf#addMode('changelist')
|
||||
call fuf#addMode('quickfix')
|
||||
call fuf#addMode('line')
|
||||
call fuf#addMode('help')
|
||||
call fuf#addMode('givenfile')
|
||||
call fuf#addMode('givendir')
|
||||
call fuf#addMode('givencmd')
|
||||
call fuf#addMode('callbackfile')
|
||||
call fuf#addMode('callbackitem')
|
||||
"---------------------------------------------------------------------------
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:initMisc()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:defineOption(name, default)
|
||||
if !exists(a:name)
|
||||
let {a:name} = a:default
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:renewCachesOfAllModes()
|
||||
for m in g:fuf_modes
|
||||
for m in fuf#getModeNames()
|
||||
call fuf#{m}#renewCache()
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:onBufEnter()
|
||||
for m in g:fuf_modes
|
||||
call fuf#{m}#onBufEnter()
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:onBufWritePost()
|
||||
for m in g:fuf_modes
|
||||
call fuf#{m}#onBufWritePost()
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:onCommandPre()
|
||||
for m in filter(copy(g:fuf_modes), 'fuf#{v:val}#requiresOnCommandPre()')
|
||||
call fuf#{m}#onCommandPre(getcmdtype() . getcmdline())
|
||||
endfor
|
||||
" lets last entry become the newest in the history
|
||||
call histadd(getcmdtype(), getcmdline())
|
||||
" this is not mapped again (:help recursive_mapping)
|
||||
return "\<CR>"
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" INITIALIZATION {{{1
|
||||
|
||||
Reference in New Issue
Block a user