LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   vi editor to move file page. (https://www.linuxquestions.org/questions/linux-newbie-8/vi-editor-to-move-file-page-879787/)

gardenair 05-10-2011 02:50 AM

vi editor to move file page.
 
hi,
I have a file of 200 pages. I want to move my cursor page wise. Suppose I want to move my cursor from last page of the file to up three pages.
Is there any command to do it or I use "k" to move up?
thanks in advance,
garden

markush 05-10-2011 03:46 AM

Hi,

what do you mean with "page", a "screenfull" can be moved by <CTRL><B> and <CTRL><F> backward (up) and forward (down).
You may also give the k (or j) command a number as an argument, 40k will move 40 lines up.

To your question: 3 pages up = 3<CTRL><B>

Markus

baltho 05-10-2011 03:46 AM

A few options here, as always in the OSS world!

Simplest, if your pages are (say) 50 lines each, typing 50k will move you up a page. 150k up 3 pages, etc.

If the pages are separated by a new-page character (Ctrl-L from memory) you could search for that: / Ctrl-V Ctrl-L (use a ? instead of a / to search backwards)

Both of those could be mapped to function keys:
:map PgUp 50k
for instance. (Not sure about the "PgUp", you might need to refer to the manual for your particular version of vi...). Stick that command in a .vimrc file and it'll be permanent.

Hope this helps....

chrism01 05-10-2011 11:31 PM

If the keybd mapping is correct, I think you should be able to use the cursor keys marked 'Page Up', 'Page Down' ...


All times are GMT -5. The time now is 05:39 AM.