On Sun, Apr 18, 2021 at 1:33 PM 'c.willis111' via vim_use
<[email protected]> wrote:
>
>
>
>
>
> ------ Original Message ------
> From: "Romain Lafourcade" <[email protected]>
> To: "vim_use" <[email protected]>
> 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

Hm, in Vim syntax a number can optionally start with a single plus or
minus sign; for an integer all the rest must be digits. A
floating-point number can in addition have a single dot (decimal
point) followed by one or more digits, and then optionally e or E
followed by one or more digits. At script version 2 or higher the
decimal point need not be preceded by any digits. All this is rather
complex, I suppose it can be done, but only by means of a function
(which can start searching with /[-+[:digit:]] and then repeat if what
was found was not a "proper" number). Tricky. If different search
rules must be applied for different programming languages or texts it
becomes even more tricky.

Best regards,
Tony.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CAJkCKXtv-ufbySGNHYTcZQO32ceiFavsQkMpKqWbcXECiruH5A%40mail.gmail.com.

Reply via email to