various.txt 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. *various.txt* Nvim
  2. VIM REFERENCE MANUAL by Bram Moolenaar
  3. Various commands *various*
  4. Type |gO| to see the table of contents.
  5. ==============================================================================
  6. 1. Various commands *various-cmds*
  7. *CTRL-L*
  8. CTRL-L Clears and redraws the screen. The redraw may happen
  9. later, after processing typeahead.
  10. See also |nvim__redraw()|.
  11. *CTRL-L-default*
  12. By default, also clears search highlighting
  13. |:nohlsearch| and updates diffs |:diffupdate|.
  14. |default-mappings|
  15. *:mod* *:mode*
  16. :mod[e] Clears and redraws the screen.
  17. See also |nvim__redraw()|.
  18. *:redr* *:redraw*
  19. :redr[aw][!] Redraws pending screen updates now, or the entire
  20. screen if "!" is included. To CLEAR the screen use
  21. |:mode| or |CTRL-L|.
  22. It can be used to redraw the screen in a script
  23. or function (or a mapping if |'lazyredraw'| is set).
  24. See also |nvim__redraw()|.
  25. *:redraws* *:redrawstatus*
  26. :redraws[tatus][!] Redraws the status line and window bar of the current
  27. window, or all status lines and window bars if "!" is
  28. included. Redraws the commandline instead if it contains
  29. the 'ruler'. Useful if 'statusline' or 'winbar' includes
  30. an item that doesn't cause automatic updating.
  31. See also |nvim__redraw()|.
  32. *:redrawt* *:redrawtabline*
  33. :redrawt[abline] Redraw the tabline. Useful to update the tabline when
  34. 'tabline' includes an item that doesn't trigger
  35. automatic updating. See also |nvim__redraw()|.
  36. *N<Del>*
  37. <Del> When entering a number: Remove the last digit.
  38. Note: if you like to use <BS> for this, add this
  39. mapping to your vimrc: >
  40. :map CTRL-V <BS> CTRL-V <Del>
  41. <
  42. :as[cii] or *ga* *:as* *:ascii*
  43. ga Print the ascii value of the character under the
  44. cursor in decimal, hexadecimal and octal.
  45. Mnemonic: Get Ascii value.
  46. For example, when the cursor is on a 'R':
  47. <R> 82, Hex 52, Octal 122 ~
  48. When the character is a non-standard ASCII character,
  49. but printable according to the 'isprint' option, the
  50. non-printable version is also given.
  51. When the character is larger than 127, the <M-x> form
  52. is also printed. For example:
  53. <~A> <M-^A> 129, Hex 81, Octal 201 ~
  54. <p> <|~> <M-~> 254, Hex fe, Octal 376 ~
  55. (where <p> is a special character)
  56. The <Nul> character in a file is stored internally as
  57. <NL>, but it will be shown as:
  58. <^@> 0, Hex 00, Octal 000 ~
  59. If the character has composing characters these are
  60. also shown. The value of 'maxcombine' doesn't matter.
  61. If the character can be inserted as a digraph, also
  62. output the two characters that can be used to create
  63. the character:
  64. <ö> 246, Hex 00f6, Oct 366, Digr o: ~
  65. This shows you can type CTRL-K o : to insert ö.
  66. *g8*
  67. g8 Print the hex values of the bytes used in the
  68. character under the cursor, assuming it is in |UTF-8|
  69. encoding. This also shows composing characters. The
  70. value of 'maxcombine' doesn't matter.
  71. Example of a character with two composing characters:
  72. e0 b8 81 + e0 b8 b9 + e0 b9 89 ~
  73. *8g8*
  74. 8g8 Find an illegal UTF-8 byte sequence at or after the
  75. cursor.
  76. Can be used when editing a file that was supposed to
  77. be UTF-8 but was read as if it is an 8-bit encoding
  78. because it contains illegal bytes.
  79. Does not wrap around the end of the file.
  80. Note that when the cursor is on an illegal byte or the
  81. cursor is halfway through a multibyte character the
  82. command won't move the cursor.
  83. *gx*
  84. gx Opens the current filepath or URL (decided by
  85. |<cfile>|, 'isfname') at cursor using the system
  86. default handler, by calling |vim.ui.open()|.
  87. *v_gx*
  88. {Visual}gx Opens the selected text using the system default
  89. handler, by calling |vim.ui.open()|.
  90. *:p* *:pr* *:print* *E749*
  91. :[range]p[rint] [flags]
  92. Print [range] lines (default current line).
  93. In the GUI you can use the File.Print menu entry.
  94. See |ex-flags| for [flags].
  95. The |:filter| command can be used to only show lines
  96. matching a pattern.
  97. :[range]p[rint] {count} [flags]
  98. Print {count} lines, starting with [range] (default
  99. current line |cmdline-ranges|).
  100. See |ex-flags| for [flags].
  101. *:l* *:list*
  102. :[range]l[ist] [count] [flags]
  103. Same as :print, but show tabs as ">", trailing spaces
  104. as "-", and non-breakable space characters as "+" by
  105. default. Further changed by the 'listchars' option.
  106. See |ex-flags| for [flags].
  107. *:nu* *:number*
  108. :[range]nu[mber] [count] [flags]
  109. Same as :print, but precede each line with its line
  110. number. (See also |hl-LineNr| and 'numberwidth').
  111. See |ex-flags| for [flags].
  112. *:#*
  113. :[range]# [count] [flags]
  114. synonym for :number.
  115. *:#!* *vim-shebang*
  116. :#!{anything} Ignored, so that you can start a Vim script with: >
  117. #!vim -S
  118. let mylogbook='$HOME/logbook.md'
  119. exe $':e {mylogbook}'
  120. $
  121. put ='## ' .. strftime('%d. %b %Y')
  122. norm! o
  123. <
  124. Make that script executable and run it to create a
  125. new diary entry.
  126. *:z* *E144*
  127. :[range]z[+-^.=][count] Display several lines of text surrounding the line
  128. specified with [range], or around the current line
  129. if there is no [range].
  130. If there is a [count], that's how many lines you'll
  131. see; if there is no [count] and only one window then
  132. twice the value of the 'scroll' option is used,
  133. otherwise the current window height minus 3 is used.
  134. This is the value of "scr" in the table below.
  135. If there is a [count] the 'window' option is set to
  136. its value.
  137. :z can be used either alone or followed by any of
  138. several marks. These have the following effect:
  139. mark first line last line new cursor line ~
  140. ---- ---------- --------- ------------
  141. + current line 1 scr forward 1 scr forward
  142. - 1 scr back current line current line
  143. ^ 2 scr back 1 scr back 1 scr back
  144. . 1/2 scr back 1/2 scr fwd 1/2 scr fwd
  145. = 1/2 scr back 1/2 scr fwd current line
  146. Specifying no mark at all is the same as "+".
  147. If the mark is "=", a line of dashes is printed
  148. around the current line.
  149. *:z!*
  150. :[range]z![+-^.=][count]
  151. Like ":z", but when [count] is not specified, it
  152. defaults to the Vim window height minus one.
  153. :[range]z[!]#[+-^.=][count] *:z#*
  154. Like ":z" or ":z!", but number the lines.
  155. *:=*
  156. := [args] Without [args]: prints the last line number.
  157. With [args]: equivalent to `:lua ={expr}`. see |:lua|
  158. :{range}= Prints the last line number in {range}. For example,
  159. this prints the current line number: >
  160. :.=
  161. :norm[al][!] {commands} *:norm* *:normal*
  162. Execute Normal mode commands {commands}. This makes
  163. it possible to execute Normal mode commands typed on
  164. the command-line. {commands} are executed like they
  165. are typed. For undo all commands are undone together.
  166. Execution stops when an error is encountered.
  167. If the [!] is given, mappings will not be used.
  168. Without it, when this command is called from a
  169. non-remappable mapping (|:noremap|), the argument can
  170. be mapped anyway.
  171. {commands} should be a complete command. If
  172. {commands} does not finish a command, the last one
  173. will be aborted as if <Esc> or <C-C> was typed.
  174. This implies that an insert command must be completed
  175. (to start Insert mode, see |:startinsert|). A ":"
  176. command must be completed as well. And you can't use
  177. "gQ" to start Ex mode.
  178. The display is not updated while ":normal" is busy.
  179. {commands} cannot start with a space. Put a count of
  180. 1 (one) before it, "1 " is one space.
  181. This command cannot be followed by another command,
  182. since any '|' is considered part of the command.
  183. This command can be used recursively, but the depth is
  184. limited by 'maxmapdepth'.
  185. An alternative is to use |:execute|, which uses an
  186. expression as argument. This allows the use of
  187. printable characters to represent special characters.
  188. Example: >
  189. :exe "normal \<c-w>\<c-w>"
  190. <
  191. :{range}norm[al][!] {commands} *:normal-range*
  192. Execute Normal mode commands {commands} for each line
  193. in the {range}. Before executing the {commands}, the
  194. cursor is positioned in the first column of the range,
  195. for each line. Otherwise it's the same as the
  196. ":normal" command without a range.
  197. *:sh* *:shell* *E371* *E360*
  198. :sh[ell] Removed. |vim-differences|
  199. *:terminal* *:te*
  200. :te[rminal][!] [{cmd}] Run {cmd} in a non-interactive 'shell' in a new
  201. |terminal-emulator| buffer. Without {cmd}, start an
  202. interactive 'shell'.
  203. Type |i| to enter |Terminal-mode|, then keys are sent to
  204. the job running in the terminal. Type <C-\><C-N> to
  205. leave Terminal-mode. |CTRL-\_CTRL-N|. Type <C-\><C-O>
  206. to execute a single normal mode command |t_CTRL-\_CTRL-O|
  207. Fails if changes have been made to the current buffer,
  208. unless 'hidden' is set.
  209. If {cmd} is omitted, and the 'shell' job exits with no
  210. error, the buffer is closed automatically
  211. |default-autocmds|.
  212. To enter |Terminal-mode| automatically: >
  213. autocmd TermOpen * startinsert
  214. <
  215. *:!cmd* *:!*
  216. :!{cmd} Execute {cmd} with 'shell'. See also |:terminal|.
  217. For the filter command, see |:range!|.
  218. The command runs in a non-interactive shell connected
  219. to a pipe (not a terminal). Use |:terminal| to run an
  220. interactive shell connected to a terminal.
  221. Backgrounded ("&") commands must not write to stdout
  222. or stderr, the streams are closed immediately. |E5677|
  223. Use |jobstart()| instead. >
  224. :call jobstart('foo', {'detach':1})
  225. <
  226. For powershell, chaining a stringed executable path
  227. requires using the call operator (&). >
  228. :!Write-Output "1`n2" | & "C:\Windows\System32\sort.exe" /r
  229. <
  230. Vim builds command line using options 'shell', 'shcf',
  231. 'sxq' and 'shq' in the following order:
  232. `&sh &shcf &sxq &shq {cmd} &shq &sxq`
  233. So setting both 'sxq' and 'shq' is possible but rarely
  234. useful. Additional escaping inside `{cmd}` may also
  235. be due to 'sxe' option.
  236. Also, all |cmdline-special| characters in {cmd} are
  237. replaced by Vim before passing them to shell.
  238. *E34*
  239. Any "!" in {cmd} is replaced with the previous
  240. external command (see also 'cpoptions'), unless
  241. escaped by a backslash. Example: ":!ls" followed by
  242. ":!echo ! \! \\!" executes "echo ls ! \!".
  243. Any "|" in {cmd} is passed to the shell, you cannot
  244. use it to append a Vim command. See |:bar|.
  245. Any "%" in {cmd} is expanded to the current file name.
  246. Any "#" in {cmd} is expanded to the alternate file name.
  247. Special characters are not escaped, use quotes or
  248. |shellescape()|: >
  249. :!ls "%"
  250. :exe "!ls " .. shellescape(expand("%"))
  251. <
  252. Newline character ends {cmd} unless a backslash
  253. precedes the newline. What follows is interpreted as
  254. another |:| command.
  255. After the command has been executed, the timestamp and
  256. size of the current file is checked |timestamp|.
  257. If the command produces too much output some lines may
  258. be skipped so the command can execute quickly. No
  259. data is lost, this only affects the display. The last
  260. few lines are always displayed (never skipped).
  261. To avoid the hit-enter prompt use: >
  262. :silent !{cmd}
  263. <
  264. *:!!*
  265. :!! Repeat last ":!{cmd}".
  266. *:ve* *:ver* *:version*
  267. :ve[rsion] Print editor version and build information.
  268. See also |feature-compile|.
  269. *:redi* *:redir*
  270. :redi[r][!] > {file} Redirect messages to file {file}. The messages which
  271. are the output of commands are written to that file,
  272. until redirection ends. The messages are also still
  273. shown on the screen. When [!] is included, an
  274. existing file is overwritten. When [!] is omitted,
  275. and {file} exists, this command fails.
  276. Only one ":redir" can be active at a time. Calls to
  277. ":redir" will close any active redirection before
  278. starting redirection to the new target. For recursive
  279. use check out |execute()|.
  280. To stop the messages and commands from being echoed to
  281. the screen, put the commands in a function and call it
  282. with ":silent call Function()".
  283. Alternatives are the 'verbosefile' option or
  284. |execute()| function, these can be used in combination
  285. with ":redir".
  286. :redi[r] >> {file} Redirect messages to file {file}. Append if {file}
  287. already exists.
  288. :redi[r] @{a-zA-Z}
  289. :redi[r] @{a-zA-Z}> Redirect messages to register {a-z}. Append to the
  290. contents of the register if its name is given
  291. uppercase {A-Z}. The ">" after the register name is
  292. optional.
  293. :redi[r] @{a-z}>> Append messages to register {a-z}.
  294. :redi[r] @*>
  295. :redi[r] @+> Redirect messages to the selection or clipboard. For
  296. backward compatibility, the ">" after the register
  297. name can be omitted. See |quotestar| and |quoteplus|.
  298. :redi[r] @*>>
  299. :redi[r] @+>> Append messages to the selection or clipboard.
  300. :redi[r] @"> Redirect messages to the unnamed register. For
  301. backward compatibility, the ">" after the register
  302. name can be omitted.
  303. :redi[r] @">> Append messages to the unnamed register.
  304. :redi[r] => {var} Redirect messages to a variable. If the variable
  305. doesn't exist, then it is created. If the variable
  306. exists, then it is initialized to an empty string.
  307. The variable will remain empty until redirection ends.
  308. Only string variables can be used. After the
  309. redirection starts, if the variable is removed or
  310. locked or the variable type is changed, then further
  311. command output messages will cause errors. When using
  312. a local variable (l:var in a function or s:var in a
  313. script) and another `:redir` causes the current one to
  314. end, the scope might be different and the assignment
  315. fails.
  316. To get the output of one command the |execute()|
  317. function can be used instead of redirection.
  318. :redi[r] =>> {var} Append messages to an existing variable. Only string
  319. variables can be used.
  320. :redi[r] END End redirecting messages.
  321. *:filt* *:filter*
  322. :filt[er][!] {pattern} {command}
  323. :filt[er][!] /{pattern}/ {command}
  324. Restrict the output of {command} to lines matching
  325. with {pattern}. For example, to list only xml files: >
  326. :filter /\.xml$/ oldfiles
  327. < If the [!] is given, restrict the output of {command}
  328. to lines that do NOT match {pattern}.
  329. {pattern} is a Vim search pattern. Instead of enclosing
  330. it in / any non-ID character (see |'isident'|) can be
  331. used, so long as it does not appear in {pattern}.
  332. Without the enclosing character the pattern cannot
  333. include the bar character. 'ignorecase' is not used.
  334. The pattern is matched against the relevant part of
  335. the output, not necessarily the whole line. Only some
  336. commands support filtering, try it out to check if it
  337. works. Some of the commands that support filtering:
  338. |:#| - filter whole line
  339. |:clist| - filter by file name or module name
  340. |:command| - filter by command name
  341. |:files| - filter by file name
  342. |:highlight| - filter by highlight group
  343. |:history| - filter by history commands
  344. |:jumps| - filter by file name
  345. |:let| - filter by variable name
  346. |:list| - filter whole line
  347. |:llist| - filter by file name or module name
  348. |:marks| - filter by text in the current file,
  349. or file name for other files
  350. |:oldfiles| - filter by file name
  351. |:registers| - filter by register contents
  352. (does not work multi-line)
  353. |:set| - filter by option name
  354. Only normal messages are filtered, error messages are
  355. not.
  356. *:sil* *:silent* *:silent!*
  357. :sil[ent][!] {command} Execute {command} silently. Normal messages will not
  358. be given or added to the message history.
  359. When [!] is added, error messages will also be
  360. skipped, and commands and mappings will not be aborted
  361. when an error is detected. |v:errmsg| is still set.
  362. When [!] is not used, an error message will cause
  363. further messages to be displayed normally.
  364. Redirection, started with |:redir|, will continue as
  365. usual, although there might be small differences.
  366. This will allow redirecting the output of a command
  367. without seeing it on the screen. Example: >
  368. :redir >/tmp/foobar
  369. :silent g/Aap/p
  370. :redir END
  371. < To execute a Normal mode command silently, use the
  372. |:normal| command. For example, to search for a
  373. string without messages: >
  374. :silent exe "normal /path\<CR>"
  375. < ":silent!" is useful to execute a command that may
  376. fail, but the failure is to be ignored. Example: >
  377. :let v:errmsg = ""
  378. :silent! /^begin
  379. :if v:errmsg != ""
  380. : ... pattern was not found
  381. < ":silent" also skips the hit-enter prompt.
  382. Dialogs that prompt for user input (|confirm()|,
  383. 'swapfile', …) are never silent.
  384. *:uns* *:unsilent*
  385. :uns[ilent] {command} Execute {command} not silently. Only makes a
  386. difference when |:silent| was used to get to this
  387. command.
  388. Use this for giving a message even when |:silent| was
  389. used. In this example |:silent| is used to avoid the
  390. message about reading the file and |:unsilent| to be
  391. able to list the first line of each file. >
  392. :silent argdo unsilent echo expand('%') .. ": " .. getline(1)
  393. <
  394. *:verb* *:verbose*
  395. :[count]verb[ose] {command}
  396. Execute {command} with 'verbose' set to [count]. If
  397. [count] is omitted one is used. ":0verbose" can be
  398. used to set 'verbose' to zero.
  399. The additional use of ":silent" makes messages
  400. generated but not displayed.
  401. The combination of ":silent" and ":verbose" can be
  402. used to generate messages and check them with
  403. |v:statusmsg| and friends. For example: >
  404. :let v:statusmsg = ""
  405. :silent verbose runtime foobar.vim
  406. :if v:statusmsg != ""
  407. : " foobar.vim could not be found
  408. :endif
  409. < When concatenating another command, the ":verbose"
  410. only applies to the first one: >
  411. :4verbose set verbose | set verbose
  412. < verbose=4 ~
  413. verbose=0 ~
  414. For logging verbose messages in a file use the
  415. 'verbosefile' option.
  416. *:verbose-cmd*
  417. When 'verbose' is non-zero, listing the value of a Vim option or a key map or
  418. an abbreviation or a user-defined function or a command or a highlight group
  419. or an autocommand will also display where it was last defined. If they were
  420. defined in Lua they will only be located if 'verbose' is set. So Start
  421. nvim with -V1 arg to see them. If it was defined manually then there
  422. will be no "Last set" message. When it was defined while executing a function,
  423. user command or autocommand, the script in which it was defined is reported.
  424. *K*
  425. [count]K Runs the program given by 'keywordprg' to lookup the
  426. |word| (defined by 'iskeyword') under or right of the
  427. cursor. Default is "man". Works like this: >
  428. :tabnew | terminal {program} {keyword}
  429. < Special cases:
  430. - If 'keywordprg' begins with ":" it is invoked as
  431. a Vim command with [count].
  432. - If 'keywordprg' is empty, |:help| is used.
  433. - When 'keywordprg' is equal to "man", a [count]
  434. before "K" is inserted after the "man" command and
  435. before the keyword. For example, using "2K" while
  436. the cursor is on "mkdir", results in: >
  437. !man 2 mkdir
  438. < - When 'keywordprg' is equal to "man -s", a [count]
  439. before "K" is inserted after the "-s". If there is
  440. no count, the "-s" is removed.
  441. *K-lsp-default*
  442. - The Nvim |LSP| client sets K to show LSP "hover"
  443. feature. |lsp-defaults|
  444. *v_K*
  445. {Visual}K Like "K", but use the visually highlighted text for
  446. the keyword. Only works when the highlighted text is
  447. not more than one line.
  448. *gO*
  449. gO Show a filetype-specific, navigable "outline" of the
  450. current buffer. For example, in a |help| buffer this
  451. shows the table of contents.
  452. Works in |help| and |:Man| buffers, or any buffer with
  453. an active |LSP| client (|lsp-defaults|).
  454. [N]gs *gs* *:sl* *:sleep*
  455. :[N]sl[eep] [N][m] Do nothing for [N] seconds, or [N] milliseconds if [m]
  456. was given. "gs" always uses seconds.
  457. Default is one second. >
  458. :sleep "sleep for one second
  459. :5sleep "sleep for five seconds
  460. :sleep 100m "sleep for 100 milliseconds
  461. 10gs "sleep for ten seconds
  462. < Can be interrupted with CTRL-C.
  463. "gs" stands for "goto sleep".
  464. While sleeping the cursor is positioned in the text,
  465. if at a visible position.
  466. Queued messages are processed during the sleep.
  467. *:sl!* *:sleep!*
  468. :[N]sl[eep]! [N][m] Same as above, but hide the cursor.
  469. ==============================================================================
  470. 2. Using Vim like less or more *less*
  471. If you use the less or more program to view a file, you don't get syntax
  472. highlighting. Thus you would like to use Vim instead. You can do this by
  473. using the shell script "$VIMRUNTIME/scripts/less.sh".
  474. This shell script uses the Vim script "$VIMRUNTIME/scripts/less.vim". It sets
  475. up mappings to simulate the commands that less supports. Otherwise, you can
  476. still use the Vim commands.
  477. This isn't perfect. For example, when viewing a short file Vim will still use
  478. the whole screen. But it works well enough for most uses, and you get syntax
  479. highlighting.
  480. The "h" key will give you a short overview of the available commands.
  481. If you want to set options differently when using less, define the
  482. LessInitFunc in your vimrc, for example: >
  483. func LessInitFunc()
  484. set nocursorcolumn nocursorline
  485. endfunc
  486. <
  487. ==============================================================================
  488. 3. Commenting *commenting*
  489. Nvim supports commenting and uncommenting of lines based on 'commentstring'.
  490. Acting on a single line behaves as follows:
  491. - If the line matches 'commentstring', the comment markers are removed (e.g.
  492. `/*foo*/` is transformed to `foo`).
  493. - Otherwise the comment markers are added to the current line (e.g. `foo` is
  494. transformed to `/*foo*/`). Blank lines are ignored.
  495. Acting on multiple lines behaves as follows:
  496. - If each affected non-blank line matches 'commentstring', then all comment
  497. markers are removed.
  498. - Otherwise all affected lines are converted to comments; blank lines are
  499. transformed to empty comments (e.g. `/**/`). Comment markers are aligned to
  500. the least indented line.
  501. Matching 'commentstring' does not account for whitespace in comment markers.
  502. Removing comment markers is first attempted exactly, with fallback to using
  503. markers trimmed from whitespace.
  504. If the filetype of the buffer is associated with a language for which a
  505. |treesitter| parser is installed, then |vim.filetype.get_option()| is called
  506. to look up the value of 'commentstring' corresponding to the cursor position.
  507. (This can be different from the buffer's 'commentstring' in case of
  508. |treesitter-language-injections|.)
  509. *gc* *gc-default*
  510. gc{motion} Comment or uncomment lines covered by {motion}.
  511. *gcc* *gcc-default*
  512. gcc Comment or uncomment [count] lines starting at cursor.
  513. *v_gc* *v_gc-default*
  514. {Visual}gc Comment or uncomment the selected line(s).
  515. *o_gc* *o_gc-default*
  516. gc Text object for the largest contiguous block of
  517. non-blank commented lines around the cursor (e.g.
  518. `gcgc` uncomments a comment block; `dgc` deletes it).
  519. Works only in Operator-pending mode.
  520. vim:noet:tw=78:ts=8:ft=help:norl: