summaryrefslogtreecommitdiff
path: root/rc/filetype/python.kak
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-07-30 21:14:37 +1000
committerMaxime Coste <mawww@kakoune.org>2020-07-30 21:14:37 +1000
commit55fbdb3606a802c5de30dfd41f196bc18ead85cf (patch)
treefd6886acce862004dcb526745a1d0e0f46d92352 /rc/filetype/python.kak
parentb322a1f29c4ff35d8a2177f46ef6580c4c5431b0 (diff)
parent6258646f412159259b98d80f22b80be54f63dcca (diff)
Merge remote-tracking branch 'johnisom/deindent-closing-braces'
Diffstat (limited to 'rc/filetype/python.kak')
-rw-r--r--rc/filetype/python.kak14
1 files changed, 8 insertions, 6 deletions
diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak
index bac31e3f..db62c8db 100644
--- a/rc/filetype/python.kak
+++ b/rc/filetype/python.kak
@@ -28,7 +28,7 @@ hook -group python-highlight global WinSetOption filetype=python %{
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/python }
}
-provide-module python %{
+provide-module python %§
# Highlighters & Completion
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@@ -149,15 +149,17 @@ define-command -hidden python-insert-on-new-line %{
try %{ execute-keys -draft k <a-x> s ^\h*#\h* <ret> y jgh P }
}
}
-define-command -hidden python-indent-on-new-line %{
- evaluate-commands -draft -itersel %{
+define-command -hidden python-indent-on-new-line %<
+ evaluate-commands -draft -itersel %<
# preserve previous line indent
try %{ execute-keys -draft <semicolon> K <a-&> }
# cleanup trailing whitespaces from previous line
try %{ execute-keys -draft k <a-x> s \h+$ <ret> d }
# indent after line ending with :
try %{ execute-keys -draft <space> k <a-x> <a-k> :$ <ret> j <a-gt> }
- }
-}
+ # deindent closing brace/bracket when after cursor (for arrays and dictionaries)
+ try %[ execute-keys -draft <a-x> <a-k> ^\h*[}\]] <ret> gh / [}\]] <ret> m <a-S> 1<a-&> ]
+ >
+>
-}