Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to jump cursor to specific line in visual mode in vi?

Tags:

vim

vi

When I am using vi I will jump to a new line using :<line number>. And then when I try to highlight something, I will go to visual mode, and try the same command :<line number>. but instead of jumping to the line number that I asked, it does some weird behavior. How do I jump to a specific line while in visual mode?

like image 848
makansij Avatar asked Jul 21 '17 19:07

makansij


3 Answers

In visual mode, most movement commands work the same way they do in normal mode. In this case, you can type <line_number>gg or <line_number>G.

like image 195
merlin2011 Avatar answered Oct 11 '22 17:10

merlin2011


In visual mode, you can type the line number you want to go to, then press shift + g to go there.

like image 39
David C Avatar answered Oct 11 '22 18:10

David C


nG where n is the line number.

like image 38
unxnut Avatar answered Oct 11 '22 18:10

unxnut