From 2d8456db102e13f37a5cd271868c330d73580f6d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 15 Apr 2022 08:14:17 +1000 Subject: [PATCH] Move user mappings to and keep/remove selection to , --- README.asciidoc | 4 ++-- contrib/TRAMPOLINE | 8 +++---- doc/pages/changelog.asciidoc | 3 +++ doc/pages/keys.asciidoc | 6 ++--- doc/pages/modes.asciidoc | 4 ++-- rc/detection/editorconfig.kak | 2 +- rc/filetype/c-family.kak | 2 +- rc/filetype/cabal.kak | 2 +- rc/filetype/clojure.kak | 2 +- rc/filetype/crystal.kak | 2 +- rc/filetype/cucumber.kak | 2 +- rc/filetype/d.kak | 2 +- rc/filetype/dart.kak | 2 +- rc/filetype/fennel.kak | 2 +- rc/filetype/fsharp.kak | 4 ++-- rc/filetype/gdscript.kak | 2 +- rc/filetype/hbs.kak | 2 +- rc/filetype/html.kak | 2 +- rc/filetype/janet.kak | 2 +- rc/filetype/java.kak | 2 +- rc/filetype/javascript.kak | 2 +- rc/filetype/kotlin.kak | 2 +- rc/filetype/lisp.kak | 2 +- rc/filetype/lua.kak | 4 ++-- rc/filetype/mercury.kak | 2 +- rc/filetype/moon.kak | 2 +- rc/filetype/nim.kak | 2 +- rc/filetype/perl.kak | 2 +- rc/filetype/pony.kak | 6 ++--- rc/filetype/pug.kak | 2 +- rc/filetype/python.kak | 2 +- rc/filetype/r.kak | 2 +- rc/filetype/sh.kak | 22 +++++++++---------- rc/filetype/vhdl.kak | 4 ++-- rc/filetype/yaml.kak | 4 ++-- rc/tools/clang.kak | 2 +- rc/tools/ctags.kak | 2 +- rc/tools/grep.kak | 4 ++-- src/main.cc | 1 + src/normal.cc | 6 ++--- test/compose/undo-multi-replace-at-end/cmd | 2 +- .../deindent-complex-brace-structure/cmd | 2 +- test/normal/rotate/cmd | 2 +- .../cmd | 2 +- 44 files changed, 72 insertions(+), 68 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 44b40fc0..f07cca40 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -628,8 +628,8 @@ pattern uses the last one. As a convenience, `` 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 ``. +To clear multiple selections, use `,`. To keep only the nth selection +use `n` followed by `,`, in order to remove a selection, use ``. `` allows you to enter a regex and keep only the selections that contains a match for this regex. Using `` you can keep the selections diff --git a/contrib/TRAMPOLINE b/contrib/TRAMPOLINE index d1595a77..744d48e3 100644 --- a/contrib/TRAMPOLINE +++ b/contrib/TRAMPOLINE @@ -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 (``). + `---' respectively the parenthesis (`)`), and the alt/comma + key combination (``). .---, .---, - |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 `` to end up with only the first + then hitting `` to end up with only the first and third number selected. However, being able to trim out some selections out diff --git a/doc/pages/changelog.asciidoc b/doc/pages/changelog.asciidoc index d81c5809..df33139b 100644 --- a/doc/pages/changelog.asciidoc +++ b/doc/pages/changelog.asciidoc @@ -12,6 +12,9 @@ released versions. * `x` now just extends the selection to contain full lines (as `` did) `` trims partial lines from the selection (as `` did) +* User mappings is now bound to `` while keeping/removing main selection + moved to `,` and `` + == Kakoune 2021.11.07 * Support for curly and separately colored underlines (undocumented in 2021.10.28) diff --git a/doc/pages/keys.asciidoc b/doc/pages/keys.asciidoc index 29ddb54b..9f171386 100644 --- a/doc/pages/keys.asciidoc +++ b/doc/pages/keys.asciidoc @@ -575,10 +575,10 @@ to skim through the jump list using: **:: copy the main selection to the previous line -**:: +*,*:: clear selections to only keep the main one -**:: +**:: clear the main selection **:: @@ -822,6 +822,6 @@ The following keys are recognized by this mode to help with editing == User commands -*,*:: +**:: enter default `user mode` to access custom commands (See <>) diff --git a/doc/pages/modes.asciidoc b/doc/pages/modes.asciidoc index 754dda5b..f739ae98 100644 --- a/doc/pages/modes.asciidoc +++ b/doc/pages/modes.asciidoc @@ -89,8 +89,8 @@ See object commands <>. === 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 ``. 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 diff --git a/rc/detection/editorconfig.kak b/rc/detection/editorconfig.kak index 6bfe1600..aac35c58 100644 --- a/rc/detection/editorconfig.kak +++ b/rc/detection/editorconfig.kak @@ -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+\\zd } } }" + print "hook buffer BufWritePre \"" file "\" -group editorconfig-hooks %{ try %{ execute-keys -draft %{%s\\h+$|\\n+\\zd} } }" } if (max_line_length && max_line_length != "off") { print "set window autowrap_column " max_line_length diff --git a/rc/filetype/c-family.kak b/rc/filetype/c-family.kak index 7ef1c975..3682d323 100644 --- a/rc/filetype/c-family.kak +++ b/rc/filetype/c-family.kak @@ -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[{(](\h*\S+)+\n "(([^"]*"){2})* '(([^']*'){2})* L # Remove possibly incorrect indent from new line which was copied from previous line - try %< execute-keys -draft s\h+ d > + try %< execute-keys -draft , s\h+ d > # Now indent and align that new line with the opening parenthesis/brace execute-keys 1 & > > diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index 684542e2..a1f45261 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -65,7 +65,7 @@ define-command -hidden cabal-indent-on-new-line %[ # filter previous line try %[ execute-keys -draft k : cabal-trim-indent ] # indent after lines ending with { or : - try %[ execute-keys -draft k x [:{]$ j ] + try %[ execute-keys -draft , k x [:{]$ j ] # deindent closing brace when after cursor try %[ execute-keys -draft x \h*\} gh / \} m 1 ] ] diff --git a/rc/filetype/clojure.kak b/rc/filetype/clojure.kak index 4152fb17..d876262a 100644 --- a/rc/filetype/clojure.kak +++ b/rc/filetype/clojure.kak @@ -213,7 +213,7 @@ define-command -hidden clojure-indent-on-new-line %{ } try %{ execute-keys -draft '[rl"i' } try %{ execute-keys -draft '[Bl"i' } - execute-keys -draft ';"ia&' + execute-keys -draft ';"ia&,' } } diff --git a/rc/filetype/crystal.kak b/rc/filetype/crystal.kak index 5a62e7dc..e3540678 100644 --- a/rc/filetype/crystal.kak +++ b/rc/filetype/crystal.kak @@ -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+)")y%aa' + kak -f '%1sdata-id="github.com/crystal-lang/crystal/(\w+)")y%aa' } } diff --git a/rc/filetype/cucumber.kak b/rc/filetype/cucumber.kak index 00c2a42f..f8f54152 100644 --- a/rc/filetype/cucumber.kak +++ b/rc/filetype/cucumber.kak @@ -95,7 +95,7 @@ define-command -hidden cucumber-indent-on-new-line %{ # filter previous line try %{ execute-keys -draft k : cucumber-trim-indent } # indent after lines containing : - try %{ execute-keys -draft k x : j } + try %{ execute-keys -draft , k x : j } } } diff --git a/rc/filetype/d.kak b/rc/filetype/d.kak index 7d2f307b..359c1ca9 100644 --- a/rc/filetype/d.kak +++ b/rc/filetype/d.kak @@ -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 ^\h*(case|default).*:$ j ] # indent after if|else|while|for - try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor try %[ execute-keys -draft x ^\h*[})] gh / [})] m 1 ] = diff --git a/rc/filetype/dart.kak b/rc/filetype/dart.kak index 7091f1c5..d6623591 100644 --- a/rc/filetype/dart.kak +++ b/rc/filetype/dart.kak @@ -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 ^\h*(case|default).*:$ j ] # indent after if|else|while|for - try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace when after cursor try %[ execute-keys -draft x ^\h*\} gh / \} m 1 ] = diff --git a/rc/filetype/fennel.kak b/rc/filetype/fennel.kak index 91368cc5..7b82a8e8 100644 --- a/rc/filetype/fennel.kak +++ b/rc/filetype/fennel.kak @@ -102,7 +102,7 @@ define-command -hidden fennel-indent-on-new-line %{ } try %{ execute-keys -draft '[rl"i' } try %{ execute-keys -draft '[Bl"i' } - execute-keys -draft ';"ia&' + execute-keys -draft ';"ia&,' } } diff --git a/rc/filetype/fsharp.kak b/rc/filetype/fsharp.kak index f2909e0b..64d6b2c0 100644 --- a/rc/filetype/fsharp.kak +++ b/rc/filetype/fsharp.kak @@ -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+$ d } # indent after line ending with = - try %{ execute-keys -draft k x =$ j } + try %{ execute-keys -draft , k x =$ j } # indent after line ending with "do" - try %{ execute-keys -draft k x \bdo$ j } + try %{ execute-keys -draft , k x \bdo$ j } } } diff --git a/rc/filetype/gdscript.kak b/rc/filetype/gdscript.kak index 7f716554..3fb758c7 100644 --- a/rc/filetype/gdscript.kak +++ b/rc/filetype/gdscript.kak @@ -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+$ d } # indent after line ending with : - try %{ execute-keys -draft k x :$ ^\h*# j } + try %{ execute-keys -draft , k x :$ ^\h*# j } # deindent closing brace/bracket when after cursor (for arrays and dictionaries) try %< execute-keys -draft x ^\h*[}\]] gh / [}\]] m 1 > > diff --git a/rc/filetype/hbs.kak b/rc/filetype/hbs.kak index 5a9efaef..5ea99bc7 100644 --- a/rc/filetype/hbs.kak +++ b/rc/filetype/hbs.kak @@ -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 s ^\h+\{\{/([\w-.]+(?:/[\w-.]+)*)\}\}$ {c\{\{#1,\{\{/1\}\} s \A|.\z 1 ] + try %[ execute-keys -draft , s ^\h+\{\{/([\w-.]+(?:/[\w-.]+)*)\}\}$ {c\{\{#1,\{\{/1\}\} s \A|.\z 1 ] ] ] diff --git a/rc/filetype/html.kak b/rc/filetype/html.kak index 8a68c69f..0b09ef6a 100644 --- a/rc/filetype/html.kak +++ b/rc/filetype/html.kak @@ -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 s ^\h+/(\w+)$ {c1,/1 s \A|.\z 1 ] + try %[ execute-keys -draft , s ^\h+/(\w+)$ {c1,/1 s \A|.\z 1 ] ] ] diff --git a/rc/filetype/janet.kak b/rc/filetype/janet.kak index 2ce53936..b5f7c7b5 100644 --- a/rc/filetype/janet.kak +++ b/rc/filetype/janet.kak @@ -71,7 +71,7 @@ define-command -hidden janet-indent-on-new-line %{ } try %{ execute-keys -draft '[rl"i' } try %{ execute-keys -draft '[Bl"i' } - execute-keys -draft '"ia&' + execute-keys -draft '"ia&,' } } diff --git a/rc/filetype/java.kak b/rc/filetype/java.kak index d252b4b6..69b0d74e 100644 --- a/rc/filetype/java.kak +++ b/rc/filetype/java.kak @@ -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 ^\h*(case|default).*:$ j ] # indent after keywords - try %[ execute-keys -draft )MB \A(if|else|while|for|try|catch)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + try %[ execute-keys -draft )MB \A(if|else|while|for|try|catch)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor try %[ execute-keys -draft x ^\h*[})] gh / [})] m 1 ] = diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index 1f39aa6a..64c7c862 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -146,7 +146,7 @@ define-command -hidden javascript-indent-on-new-line %< # Validate selection and get first and last char execute-keys \A[{(](\h*\S+)+\n "(([^"]*"){2})* '(([^']*'){2})* L # Remove possibly incorrect indent from new line which was copied from previous line - try %< execute-keys -draft s\h+ d > + try %< execute-keys -draft , s\h+ d > # Now indent and align that new line with the opening parenthesis/brace execute-keys 1 & > > diff --git a/rc/filetype/kotlin.kak b/rc/filetype/kotlin.kak index 14a8ff59..152de4b4 100644 --- a/rc/filetype/kotlin.kak +++ b/rc/filetype/kotlin.kak @@ -126,7 +126,7 @@ define-command -hidden kotlin-indent-on-new-line %~ # indent after term on an expression try %[ execute-keys -draft kx =\h*?$ j ] # indent after keywords - try %[ execute-keys -draft )MB \A(catch|do|else|for|if|try|while)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + try %[ execute-keys -draft )MB \A(catch|do|else|for|if|try|while)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor try %[ execute-keys -draft x ^\h*[})] gh / [})] m 1 ] > diff --git a/rc/filetype/lisp.kak b/rc/filetype/lisp.kak index 153acbcf..9ab91826 100644 --- a/rc/filetype/lisp.kak +++ b/rc/filetype/lisp.kak @@ -74,7 +74,7 @@ define-command -hidden lisp-indent-on-new-line %{ } try %{ execute-keys -draft '[rl"i' } try %{ execute-keys -draft '[Bl"i' } - execute-keys -draft ';"ia&' + execute-keys -draft ';"ia&,' } } diff --git a/rc/filetype/lua.kak b/rc/filetype/lua.kak index b1bcf4ea..98354770 100644 --- a/rc/filetype/lua.kak +++ b/rc/filetype/lua.kak @@ -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 ] # preserve previous non-empty line indent - try %[ execute-keys -draft gh^[^\n]+$s\A|.\z) ] + try %[ execute-keys -draft ,gh^[^\n]+$s\A|.\z) ] # 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 \ - Kx \ + , Kx \ \A\h*-- \ \A[^\n]*\b(end|until)\b \ \A(\h*\b(do|else|elseif|for|function|if|repeat|while)\b|[^\n]*[({]$|[^\n]*\bfunction\b\h*[(]) \ diff --git a/rc/filetype/mercury.kak b/rc/filetype/mercury.kak index 7992c889..813b4ca0 100644 --- a/rc/filetype/mercury.kak +++ b/rc/filetype/mercury.kak @@ -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+$ d } # indent after line ending with :- - try %{ execute-keys -draft k x :-$ j } + try %{ execute-keys -draft , k x :-$ j } # deindent closing brace/bracket when after cursor try %< execute-keys -draft x ^\h*[}\])] gh / [}\])] m 1 > > diff --git a/rc/filetype/moon.kak b/rc/filetype/moon.kak index fcd7c130..43d8dd4d 100644 --- a/rc/filetype/moon.kak +++ b/rc/filetype/moon.kak @@ -91,7 +91,7 @@ define-command -hidden moon-indent-on-char %{ # align _else_ statements to start try %{ execute-keys -draft x ^ \h * (else(if)?) $ ^ \h * (if|unless|when) s \A | \z ) } # align _when_ to _switch_ then indent - try %{ execute-keys -draft x ^ \h * (when) $ ^ \h * (switch) s \A | \z ) ) } + try %{ execute-keys -draft x ^ \h * (when) $ ^ \h * (switch) s \A | \z ) ) , } # align _catch_ and _finally_ to _try_ try %{ execute-keys -draft x ^ \h * (catch|finally) $ ^ \h * (try) s \A | \z ) } } diff --git a/rc/filetype/nim.kak b/rc/filetype/nim.kak index 916b9d19..2c00ac39 100644 --- a/rc/filetype/nim.kak +++ b/rc/filetype/nim.kak @@ -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+$ d } # indent after line ending with enum, tuple, object, type, import, export, const, let, var, ':' or '=' - try %{ exec -draft k x (:|=|\b(?:enum|tuple|object|const|let|var|import|export|type))$ j } + try %{ exec -draft , k x (:|=|\b(?:enum|tuple|object|const|let|var|import|export|type))$ j } } } diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index 699b94d4..2fcb0265 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -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 ^\h*(case|default).*:$ j ] # indent after if|else|while|for - try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor try %[ execute-keys -draft x ^\h*[})] gh / [})] m 1 ] = diff --git a/rc/filetype/pony.kak b/rc/filetype/pony.kak index 592fb943..f0fa8e28 100644 --- a/rc/filetype/pony.kak +++ b/rc/filetype/pony.kak @@ -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 K } + try %{ execute-keys -draft , K } # cleanup trailing whitespaces from previous line try %{ execute-keys -draft k x s \h+$ d } # indent after line ending with : - try %{ execute-keys -draft k x (\b(?:do|try|then|else)|:|=>)$ j } + try %{ execute-keys -draft , k x (\b(?:do|try|then|else)|:|=>)$ j } # else, end are always de-indented - try %{ execute-keys -draft k x \b(else|end):$ k x s ^\h* y j x ^" J } + try %{ execute-keys -draft , k x \b(else|end):$ k x s ^\h* y j x ^" J } } } diff --git a/rc/filetype/pug.kak b/rc/filetype/pug.kak index f9520bbe..db05c9bc 100644 --- a/rc/filetype/pug.kak +++ b/rc/filetype/pug.kak @@ -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* y gh j P } # indent unless we copied something above - try %{ execute-keys -draft b s \S g l } + try %{ execute-keys -draft , b s \S g l } } } diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index ff60297a..6444423b 100644 --- a/rc/filetype/python.kak +++ b/rc/filetype/python.kak @@ -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+$ d } # indent after line ending with : - try %{ execute-keys -draft k x :$ ^\h*# j } + try %{ execute-keys -draft , k x :$ ^\h*# j } # deindent closing brace/bracket when after cursor (for arrays and dictionaries) try %< execute-keys -draft x ^\h*[}\]] gh / [}\]] m 1 > > diff --git a/rc/filetype/r.kak b/rc/filetype/r.kak index 30d15430..d3d98547 100644 --- a/rc/filetype/r.kak +++ b/rc/filetype/r.kak @@ -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[{(](\h*\S+)+\n "(([^"]*"){2})* '(([^']*'){2})* L # Remove possibly incorrect indent from new line which was copied from previous line - try %< execute-keys -draft s\h+ d > + try %< execute-keys -draft , s\h+ d > # Now indent and align that new line with the opening parenthesis/brace execute-keys 1 & > > diff --git a/rc/filetype/sh.kak b/rc/filetype/sh.kak index 7a284c84..9a9f51e7 100644 --- a/rc/filetype/sh.kak +++ b/rc/filetype/sh.kak @@ -120,11 +120,11 @@ define-command -hidden sh-indent-on-new-line %¶ # done # # indent after do - try %{ execute-keys -draft k x \bdo$ j } + try %{ execute-keys -draft , k x \bdo$ j } # 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 k x \bdone$ gh [c\bdo\b,\bdone\b x 1 j K } + try %{ execute-keys -draft , k x \bdone$ gh [c\bdo\b,\bdone\b x 1 , j K } # 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 k x \bthen$ j } + try %{ execute-keys -draft , k x \bthen$ j } # copy the indentation of the matching if - try %{ execute-keys -draft k x \bfi$ gh [c\bif\b,\bfi\b x 1 j K } + try %{ execute-keys -draft , k x \bfi$ gh [c\bif\b,\bfi\b x 1 , j K } # copy the indentation of the matching if, and then re-indent afterwards - try %{ execute-keys -draft k x \belse$ gh [c\bif\b,\bfi\b x 1 j K j } + try %{ execute-keys -draft , k x \belse$ gh [c\bif\b,\bfi\b x 1 , j K j } # 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 k x \bin$ j } + try %{ execute-keys -draft , k x \bin$ j } # copy the indentation of the matching case - try %{ execute-keys -draft k x \besac$ gh [c\bcase\b,\besac\b x 1 j K } + try %{ execute-keys -draft , k x \besac$ gh [c\bcase\b,\besac\b x 1 , j K } # indent after ) - try %{ execute-keys -draft k x ^\s*\(?[^(]+[^)]\)$ j } + try %{ execute-keys -draft , k x ^\s*\(?[^(]+[^)]\)$ j } # deindent after ;; - try %{ execute-keys -draft k x ^\s*\;\;$ j } + try %{ execute-keys -draft , k x ^\s*\;\;$ j } # 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 k x (\s|^)\{$ j = + try %= execute-keys -draft , k x (\s|^)\{$ j = # deindent closing } - try %= execute-keys -draft k x ^\s*\}$ j K = + try %= execute-keys -draft , k x ^\s*\}$ j K = # deindent closing } when after cursor try %= execute-keys -draft x ^\h*\} gh / \} m 1 = diff --git a/rc/filetype/vhdl.kak b/rc/filetype/vhdl.kak index ddb9e5ee..289a4875 100644 --- a/rc/filetype/vhdl.kak +++ b/rc/filetype/vhdl.kak @@ -399,10 +399,10 @@ define-command -hidden vhdl-indent-on-new-line %{ ] # Copy the indentation of the matching if. - try %{ execute-keys -draft k x ^\h*(elsif\b|else$) gh [c^\h*(\S*\h*:\h*)?if\b,\bend\sif\b x 1 j K } + try %{ execute-keys -draft , k x ^\h*(elsif\b|else$) gh [c^\h*(\S*\h*:\h*)?if\b,\bend\sif\b x 1 , j K } # Increase indent after some operators. - try %[ execute-keys -draft k x (\(|=>|<=|:=)$ j ] + try %[ execute-keys -draft , k x (\(|=>|<=|:=)$ j ] } } diff --git a/rc/filetype/yaml.kak b/rc/filetype/yaml.kak index 6bc79a4e..db6a4f90 100644 --- a/rc/filetype/yaml.kak +++ b/rc/filetype/yaml.kak @@ -64,9 +64,9 @@ define-command -hidden yaml-indent-on-new-line %{ # filter previous line try %{ execute-keys -draft k : yaml-trim-indent } # indent after : - try %{ execute-keys -draft k x :$ j } + try %{ execute-keys -draft , k x :$ j } # indent after - - try %{ execute-keys -draft k x ^\h*- j } + try %{ execute-keys -draft , k x ^\h*- j } } } diff --git a/rc/tools/clang.kak b/rc/tools/clang.kak index 7439ffab..cddf9003 100644 --- a/rc/tools/clang.kak +++ b/rc/tools/clang.kak @@ -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 {( ^\( b \A\w+\z + execute-keys ,{( ^\( b \A\w+\z 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 diff --git a/rc/tools/ctags.kak b/rc/tools/ctags.kak index 5b18e04a..1d6b26c5 100644 --- a/rc/tools/ctags.kak +++ b/rc/tools/ctags.kak @@ -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 "b_.{%opt{ctags_min_chars},}" + execute-keys ",b_.{%opt{ctags_min_chars},}" ctags-complete # run in draft context to preserve selection } } diff --git a/rc/tools/grep.kak b/rc/tools/grep.kak index dd86c0f0..ec036385 100644 --- a/rc/tools/grep.kak +++ b/rc/tools/grep.kak @@ -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 will be a no-op and we'll jump to the first result. # Yeah, thats ugly... - execute-keys "ge %opt{grep_current_line}g /^[^:]+:\d+:" + execute-keys ge %opt{grep_current_line}g /^[^:]+:\d+: 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 ^[^:]+:\d+:" + execute-keys ge %opt{grep_current_line}g ^[^:]+:\d+: grep-jump } try %{ diff --git a/src/main.cc b/src/main.cc index f0088265..83d37a9d 100644 --- a/src/main.cc +++ b/src/main.cc @@ -49,6 +49,7 @@ struct { "» {+u}complete-command{} to configure command completion\n" "» {+b}!{} and {+b}{} now select the inserted text\n" "» {+b}x{} now uses {+b}{} behaviour\n" + "» {+b}{} and {+b},{} have been swapped\n" }, { 20211107, "» colored and curly underlines support (undocumented in 20210828)\n" diff --git a/src/normal.cc b/src/normal.cc index e68db583..c891d541 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -2269,8 +2269,8 @@ static constexpr HashMap { {'!'}, {"insert command output", insert_output} }, { {alt('!')}, {"append command output", insert_output} }, - { {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 { {'C'}, {"copy selection on next lines", copy_selections_on_next_lines} }, { {alt('C')}, {"copy selection on previous lines", copy_selections_on_next_lines} }, - { {','}, {"user mappings", exec_user_mappings} }, + { {Key::Space}, {"user mappings", exec_user_mappings} }, { {Key::PageUp}, { "scroll one page up", scroll} }, { {Key::PageDown}, {"scroll one page down", scroll} }, diff --git a/test/compose/undo-multi-replace-at-end/cmd b/test/compose/undo-multi-replace-at-end/cmd index 0c359aa9..40dacb04 100644 --- a/test/compose/undo-multi-replace-at-end/cmd +++ b/test/compose/undo-multi-replace-at-end/cmd @@ -1 +1 @@ -%y1Ru +%y1Ru diff --git a/test/indent/javascript/deindent-complex-brace-structure/cmd b/test/indent/javascript/deindent-complex-brace-structure/cmd index f9bfe77d..4a6870e5 100644 --- a/test/indent/javascript/deindent-complex-brace-structure/cmd +++ b/test/indent/javascript/deindent-complex-brace-structure/cmd @@ -1 +1 @@ -cOif (true) {}hiOconsole.log();hhiO{},{},hhi1Ofoo: { bar: 1 },jjobaz: { bam: 2 }, +cOif (true) {}hiOconsole.log();hhiO{},{},hhi1,Ofoo: { bar: 1 },jjobaz: { bam: 2 }, diff --git a/test/normal/rotate/cmd b/test/normal/rotate/cmd index 90f0818a..4de3674c 100644 --- a/test/normal/rotate/cmd +++ b/test/normal/rotate/cmd @@ -1 +1 @@ -) +) diff --git a/test/regression/3909-crash-on-closing-buffer-with-user-mapping/cmd b/test/regression/3909-crash-on-closing-buffer-with-user-mapping/cmd index b870f425..c2f3e902 100644 --- a/test/regression/3909-crash-on-closing-buffer-with-user-mapping/cmd +++ b/test/regression/3909-crash-on-closing-buffer-with-user-mapping/cmd @@ -1 +1 @@ -i,d +id