mirror of
https://github.com/gryf/python.vim.git
synced 2025-12-17 11:30:22 +01:00
Version 1.3
I've added an IM-Python menu that holds the class definitions and function definitions.
This commit is contained in:
committed by
Able Scraper
parent
39257801b5
commit
431c682826
@@ -33,6 +33,7 @@
|
||||
" ]<up> -- Jump to previous line with the same/lower indentation
|
||||
" ]<down> -- Jump to next line with the same/lower indentation
|
||||
|
||||
|
||||
map [[ :PBoB<CR>
|
||||
vmap [[ :<C-U>PBoB<CR>m'gv``
|
||||
map ]] :PEoB<CR>
|
||||
@@ -275,5 +276,48 @@ function! PythonNextLine(direction)
|
||||
execute "normal ".ln."G"
|
||||
endfunction
|
||||
|
||||
" update the IM-Python menu, that holds Classes and Functions
|
||||
function! UpdateMenu()
|
||||
call MakeClassStructure ()
|
||||
call MakeFuncStructure ()
|
||||
endfunction
|
||||
|
||||
command UpdateMenu call UpdateMenu ()
|
||||
|
||||
" make a menu that holds all of the classes
|
||||
function! MakeClassStructure ()
|
||||
norm mpgg0
|
||||
while line(".") <= line("$")
|
||||
if match ( getline("."), '^\s*class\s\+' ) != -1
|
||||
norm ^w"nyw
|
||||
let name=@n
|
||||
exe 'menu IM-Python.classes.'.name.' '.line(".").'gg'
|
||||
endif
|
||||
if line(".") == line("$")
|
||||
return
|
||||
endif
|
||||
norm j
|
||||
endwhile
|
||||
norm 'p
|
||||
endfunction
|
||||
|
||||
"make a menu that holds all of the function deffinitions
|
||||
function! MakeFuncStructure ()
|
||||
norm mpgg0
|
||||
while line(".") <= line("$")
|
||||
if match ( getline("."), '^\s*def\s\+' ) != -1
|
||||
norm ^w"nyw
|
||||
let name=@n
|
||||
exe 'menu IM-Python.functions.'.name.' '.line(".").'gg'
|
||||
endif
|
||||
if line(".") == line("$")
|
||||
return
|
||||
endif
|
||||
norm j
|
||||
endwhile
|
||||
norm 'p
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" vim:set et sts=2 sw=2:
|
||||
|
||||
Reference in New Issue
Block a user