X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/bcf414643c89f4f9d4debb4874cfabcc109776d9..0586a518f9cc8a590a35fd2443be4c0677bc45ad:/indent/python.vim diff --git a/indent/python.vim b/indent/python.vim index b038103..e3c2352 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -69,20 +69,28 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>' " Skip strings and comments. Return 1 for chars to skip. " jedi* refers to syntax definitions from jedi-vim for call signatures, which " are inserted temporarily into the buffer. -let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' . - \ '=~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"' +" let s:skip_special_chars = '(execute("sleep 100m") && 0) || synIDattr(synID(line("."), col("."), 0), "name") ' . +function! s:_skip_special_chars() + return synIDattr(synID(line('.'), col('.'), 0), 'name') + \ =~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S" +endfunction +let s:skip_special_chars = 's:_skip_special_chars()' let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' . \ '=~? "\\vcomment|jedi\\S"' " Also ignore anything concealed. -" Wrapper around synconcealed for older Vim (7.3.429, used on Travis CI). -function! s:is_concealed(line, col) - let concealed = synconcealed(a:line, a:col) - return len(concealed) && concealed[0] -endfunction -if has('conceal') - let s:skip_special_chars .= '|| s:is_concealed(line("."), col("."))' +" TODO: doc; likely only necessary with jedi-vim, where a better version is +" planned (https://github.com/Vimjas/vim-python-pep8-indent/pull/98). +if get(g:, 'python_pep8_indent_skip_concealed', 0) + " Wrapper around synconcealed for older Vim (7.3.429, used on Travis CI). + function! s:is_concealed(line, col) + let concealed = synconcealed(a:line, a:col) + return len(concealed) && concealed[0] + endfunction + if has('conceal') + let s:skip_special_chars .= '|| s:is_concealed(line("."), col("."))' + endif endif