X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/f196c5be1042d262206c6be67ff44eff91ebb522..c330d0c4c20367bb15b50677d38aa50ba7bf3774:/indent/python.vim?ds=inline diff --git a/indent/python.vim b/indent/python.vim index 55b2b1b..52a2966 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -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