Sunday, April 18, 2021

Re: Some basic Vim commands





------ Original Message ------
From: "Romain Lafourcade" <romainlafourcade@gmail.com>
To: "vim_use" <vim_use@googlegroups.com>
Sent: Sunday, 18 Apr, 2021 At 09:42
Subject: Re: Some basic Vim commands

> Is there a single command to delete all initial whitespace on a line?

:left<CR>

> Is there any command to the effect of "find the next number"?

/\d<CR>

> take this word and the next two words, and send them down 3 newlines.

This one is unclear. Do you want to create a new line with just those two words? Do you want to insert them in an existing line? Etc.

--
/\d<CR> is fine for finding a number if it is being done by the operator. Not so clever as part of a function - unless it is clear that you are starting outside a number. In particular not between the mantissa and exponent of a floating point number in scientific notation. Also what about numbers that start with a minus sign or a decimal point? The latter wd seem to be managed with /[.-]*\d<CR> (unless I've been caught out by vim's strange escape strategy).


Chris W

No comments: