Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How may I scroll with vim into a big file?

I have a big file with thousands of lines of thousands of characters.

I move the cursor to 3000th character.

If I use PageDown or Ctrl+D, the file will scroll but the cursor will come back to the first no-space character.

There's is an option to set to keep the cursor in the same column after a such scroll ?

I have the behavior with gvim on Window, vim on OpenVMS and Cygwin.

like image 928
Luc M Avatar asked Feb 18 '09 15:02

Luc M


People also ask

Can vim handle large files?

Yes, Vim can open very large files.


2 Answers

CTRL-E - scroll down
CTRL-Y - scroll up

100<CTRL-E> will scroll down 100 lines for example

If you like using PageUp, PageDown or Ctrl+D etc. you can set the "nostartofline" option

:set nostartofline
like image 174
Philip Reynolds Avatar answered Nov 01 '22 15:11

Philip Reynolds


Well, one easy way to do so is using the movement keys. For example, to go down 100 lines keeping the cursor at the same column: "100j"

Edit:

Alright, searching a little more to really find an answer to your question, there's an option to do exactly what you want:

:set nostartofline
like image 36
skinp Avatar answered Nov 01 '22 15:11

skinp