From 58ab144865bed49bd8b34a2e65a190bf81223c1b Mon Sep 17 00:00:00 2001 From: Jason Felice Date: Mon, 4 Feb 2019 12:23:57 -0500 Subject: [PATCH] Use indentwidth for lisp, scheme, and Clojure --- rc/base/clojure.kak | 5 +++-- rc/base/lisp.kak | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/rc/base/clojure.kak b/rc/base/clojure.kak index 451c13f5..da6134a6 100644 --- a/rc/base/clojure.kak +++ b/rc/base/clojure.kak @@ -179,8 +179,9 @@ define-command -hidden clojure-indent-on-new-line %{ execute-keys -draft '[bl"i"wZ' try %{ - # If a special form, indent another space - execute-keys -draft '"wze\A' %opt{clojure_special_indent_forms} '\zs.\K.*;"i' + # If a special form, indent another (indentwidth - 1) spaces + execute-keys -draft '"wze\A' %opt{clojure_special_indent_forms} '\z' + execute-keys -draft '"wzes.{' %sh{printf $(( kak_opt_indentwidth - 1 ))} '}\K.*;"i' } catch %{ # If not special and parameter appears on line 1, indent to parameter execute-keys -draft '"wzes\h\K[^\s].*;"i' diff --git a/rc/base/lisp.kak b/rc/base/lisp.kak index d0ab1d19..378bb3c5 100644 --- a/rc/base/lisp.kak +++ b/rc/base/lisp.kak @@ -43,10 +43,14 @@ define-command -hidden lisp-indent-on-new-line %{ try %{ execute-keys -draft '[bl"i"wZ' - try %{ execute-keys -draft '"wzs.\K.*;"i' } - - # If not "special" form and parameter appears on line 1, indent to parameter - execute-keys -draft '"wze\A' %opt{lisp_special_indent_forms} '\z' 's\h\K[^\s].*;"i' + try %{ + # If a special form, indent another (indentwidth - 1) spaces + execute-keys -draft '"wze\A' %opt{lisp_special_indent_forms} '\z' + execute-keys -draft '"wzes.{' %sh{printf $(( kak_opt_indentwidth - 1 ))} '}\K.*;"i' + } catch %{ + # If not "special" form and parameter appears on line 1, indent to parameter + execute-keys -draft '"wzes\h\K[^\s].*;"i' + } } try %{ execute-keys -draft '[rl"i' } try %{ execute-keys -draft '[Bl"i' }