summaryrefslogtreecommitdiffstats
path: root/src/indent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/indent.c b/src/indent.c
index 06d98f92ec..dfc481a785 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1169,6 +1169,22 @@ preprocs_left(void)
#ifdef FEAT_SMARTINDENT
/*
+ * Return TRUE if the conditions are OK for smart indenting.
+ */
+ int
+may_do_si()
+{
+ return curbuf->b_p_si
+# ifdef FEAT_CINDENT
+ && !curbuf->b_p_cin
+# endif
+# ifdef FEAT_EVAL
+ && *curbuf->b_p_inde == NUL
+# endif
+ && !p_paste;
+}
+
+/*
* Try to do some very smart auto-indenting.
* Used when inserting a "normal" character.
*/
@@ -1235,7 +1251,7 @@ ins_try_si(int c)
}
// set indent of '#' always to 0
- if (curwin->w_cursor.col > 0 && can_si && c == '#')
+ if (curwin->w_cursor.col > 0 && can_si && c == '#' && inindent(0))
{
// remember current indent for next line
old_indent = get_indent();