summaryrefslogtreecommitdiff
path: root/rc/filetype/python.kak
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2022-03-17 09:20:07 +1100
committerMaxime Coste <mawww@kakoune.org>2022-07-05 08:43:40 +1000
commitef8a11b3dbefb8a1222974a8c34e15fa006d56e0 (patch)
treee66d71d0a5d67c6bc43d4d5977b8468d0335b62d /rc/filetype/python.kak
parent046be3b06ce41922e363c742ee9470f0ac885d4b (diff)
Make `x` just select the full lines
`x` is often criticized as hard to predict due to its slightly complex behaviour of selecting next line if the current one is fully selected. Change `x` to use the previous `<a-x>` behaviour, and change `<a-x>` to trim to fully selected lines as `<a-X>` did. Adapt existing indentation script to the new behaviour
Diffstat (limited to 'rc/filetype/python.kak')
-rw-r--r--rc/filetype/python.kak10
1 files changed, 5 insertions, 5 deletions
diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak
index d05338d3..ff60297a 100644
--- a/rc/filetype/python.kak
+++ b/rc/filetype/python.kak
@@ -19,7 +19,7 @@ hook global WinSetOption filetype=python %{
hook window InsertChar \n -group python-insert python-insert-on-new-line
hook window InsertChar \n -group python-indent python-indent-on-new-line
# cleanup trailing whitespaces on current line insert end
- hook window ModeChange pop:insert:.* -group python-trim-indent %{ try %{ execute-keys -draft <semicolon> <a-x> s ^\h+$ <ret> d } }
+ hook window ModeChange pop:insert:.* -group python-trim-indent %{ try %{ execute-keys -draft <semicolon> x s ^\h+$ <ret> d } }
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window python-.+ }
}
@@ -149,7 +149,7 @@ add-highlighter shared/python/code/ regex ^\h*(?:from|import)\h+(\S+) 1:module
define-command -hidden python-insert-on-new-line %{
evaluate-commands -draft -itersel %{
# copy '#' comment prefix and following white spaces
- try %{ execute-keys -draft k <a-x> s ^\h*#\h* <ret> y jgh P }
+ try %{ execute-keys -draft k x s ^\h*#\h* <ret> y jgh P }
}
}
@@ -158,11 +158,11 @@ define-command -hidden python-indent-on-new-line %<
# 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 }
+ try %{ execute-keys -draft k x s \h+$ <ret> d }
# indent after line ending with :
- try %{ execute-keys -draft <space> k <a-x> <a-k> :$ <ret> <a-K> ^\h*# <ret> j <a-gt> }
+ try %{ execute-keys -draft <space> k x <a-k> :$ <ret> <a-K> ^\h*# <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-&> >
+ try %< execute-keys -draft x <a-k> ^\h*[}\]] <ret> gh / [}\]] <ret> m <a-S> 1<a-&> >
>
>