From 431c68282642d4817773f9b7ed99cd5c5df0a6c6 Mon Sep 17 00:00:00 2001 From: adam seyfarth Date: Wed, 22 Aug 2001 00:00:00 +0000 Subject: [PATCH] Version 1.3 I've added an IM-Python menu that holds the class definitions and function definitions. --- plugin/python.vim | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) 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: