Home Explore Blog CI



neovim

8th chunk of `runtime/doc/various.txt`
9ae1e11a82bb5c40902e793b5cbdb48861b11f4110ab8a390000000100000eaa
 of the
			current buffer. For example, in a |help| buffer this
			shows the table of contents.

			Works in |help| and |:Man| buffers, or any buffer with
			an active |LSP| client (|lsp-defaults|).

[N]gs							*gs* *:sl* *:sleep*
:[N]sl[eep] [N][m]	Do nothing for [N] seconds, or [N] milliseconds if [m]
			was given.  "gs" always uses seconds.
			Default is one second. >
			     :sleep	     "sleep for one second
			     :5sleep	     "sleep for five seconds
			     :sleep 100m     "sleep for 100 milliseconds
			     10gs	     "sleep for ten seconds
<			Can be interrupted with CTRL-C.
			"gs" stands for "goto sleep".
			While sleeping the cursor is positioned in the text,
			if at a visible position.
			Queued messages are processed during the sleep.

							*:sl!* *:sleep!*
:[N]sl[eep]! [N][m]	Same as above, but hide the cursor.

							*g==*
g==			Executes the current code block.

			Works in |help| buffers.

==============================================================================
2. Using Vim like less or more					*less*

If you use the less or more program to view a file, you don't get syntax
highlighting.  Thus you would like to use Vim instead.  You can do this by
using the shell script "$VIMRUNTIME/scripts/less.sh".

This shell script uses the Vim script "$VIMRUNTIME/scripts/less.vim".  It sets
up mappings to simulate the commands that less supports.  Otherwise, you can
still use the Vim commands.

This isn't perfect.  For example, when viewing a short file Vim will still use
the whole screen.  But it works well enough for most uses, and you get syntax
highlighting.

The "h" key will give you a short overview of the available commands.

If you want to set options differently when using less, define the
LessInitFunc in your vimrc, for example: >

	func LessInitFunc()
	  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.

Matching 'commentstring' does not account for whitespace in comment markers.
Removing comment markers is first attempted exactly, with fallback to using
markers trimmed from whitespace.

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|.)

The following |default-mappings| are defined:

							*gc* *gc-default*
gc{motion}		Comment or uncomment lines covered by {motion}.

							*gcc* *gcc-default*
gcc			Comment or uncomment [count] lines starting at cursor.

							*v_gc* *v_gc-default*
{Visual}gc		Comment or uncomment the selected line(s).

							*o_gc* *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:

Title: Vim as Less/More and Commenting Functionality
Summary
This section describes how to use Vim as a 'less' or 'more' alternative, highlighting the use of shell and Vim scripts for similar functionality with syntax highlighting. It then delves into Vim's commenting/uncommenting features. It details how Vim handles commenting single and multiple lines based on the 'commentstring' option and how whitespace is treated. It explains Tree-sitter's influence on determining the appropriate 'commentstring'. Finally, it outlines the default mappings 'gc', 'gcc', and 'v_gc' for commenting and uncommenting lines.