aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/news.txt2
-rw-r--r--runtime/doc/various.txt38
-rw-r--r--runtime/doc/vim_diff.txt2
3 files changed, 42 insertions, 0 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 5aa274637b..c219762c3f 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -346,6 +346,8 @@ The following new APIs and features were added.
• |extmarks| option `scoped`: only show the extmarks in its namespace's scope.
+• Added built-in |commenting| support.
+
==============================================================================
CHANGED FEATURES *news-changed*
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 33f57580c7..803ca95cdf 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -557,5 +557,43 @@ LessInitFunc in your vimrc, for example: >
set nocursorcolumn nocursorline
endfunc
<
+==============================================================================
+3. Commenting *commenting*
+
+Nvim supports commenting and uncommenting of lines based on 'commentstring'.
+
+Acting on a single line behaves as follows:
+- If the line matches 'commentstring', the comment markers are removed (e.g.
+ `/*foo*/` is transformed to `foo`).
+- Otherwise the comment markers are added to the current line (e.g. `foo` is
+ transformed to `/*foo*/`). Blank lines are ignored.
+
+Acting on multiple lines behaves as follows:
+- If each affected non-blank line matches 'commentstring', then all comment
+ markers are removed.
+- Otherwise all affected lines are converted to comments; blank lines are
+ transformed to empty comments (e.g. `/**/`). Comment markers are aligned to
+ the least indented line.
+
+If the filetype of the buffer is associated with a language for which a
+|treesitter| parser is installed, then |vim.filetype.get_option()| is called
+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|.)
+
+ *gc-default*
+gc{motion} Comment or uncomment lines covered by {motion}.
+
+ *gcc-default*
+gcc Comment or uncomment [count] lines starting at cursor.
+
+ *v_gc-default*
+{Visual}gc Comment or uncomment the selected line(s).
+
+ *o_gc-default*
+gc Text object for the largest contiguous block of
+ non-blank commented lines around the cursor (e.g.
+ `gcgc` uncomments a comment block; `dgc` deletes it).
+ Works only in Operator-pending mode.
vim:noet:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index a76166abf7..82f3fe9b1b 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -134,6 +134,8 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y".
- @ |v_@-default|
- # |v_#-default|
- * |v_star-default|
+- gc |gc-default| |v_gc-default| |o_gc-default|
+- gcc |gcc-default|
- Nvim LSP client defaults |lsp-defaults|
- K |K-lsp-default|