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

17
Q

Got to the end of current line

18
Q

Go to the first non blank character of current line

19
Q

Go to the beginning of the paragraph

20
Q

Go to the beginning of the next paragraph

21
Q

Go to the beginning of the current sentence

22
Q

Got to the beginning of the next sentence

23
Q

Go to the beginning of current screen

A

H for home location

24
Q

Go to the middle of current screen

25
Go to the last line of current screen
L
26
Bring the current line to the top of the screen
z
27
Bring current line to the bottom of the screen
z-
28
Bring current line to the middle of the screen
z.
29
Go to the last non blank character of the current line
g_
30
Go to the top of the file
:0 | gg
31
Go to the bottom of the file
:$ | G
32
Specify the percentage of lines
percentage%
33
Display line numbers | and unset it
:set nu/number | :set nonu/nonumber
34
Go to a specific line
:number 50gg 50G
35
Go to the matching character of the pair
% | This is very useful when we are editing a script
36
Go back to previous spot
ctrl + o
37
specify a visual line operation
g+operation
38
command line vim navigation
vim +number | there is no space between + and number