Saturday, April 17, 2021

Re: Some basic Vim commands

On Sat, Apr 17, 2021 at 4:48 PM Julius Hamilton <julkhami@gmail.com> wrote:
>
> I was curious:
>
> I can jump to the beginning of some text on a line that begins with whitespace with v, w, h, d. Is there a single command to delete all initial whitespace on a line?
>
> I then wanted to jump over a few words to the next number (in brackets). Is there any command to the effect of "find the next number"?
>
> Then I wanted to say: take this word and the next two words, and send them down 3 newlines. Would there be a way to do that?
>
> Thanks very much,
> Julius

To go to he first nonblank on the current line: ^
To go to the first charcter of any kind on the current line: 0
To jump to the next v w h or d at the start of a word: /\<[vwhd]
To delete all initial whitespace on the current line: :s/^\s*//
To delete all final whitespace on all lines: :%s/\s*$//
To go to the next digit: /\d
To go to the next digit immediately after an opening bracket: /(\zs\d

You may want to study the following helpfiles for explanations about
the above and about other similar questions:
:help pattern.txt
:help motion.txt

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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXsVO0iUDTRw8ROktiGuAg5fS4rQc3Xy_ggnF6zW%2B10bLA%40mail.gmail.com.

No comments: