-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvim_tricks
90 lines (76 loc) · 1.64 KB
/
vim_tricks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
power shell -> shell for windows
c = portal
z = jump
shell - interface to the OS
echo $PATH
which ls
ls -l (each on new line)
ls -a (hidden files & folders)
cd .. (previous directory)
cd . (current directory)
man zip (manual for zip)
/ (search within manual)
n (next search)
g (go to home)
q (to exit)
(.bashrc is the configuration file of the terminal)
subl .bashrc
alias c='cd ~/code'
rm (delete file)
rm -r (recursive delete for a folder)
source /home/vman/code/z-master/z.sh
https://github.com/rupa/z
grep (searches)
e.g.:
grep 'def' cinema.py
wc -
composition of commands:
ls /usr/bin | grep python
ls /usr/bin | grep python | wc -l
:q
:e
e.g.
:e asd.py
:w
e.g.
:wq
vim normal state (mode) - for commands
vim insert mode - writing code
i
insert mode
how to paste:
vim essential.vim
:set paste
i
crtl + shift + v
:wq
http://vim.wikia.com/wiki/Example_vimrc
vim -u essential.vim essential.vim
vim -u essential.vim asd.py
Normal mode:
x - deletes under cursor
dd - deletes the line of the cursor
u - crtl+Z
ctrl+r - redo
hjkl - navigation
w - word forward
b - word back
3w - 3 words forward
5l - 5 characters left
3x - deletes whole word
dw - delete rest of word
G - end of file
gg - start of file
0 - start of line
$ - end of line
f: - finds :
; - next found
C - enters us in insert mode
o - new line below + insert mode
O - new line above + insert mode
$a - add at the end of the line
$i - add at the beginning of the line
A - $a
I - $i
s - deletes and goes to insert mode
/ - search