From 8d87647ce346aa2d356682589c6d43c92b5e55a6 Mon Sep 17 00:00:00 2001 From: Joseph Irwin Date: Sat, 18 Aug 2012 13:18:25 +0900 Subject: [PATCH] Do not indent after comment line with colon When checking for a line ending with a colon, this commit adds a condition to avoid matching comments. A comment line ending with a colon should not indent a new block. This changes the current behavior from this:: \#: To this:: \#: --- indent/python.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indent/python.vim b/indent/python.vim index 82f0d7c..9c93c60 100644 --- a/indent/python.vim +++ b/indent/python.vim @@ -172,9 +172,9 @@ function! GetPythonIndent(lnum) endif endif - " If the previous line ended with a colon, indent relative to - " statement start. - if pline =~ ':\s*$' + " If the previous line ended with a colon and is not a comment, indent + " relative to statement start. + if pline =~ ':\s*$' && pline !~ '^\s*#' return indent(sslnum) + &sw endif -- 2.39.5