LinuxQuestions.org
Help answer threads with 0 replies.
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 02-07-2011, 10:57 PM   #1
Snaggletooth
LQ Newbie
 
Registered: Feb 2007
Location: Indiana
Distribution: Fedora 14
Posts: 4

Rep: Reputation: 0
vim count command


Hello,

I am a linux novice and just starting to learn Vim. I am having trouble with what my online book is calling the "count" command.

It allows you to multiply a commands execution x number of times.

My ":3a!" does nothing. ":9k" gives the error E16: Invalid Range. I made sure I press Escape before entering the command. Other letter combinations I have tried haven't work yet either, obviously.

The paragraph from the book "vim book" that I found on sourceforge.

Using a Count to Edit Faster
Suppose you want to move up nine lines.You can type kkkkkkkkk or you can enter the command 9k. In fact, you can precede all the movement commands with a number. Earlier in this chapter, for instance, you added three exclamation points to the end of a line by typing a!!!<Esc>. Another way to do this is to use the command 3a!<Esc>.The count of 3 tells the a command to insert what follows (!) three times.
Similarly, to delete three characters, use the command 3x.


Thanks,
Carl
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-08-2011, 02:04 AM   #2
LoDam
LQ Newbie
 
Registered: Jan 2011
Location: Fr
Distribution: ArchLinux at the moment
Posts: 25

Rep: Reputation: 4
Hello,

For theses tricks I don't use the semi colons. I just type 9k (not in the editing mode of course, ie, I just type 'esc' then 9 then k) to go up 9 lines.

Edit: great way to learn vim other than books is the exelent vimtutor (just type that in a terminal). And of course you can use the command

:help command

to have a short help on a specific command. Or simply

:help

to have the entire help menu.

Last edited by LoDam; 02-08-2011 at 02:06 AM.
 
1 members found this post helpful.
Old 02-08-2011, 06:07 AM   #3
Mark1986
Member
 
Registered: Aug 2008
Location: Netherlands
Distribution: Xubuntu
Posts: 87

Rep: Reputation: 11
There are also excellent pages about Vim online:

http://vim.runpaint.org/toc/
http://www.moolenaar.net/habits.html (Moolenaar created Vim, based on vi.)
http://www.selectorweb.com/vim.html

I mostly use these websites to find what I need.

I also use a cheat sheet while I work with Vim at the moment:

http://www.viemu.com/vi-vim-cheat-sheet.gif (This one is made for Gvim, however. Find others using Google: vi cheat sheet)
 
2 members found this post helpful.
Old 02-08-2011, 08:46 PM   #4
Snaggletooth
LQ Newbie
 
Registered: Feb 2007
Location: Indiana
Distribution: Fedora 14
Posts: 4

Original Poster
Rep: Reputation: 0
That helped. I've got the movement down now. I'll be checking out the other sources now. Thanks.
 
Old 02-09-2011, 03:13 AM   #5
sumeet inani
Member
 
Registered: Oct 2008
Posts: 898
Blog Entries: 26

Rep: Reputation: 49
mark1986 , What a great vim cheat sheet for beginners .

By the way , Snaggletooth . When You learn the basics of vim , you won't like other text editors simply because vim is faster & skilfully designed .
It can do all text processing you can imagine.
It (actually vim-tiny) is also installed by default in most distros which is useful in terminal.
Happy vimming.

Last edited by sumeet inani; 02-09-2011 at 03:15 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Command to count all characters in file. guif Linux - Newbie 4 03-26-2010 08:44 AM
Need help in word count command grunge_1 Linux - General 4 03-20-2009 04:01 AM
command to count occurances of a string MicahCarrick Linux - Software 1 06-02-2007 10:43 PM
command to count how many lines in a file? dr_zayus69 Linux - Software 3 01-06-2005 10:42 AM
Vim editor, right hand bottom number count jules_fraser Linux - Newbie 15 12-06-2003 06:18 PM


All times are GMT -5. The time now is 11:58 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration