Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I move the cursor to a specific row and column?

Tags:

vim

:30 will move my cursor to the beginning of line 30.

How can I tell Vim to place the cursor at line y, column x? Is this possible without using the arrow keys or h, j, k, l keys?

I am running Vim version 7.3.429.

like image 293
pacv Avatar asked Aug 01 '12 21:08

pacv


People also ask

How do I get column numbers in vim?

If you want to show the current column of cursor, then type :echo col('. ').


2 Answers

Try a number followed by a pipe to get to the specified column in that line.

80| should get you to position 80 in that line.

EDIT: If you are looking to go to a specific x,y position, I am not sure on that one.

like image 164
WebDevNewbie Avatar answered Sep 21 '22 15:09

WebDevNewbie


Not sure it's in any way more convenient, but you can call the cursor function directly:

:cal cursor(30, 5) 

will jump to line 30, column 5.

like image 29
Jeen Broekstra Avatar answered Sep 18 '22 15:09

Jeen Broekstra