Home Explore Blog CI



neovim

4th chunk of `runtime/doc/usr_12.txt`
68911c1efb26f3a7084a116e6e5edf77b2e2077b354bbeb000000001000008ae
 were working on.
   To find a man page in a specific section, put the section number first.
For example, to look in section 3 for "echo": >

	:Man 3 echo

To jump to another man page, which is in the text with the typical form
"word(1)", press CTRL-] on it.  Further ":Man" commands will use the same
window.

To display a man page for the word under the cursor, use this: >

	K

For example, you want to know the return value of "strstr()" while editing
this line:

	if ( strstr (input, "aap") == ) ~

Move the cursor to somewhere on "strstr" and type "K".  A window will open
to display the man page for strstr().

==============================================================================
*12.7*	Trim blanks

Some people find spaces and tabs at the end of a line useless, wasteful, and
ugly.  To remove whitespace at the end of every line, execute the following
command: >

	:%s/\s\+$//

The line range "%" is used, thus this works on the whole file.  The pattern
that the ":substitute" command matches with is "\s\+$".  This finds white
space characters (\s), 1 or more of them (\+), before the end-of-line ($).
Later will be explained how you write patterns like this, see |usr_27.txt|.
   The "to" part of the substitute command is empty: "//".  Thus it replaces
with nothing, effectively deleting the matched white space.

Another wasteful use of spaces is placing them before a tab.  Often these can
be deleted without changing the amount of white space.  But not always!
Therefore, you can best do this manually.  Use this search command: >

	/ 	

You cannot see it, but there is a space before a tab in this command.  Thus
it's "/<Space><Tab>".   Now use "x" to delete the space and check that the
amount of white space doesn't change.  You might have to insert a tab if it
does change.  Type "n" to find the next match.  Repeat this until no more
matches can be found.

==============================================================================
*12.8*	Find where a word is used

If you are a Unix user, you can use a combination of Vim and the grep command
to edit all the files that contain a given word.  This is extremely useful if
you are working on a program and want to view or edit all the files

Title: Vim: Finding Man Pages, Trimming Blanks, and Locating Word Usage
Summary
This section details how to use Vim to find man pages, trim whitespace, and find where a word is used in a project. It explains how to use the 'K' or ':Man' commands to open man pages within Vim, and how to trim trailing whitespace from lines using a substitute command. It also briefly touches on how to manually remove spaces before tabs. Finally, it introduces the use of Vim in combination with grep to find and edit all files containing a specific word, especially useful for programming projects.