From 0fcdbfbdd9064e7851e5460eb1bd3f16c4e8574f Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Thu, 3 Jul 2014 17:50:48 +0200 Subject: [PATCH] indent_on_char: deindent on (else|end) command insertion --- rc/fish.kak | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rc/fish.kak b/rc/fish.kak index 769b6f26..f0e2fd8e 100644 --- a/rc/fish.kak +++ b/rc/fish.kak @@ -41,6 +41,13 @@ def -hidden _fish_filter_around_selections %{ } } +def -hidden _fish_indent_on_char %{ + eval -draft -itersel %{ + # deindent on (else|end) command insertion + try %{ exec -draft w (else|end) } + } +} + def -hidden _fish_indent_on_new_line %{ eval -draft -itersel %{ # preserve previous line indent @@ -63,6 +70,7 @@ hook global WinSetOption filetype=fish %{ addhl ref fish hook window InsertEnd .* -group fish-hooks _fish_filter_around_selections + hook window InsertChar .* -group fish-indent _fish_indent_on_char hook window InsertChar \n -group fish-indent _fish_indent_on_new_line }