Move user mappings to <space> and keep/remove selection to ,

main
Maxime Coste 2022-04-15 08:14:17 +10:00
parent 266d1c37d0
commit 2d8456db10
44 changed files with 72 additions and 68 deletions

View File

@ -628,8 +628,8 @@ pattern uses the last one.
As a convenience, `<a-s>` allows you to split the current selections on
line boundaries.
To clear multiple selections, use `space`. To keep only the nth selection
use `n` followed by `space`, in order to remove a selection, use `<a-space>`.
To clear multiple selections, use `,`. To keep only the nth selection
use `n` followed by `,`, in order to remove a selection, use `<a-,>`.
`<a-k>` allows you to enter a regex and keep only the selections that
contains a match for this regex. Using `<a-K>` you can keep the selections

View File

@ -356,14 +356,14 @@ using the built-in `:doc` command.
and additional manual editing of the selections is
.---, needed. In order to loop through all the selections and
| ) | remove the current one, two primitives are available:
`---' respectively the parenthesis (`)`), and the alt/space
key combination (`<a-space>`).
`---' respectively the parenthesis (`)`), and the alt/comma
key combination (`<a-,>`).
.---, .---,
|alt|+|spc| Example: given a list of three numbers all selected
|alt|+| , | Example: given a list of three numbers all selected
`---' `---' individually, (e.g., `1 2 3`), deselecting the second
selection would be done by hitting the parenthesis primitive
(`)`) until the according selection is the current one,
then hitting `<a-space>` to end up with only the first
then hitting `<a-,>` to end up with only the first
and third number selected.
However, being able to trim out some selections out

View File

@ -12,6 +12,9 @@ released versions.
* `x` now just extends the selection to contain full lines (as `<a-x>` did)
`<a-x>` trims partial lines from the selection (as `<a-X>` did)
* User mappings is now bound to `<space>` while keeping/removing main selection
moved to `,` and `<a-,>`
== Kakoune 2021.11.07
* Support for curly and separately colored underlines (undocumented in 2021.10.28)

View File

@ -575,10 +575,10 @@ to skim through the jump list using:
*<a-C>*::
copy the main selection to the previous line
*<space>*::
*,*::
clear selections to only keep the main one
*<a-space>*::
*<a-,>*::
clear the main selection
*<a-k>*::
@ -822,6 +822,6 @@ The following keys are recognized by this mode to help with editing
== User commands
*,*::
*<space>*::
enter default `user mode` to access custom commands
(See <<modes#user-mode,`:doc modes user-mode`>>)

View File

@ -89,8 +89,8 @@ See object commands <<keys#object-selection,`:doc keys object-selection`>>.
=== User mode
Mode entered with `,` (comma key). The user mode is empty by default and is
the opportunity to store custom mappings with no risk to shadow builtin ones.
Mode entered with `<space>`. The user mode is empty by default and is the
opportunity to store custom mappings with no risk to shadow builtin ones.
The context of execution is always the Normal mode.
== User modes

View File

@ -45,7 +45,7 @@ define-command editorconfig-load -params ..1 -docstring "editorconfig-load [file
print "set-option buffer BOM utf8"
}
if (trim_trailing_whitespace == "true") {
print "hook buffer BufWritePre \"" file "\" -group editorconfig-hooks %{ try %{ execute-keys -draft %{ %s\\h+$|\\n+\\z<ret>d } } }"
print "hook buffer BufWritePre \"" file "\" -group editorconfig-hooks %{ try %{ execute-keys -draft %{%s\\h+$|\\n+\\z<ret>d} } }"
}
if (max_line_length && max_line_length != "off") {
print "set window autowrap_column " max_line_length

View File

@ -108,7 +108,7 @@ define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -i
# Validate selection and get first and last char
execute-keys <a-k>\A[{(](\h*\S+)+\n<ret> <a-K>"(([^"]*"){2})*<ret> <a-K>'(([^']*'){2})*<ret> <a-:><a-semicolon>L <a-S>
# Remove possibly incorrect indent from new line which was copied from previous line
try %< execute-keys -draft <space> <a-h> s\h+<ret> d >
try %< execute-keys -draft , <a-h> s\h+<ret> d >
# Now indent and align that new line with the opening parenthesis/brace
execute-keys 1<a-&> &
> >

View File

@ -65,7 +65,7 @@ define-command -hidden cabal-indent-on-new-line %[
# filter previous line
try %[ execute-keys -draft k : cabal-trim-indent <ret> ]
# indent after lines ending with { or :
try %[ execute-keys -draft <space> k x <a-k> [:{]$ <ret> j <a-gt> ]
try %[ execute-keys -draft , k x <a-k> [:{]$ <ret> j <a-gt> ]
# deindent closing brace when after cursor
try %[ execute-keys -draft x <a-k> \h*\} <ret> gh / \} <ret> m <a-S> 1<a-&> ]
]

View File

@ -213,7 +213,7 @@ define-command -hidden clojure-indent-on-new-line %{
}
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
try %{ execute-keys -draft '[Bl"i<a-Z><gt>' }
execute-keys -draft ';"i<a-z>a&<space>'
execute-keys -draft ';"i<a-z>a&,'
}
}

View File

@ -251,7 +251,7 @@ define-command -hidden crystal-fetch-objects %{
set-register dquote %sh{
curl --location https://crystal-lang.org/api/ |
# Remove Top Level Namespace
kak -f '%1sdata-id="github.com/crystal-lang/crystal/(\w+)"<ret>)<a-space>y%<a-R>a<ret><esc><a-_>a<del><esc>'
kak -f '%1sdata-id="github.com/crystal-lang/crystal/(\w+)"<ret>)<a-,>y%<a-R>a<ret><esc><a-_>a<del><esc>'
}
}

View File

@ -95,7 +95,7 @@ define-command -hidden cucumber-indent-on-new-line %{
# filter previous line
try %{ execute-keys -draft k : cucumber-trim-indent <ret> }
# indent after lines containing :
try %{ execute-keys -draft <space> k x <a-k> : <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> : <ret> j <a-gt> }
}
}

View File

@ -126,7 +126,7 @@ define-command -hidden d-indent-on-new-line %~
# indent after a switch's case/default statements
try %[ execute-keys -draft kx <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
# indent after if|else|while|for
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-,><a-gt> ]
# deindent closing brace(s) when after cursor
try %[ execute-keys -draft x <a-k> ^\h*[})] <ret> gh / [})] <ret> m <a-S> 1<a-&> ]
=

View File

@ -107,7 +107,7 @@ define-command -hidden dart-indent-on-new-line %~
# indent after a switch's case/default statements
try %[ execute-keys -draft kx <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
# indent after if|else|while|for
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-,><a-gt> ]
# deindent closing brace when after cursor
try %[ execute-keys -draft x <a-k> ^\h*\} <ret> gh / \} <ret> m <a-S> 1<a-&> ]
=

View File

@ -102,7 +102,7 @@ define-command -hidden fennel-indent-on-new-line %{
}
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
try %{ execute-keys -draft '[Bl"i<a-Z><gt>' }
execute-keys -draft ';"i<a-z>a&<space>'
execute-keys -draft ';"i<a-z>a&,'
}
}

View File

@ -148,9 +148,9 @@ define-command -hidden fsharp-indent-on-new-line %{
# cleanup trailing whitespaces from previous line
try %{ execute-keys -draft k x s \h+$ <ret> d }
# indent after line ending with =
try %{ execute-keys -draft <space> k x <a-k> =$ <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> =$ <ret> j <a-gt> }
# indent after line ending with "do"
try %{ execute-keys -draft <space> k x <a-k> \bdo$ <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> \bdo$ <ret> j <a-gt> }
}
}

View File

@ -101,7 +101,7 @@ define-command -hidden gdscript-indent-on-new-line %<
# cleanup trailing whitespaces from previous line
try %{ execute-keys -draft k x s \h+$ <ret> d }
# indent after line ending with :
try %{ execute-keys -draft <space> k x <a-k> :$ <ret> <a-K> ^\h*# <ret> j <a-gt> }
try %{ execute-keys -draft , 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 x <a-k> ^\h*[}\]] <ret> gh / [}\]] <ret> m <a-S> 1<a-&> >
>

View File

@ -72,7 +72,7 @@ define-command -hidden hbs-trim-indent %{
define-command -hidden hbs-indent-on-char %[
evaluate-commands -draft -itersel %[
# de-indent after closing a yielded block tag
try %[ execute-keys -draft <space> <a-h> s ^\h+\{\{/([\w-.]+(?:/[\w-.]+)*)\}\}$ <ret> {c\{\{#<c-r>1,\{\{/<c-r>1\}\} <ret> s \A|.\z <ret> 1<a-&> ]
try %[ execute-keys -draft , <a-h> s ^\h+\{\{/([\w-.]+(?:/[\w-.]+)*)\}\}$ <ret> {c\{\{#<c-r>1,\{\{/<c-r>1\}\} <ret> s \A|.\z <ret> 1<a-&> ]
]
]

View File

@ -70,7 +70,7 @@ define-command -hidden html-trim-indent %{
define-command -hidden html-indent-on-greater-than %[
evaluate-commands -draft -itersel %[
# align closing tag to opening when alone on a line
try %[ execute-keys -draft <space> <a-h> s ^\h+<lt>/(\w+)<gt>$ <ret> {c<lt><c-r>1,<lt>/<c-r>1<gt> <ret> s \A|.\z <ret> 1<a-&> ]
try %[ execute-keys -draft , <a-h> s ^\h+<lt>/(\w+)<gt>$ <ret> {c<lt><c-r>1,<lt>/<c-r>1<gt> <ret> s \A|.\z <ret> 1<a-&> ]
]
]

View File

@ -71,7 +71,7 @@ define-command -hidden janet-indent-on-new-line %{
}
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
try %{ execute-keys -draft '[Bl"i<a-Z><gt>' }
execute-keys -draft '"i<a-z>a&<space>'
execute-keys -draft '"i<a-z>a&,'
}
}

View File

@ -58,7 +58,7 @@ define-command -hidden java-indent-on-new-line %~
# indent after a switch's case/default statements
try %[ execute-keys -draft kx <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
# indent after keywords
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(if|else|while|for|try|catch)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(if|else|while|for|try|catch)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-,><a-gt> ]
# deindent closing brace(s) when after cursor
try %[ execute-keys -draft x <a-k> ^\h*[})] <ret> gh / [})] <ret> m <a-S> 1<a-&> ]
=

View File

@ -146,7 +146,7 @@ define-command -hidden javascript-indent-on-new-line %<
# Validate selection and get first and last char
execute-keys <a-k>\A[{(](\h*\S+)+\n<ret> <a-K>"(([^"]*"){2})*<ret> <a-K>'(([^']*'){2})*<ret> <a-:><a-semicolon>L <a-S>
# Remove possibly incorrect indent from new line which was copied from previous line
try %< execute-keys -draft <space> <a-h> s\h+<ret> d >
try %< execute-keys -draft , <a-h> s\h+<ret> d >
# Now indent and align that new line with the opening parenthesis/brace
execute-keys 1<a-&> &
> >

View File

@ -126,7 +126,7 @@ define-command -hidden kotlin-indent-on-new-line %~
# indent after term on an expression
try %[ execute-keys -draft kx <a-k> =\h*?$ <ret> j<a-gt> ]
# indent after keywords
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(catch|do|else|for|if|try|while)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(catch|do|else|for|if|try|while)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-,><a-gt> ]
# deindent closing brace(s) when after cursor
try %[ execute-keys -draft x <a-k> ^\h*[})] <ret> gh / [})] <ret> m <a-S> 1<a-&> ]
>

View File

@ -74,7 +74,7 @@ define-command -hidden lisp-indent-on-new-line %{
}
try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
try %{ execute-keys -draft '[Bl"i<a-Z><gt>' }
execute-keys -draft ';"i<a-z>a&<space>'
execute-keys -draft ';"i<a-z>a&,'
}
}

View File

@ -106,13 +106,13 @@ define-command -hidden lua-indent-on-new-line %[
# remove trailing white spaces from previous line
try %[ execute-keys -draft k : lua-trim-indent <ret> ]
# preserve previous non-empty line indent
try %[ execute-keys -draft <space>gh<a-?>^[^\n]+$<ret>s\A|.\z<ret>)<a-&> ]
try %[ execute-keys -draft ,gh<a-?>^[^\n]+$<ret>s\A|.\z<ret>)<a-&> ]
# add one indentation level if the previous line is not a comment and:
# - starts with a block keyword that is not closed on the same line,
# - or contains an unclosed function expression,
# - or ends with an enclosed '(' or '{'
try %[ execute-keys -draft \
<space> Kx \
, Kx \
<a-K>\A\h*--<ret> \
<a-K>\A[^\n]*\b(end|until)\b<ret> \
<a-k>\A(\h*\b(do|else|elseif|for|function|if|repeat|while)\b|[^\n]*[({]$|[^\n]*\bfunction\b\h*[(])<ret> \

View File

@ -115,7 +115,7 @@ define-command -hidden mercury-indent-on-new-line %<
# cleanup trailing whitespaces from previous line
try %{ execute-keys -draft k x s \h+$ <ret> d }
# indent after line ending with :-
try %{ execute-keys -draft <space> k x <a-k> :-$ <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> :-$ <ret> j <a-gt> }
# deindent closing brace/bracket when after cursor
try %< execute-keys -draft x <a-k> ^\h*[}\])] <ret> gh / [}\])] <ret> m <a-S> 1<a-&> >
>

View File

@ -91,7 +91,7 @@ define-command -hidden moon-indent-on-char %{
# align _else_ statements to start
try %{ execute-keys -draft x <a-k> ^ \h * (else(if)?) $ <ret> <a-semicolon> <a-?> ^ \h * (if|unless|when) <ret> s \A | \z <ret> ) <a-&> }
# align _when_ to _switch_ then indent
try %{ execute-keys -draft x <a-k> ^ \h * (when) $ <ret> <a-semicolon> <a-?> ^ \h * (switch) <ret> s \A | \z <ret> ) <a-&> ) <space> <gt> }
try %{ execute-keys -draft x <a-k> ^ \h * (when) $ <ret> <a-semicolon> <a-?> ^ \h * (switch) <ret> s \A | \z <ret> ) <a-&> ) , <gt> }
# align _catch_ and _finally_ to _try_
try %{ execute-keys -draft x <a-k> ^ \h * (catch|finally) $ <ret> <a-semicolon> <a-?> ^ \h * (try) <ret> s \A | \z <ret> ) <a-&> }
}

View File

@ -125,7 +125,7 @@ define-command -hidden nim-indent-on-new-line %{
# cleanup trailing whitespaces from previous line
try %{ exec -draft k x s \h+$ <ret> d }
# indent after line ending with enum, tuple, object, type, import, export, const, let, var, ':' or '='
try %{ exec -draft <space> k x <a-k> (:|=|\b(?:enum|tuple|object|const|let|var|import|export|type))$ <ret> j <a-gt> }
try %{ exec -draft , k x <a-k> (:|=|\b(?:enum|tuple|object|const|let|var|import|export|type))$ <ret> j <a-gt> }
}
}

View File

@ -127,7 +127,7 @@ define-command -hidden perl-indent-on-new-line %~
# indent after a switch's case/default statements
try %[ execute-keys -draft kx <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
# indent after if|else|while|for
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
try %[ execute-keys -draft <semicolon><a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-,><a-gt> ]
# deindent closing brace(s) when after cursor
try %[ execute-keys -draft x <a-k> ^\h*[})] <ret> gh / [})] <ret> m <a-S> 1<a-&> ]
=

View File

@ -91,13 +91,13 @@ define-command -hidden pony-insert-on-new-line %{
define-command -hidden pony-indent-on-new-line %{
evaluate-commands -draft -itersel %{
# preserve previous line indent
try %{ execute-keys -draft <space> K <a-&> }
try %{ execute-keys -draft , K <a-&> }
# cleanup trailing whitespaces from previous line
try %{ execute-keys -draft k x s \h+$ <ret> d }
# indent after line ending with :
try %{ execute-keys -draft <space> k x <a-k> (\b(?:do|try|then|else)|:|=>)$ <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> (\b(?:do|try|then|else)|:|=>)$ <ret> j <a-gt> }
# else, end are always de-indented
try %{ execute-keys -draft <space> k x <a-k> \b(else|end):$ <ret> k x s ^\h* <ret> y j x <a-k> ^<c-r>" <ret> J <a-lt> }
try %{ execute-keys -draft , k x <a-k> \b(else|end):$ <ret> k x s ^\h* <ret> y j x <a-k> ^<c-r>" <ret> J <a-lt> }
}
}

View File

@ -74,7 +74,7 @@ define-command -hidden pug-indent-on-new-line %{
# copy '//', '|', '-' or '(!)=' prefix and following whitespace
try %{ execute-keys -draft k x s ^\h*\K[/|!=-]{1,2}\h* <ret> y gh j P }
# indent unless we copied something above
try %{ execute-keys -draft <a-gt> <space> b s \S <ret> g l <a-lt> }
try %{ execute-keys -draft <a-gt> , b s \S <ret> g l <a-lt> }
}
}

View File

@ -160,7 +160,7 @@ define-command -hidden python-indent-on-new-line %<
# cleanup trailing whitespaces from previous line
try %{ execute-keys -draft k x s \h+$ <ret> d }
# indent after line ending with :
try %{ execute-keys -draft <space> k x <a-k> :$ <ret> <a-K> ^\h*# <ret> j <a-gt> }
try %{ execute-keys -draft , 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 x <a-k> ^\h*[}\]] <ret> gh / [}\]] <ret> m <a-S> 1<a-&> >
>

View File

@ -93,7 +93,7 @@ define-command -hidden r-indent-on-newline %< evaluate-commands -draft -itersel
# Validate selection and get first and last char
execute-keys <a-k>\A[{(](\h*\S+)+\n<ret> <a-K>"(([^"]*"){2})*<ret> <a-K>'(([^']*'){2})*<ret> <a-:><a-semicolon>L <a-S>
# Remove possibly incorrect indent from new line which was copied from previous line
try %< execute-keys -draft <space> <a-h> s\h+<ret> d >
try %< execute-keys -draft , <a-h> s\h+<ret> d >
# Now indent and align that new line with the opening parenthesis/brace
execute-keys 1<a-&> &
> >

View File

@ -120,11 +120,11 @@ define-command -hidden sh-indent-on-new-line %¶
# done
#
# indent after do
try %{ execute-keys -draft <space> k x <a-k> \bdo$ <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> \bdo$ <ret> j <a-gt> }
# copy the indentation of the matching for/when - matching on the do
# statement, so we don't need to duplicate this for the two loop
# structures.
try %{ execute-keys -draft <space> k x <a-k> \bdone$ <ret> gh [c\bdo\b,\bdone\b <ret> x <a-S> 1<a-&> <space> j K <a-&> }
try %{ execute-keys -draft , k x <a-k> \bdone$ <ret> gh [c\bdo\b,\bdone\b <ret> x <a-S> 1<a-&> , j K <a-&> }
# Indent if/then/else syntax, e.g.:
# if [ $foo = $bar ]; then
@ -142,11 +142,11 @@ define-command -hidden sh-indent-on-new-line %¶
# fi
#
# indent after then
try %{ execute-keys -draft <space> k x <a-k> \bthen$ <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> \bthen$ <ret> j <a-gt> }
# copy the indentation of the matching if
try %{ execute-keys -draft <space> k x <a-k> \bfi$ <ret> gh [c\bif\b,\bfi\b <ret> x <a-S> 1<a-&> <space> j K <a-&> }
try %{ execute-keys -draft , k x <a-k> \bfi$ <ret> gh [c\bif\b,\bfi\b <ret> x <a-S> 1<a-&> , j K <a-&> }
# copy the indentation of the matching if, and then re-indent afterwards
try %{ execute-keys -draft <space> k x <a-k> \belse$ <ret> gh [c\bif\b,\bfi\b <ret> x <a-S> 1<a-&> <space> j K <a-&> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> \belse$ <ret> gh [c\bif\b,\bfi\b <ret> x <a-S> 1<a-&> , j K <a-&> j <a-gt> }
# Indent case syntax, e.g.:
# case "$foo" in
@ -166,13 +166,13 @@ define-command -hidden sh-indent-on-new-line %¶
# esac
#
# indent after in
try %{ execute-keys -draft <space> k x <a-k> \bin$ <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> \bin$ <ret> j <a-gt> }
# copy the indentation of the matching case
try %{ execute-keys -draft <space> k x <a-k> \besac$ <ret> gh [c\bcase\b,\besac\b <ret> x <a-S> 1<a-&> <space> j K <a-&> }
try %{ execute-keys -draft , k x <a-k> \besac$ <ret> gh [c\bcase\b,\besac\b <ret> x <a-S> 1<a-&> , j K <a-&> }
# indent after )
try %{ execute-keys -draft <space> k x <a-k> ^\s*\(?[^(]+[^)]\)$ <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> ^\s*\(?[^(]+[^)]\)$ <ret> j <a-gt> }
# deindent after ;;
try %{ execute-keys -draft <space> k x <a-k> ^\s*\;\;$ <ret> j <a-lt> }
try %{ execute-keys -draft , k x <a-k> ^\s*\;\;$ <ret> j <a-lt> }
# Indent compound commands as logical blocks, e.g.:
# {
@ -194,9 +194,9 @@ define-command -hidden sh-indent-on-new-line %¶
# white space (including a newline), though technically it can also be
# ';'. Only vertical white space makes sense in this context, though,
# since the syntax denotes a logical block, not a simple compound command.
try %= execute-keys -draft <space> k x <a-k> (\s|^)\{$ <ret> j <a-gt> =
try %= execute-keys -draft , k x <a-k> (\s|^)\{$ <ret> j <a-gt> =
# deindent closing }
try %= execute-keys -draft <space> k x <a-k> ^\s*\}$ <ret> <a-lt> j K <a-&> =
try %= execute-keys -draft , k x <a-k> ^\s*\}$ <ret> <a-lt> j K <a-&> =
# deindent closing } when after cursor
try %= execute-keys -draft x <a-k> ^\h*\} <ret> gh / \} <ret> m <a-S> 1<a-&> =

View File

@ -399,10 +399,10 @@ define-command -hidden vhdl-indent-on-new-line %{
]
# Copy the indentation of the matching if.
try %{ execute-keys -draft <space> k x <a-k> ^\h*(elsif\b|else$) <ret> gh [c^\h*(\S*\h*:\h*)?if\b,\bend\sif\b <ret> x <a-S> 1<a-&> <space> j K <a-&> }
try %{ execute-keys -draft , k x <a-k> ^\h*(elsif\b|else$) <ret> gh [c^\h*(\S*\h*:\h*)?if\b,\bend\sif\b <ret> x <a-S> 1<a-&> , j K <a-&> }
# Increase indent after some operators.
try %[ execute-keys -draft <semicolon> <space> k x <a-k> (\(|=>|<=|:=)$ <ret> j <a-gt> ]
try %[ execute-keys -draft <semicolon> , k x <a-k> (\(|=>|<=|:=)$ <ret> j <a-gt> ]
}
}

View File

@ -64,9 +64,9 @@ define-command -hidden yaml-indent-on-new-line %{
# filter previous line
try %{ execute-keys -draft k : yaml-trim-indent <ret> }
# indent after :
try %{ execute-keys -draft <space> k x <a-k> :$ <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> :$ <ret> j <a-gt> }
# indent after -
try %{ execute-keys -draft <space> k x <a-k> ^\h*- <ret> j <a-gt> }
try %{ execute-keys -draft , k x <a-k> ^\h*- <ret> j <a-gt> }
}
}

View File

@ -111,7 +111,7 @@ define-command clang-complete -docstring "Complete the current selection" %{ cla
define-command -hidden clang-show-completion-info %[ try %[
evaluate-commands -draft %[
execute-keys <space>{( <a-k> ^\( <ret> b <a-k> \A\w+\z <ret>
execute-keys ,{( <a-k> ^\( <ret> b <a-k> \A\w+\z <ret>
evaluate-commands %sh[
desc=$(printf %s\\n "${kak_opt_clang_completions}" | sed -e "{ s/\([^\\]\):/\1\n/g }" | sed -ne "/^${kak_selection}|/ { s/^[^|]\+|//; s/|.*$//; s/\\\:/:/g; p }")
if [ -n "$desc" ]; then

View File

@ -150,7 +150,7 @@ define-command ctags-enable-autocomplete -docstring "Enable automatic ctags comp
hook window -group ctags-autocomplete InsertIdle .* %{
try %{
evaluate-commands -draft %{ # select previous word >= ctags_min_chars
execute-keys "<space>b_<a-k>.{%opt{ctags_min_chars},}<ret>"
execute-keys ",b_<a-k>.{%opt{ctags_min_chars},}<ret>"
ctags-complete # run in draft context to preserve selection
}
}

View File

@ -57,7 +57,7 @@ define-command grep-next-match -docstring 'Jump to the next grep match' %{
# First jump to end of buffer so that if grep_current_line == 0
# 0g<a-l> will be a no-op and we'll jump to the first result.
# Yeah, thats ugly...
execute-keys "ge %opt{grep_current_line}g<a-l> /^[^:]+:\d+:<ret>"
execute-keys ge %opt{grep_current_line}g<a-l> /^[^:]+:\d+:<ret>
grep-jump
}
try %{
@ -72,7 +72,7 @@ define-command grep-previous-match -docstring 'Jump to the previous grep match'
evaluate-commands -try-client %opt{jumpclient} %{
buffer '*grep*'
# See comment in grep-next-match
execute-keys "ge %opt{grep_current_line}g<a-h> <a-/>^[^:]+:\d+:<ret>"
execute-keys ge %opt{grep_current_line}g<a-h> <a-/>^[^:]+:\d+:<ret>
grep-jump
}
try %{

View File

@ -49,6 +49,7 @@ struct {
"» {+u}complete-command{} to configure command completion\n"
"» {+b}!{} and {+b}<a-!>{} now select the inserted text\n"
"» {+b}x{} now uses {+b}<a-x>{} behaviour\n"
"» {+b}<space>{} and {+b},{} have been swapped\n"
}, {
20211107,
"» colored and curly underlines support (undocumented in 20210828)\n"

View File

@ -2269,8 +2269,8 @@ static constexpr HashMap<Key, NormalCmd, MemoryDomain::Undefined, KeymapBackend>
{ {'!'}, {"insert command output", insert_output<PasteMode::Insert>} },
{ {alt('!')}, {"append command output", insert_output<PasteMode::Append>} },
{ {Key::Space}, {"remove all selections except main", keep_selection} },
{ {alt(Key::Space)}, {"remove main selection", remove_selection} },
{ {','}, {"remove all selections except main", keep_selection} },
{ {alt(',')}, {"remove main selection", remove_selection} },
{ {';'}, {"reduce selections to their cursor", clear_selections} },
{ {alt(';')}, {"swap selections cursor and anchor", flip_selections} },
{ {alt(':')}, {"ensure selection cursor is after anchor", ensure_forward} },
@ -2374,7 +2374,7 @@ static constexpr HashMap<Key, NormalCmd, MemoryDomain::Undefined, KeymapBackend>
{ {'C'}, {"copy selection on next lines", copy_selections_on_next_lines<Forward>} },
{ {alt('C')}, {"copy selection on previous lines", copy_selections_on_next_lines<Backward>} },
{ {','}, {"user mappings", exec_user_mappings} },
{ {Key::Space}, {"user mappings", exec_user_mappings} },
{ {Key::PageUp}, { "scroll one page up", scroll<Backward>} },
{ {Key::PageDown}, {"scroll one page down", scroll<Forward>} },

View File

@ -1 +1 @@
%<a-s>y1<a-space>Ru
%<a-s>y1<a-,>Ru

View File

@ -1 +1 @@
c<ret><esc>Oif (true) {}<esc>hi<ret><esc>Oconsole.log();<esc>hhi<ret><esc>O{},<ret>{},<esc>hh<a-C>i<ret><esc>1<space>Ofoo: { bar: 1 },<esc>jjobaz: { bam: 2 },<esc>
c<ret><esc>Oif (true) {}<esc>hi<ret><esc>Oconsole.log();<esc>hhi<ret><esc>O{},<ret>{},<esc>hh<a-C>i<ret><esc>1,Ofoo: { bar: 1 },<esc>jjobaz: { bam: 2 },<esc>

View File

@ -1 +1 @@
)<a-space>
)<a-,>

View File

@ -1 +1 @@
i<a-;>,d<esc>
i<a-;><space>d<esc>