LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-18-2016, 09:43 AM   #1
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Rep: Reputation: Disabled
Smile vi editor


Hello, I am a newbie and I just started last week to work with Linux. When using vi editor I am stuck on figuring out a command to move down x lines at a time. For example, if I have a 24 lines of text on the vi screen/page. How I could move 11 lines at the time? thank you for your help!
 
Old 05-18-2016, 10:10 AM   #2
dab1414
Member
 
Registered: May 2011
Location: OK, USA
Distribution: Slackware 14.1_64
Posts: 76

Rep: Reputation: 52
https://lmddgtfy.net/?q=vi%20command...current%20line
 
Old 05-18-2016, 10:25 AM   #3
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,139

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
Here's a good guide
http://www.washington.edu/computing/unix/viref.html

vi can be a mystery, but there are times when it's the only thing available so one just perseveres. Some even get to love it
 
1 members found this post helpful.
Old 05-18-2016, 10:40 AM   #4
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thnak you so much for the help guys! I really appreciate that!
 
Old 05-19-2016, 09:26 AM   #5
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Original Poster
Rep: Reputation: Disabled
So if I understanding it right the command should be vi filename+11

Thank you!
 
Old 05-19-2016, 09:32 AM   #6
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
You mean scroll down 11 lines? (11, down key)
 
Old 05-19-2016, 09:33 AM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
With most keys in vi, you can simply type a number and then hit a key to do that action that many times. Eg: typing "11" followed by the down arrow would move down 11 lines, "11" followed by "dd" would cut 11 lines, etc.
 
Old 05-19-2016, 11:14 AM   #8
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thumbs up

Sorry about being a pain in the butt guys. English is my second language and sometimes I can't communicate the way I would like. What I am asking is if here are 50 lines of text on a vi screen/page. What would be the command to move down 14 lines at a time.
Thank you guys!
 
Old 05-19-2016, 11:45 AM   #9
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Cut and past 14 lines?
(position the cursor at the first line from the 14 you want to move), 14, dd, (position the cursor at the line after which you want them pasted), p
 
Old 05-19-2016, 12:20 PM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,837

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
for example:
Code:
:,+13m+15

:  enter command mode
,+13 is an address, format: from,to. from is now the current line (empty), to is +13 lines, altogether 14 lines
m is the command move
+15 is the location, where do you want to move it (sometimes called movement operator, http://vim.wikia.com/wiki/Moving_around)
http://vim.wikia.com/wiki/Moving_lines_up_or_down
http://bullium.com/support/vim.html#move
 
Old 05-19-2016, 12:21 PM   #11
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,223

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by torito View Post
How I could move 11 lines at the time?
Move up 11 lines: 11j

Move down 11 lines: 11k
 
Old 05-19-2016, 12:52 PM   #12
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Quote:
Originally Posted by torito View Post
Sorry about being a pain in the butt guys. English is my second language and sometimes I can't communicate the way I would like. What I am asking is if here are 50 lines of text on a vi screen/page. What would be the command to move down 14 lines at a time.
Thank you guys!
type 14 followed by the down arrow.
 
Old 05-19-2016, 01:00 PM   #13
torito
LQ Newbie
 
Registered: May 2016
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thumbs up

All clear!!!! Thank you very much everyone for your help! This is a great forum!!! Thank you again!
 
Old 05-19-2016, 03:05 PM   #14
pingu_penguin
Member
 
Registered: Aug 2004
Location: pune
Distribution: Slackware
Posts: 350

Rep: Reputation: 60
Alternately you can use ctrl+f to scroll your screen down forward half a page and ctrl+b to go back half a page on the screen.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] return text from geany or other editor to IDE after saving and closing the editor mtdew3q Programming 4 05-15-2013 10:40 PM
[SOLVED] Need disk editor, not file editor Dafydd Linux - General 7 05-19-2012 01:10 PM
LQ is Looking for a News Editor and a Content Editor jeremy Linux - News 7 05-18-2012 11:58 PM
linux distro / photo editor / music editor of choice ?? expatcanuck Linux - Newbie 1 05-04-2009 05:24 PM
LXer: Open Movie Editor: Linux Video Editor with Plot Twists LXer Syndicated Linux News 0 10-27-2008 09:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration