From 472d41b5b620671050efeb36bfe792301fd73f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20B=C3=ACnh=20An?= <111893501+brianhuster@users.noreply.github.com> Date: Sun, 4 May 2025 05:47:59 +0700 Subject: [PATCH] docs: default mappings #33706 Problem: Docs don't mention that `gc` is just a mapping, not a builtin normal-mode command. Solution: Update docs for all "default mappings". (cherry picked from commit 2c1f5a6aa587e02748ffe4f153d96703d861828b) --- runtime/doc/editing.txt | 20 +++++++++++--- runtime/doc/insert.txt | 2 +- runtime/doc/quickfix.txt | 60 ++++++++++++++++++++++++++++++++-------- runtime/doc/tagsrch.txt | 30 ++++++++++++++++---- runtime/doc/various.txt | 6 ++-- runtime/doc/windows.txt | 21 +++++++++++--- 6 files changed, 110 insertions(+), 29 deletions(-) diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index c275bf863d..b9da59748d 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -714,11 +714,14 @@ list of the current window. omitted the current entry is used. Also see |++opt| and |+cmd|. -:[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *]a* *E165* *E163* +:[count]n[ext] [++opt] [+cmd] *:n* *:ne* *:next* *E165* *E163* Edit [count] next file. This fails when changes have been made and Vim does not want to |abandon| the current buffer. Also see |++opt| and |+cmd|. + *]a* +]a Mapped to |:next|. |default-mappings| + :[count]n[ext]! [++opt] [+cmd] Edit [count] next file, discard any changes to the buffer. Also see |++opt| and |+cmd|. @@ -740,16 +743,22 @@ list of the current window. any changes to the buffer. Also see |++opt| and |+cmd|. -:[count]prev[ious] [count] [++opt] [+cmd] *:prev* *:previous* *[a* +:[count]prev[ious] [count] [++opt] [+cmd] *:prev* *:previous* Same as :Next. Also see |++opt| and |+cmd|. - *:rew* *:rewind* *[A* + *[a* +[a Mapped to |:previous|. |default-mappings| + + *:rew* *:rewind* :rew[ind] [++opt] [+cmd] Start editing the first file in the argument list. This fails when changes have been made and Vim does not want to |abandon| the current buffer. Also see |++opt| and |+cmd|. + *[A* +[A Mapped to |:rewind|. |default-mappings| + :rew[ind]! [++opt] [+cmd] Start editing the first file in the argument list. Discard any changes to the buffer. Also see |++opt| @@ -759,13 +768,16 @@ list of the current window. :fir[st][!] [++opt] [+cmd] Other name for ":rewind". - *:la* *:last* *]A* + *:la* *:last* :la[st] [++opt] [+cmd] Start editing the last file in the argument list. This fails when changes have been made and Vim does not want to |abandon| the current buffer. Also see |++opt| and |+cmd|. + *]A* +]A Mapped to |:last|. |default-mappings| + :la[st]! [++opt] [+cmd] Start editing the last file in the argument list. Discard any changes to the buffer. Also see |++opt| diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 3c8bb0814a..e1071522be 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1923,7 +1923,7 @@ These commands are used to start inserting text. You can end insert mode with . See |mode-ins-repl| for the other special characters in Insert mode. The effect of [count] takes place after Insert mode is exited. -The following commands insert text, but stay in normal mode: +The following |default-mappings| insert text, but stay in normal mode: *]* ] Insert an empty line below the cursor without leaving diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index c2a8c15b10..671286a96b 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -91,28 +91,40 @@ processing a quickfix or location list command, it will be aborted. :ll[!] [nr] Same as ":cc", except the location list for the :[nr]ll[!] current window is used instead of the quickfix list. - *:cn* *:cne* *:cnext* *E553* *]q* + *:cn* *:cne* *:cnext* *E553* :[count]cn[ext][!] Display the [count] next error in the list that includes a file name. If there are no file names at all, go to the [count] next error. See |:cc| for [!] and 'switchbuf'. - *:lne* *:lnext* *]l* + *]q* +]q Mapped to |:cnext|. |default-mappings| + + *:lne* *:lnext* :[count]lne[xt][!] Same as ":cnext", except the location list for the current window is used instead of the quickfix list. -:[count]cN[ext][!] *:cp* *:cprevious* *:cprev* *:cN* *:cNext* *[q* + *]l* +]l Mapped to |:lnext|. |default-mappings| + +:[count]cN[ext][!] *:cp* *:cprevious* *:cprev* *:cN* *:cNext* :[count]cp[revious][!] Display the [count] previous error in the list that includes a file name. If there are no file names at all, go to the [count] previous error. See |:cc| for [!] and 'switchbuf'. + *[q* +[q Mapped to |:cprevious|. |default-mappings| -:[count]lN[ext][!] *:lp* *:lprevious* *:lprev* *:lN* *:lNext* *[l* + +:[count]lN[ext][!] *:lp* *:lprevious* *:lprev* *:lN* *:lNext* :[count]lp[revious][!] Same as ":cNext" and ":cprevious", except the location list for the current window is used instead of the quickfix list. + *[l* +[l Mapped to |:lprevious|. |default-mappings| + *:cabo* *:cabove* :[count]cabo[ve] Go to the [count] error above the current line in the current buffer. If [count] is omitted, then 1 is @@ -171,52 +183,76 @@ processing a quickfix or location list command, it will be aborted. :[count]laf[ter] Same as ":cafter", except the location list for the current window is used instead of the quickfix list. - *:cnf* *:cnfile* *]CTRL-Q* + *:cnf* *:cnfile* :[count]cnf[ile][!] Display the first error in the [count] next file in the list that includes a file name. If there are no file names at all or if there is no next file, go to the [count] next error. See |:cc| for [!] and 'switchbuf'. - *:lnf* *:lnfile* *]CTRL-L* + *]CTRL-Q* +]CTRL-Q Mapped to |:cnfile|. |default-mappings| + + *:lnf* *:lnfile* :[count]lnf[ile][!] Same as ":cnfile", except the location list for the current window is used instead of the quickfix list. -:[count]cNf[ile][!] *:cpf* *:cpfile* *:cNf* *:cNfile* *[CTRL-Q* + *]CTRL-L* +]CTRL-L Mapped to |:lnfile|. |default-mappings| + +:[count]cNf[ile][!] *:cpf* *:cpfile* *:cNf* *:cNfile* :[count]cpf[ile][!] Display the last error in the [count] previous file in the list that includes a file name. If there are no file names at all or if there is no next file, go to the [count] previous error. See |:cc| for [!] and 'switchbuf'. + *[CTRL-Q* +[CTRL-Q Mapped to |:cpfile|. |default-mappings| -:[count]lNf[ile][!] *:lpf* *:lpfile* *:lNf* *:lNfile* *[CTRL-L* + +:[count]lNf[ile][!] *:lpf* *:lpfile* *:lNf* *:lNfile* :[count]lpf[ile][!] Same as ":cNfile" and ":cpfile", except the location list for the current window is used instead of the quickfix list. - *:crewind* *:cr* *[Q* + *[CTRL-L* +[CTRL-L Mapped to |:lpfile|. |default-mappings| + + *:crewind* *:cr* :cr[ewind][!] [nr] Display error [nr]. If [nr] is omitted, the FIRST error is displayed. See |:cc|. - *:lrewind* *:lr* *[L* + *[Q* +[Q Mapped to |:crewind|. |default-mappings| + + *:lrewind* *:lr* :lr[ewind][!] [nr] Same as ":crewind", except the location list for the current window is used instead of the quickfix list. + *[L* +[L Mapped to |:lrewind|. |default-mappings| + *:cfirst* *:cfir* :cfir[st][!] [nr] Same as ":crewind". *:lfirst* *:lfir* :lfir[st][!] [nr] Same as ":lrewind". - *:clast* *:cla* *]Q* + *:clast* *:cla* :cla[st][!] [nr] Display error [nr]. If [nr] is omitted, the LAST error is displayed. See |:cc|. - *:llast* *:lla* *]L* + *]Q* +]Q Mapped to |:clast|. + + *:llast* *:lla* :lla[st][!] [nr] Same as ":clast", except the location list for the current window is used instead of the quickfix list. + *]L* +]L Mapped to |:llast|. + *:cq* *:cquit* :cq[uit][!] :{N}cq[uit][!] diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index d5e165a870..fef1646968 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -274,27 +274,39 @@ g CTRL-] Like CTRL-], but use ":tjump" instead of ":tag". {Visual}g CTRL-] Same as "g CTRL-]", but use the highlighted text as the identifier. - *:tn* *:tnext* *]t* + *:tn* *:tnext* :[count]tn[ext][!] Jump to [count] next matching tag (default 1). See |tag-!| for [!]. - *:tp* *:tprevious* *[t* + *]t* +]t Mapped to |:tnext|. |default-mappings| + + *:tp* *:tprevious* :[count]tp[revious][!] Jump to [count] previous matching tag (default 1). See |tag-!| for [!]. + *[t* +[t Mapped to |:tprevious|. |default-mappings| + *:tN* *:tNext* :[count]tN[ext][!] Same as ":tprevious". - *:tr* *:trewind* *[T* + *:tr* *:trewind* :[count]tr[ewind][!] Jump to first matching tag. If [count] is given, jump to [count]th matching tag. See |tag-!| for [!]. + *[T* +[T Mapped to |:trewind|. |default-mappings| + *:tf* *:tfirst* :[count]tf[irst][!] Same as ":trewind". - *:tl* *:tlast* *]T* + *:tl* *:tlast* :tl[ast][!] Jump to last matching tag. See |tag-!| for [!]. + *]T* +]T Mapped to |:tlast|. |default-mappings| + *:lt* *:ltag* :lt[ag][!] [name] Jump to tag [name] and add the matching tags to a new location list for the current window. [name] can be @@ -335,12 +347,18 @@ the same as above, with a "p" prepended. :ptj[ump][!] [name] Does ":tjump[!] [name]" and shows the new tag in a "Preview" window. See |:ptag| for more info. - *:ptn* *:ptnext* *]CTRL-T* + *:ptn* *:ptnext* :[count]ptn[ext][!] ":tnext" in the preview window. See |:ptag|. - *:ptp* *:ptprevious* *[CTRL-T* + *]CTRL-T* +]CTRL-T Mapped to |:ptnext|. |default-mappings| + + *:ptp* *:ptprevious* :[count]ptp[revious][!] ":tprevious" in the preview window. See |:ptag|. + *[CTRL-T* +[CTRL-T Mapped to |:ptprevious|. |default-mappings| + *:ptN* *:ptNext* :[count]ptN[ext][!] Same as ":ptprevious". diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 662519d415..6484102c3f 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -103,11 +103,11 @@ g8 Print the hex values of the bytes used in the *gx* gx Opens the current filepath or URL (decided by ||, 'isfname') at cursor using the system - default handler, by calling |vim.ui.open()|. + default handler. Mapped to |vim.ui.open()|. *v_gx* {Visual}gx Opens the selected text using the system default - handler, by calling |vim.ui.open()|. + handler. Mapped to |vim.ui.open()|. *:p* *:pr* *:print* *E749* :[range]p[rint] [flags] @@ -611,6 +611,8 @@ to look up the value of 'commentstring' corresponding to the cursor position. (This can be different from the buffer's 'commentstring' in case of |treesitter-language-injections|.) +The following |default-mappings| are defined: + *gc* *gc-default* gc{motion} Comment or uncomment lines covered by {motion}. diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index f5ab74ca89..9cdee3b193 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1272,7 +1272,7 @@ list of buffers. |unlisted-buffer| :w foobar | sp # < Also see |+cmd|. -:[N]bn[ext][!] [+cmd] [N] *:bn* *:bnext* *]b* *E87* +:[N]bn[ext][!] [+cmd] [N] *:bn* *:bnext* *E87* Go to [N]th next buffer in buffer list. [N] defaults to one. Wraps around the end of the buffer list. See |:buffer-!| for [!]. @@ -1284,13 +1284,20 @@ list of buffers. |unlisted-buffer| the way when you're browsing code/text buffers. The next three commands also work like this. + *]b* +]b Mapped to |:bnext|. |default-mappings| + *:sbn* *:sbnext* :[N]sbn[ext] [+cmd] [N] Split window and go to [N]th next buffer in buffer list. Wraps around the end of the buffer list. Uses 'switchbuf' Also see |+cmd|. -:[N]bN[ext][!] [+cmd] [N] *:bN* *:bNext* *:bp* *:bprevious* *[b* *E88* +:[N]bN[ext][!] [+cmd] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88* + + *[b* +[b Mapped to |:bprevious|. |default-mappings| + :[N]bp[revious][!] [+cmd] [N] Go to [N]th previous buffer in buffer list. [N] defaults to one. Wraps around the start of the buffer list. @@ -1304,11 +1311,14 @@ list of buffers. |unlisted-buffer| Uses 'switchbuf'. Also see |+cmd|. -:br[ewind][!] [+cmd] *:br* *:bre* *:brewind* *[B* +:br[ewind][!] [+cmd] *:br* *:bre* *:brewind* Go to first buffer in buffer list. If the buffer list is empty, go to the first unlisted buffer. See |:buffer-!| for [!]. + *[B* +[B Mapped to |:brewind|. |default-mappings| + :bf[irst] [+cmd] *:bf* *:bfirst* Same as |:brewind|. Also see |+cmd|. @@ -1322,11 +1332,14 @@ list of buffers. |unlisted-buffer| :sbf[irst] [+cmd] *:sbf* *:sbfirst* Same as ":sbrewind". -:bl[ast][!] [+cmd] *:bl* *:blast* *]B* +:bl[ast][!] [+cmd] *:bl* *:blast* Go to last buffer in buffer list. If the buffer list is empty, go to the last unlisted buffer. See |:buffer-!| for [!]. + *]B* +]B Mapped to |:blast|. |default-mappings| + :sbl[ast] [+cmd] *:sbl* *:sblast* Split window and go to last buffer in buffer list. If the buffer list is empty, go to the last unlisted buffer.