Split python auto-insert hooks from auto-indent
This commit is contained in:
parent
5fd548d5cf
commit
5933ab1e78
|
@ -16,6 +16,7 @@ hook global WinSetOption filetype=python %{
|
||||||
|
|
||||||
set-option window static_words %opt{python_static_words}
|
set-option window static_words %opt{python_static_words}
|
||||||
|
|
||||||
|
hook window InsertChar \n -group python-insert python-insert-on-new-line
|
||||||
hook window InsertChar \n -group python-indent python-indent-on-new-line
|
hook window InsertChar \n -group python-indent python-indent-on-new-line
|
||||||
# cleanup trailing whitespaces on current line insert end
|
# 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> <a-x> s ^\h+$ <ret> d } }
|
||||||
|
@ -142,10 +143,14 @@ add-highlighter shared/python/code/ regex ^\h*(?:from|import)\h+(\S+) 1:module
|
||||||
# Commands
|
# Commands
|
||||||
# ‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
define-command -hidden python-indent-on-new-line %{
|
define-command -hidden python-insert-on-new-line %{
|
||||||
evaluate-commands -draft -itersel %{
|
evaluate-commands -draft -itersel %{
|
||||||
# copy '#' comment prefix and following white spaces
|
# 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 <a-x> s ^\h*#\h* <ret> y jgh P }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
define-command -hidden python-indent-on-new-line %{
|
||||||
|
evaluate-commands -draft -itersel %{
|
||||||
# preserve previous line indent
|
# preserve previous line indent
|
||||||
try %{ execute-keys -draft <semicolon> K <a-&> }
|
try %{ execute-keys -draft <semicolon> K <a-&> }
|
||||||
# cleanup trailing whitespaces from previous line
|
# cleanup trailing whitespaces from previous line
|
||||||
|
|
Loading…
Reference in New Issue
Block a user