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

- updated FuzzyFinder

- moved Pydoc to ftplugin/python
- updated pyflakes
- added Pygments feature into rst functions
This commit is contained in:
2010-11-15 18:45:27 +01:00
parent 53ddc03045
commit 442a6ab74e
29 changed files with 1779 additions and 1147 deletions

View File

@@ -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

View File

@@ -1,106 +0,0 @@
"pydoc.vim: pydoc integration for vim
"performs searches and can display the documentation of python modules
"Author: Andr<64> Kelpe <efeshundertelf at googlemail dot com>
"Author: Romain Chossart <romainchossat at gmail dot com>
"Author: Matthias Vogelgesang
"http://www.vim.org/scripts/script.php?script_id=910
"This plugin integrates the pydoc into vim. You can view the
"documentation of a module by using :Pydoc foo.bar.baz or search
"a word (uses pydoc -k) in the documentation by typing PydocSearch
"foobar. You can also view the documentation of the word under the
"cursor by pressing <leader>pw or the WORD (see :help WORD) by pressing
"<leader>pW. "This is very useful if you want to jump to a module which was found by
"PydocSearch. To have a browser like feeling you can use u and CTRL-R to
"go back and forward, just like editing normal text.
"If you want to use the script and pydoc is not in your PATH, just put a
"line like
" let g:pydoc_cmd = \"/usr/bin/pydoc" (without the backslash!!)
"in your .vimrc
"pydoc.vim is free software, you can redistribute or modify
"it under the terms of the GNU General Public License Version 2 or any
"later Version (see http://www.gnu.org/copyleft/gpl.html for details).
"Please feel free to contact me.
set switchbuf=useopen
function! ShowPyDoc(name, type)
if !exists('g:pydoc_cmd')
let g:pydoc_cmd = 'pydoc'
endif
if bufloaded("__doc__") >0
let l:buf_is_new = 0
else
let l:buf_is_new = 1
endif
if bufnr("__doc__") >0
execute "sb __doc__"
else
execute 'split __doc__'
endif
setlocal noswapfile
set buftype=nofile
setlocal modifiable
normal ggdG
let s:name2 = substitute(a:name, '(.*', '', 'g' )
let s:name2 = substitute(a:name, ':', '', 'g' )
if a:type==1
execute "silent read ! " . g:pydoc_cmd . " " . s:name2
else
execute "silent read ! " . g:pydoc_cmd . " -k " . s:name2
endif
setlocal nomodified
set filetype=man
normal 1G
if !exists('g:pydoc_wh')
let g:pydoc_wh = 10
end
resize -999
execute "silent resize +" . g:pydoc_wh
if !exists('g:pydoc_highlight')
let g:pydoc_highlight = 1
endif
if g:pydoc_highlight == 1
call Highlight(s:name2)
endif
let l:line = getline(2)
if l:line =~ "^no Python documentation found for.*$"
if l:buf_is_new
execute "bd!"
else
normal u
endif
redraw
echohl WarningMsg | echo l:line | echohl None
endif
endfunction
function! Highlight(name)
execute "sb __doc__"
set filetype=man
syn on
execute 'syntax keyword pydoc '.s:name2
hi pydoc gui=reverse
endfunction
"mappings
au FileType python,man map <buffer> <leader>pw :call ShowPyDoc('<C-R><C-W>', 1)<CR>
au FileType python,man map <buffer> <leader>pW :call ShowPyDoc('<C-R><C-A>', 1)<CR>
au FileType python,man map <buffer> <leader>pk :call ShowPyDoc('<C-R><C-W>', 0)<CR>
au FileType python,man map <buffer> <leader>pK :call ShowPyDoc('<C-R><C-A>', 0)<CR>
"commands
command -nargs=1 Pydoc :call ShowPyDoc('<args>', 1)
command -nargs=* PydocSearch :call ShowPyDoc('<args>', 0)