X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0cd83ebcc7c28719b695e72c9e26dd78479e67c4..c330d0c4c20367bb15b50677d38aa50ba7bf3774:/indent/python.vim?ds=inline diff --git a/indent/python.vim b/indent/python.vim index c56c2dc..52a2966 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -61,7 +61,7 @@ let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>' " 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|jedi\\S"' + \ '=~? "\\vstring|comment|^pythonbytes%(contents)=$|jedi\\S"' let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' . \ '=~? "\\vcomment|jedi\\S"' @@ -77,9 +77,6 @@ if has('conceal') endif -let s:skip_search = 'synIDattr(synID(line("."), col("."), 0), "name") ' . - \ '=~? "comment"' - " Use 'shiftwidth()' instead of '&sw'. " (Since Vim patch 7.3.629, 'shiftwidth' can be set to 0 to follow 'tabstop'). if exists('*shiftwidth') @@ -104,7 +101,9 @@ function! s:find_opening_paren(...) endif " Return if cursor is in a comment. - exe 'if' s:skip_search '| return [0, 0] | endif' + if synIDattr(synID(line('.'), col('.'), 0), 'name') =~? 'comment' + return [0, 0] + endif let nearest = [0, 0] for [p, maxoff] in items(s:paren_pairs) @@ -313,7 +312,7 @@ function! s:indent_like_previous_line(lnum) return -1 endif - if !empty && s:is_dedented_already(current, base) + if (current || !empty) && s:is_dedented_already(current, base) return -1 endif