Groups | Search | Server Info | Login | Register


Groups > comp.editors > #106896

Re: Trivial question about the vi(m) command line.

From Eli the Bearded <*@eli.users.panix.com>
Newsgroups comp.editors
Subject Re: Trivial question about the vi(m) command line.
Date 2026-04-05 17:48 +0000
Organization Some absurd concept
Message-ID <eli$2604051327@qaz.wtf> (permalink)
References <10qtoum$ac1e$1@news.xmission.com>

Show all headers | View raw


In comp.editors, Kenny McCormack <gazelle@shell.xmission.com> wrote:
> What is the best command line way to tell Vim to put the cursor on the last
> line for editing?
> 
> I ended up with: vi -c '$' myLargeFile.txt

The -c commands operate in ex mode, so $ is the correct answer.

> which of course works fine.  But I thought there was a dedicated command
> for this.  In less, you can use "+G", but that doesn't seem to work with
> vi(m), which surprised me.

In vi mode, you can use G to go to the end of the file, and <num>G to go
to a particular line number. If you have vim, vi mode is also called
"normal" mode and this works:

    vim -c 'normal G' myLargeFile.txt

I pretty much only use "normal" for g// operations, like say increase
the number in column three (tab separated) by two on lines matching foobar:

:g/foobar/ normal 02f^V^I2^V^A

where ^V^I is typed ctrl-V <tab>, for an escaped tab character, and ^V^A
is typed ctrl-V ctrl-A, for an escaped control-A.

Elijah
------
and use ":set nrformats=" (empty value) for normal number handling

Back to comp.editors | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Trivial question about the vi(m) command line. gazelle@shell.xmission.com (Kenny McCormack) - 2026-04-05 13:43 +0000
  Re: Trivial question about the vi(m) command line. Eli the Bearded <*@eli.users.panix.com> - 2026-04-05 17:48 +0000
  Re: Trivial question about the vi(m) command line. Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-04-06 16:18 +0200
    Re: Trivial question about the vi(m) command line. gazelle@shell.xmission.com (Kenny McCormack) - 2026-04-06 15:11 +0000

csiph-web