Академический Документы
Профессиональный Документы
Культура Документы
1" Tips
vi!1" Tips
Essential vi/vim Editor Skills
by
Jacek Artymiak
First Edition
Lublin 2008
!i"1# Tips, 1st ed. by Jacek Artymiak
Published by devGuide.net
www: http://www.devguide.net/books/vitips1
email: jacek@devguide.net
08! 10 9 8 7 6 5 4 3 2 1
ISBN: 978"83"60869"00"0
The author and the publisher disclaim any and all liability for the
use of information and programs contained in this book.
Basic File
Operations
! Chapter 2: Basic File Operations "
Starting vi!1"
You can start vi#1$ from the command line without telling it which
file it is supposed to open. You can provide that information later
#see page 10$.
Before
After
How#To:
1. Type vi
2. Press Enter/Return.
Page 9
! Chapter 2: Basic File Operations "
Before
After
How#To:
1. Type vi ~/book.txt
2. Press Enter/Return.
Page 10
! Chapter 2: Basic File Operations "
Before
After
How#To:
1. Type vi ~/*.txt
2. Press Enter/Return.
Page 11
! Chapter 2: Basic File Operations "
chapter0[!1234567].txt (filenames
any single character
[!abc] outside the chapter01.txt through
not on the list
chapter07.txt range)
chapter0[!0-9].txt (filenames
any single character
[!a-z] outside the chapter00.txt through
outside range
chapter09.txt range)
Page 12
! Chapter 2: Basic File Operations "
Step 1
Step 3
Step 4
Step 5
How#To:
Page 13
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 14
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 15
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 16
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 17
! Chapter 2: Basic File Operations "
If you forget !, vi#1$ will complain and refuse to write the specified
block. Rightly so, because you are replacing the whole file with a
smaller chunk and vi#1$ wants to make sure you know what you are
doing.
After
Before
How#To:
Page 18
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 19
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 20
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 21
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 22
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 23
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 24
! Chapter 2: Basic File Operations "
After
Before
How#To:
Page 25
! Chapter 2: Basic File Operations "
Page 26
Index
! Index "
A lines, 82%83
arrow keys, 29%30, 63 words, 81
Page 97
! Index "
first, 34 F
last, 34 file operations, 6
next, 34
previous, 34 filename, 11%12 , 17, 59
start of the line, 33%34 changing, 17
paragraph, wildcard, 11%12
next, 45%46 testing, 11
previous, 45%46
screen, file, 10%11, 13%24, 26, 59
bottom of, 38, 51 access path, 10, 19, 59
middle of, 38, 51 appending to, 20
top of, 38, 51 a part of, to another, 21
sentence, current, 20%22, 24%26, 59
next, 44 forcing to save and quit, 23
previous, 44 editing, 10%11
word, forced saving the current, 16
end of, 43 inserting, 59
next, 43 location, 17
previous, 43 opening, 10, 14
screen, half a opening multiple, 11
down, 38, 40 read"only, 23
up, 38, 40 recovery, 26
search match, saving, 22
next, 50 a part of, 18
previous, 50 under a di%erent name, 19
current, 15
cutting text, see deleting quitting, 22
under a di%erent name, 17
D switching between, 13
deleting, 67, 69%71, 73%75, 80, 84
characters, 71 I
lines, 70%71, 73%75 insert mode, 6, 29, 55, 58, 63, 69%70
words, 71, 73
inserting, 55, 57
display, adjusting, 51 empty lines, 57
above the current line, 57
E below the current line, 57
editing, text, 10%11, 13%14, 17, 22%24, text, 55
53, 55, 63, 67, 91
J
entering, text, 55, 63 joining, lines, 85
ex mode, 6
Page 98
! Index "
L up, 66
lines, 6, 21, 61 word,
blocks of, 21, 61 end of, 66
long, 6 next, 66
previous, 66
line, 9, 30, 36, 70
current, 60 N
empty, 9 numbers, 87
number, 36, 70 decrementing, 87
source, 30 incrementing, 87
target, 30
O
lowercase, 86 out of control, 5
M overtype mode, 67
markers, 9, 48, 60%61,63, 77, 82
~, 9 P
end of region, 63 panic, 5
Page 99
! Index "
Page 100
! Index "
scripts, 91 Y
yank, see yanking
searching, 50, 77 yanking, 80
backward, 50
forward, 50
shell access, 92
T
text editor, 6
tricks, 89
U
undo, 87
history, 87
uppercase, 86
V
vi, 9%11, 22, 24%25, 92
forcing to quit without saving, 25
quitting without saving, 24
quitting, 22, 92
starting, 9%11
W
way out, 5
whitespace, 43
wrapping lines, 62
Page 101