-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.vim
More file actions
215 lines (134 loc) · 3.63 KB
/
map.vim
File metadata and controls
215 lines (134 loc) · 3.63 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
" edit vimrc
nnoremap <leader>vrc :vsplit $MYVIMRC<CR>
nnoremap <leader>vab :vsplit ~/.abbrev.vim<CR>
nnoremap <leader>vmp :vsplit ~/.map.vim<CR>
nnoremap <leader>vpg :vsplit ~/.plugs.vim<CR>
nnoremap <silent> <leader>rv :source $MYVIMRC<CR>:filetype detect<CR>:exe ":echom 'vimrc reloaded'"<CR>
" reopen last file in split (kinda like cmd-shift-t in Chrome)
nnoremap <C-S-t> :vs<bar>:b#<CR>
" automatically insert a \v before any search string, so search uses normal regexes
nnoremap / /\v
vnoremap / /\v"
" make tab % to jump between brackets.
nnoremap <tab> %
vnoremap <tab> %
" Make Y behave like other capitals
noremap Y y$"
" Easier visual indent
vnoremap < <gv
vnoremap > >gv
" Pageup/pagedown
noremap gk <C-u>
noremap gj <C-d>
" Save
nnoremap gs :w<Enter>
nnoremap gss :wq<Enter>
nnoremap gsss :w !sudo tee % >/dev/null<Enter>
" Quit
nnoremap gq :q<Enter>
nnoremap gqq :q!<Enter>
nnoremap gqa :qa<Enter>
" Split commands.
nnoremap <silent> ss :Sexplore<Enter>
nnoremap <silent> vv :Vexplore<Enter>
" vertical ➜ horizontal splits
nnoremap <silent> vs :windo wincmd K<Enter>
" horizontal ➜ vertical splits
nnoremap <silent> sv :windo wincmd H<Enter>
" split nav
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-H> <C-W>h
nnoremap <C-L> <C-W>l
" Resize splits
nnoremap ++ 10<C-w>+
nnoremap -- 10<C-w>-
nnoremap << 5<C-w><
nnoremap >> 5<C-w>>
nnoremap <> <C-w>=
" paste mode
command Pa set paste!
" File Explorer
nnoremap gx :Explore<Enter>
nnoremap gb :b#<Enter>
" unhighlight search
noremap <silent><esc> <esc>:noh<CR><esc>
" allow Vim to still understand escape sequences
nnoremap <esc>^[ <esc>^[
" replace
nnoremap ?? :%s/<C-r><C-w>//g<Left><Left>
vnoremap ?? :s/<C-r><C-w>//g<Left><Left>
nnoremap ??? :windo %s/<C-r><C-w>//g<Left><Left>
" yank whole file
nnoremap yyy :%y<CR>
" Move cursor line to the center of the screen
nnoremap <Enter> zz
" make new local file
nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
nnoremap <leader>n :cd %:p:h<CR>:new
" Remove all console.log
nnoremap <leader>cl :g/console.log/d<Enter>
" Reload file
nnoremap <leader>re :edit<CR>
" tabs -> spaces
nnoremap <leader><tab> :set shiftwidth=2 tabstop=2 softtabstop=2 expandtab<CR>:retab<CR>
" Scroll bind
command Scb set scrollbind!
" Set filetyps
command Re filetype detect
command Csh set filetype=csh
command Css set filetype=css
command Html set filetype=html
command Js set filetype=javascript
command Less set filetype=less
" Chrome Secure Shell remappings
noremap <C-e> <C-w>
" Typos
command Q q
command W w
command Wq wq
" No Exec mode
noremap Q <NOP>
" Space to fold/unfold code
nnoremap gz za
" Line comments
nnoremap g> ^i//<C-c>j
nnoremap g< ^:%s/\/\///c<Enter>y
" Line numbers
nnoremap <F6> :set invnumber<CR>
command No set invnumber! | GitGutterToggle
command NO set invnumber! | GitGutterToggle
" Ack
nnoremap <Leader>/ :Ack<Space>
" search tags
nnoremap \\ :Tags <C-r><C-w>
vnoremap \\ :Tags <C-r><C-w>
" vimrc
command Vimrc e $MYVIMRC
command Vimre source $MYVIMRC
" tabs
nnoremap <C-e>g :tab sball<CR>
nnoremap <C-e>t :tab split<CR>
nnoremap <C-e>q :tabclose<CR>
nnoremap <C-e>h :tabp<CR>
nnoremap <C-e>j :tabp<CR>
nnoremap <C-e>k :tabn<CR>
nnoremap <C-e>l :tabn<CR>
" jump back to previous buffer
nnoremap <leader>, <c-^>
" show and select buffer
nnoremap gb :ls<CR>:b<Space>
" unix commands
nnoremap <leader>py :! python %<CR>
nnoremap <leader>py3 :! python %<CR>
nnoremap <leader>nd :! node %<CR>
" Arrow keys getting in my way
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" No manual
noremap <S-k> <NOP>
" errors
nnoremap <Leader>ne :lnext<CR>
nnoremap <Leader>Ne :lprevious<CR>