context.vim icon indicating copy to clipboard operation
context.vim copied to clipboard

RegEx expansion to match Python function definitions

Open ntropia2 opened this issue 1 year ago • 0 comments

I noticed that the plugin works with mixed results with Python code, capturing the class definition very well, but missing most of the function definitions (def ...).

I tried to extend the regular expressions with g:context_extend_regex but I couldn't get a clean behavior. This is the best I could come up with:

let g:context_extend_regex = '^\s*\([]{})]\|end\|else\|case\>\|default\>\|def\)' 

which matches decorated functions like this:

@property
def my_function():
       pass

but does not recognize anymore the end of the function from the indentation change.

Did anyone have luck at getting this to work?

ntropia2 avatar Dec 18 '24 18:12 ntropia2