How to move cursor to a specific byte in Vim?

Posted on In QA

In Vim, ’20G’ moves the cursor to line 20 in command mode. But how to move the cursor to a specific byte in Vim?

In normal mode,

20go

will move the cursor to byte 20.

Or in command line,

:goto 20

or

:go 20

From vimdoc:

:[range]go[to] [count]
[count]go
            Go to {count} byte in the buffer.  Default [count] is
			one, start of the file.  When giving [range], the
			last number in it used as the byte count.  End-of-line
			characters are counted depending on the current
			'fileformat' setting.

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *