diff --git a/plugin/python.vim b/plugin/python.vim index 39af86e..78d7156 100644 --- a/plugin/python.vim +++ b/plugin/python.vim @@ -33,6 +33,7 @@ " ] -- Jump to previous line with the same/lower indentation " ] -- Jump to next line with the same/lower indentation + map [[ :PBoB vmap [[ :PBoBm'gv`` map ]] :PEoB @@ -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: