1 "ayy yy puts the current line in the a register
When you use the uppercase versino of a register ,say "Ayy ,you append the text to what is already in the register
2 To get an idea of what the registers contain,execute the following command:
:registers
You can display the contents of specific register by giving them as an argument to the :registers command,For example :
:registers a
3 Special Registers
0 The last yanked text
- The last small delete
. The last inserted text
% The name of the current file
# The name of the alternate file
/ The last search string
: The last ":" command
= An expression
_ The black hole
* The text selected with the mouse
4 Editing a Specific File
To edit a specific file in this list,you need the follwing command:
:argument 2
5 Changing the File List
You can change this list by specifying a new list to the :args command,For example:
:args alpha.c beta.c gamma.c
After executeing this command ,you start editing alpha.c the next file is teta.c and so on.
6 The +cmd Argument
Suppose that you want to start editing a file at line97.You can start Vim and execute a 97G,or you can tell
Vim to start editing with the cursor on line 97,You can do this by using the option +linenumber on the comand line ,For example:
$gvim +97 file.c
You can also use the +cmd to search for a string by using +/string on the command line.
To start editing a file with the cursor position on the first containing #include,for instance,use this command
$vim +/#include file.c
Finally ,you can put any command-mode command after the plus sign
These ohter commands can takes a +cmd:
:next [+cmd]
:wnect [+cmd]
:previous [+cmd]
....
7 Global Marks
The marks a-z local to the file
The uppercase marks A-Z differ .They are global.They mark not only the location within the file,but alse the fiel itself
Take a look at example,You are editing the file one.c and place the mark A in it ,You then go on to edit file two.c .
When you execute the jmp-to-mark-A command ('A),the Vim editor will switch you from two.c file to one.c and postion the
cursor on the mark
9 Advanced Text Entry
When you are entering text in insert mode ,you can execute a number of different commands.For example
CTRL-U erases the entire line CTRL-W deletes the word before the cursor
10 Inserting Text
If you type CTRL-A ,the editor inserts the text you typed the last time you were in insert mode
The CTRL-@ command does a CTRL-A and then exits insert mode
11 The CTRL-V command is used to quote the next character,In other words,any special meaning the character
has ,it will be ignored .For example CTRL-V<Esc> inserts an escape.You can also use the command CTRL-vdigits to
insert the character number digits.For example ,the character number 64 is @.So CTRL-v64 insert @.The CTRL-vdigits
uses "decimal" digits by default,but you can also insert the "hex" digits,For example:
CTRL-v123
and
CTRL-vx7b
12 CTRL-Y command insets the characher above the cursor ,
CTRL-E command inserts the character below teh cursor
13 Insert a Register
The command CTRL-Rregister inserts the text in the register .If it contains characters such as <BS>
or ohter special characters,they are interpreted as if they had been typed from the keyboard .If you do not want this to happen (oyou really want the <BS>
to intsert in the text),use the command CTRL-R CTRL-R register
First you enter the following line:
All men^H^H^Hpeople are created equal
To enter the backspace chararcters(which show up as ^H),you need to type CTRL-V<BS> or CTRL-V CTRL-H