-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapping.vim
184 lines (129 loc) · 5.14 KB
/
mapping.vim
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
nnoremap [d vim.diagnostic.goto_prev<cr>
nnoremap ]d vim.diagnostic.goto_next<cr>
nnoremap [<space> msO`s
nnoremap ]<space> mso`s
nnoremap [p Op
nnoremap ]p op
nnoremap <C-q> :lua MiniBufremove.delete()<cr>
"--------------------------------------------------------------------------
" # Free easy mappings available
"--------------------------------------------------------------------------
"Ctrl + b
"Ctrl + e
" nnoremap <C-j> g,
" nnoremap <C-k> g;
" nnoremap <C-l> :cnext<cr>
" nnoremap <C-h> :cp<cr>
" nnoremap <A-0>
" nnoremap <A-h> :cprev<cr>zz
" nnoremap <A-l> :cnext<cr>zz
""navigate the QuickFixList
"--------------------------------------------------------------------------
" # Use Alt + hjkl
"--------------------------------------------------------------------------
nnoremap <A-=> :vertical resize +20<CR>
nnoremap <A--> :vertical resize -20<CR>
" move line downwards
nnoremap <A-j> <Esc>:m .+1<CR>
" move line upwards
nnoremap <A-k> <Esc>:m .-2<CR>
" ESC
inoremap jk <Esc>
"--------------------------------------------------------------------------
" # Behind the scenes
"--------------------------------------------------------------------------
" move in visual mode up and down the visual selection
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
vnoremap < <gv " Better tabbing
vnoremap > >gv " Better tabbing
" undo break point
inoremap , ,<c-g>u
inoremap . .<c-g>u
inoremap ! !<c-g>u
inoremap ? ?<c-g>u
" Jumps remap
" nnoremap <expr> k (v:count > 1 ? "m`" . v:count : '') . 'k'
" nnoremap <expr> j (v:count > 1 ? "m`" . v:count : '') . 'j'
"--------------------------------------------------------------------------
" # File Manipulation
"--------------------------------------------------------------------------
nnoremap <silent> <C-S> :w<cr>
"Indent file and keep cursor position
nnoremap <C-f> :Lines<cr>
"--------------------------------------------------------------------------
" # Navigation
"--------------------------------------------------------------------------
map H ^
map L $
nnoremap Q q
nnoremap Y yg_
""navigate the changeList
nnoremap <bs> g;
nnoremap <S-BS> g,
" keeping centered while browsing
nnoremap n nzz
nnoremap N Nzz
" Marks
nnoremap M m
nnoremap m '
nnoremap <Up> <C-W>+
nnoremap <Down> <C-W>-
nnoremap <Left> <C-W><
nnoremap <Right> <C-W>>
"--------------------------------------------------------------------------
" # Cut, Manipulate text
"--------------------------------------------------------------------------
" + or _ will cut a line and paste it here
nnoremap + :<C-u>+m.<left><left>
nnoremap _ :<C-u>-m.<left><left>
" - Smash that dot '.' multiple times to change all the other occurrences of the word
nnoremap cn *``cgn
nnoremap c. /\V<C-r>"<CR>cgn<C-a><Esc>
" replace word under cursor with the filename without the extension
map <leader>rf ciw<C-R>=expand("%:t:r")<CR>
"add the filename
imap \fn <C-R>=expand("%:t:r")<CR>
"--------------------------------------------------------------------------
" # JSX Mappings
"--------------------------------------------------------------------------
" <div> --> <div className="">
nmap <leader>jc f>i className=""i
" <div> --> <div className={classes.
nmap <leader>jC f>i className={classes.}i
" classes.tomate --> 'tomate'
nmap <leader>jS /classesdiwxysiw'ds{
" 'tomate' --> classes.tomate
nmap <leader>js /classwwyiwda"i{classes.pbds"
" class --> '& .class'
nmap <leader>je ysiw'li& .
" <div> --> <div className={clsx()}>
nmap <leader>jo f>i className={clsx(
" className='tomate' --> className={clsx('tomate')}
nmap <leader>jl f"lcs"{wysiw'ysiW(hiclsxlxf"lli,
" className={test} --> className={clsx(test, )}
nmap <leader>jL f{wi f}i bysiW(iclsxf)i,
"changes makestyle --> makestyle(theme ...
nnoremap <leader>jt ?useStyles = makewwwC(theme => ({
"import clsx
nnoremap <leader>jic mw?import<cr>oimport clsx from "clsx";`w
"--------------------------------------------------------------------------
" # sort visual
"--------------------------------------------------------------------------
xnoremap <leader>o mwoOgvoo'w
xnoremap <leader>` li`gvoi`
xnoremap <leader>ls :'<,'> sort <cr>
xnoremap <leader>ld :'<,'> sort u<cr>
xnoremap <leader>lD :'<,'> %sort! u<cr>
xnoremap <leader>lS :'<,'> %sort! <cr>
xnoremap <leader>co yoconsole.log(pA);
nnoremap <leader>u o<C-R>=strftime("%c")<CR><Esc>0wdwwhpwdWI### <Esc>mto
nnoremap <C--> <Plug>VimwikiMakeDiaryNote
" i = {":e ~/Library/Mobile Documents/Icloud~md~obsidian/Documents/terminus/work/maiia/maiia_notes.md<CR>/## TODO<CR>k:let @/ = ''<cr>o", "today"},
" :echo strftime("%c") Sun Apr 28 11:49:23 1997
" :echo strftime("%Y %b %d %X") 1997 Apr 27 11:53:25
" :echo strftime("%y%m%d %T") 970427 11:53:55
" :echo strftime("%H:%M") 11:55