diff --git a/doc/pages/changelog.asciidoc b/doc/pages/changelog.asciidoc index d475f278..5d2cfa2e 100644 --- a/doc/pages/changelog.asciidoc +++ b/doc/pages/changelog.asciidoc @@ -18,6 +18,8 @@ released versions. * Prompt history registers `%reg{colon}`, `%reg{slash}` and `%reg{pipe}` now have reverse chronological order +* Executing user mode mappings no longer adds to prompt history registers by default. + == Kakoune 2021.11.07 * Support for curly and separately colored underlines (undocumented in 2021.10.28) diff --git a/doc/pages/mapping.asciidoc b/doc/pages/mapping.asciidoc index c029383b..0ba142c4 100644 --- a/doc/pages/mapping.asciidoc +++ b/doc/pages/mapping.asciidoc @@ -59,20 +59,16 @@ It's common to use a normal-mode or user-mode mapping to trigger a command, like this: ---- -map global user n ': make-next-error' +map global user n :make-next-error ---- -Note the space between the `:` and the command. This prevents Kakoune from -adding this command to the prompt history, so the user won't have to scroll -past it to review commands they actually typed. - If you make a normal-mode mapping, you can prefix it with a count or a register name like any other normal-mode key. You can forward this information to the command you invoke with the `%val{count}` and `%val{register}` expansions (See <>). For example: ---- -map global normal = ': echo Got count %val{count} and reg %val{register}' +map global normal = ':echo Got count %val{count} and reg %val{register}' ---- == Mappable keys diff --git a/rc/filetype/diff.kak b/rc/filetype/diff.kak index 2655b9b5..5be241f2 100644 --- a/rc/filetype/diff.kak +++ b/rc/filetype/diff.kak @@ -4,7 +4,7 @@ hook global BufCreate .*\.(diff|patch) %{ hook global WinSetOption filetype=diff %{ require-module diff - map buffer normal %{: diff-jump} + map buffer normal :diff-jump } hook -group diff-highlight global WinSetOption filetype=diff %{ diff --git a/rc/filetype/mail.kak b/rc/filetype/mail.kak index 9fb2d14e..92c2e17c 100644 --- a/rc/filetype/mail.kak +++ b/rc/filetype/mail.kak @@ -4,9 +4,9 @@ hook global BufCreate .+\.eml %{ hook global WinSetOption filetype=mail %{ require-module mail - map buffer normal %{: diff-jump} + map buffer normal :diff-jump hook -once -always window WinSetOption filetype=.* %{ - unmap buffer normal %{: diff-jump} + unmap buffer normal :diff-jump } } diff --git a/rc/tools/doc.kak b/rc/tools/doc.kak index d5227ee4..e710a80f 100644 --- a/rc/tools/doc.kak +++ b/rc/tools/doc.kak @@ -131,7 +131,7 @@ define-command -params 1 -hidden doc-render %{ set-option buffer readonly true add-highlighter buffer/ ranges doc_render_ranges add-highlighter buffer/ wrap -word -indent - map buffer normal ': doc-follow-link' + map buffer normal :doc-follow-link } define-command -params 0..2 \ diff --git a/rc/tools/git.kak b/rc/tools/git.kak index d361a6c7..d8e7ef87 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -104,8 +104,8 @@ define-command -params 1.. \ # We need to unmap in case an existing buffer changes type, # for example if the user runs "git show" and "git status". map_diff_goto_source=$([ -n "${map_diff_goto_source}" ] \ - && printf %s "map buffer normal %[: git-diff-goto-source] -docstring 'Jump to source from git diff'" \ - || printf %s "unmap buffer normal %[: git-diff-goto-source]") + && printf %s "map buffer normal :git-diff-goto-source -docstring 'Jump to source from git diff'" \ + || printf %s "unmap buffer normal :git-diff-goto-source") printf %s "evaluate-commands -try-client '$kak_opt_docsclient' %{ edit! -fifo ${output} *git* diff --git a/rc/tools/man.kak b/rc/tools/man.kak index facfaedf..d2b7a16b 100644 --- a/rc/tools/man.kak +++ b/rc/tools/man.kak @@ -14,7 +14,7 @@ hook -group man-highlight global WinSetOption filetype=man %{ # References to other manpages add-highlighter window/man-highlight/ regex [-a-zA-Z0-9_.]+\([a-z0-9]+\) 0:header - map window normal ': man-jump' + map window normal :man-jump hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/man-highlight @@ -141,7 +141,7 @@ man-jump %{ # Suggested keymaps for a user mode declare-user-mode man -map global man 'g' -docstring 'Jump to a man page using selected man page link' ': man-jump' -map global man 'j' -docstring 'Go to next man page link' ': man-link-next' -map global man 'k' -docstring 'Go to previous man page link' ': man-link-prev' -map global man 'm' -docstring 'Look up a man page' ':man' +map global man 'g' -docstring 'Jump to a man page using selected man page link' :man-jump +map global man 'j' -docstring 'Go to next man page link' :man-link-next +map global man 'k' -docstring 'Go to previous man page link' :man-link-prev +map global man 'm' -docstring 'Look up a man page' :man diff --git a/src/commands.cc b/src/commands.cc index 84e0fdf3..46481b9d 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -2621,6 +2621,7 @@ void enter_user_mode(Context& context, String mode_name, KeymapMode mode, bool l auto& mapping = context.keymaps().get_mapping(key, mode); ScopedSetBool disable_keymaps(context.keymaps_disabled()); + ScopedSetBool disable_history(context.history_disabled()); InputHandler::ScopedForceNormal force_normal{context.input_handler(), {}}; diff --git a/src/normal.cc b/src/normal.cc index 09aad6f8..68a5fd6f 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -2014,6 +2014,7 @@ void exec_user_mappings(Context& context, NormalParams params) auto& mapping = context.keymaps().get_mapping(key, KeymapMode::User); ScopedSetBool disable_keymaps(context.keymaps_disabled()); + ScopedSetBool disable_history(context.history_disabled()); InputHandler::ScopedForceNormal force_normal{context.input_handler(), params};