-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvim_stuff.txt
140 lines (88 loc) · 3.95 KB
/
vim_stuff.txt
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
These are notes I took while watching ThePrimegagen's Vim as your editor playlist.
https://youtube.com/playlist?list=PLm323Lc7iSW_wuxqmKx_xxNtJC_hJbQ7R
Something to consider when using Vim or NeoVim, and this is optional, but very common for many vim users.
And that is to remap yor escape key to your caps lock key.
This makes changing between visual, insert and normal mode much easier, faster and effiecent.
Instaed of reaching to the upper left of your key board to hit escape, now all you need to do is tap the caps lock key with your left pinky to set the mode you want. Thus keeping your hands on the home row.
I learned this watching one of Luke Smith's totorials. A quick way to remap those keys is the following bash script.
Included in this script is a command to speed up your cusor and scrolling.
I placed it my /usr/bin and named it remap.
---------------------------------------------------------------------------------------------------
#!/bin/bash
# This script is called on startup to remap keys.
# Decrease key repeat delay to 300ms and increase key repeat rate to 50 per second.
xset r rate 300 80
# Map the caps lock key to super, and map the menu key to right super.
setxkbmap -option caps:super,altwin:menu_win
# When caps lock is pressed only once, treat it as escape.
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
# Turn off caps lock if on since there is no longer a key for it.
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
-----------------------------------------------------------------------------------------------------------------
Primegagen's vim how-to and tips and tricks.
MODES
-------------------
Go to Regular mode = esc(remaped tp CAPS Lock)
ESC (remaped to CAPS LOCK) to go into Normal mode.
i = insert
v = visual
r = replace
----------
Editing & Moving around:
Moving up down left and right
j = down
k = up
h = left
l = = righ
scroll half way up or down
CTRL + u for up
CTRL + d for down
b = back one word at a time
w = forward one word at a time
e = jump forward faster
SHIFT + G (cap G) jump to bottom of the page
gg = jump to top of page
gj at first line
d = delete a word and tapping d multiple times (dslakfj) whole words and
u = to undo what ever u just did
or
DELETION
To delete chars inside () go on a char inside the ( ) then press ct closing
parenthese: ct )
that deletes everything inside the parenthese, and puts you in insert mode.
SHIFT + f deletes the rest of the line and puts you in insert mode.
d = delete a word and tapping d multiple times detetes whole words and
SHIFT + v to higlight the whole first line, then move down or jump to the end
or the paragraph
to delete everything between { } ijn a block of code, just go to the top line
at the first { then hit
di{ then p to paste it some where else if you want.
example
func main() {
line1
line2
line3
}
Copy a line and paste it one line below without using visual mode:
be in Normalmode, and have the cursor on any char in the line/sentence,
then press
yy + p
SHIFT + } = jumps down between paragraphs and or blocks of code.
and
SHIFT + { = jumps up between paragraphs
jump to a matching character:
put the cursor on the specific char, and press %
Relative line jumping:
hit the numer of lines to move up, then press j to jump down that number of lines or k to jump up that number of lines.
d + 3 + j = puts in delete mode, instructs 3 to move, j says move down
and to do this up, hit k instead of j
to gradualy highlight words, hit go into vis mode, then tap w to highlight words to the right, and b to go back
$ = jumps to end of line but before last char in in normal mode
A = jumps to very end of line into insert mode
0 = Jumps to begining of the line
_ = jumps to beging of line
SHIFT + I jump to begining of line in insert mode.
SHIFT + A jump to end of line in insert mode.
------------------------------------
special character selection:
{slgjlskfgjlfgj} {123}} [sdlkjfh] <F12><F12><F12> (sadf()) ${UID}+