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

Python3.5 async def support

This commit is contained in:
Markus Törnqvist
2016-10-28 08:15:30 +03:00
committed by Roman Dobosz
parent 0877af4dff
commit 669040957d

View File

@@ -183,7 +183,7 @@ function! PythonDec(obj, direction)
let objregexp = "^\\s*class\\s\\+[a-zA-Z0-9_]\\+" let objregexp = "^\\s*class\\s\\+[a-zA-Z0-9_]\\+"
\ . "\\s*\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*:" \ . "\\s*\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*:"
else else
let objregexp = "^\\s*def\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*:" let objregexp = "^\\s*\\(async def\\|def\\)\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*:"
endif endif
let flag = "W" let flag = "W"
if (a:direction == -1) if (a:direction == -1)
@@ -266,7 +266,7 @@ function! PythonSelectObject(obj)
let eod = "\\(^\\s*class\\s\\+[a-zA-Z0-9_]\\+\\s*" let eod = "\\(^\\s*class\\s\\+[a-zA-Z0-9_]\\+\\s*"
\ . "\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*\\)\\@<=:" \ . "\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*\\)\\@<=:"
else else
let eod = "\\(^\\s*def\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*\\)\\@<=:" let eod = "\\(^\\s*\\(async def\\|def\\)\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*\\)\\@<=:"
endif endif
" Look for the end of the declaration (not always the same line!) " Look for the end of the declaration (not always the same line!)
call search(eod, "") call search(eod, "")
@@ -341,7 +341,7 @@ function! MenuBuilder()
let parentclass = "" let parentclass = ""
while line(".") < line("$") while line(".") < line("$")
" search for a class or function " search for a class or function
if match ( getline("."), '^\s*class\s\+[_a-zA-Z].*\|^\s*def\s\+[_a-zA-Z].*' ) != -1 if match ( getline("."), '^\s*class\s\+[_a-zA-Z].*\|^\s*\(async def\|def\)\s\+[_a-zA-Z].*' ) != -1
norm ^ norm ^
let linenum = line('.') let linenum = line('.')
let indentcol = col('.') let indentcol = col('.')