-
Notifications
You must be signed in to change notification settings - Fork 1
/
_vimrc
308 lines (239 loc) · 7.5 KB
/
_vimrc
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
" VIM Settings for Sam
" __________________________________________________
" / Vundle \ {{{
" Setup Vundle:
" $ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
"
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/Dropbox/Vim/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" Install Fuzzy Finder
Bundle 'L9'
Bundle 'FuzzyFinder'
" Install NERD Commenter
Bundle 'The-NERD-Commenter'
" \__________________________________________________/ }}}
" __________________________________________________
" / NERDTree \ {{{
Bundle 'The-NERD-Tree'
" \__________________________________________________/ }}}
" __________________________________________________
" / VTreeExplorer \ {{{
" No settings as of yet
" \__________________________________________________/ }}}
" __________________________________________________
" / Align plugin \ {{{
" I actually don't know what these commands do, I
" just put them in here because I was following
" instructions
:set nocp
:filetype plugin on
" Load align plugin
Bundle 'Align'
" \__________________________________________________/ }}}
" __________________________________________________
" / General Settings \ {{{
" Ignore case in searches
:set ignorecase
" Move the swp files to personal directory
if !isdirectory($HOME . '/.swp')
:call mkdir($HOME . '/.swp')
:endif
:set backupdir=~/.swp
:set directory=~/.swp
" Disable the toolbar
:set guioptions-=T
" My font
:set guifont=Courier_New
":h8:cANSI
" Highlite the current line
:set cursorline
:highlight CursorLine guibg=#DDFFDD
" Automatically save files when executing make
:set autowrite
" Turn off Eclim
:let g:EclimMakeLCD=0
" \__________________________________________________/ }}}
" __________________________________________________
" / Code cleanliness \ {{{
" Turn on syntax highlighting
:filetype plugin on
:syntax enable
" Highlite search results
:set hlsearch
:highlight Search guibg=#E8E8FF
" Don't extend comments on newline
:au FileType * setl fo-=cro
" Tab spaces
:set tabstop=4
" This line is indented <num> spaces
:set shiftwidth=4
:set autoindent
" Set line numbering
:set number
" Set right-margin
" :highlight OverLength ctermbg=darkred ctermfg=white guibg=#FFD9D9
" :match OverLength /\%81v.\+/
" Allow folding
:set foldmethod=marker
" Disable wrapping by default
:set nowrap
:set textwidth=0
:let g:leave_my_textwidth_alone = 1
" Configure Vim to move the cursor to the end of the
" previous line, when the left arrow key is pressed
" and the cursor is currently at the beginning of a
" line
:set whichwrap+=<>[]
" Load Solarized bundle
Bundle 'Solarized'
" Set color scheme to Solarized
:set background=dark
:colorscheme solarized
" Load php bundle
"Bundle 'php'
"Bundle 'php.vim'
" \__________________________________________________/ }}}
" __________________________________________________
" / Hotkeys \ {{{
" CTRL+w is killing me
inoremap <C-w> <C-o>:echo "DO NOT PRESS THAT KEY!!!"<CR>
cnoremap <C-w> <Esc>:echo "DO NOT PRESS THAT KEY!!!"<CR>
" Backspace key
:set bs=2
" Map CTRL-S to save
nnoremap <C-s> :write<CR>
cnoremap <C-s> <Esc>:write<CR>
inoremap <C-s> <Esc>:write<CR>a
" Map CTRL-Z to undo
nnoremap <C-z> :undo<CR>
cnoremap <C-z> <Esc>:undo<CR>
inoremap <C-z> <Esc>:undo<CR>a
" Map CTRL+Backspace to delete word (backward)
inoremap <C-BS> <C-w>
cnoremap <C-BS> <C-w>
inoremap <M-BS> <C-w>
cnoremap <M-BS> <C-w>
" Map CTRL+Space to word completion
inoremap <C-Space> <C-n>
" Map CTRL+Delete to delete word (forward)
inoremap <C-Del> <C-o>dw
inoremap <M-Del> <C-o>dw
" Map SHIFT+arrows to extend selection
" - Up
nnoremap <S-Up> v<Up>
inoremap <S-Up> <C-o>v<Up><Right>
vnoremap <S-Up> <Up>
" - Down
nnoremap <S-Down> v<Down>
inoremap <S-Down> <C-o>v<Down>
vnoremap <S-Down> <Down>
" - Right
nnoremap <S-Right> v
inoremap <S-Right> <C-o>v
vnoremap <S-Right> <Right>
vnoremap <Right> <Esc><Right>
" - Left
nnoremap <S-Left> v<Left>
inoremap <S-Left> <C-o>v
vnoremap <S-Left> <Left>
vnoremap <Left> <Esc><Left>
" Map SHIFT+CTRL+arrows to extend selection
inoremap <CS-Right> <C-o>v<C-Right>
inoremap <CS-Left> <C-o>v<C-Left>
" Map SHIFT+HOME,END
" - Home
nnoremap <S-Home> v<Home>
inoremap <S-Home> <C-o>v<Home>
" - End
nnoremap <S-End> v<End>
inoremap <S-End> <C-o>v<End>
" Copy and paste
" - Ctrl+INS = Copy
vnoremap <C-Ins> y
" - Shift+INS = Paste
vnoremap <S-Ins> <Esc><Esc>p
nnoremap <S-Ins> p
inoremap <S-Ins> <Left><C-o>p
" Map <F8> to make
nnoremap <F8> :make<CR>
inoremap <F8> <ESC>:make<CR>
" Map <F5> to make run
nnoremap <F5> :wa<CR>:!make run<CR>
inoremap <F5> <ESC>:wa<CR><C-o>:!make run<CR>
" Map ^L to clear search
nnoremap <C-l> :let @/ = ""<CR>
inoremap <C-l> <C-o>:let @/ = ""<CR>
vnoremap <C-l> :let @/ = ""<CR>
" Map D-J to join
vnoremap <D-j> :join<CR>
" \__________________________________________________/ }}}
" __________________________________________________
" / Eclipse Keybindings \ {{{
" Map SHIFT+CR to END,CR
nnoremap <S-CR> o
inoremap <S-CR> <C-o>o
vnoremap <S-CR> <Esc><Esc>o
nnoremap <CS-CR> O
inoremap <CS-CR> <C-o>O
vnoremap <CS-CR> <Esc><Esc>O
" Map C-D to delete line
nnoremap <C-d> dd
inoremap <C-d> <C-o>dd
vnoremap <C-d> :delete<CR>
nnoremap <D-d> dd
inoremap <D-d> <C-o>dd
vnoremap <D-d> :delete<CR>
"" Map M-Down to move line
nnoremap <M-DOWN> :move +1<CR>
nnoremap <M-UP> :move -2<CR>
inoremap <M-DOWN> <C-o>:move +1<CR>
inoremap <M-UP> <C-o>:move -2<CR>
vnoremap <M-DOWN> :move '>+1<CR>gv
vnoremap <M-UP> :move -2<CR>gv
" Map CM-Down to clone line
nnoremap <CM-DOWN> :copy +0<CR>
nnoremap <CM-UP> :copy -1<CR>
inoremap <CM-DOWN> <C-o>:copy +0<CR>
inoremap <CM-UP> <C-o>:copy -1<CR>
vnoremap <CM-DOWN> :copy '>+0<CR>gv
vnoremap <CM-UP> :copy -1<CR>gv
" Map CMD+/ to toggle line comment(s) (Plugin: The-NERD-Commenter)
nnoremap <D-/> :call NERDComment(0, "toggle")<CR>
vnoremap <D-/> :call NERDComment(0, "toggle")<CR>
inoremap <D-/> <C-o>:call NERDComment(0, "toggle")<CR>
" __________________________________
" /---------- Fuzzy Finder ----------\ "{{{
inoremap <F3> <ESC>:FufFile **/*<CR>
nnoremap <F3> :FufFile **/*<CR>
vnoremap <F3> :FufFile **/*<CR>
cnoremap <F3> <C-u>FufFile **/*<CR>
inoremap <F4> <ESC>:FufLine function{;<CR>
nnoremap <F4> :FufLine function{;<CR>
vnoremap <F4> :FufLine function{;<CR>
cnoremap <F4> <C-u>:FufLine function{;<CR>
" \__________________________________/"}}}
" \__________________________________________________/ }}}
" __________________________________________________
" / File Types \ {{{
" *
au FileType * set formatoptions-=ro
" C#
au FileType cs set errorformat=\ %#%f(%l\\\,%c):\ error\ CS%n:\ %m
au FileType cs match OverLength // " Disable the long line highlight
" haXe
au BufRead,BufNew *.hx set filetype=haxe
" \__________________________________________________/ }}}
" __________________________________________________
" / UltiSnips \ {{{
" Tell UltiSnips to edit configuration file in a split window
let g:UltiSnipsEditSplit = 'vertical'
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsListSnippets = '<c-j>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
" Load UltiSnips
Bundle 'UltiSnips'
" \__________________________________________________/ }}}