103.8 Basic File Editing: VI Flashcards

1
Q

VI

common editor available for all Linux distributions

A

vi/vim

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

VI

used to move cursor around and perform various operations on text

A

Command mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

VI

adding/inserting text in your document

A

Insert mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

VI

advanced mode for search/replace - executing external commands and using split panes

A

Ex mode (called LastLine)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

VI

global vim config file

A

/etc/vimrc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

VI

user specific config for vim

A

/home/user/.vimrc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

VI - Command Mode number lines shortcuts

turns line numbers on the display on/off

A

:number/nonumber

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

VI - Command Mode number lines shortcuts

nu shortcut for :number/nonumber

A

:nu/no

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

VIM Command Mode

invoke the insert mode at the current cursor position where you can begin typing in the documant

A

i

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

VIM Command Mode

move to the beginning of the current line and invoke insert mode

A

I

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

VIM Command Mode

invoke insert mode placing the cursor one character to the right of the current position (append)

A

a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

VIM Command Mode

move to the end of current line, placing the cursor one char to the right of the ending position (line append)

A

A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

VIM Command Mode

insert a new line under the current line and place the cursor in the first position on the new line in insert mode

A

o

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

VIM Command Mode

insert new line above current line - place cursor in the first position of new line insert mode

A

O

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

VIM Command Mode

change text at current position

A

c[option]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

VIM Command Mode: c[option]

change the word at the current position

A

cw

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

VIM Command Mode: c[option]

change the line at the current position

A

cc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

VIM Command Mode: c[option]

change the current position to the end of the line

A

c$

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

VIM Command Mode

replace the character at the current position

A

r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

VIM Command Mode

replace text on same line until you escape the insert mode or until you reach end of line

A

R

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

VIM Command Mode

delete the character after the cursor

A

x

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

VIM Command Mode

delete the character before the cursor

A

X

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

VIM Command Mode

delete the word after the cursor

A

dw

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

VIM Command Mode

delete the entire line the cursor is on

A

dd

25
Q

VIM Command Mode

delete the text from the current cursor to the end of line

A

D

26
Q

VIM Command Mode

delete the text from current cursor to the end of current screen

A

dL

27
Q

VIM Command Mode

delete the text from current cursor to end of file

A

dG

28
Q

VIM Command Mode

delete all text from beginning of line to the current cursor

A

d^

29
Q

VIM Command Mode

undo last operation/change

A

u

30
Q

VIM Command Mode

copy the current line to the buffer

A

yy

yank

31
Q

VIM Command Mode

copy from current cursor to end of current word

A

yw

32
Q

VIM Command Mode

paste contents of buffer after the cursor

A

p

33
Q

VIM Command Mode

paste contents of buffer before the cursor

A

P

34
Q

VIM Command Mode

undo ALL changes since the last time the file was saved to disk

A

:e!

35
Q

VIM Command Mode

write file to disk (save)

A

:w

36
Q

VIM Command Mode

quit the editor (will warn you if file has changed and not saved)

A

:q

37
Q

VIM Command Mode

quit right now - don’t worry about saved / changed

A

:q!

38
Q

VIM Command Mode

shortcut for save and exit

A

ZZ

39
Q

VIM Nav Shortcuts

one char left

A

h

40
Q

VIM Nav Shortcuts

one line down

A

j

41
Q

VIM Nav Shortcuts

one line up

A

k

42
Q

VIM Nav Shortcuts

one char right

A

l

43
Q

VIM Nav Shortcuts

move back one half page

A

ctl-u

44
Q

VIM Nav Shortcuts

move back one page

A

ctl-b

45
Q

VIM Nav Shortcuts

move forward one half page

A

ctl-d

46
Q

VIM Nav Shortcuts

move forward one page

A

ctl-f

47
Q

VIM Nav Shortcuts

show the name of the file, lines and position in percentage of the total file length

A

ctl-G

48
Q

VIM Nav Shortcuts

move directly to indicated line

A

[#]G

49
Q

VIM Nav Shortcuts

move 12 words to the right

A

[#]W

50
Q

Command Mode: Searching

search from cursor position forward for ‘string’

A

/[string]

51
Q

Command Mode: Searching

search from cursor position back for string

A

?[string]

52
Q

Command Mode: Searching

when used after a search, will find the ‘next’ occurrence of said ‘string’ in indicated direction

A

N

53
Q

Replacing

syntax

A

sed-like

54
Q

Replacing

substitute in current line

A

s

55
Q

Replacing

substitute in entire file

A

%s

56
Q

Replacing

what to search for

A

/[value to find]

57
Q

Replacing

what to replace with

A

/[value to substitute]/

58
Q

Replacing

optional will replace ALL occurrences rather than just first

A

g

:s/Mar/Apr/g
will search for Mar and replace with Apr

59
Q

Run command

run indicated command on command line

A

:!