Vim 101 Hacks Flashcards

1
Q

How to write files in Vim?
What is the simplified way and full name way?
And how to specify the name of the files?

A
\:w   for :write
\:up for :update
\:w filename
\:write filename
\:up filename 
\:update filename
\:w! overwrite the file and save as newfile
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to quit the Vi editor?

A

:q

:x save working file and exit == :wq == ZZ

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

Basic Vim modes

A

There are three basic vim modes: 1. Normal mode

  1. Insert mode
  2. Command Line Mode
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the local vim configuration file location?

A

The local configuration file of vim is ~/.vimrc

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

What is the global vim configuration file location?

A

The location of global vim configuration file is /usr/share/vim/.vimrc

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

What is a link and how to get into it?

A

The link int the help documentation is the content between | |. In order to get into it , you have use ctrl + ]

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

what is the built-in tutorial for vim?

A

:vimtutor

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

Scroll down full pafe

A

ctrl + F

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

Scroll up full page

A

ctrl + B

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

scroll down one line

A

ctrl + E

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

scroll up one line

A

ctrl + Y

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

go to the beginning of the next word

A

w W

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

go to the end of the next word

A

e

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

go to the beginning of previous word

A

b B

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

what is the difference between you using w and W?

A

w go to next word even they are separated by a dot

W goes to next word separated by blank.

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

Go to the starting of current line

A

0

17
Q

Got to the end of current line

A

$

18
Q

Go to the first non blank character of current line

A
19
Q

Go to the beginning of the paragraph

A

{

20
Q

Go to the beginning of the next paragraph

A

}

21
Q

Go to the beginning of the current sentence

A

[[

22
Q

Got to the beginning of the next sentence

A

]]

23
Q

Go to the beginning of current screen

A

H for home location

24
Q

Go to the middle of current screen

A

M

25
Q

Go to the last line of current screen

A

L

26
Q

Bring the current line to the top of the screen

A

z

27
Q

Bring current line to the bottom of the screen

A

z-

28
Q

Bring current line to the middle of the screen

A

z.

29
Q

Go to the last non blank character of the current line

A

g_

30
Q

Go to the top of the file

A

:0

gg

31
Q

Go to the bottom of the file

A

:$

G

32
Q

Specify the percentage of lines

A

percentage%

33
Q

Display line numbers

and unset it

A

:set nu/number

:set nonu/nonumber

34
Q

Go to a specific line

A

:number
50gg
50G

35
Q

Go to the matching character of the pair

A

%

This is very useful when we are editing a script

36
Q

Go back to previous spot

A

ctrl + o

37
Q

specify a visual line operation

A

g+operation

38
Q

command line vim navigation

A

vim +number

there is no space between + and number