Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-07-2011, 11:57 PM   #1
LQ Newbie
Registered: Feb 2007
Location: Indiana
Distribution: Fedora 14
Posts: 4

Rep: Reputation: 0
vim count command


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.

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

Rep: Reputation: 4

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


to have the entire help menu.

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

Rep: Reputation: 11
There are also excellent pages about Vim online: (Moolenaar created Vim, based on vi.)

I mostly use these websites to find what I need.

I also use a cheat sheet while I work with Vim at the moment: (This one is made for Gvim, however. Find others using Google: vi cheat sheet)
2 members found this post helpful.
Old 02-08-2011, 09:46 PM   #4
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, 04:13 AM   #5
sumeet inani
Registered: Oct 2008
Posts: 905
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 04:15 AM.


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

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

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