]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Add g:python_pep8_indent_searchpair_timeout
authorDaniel Hahler <git@thequod.de>
Fri, 16 Nov 2018 04:01:49 +0000 (05:01 +0100)
committerDaniel Hahler <git@thequod.de>
Fri, 16 Nov 2018 04:01:49 +0000 (05:01 +0100)
Ref: https://github.com/Vimjas/vim-python-pep8-indent/issues/116

indent/python.vim

index 55b2b1bca6729af7ff2b9d8d791e2c552aef581b..b0381031facd0b97cf8fa502c168c4d26731d850 100644 (file)
@@ -38,6 +38,15 @@ if !exists('g:python_pep8_indent_hang_closing')
     let g:python_pep8_indent_hang_closing = 0
 endif
 
+" TODO: check required patch for timeout argument, likely lower than 7.3.429 though.
+if !exists('g:python_pep8_indent_searchpair_timeout')
+    if has('patch-8.0.1483')
+        let g:python_pep8_indent_searchpair_timeout = 150
+    else
+        let g:python_pep8_indent_searchpair_timeout = 0
+    endif
+endif
+
 let s:block_rules = {
             \ '^\s*elif\>': ['if', 'elif'],
             \ '^\s*except\>': ['try', 'except'],
@@ -110,7 +119,7 @@ function! s:find_opening_paren(...)
     for [p, maxoff] in items(s:paren_pairs)
         let stopline = max([0, line('.') - maxoff, nearest[0]])
         let next = searchpairpos(
-           \ '\V'.p[0], '', '\V'.p[1], 'bnW', s:skip_special_chars, stopline)
+           \ '\V'.p[0], '', '\V'.p[1], 'bnW', s:skip_special_chars, stopline, g:python_pep8_indent_searchpair_timeout)
         if next[0] && (next[0] > nearest[0] || (next[0] == nearest[0] && next[1] > nearest[1]))
             let nearest = next
         endif
@@ -364,7 +373,7 @@ function! GetPythonPEPIndent(lnum)
         if match_quotes != -1
             " closing multiline string
             let quotes = line[match_quotes:(match_quotes+2)]
-            let pairpos = searchpairpos(quotes, '', quotes, 'b')
+            let pairpos = searchpairpos(quotes, '', quotes, 'b', 1, g:python_pep8_indent_searchpair_timeout)
             if pairpos[0] != 0
                 return indent(pairpos[0])
             else