Fab
Fab

Reputation: 421

Starting Vim at a certain position (line and column) of a file

To start at a specific line I would use:

$ vim FILE +LINE

But what parameter needs to be passed to vim to position the cursor in a certain column of this line?

Upvotes: 41

Views: 8179

Answers (2)

waterkip
waterkip

Reputation: 1

Today I asked this same question on #vim on Libera and got the answer from markzen. This oneliner will do the trick.

vim foo +45 +'norm$' +'star!'

Upvotes: 0

heijp06
heijp06

Reputation: 11808

One way to do that would be:

vim "+call cursor(<LINE>, <COLUMN>)"

For completeness this is another way:

vim "+normal <LINE>G<COLUMN>|"

Upvotes: 64

Related Questions