-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.vim
356 lines (271 loc) · 9.86 KB
/
init.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
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
set runtimepath^=~/.dein/repos/github.com/Shougo/dein.vim
call dein#begin(expand('~/.dein'))
" Let dein manage dein
call dein#add('Shougo/dein.vim')
call dein#add('Shougo/deoplete.nvim')
"Make doing math inline easier
call dein#add('arecarn/crunch.vim')
call dein#add('justinmk/vim-sneak')
let g:sneak#streak = 1
"make the sneak-streak labels make sense for Dvorak
let g:sneak#target_labels = "aoeuidhtnspyfgcrlqjkxbmwvzAOEUIDHTNSPYFGCRLQJKXBMWVZ"
nmap <Space> <Plug>SneakNext
nmap <C-Space> <Plug>SneakPrevious
xmap <Space> <Plug>VSneakNext
xmap <C-Space> <Plug>VSneakPrevious
"Replaces vim default f, t basically just makes it go across lines which is
"fantastic. Also can be repeated with space which is nice since I've broken ;
"replace 'f' with inclusive 1-char Sneak
nmap f <Plug>Sneak_f
nmap F <Plug>Sneak_F
xmap f <Plug>Sneak_f
xmap F <Plug>Sneak_F
omap f <Plug>Sneak_f
omap F <Plug>Sneak_F
"replace 't' with exclusive 1-char Sneak
nmap t <Plug>Sneak_t
nmap T <Plug>Sneak_T
xmap t <Plug>Sneak_t
xmap T <Plug>Sneak_T
omap t <Plug>Sneak_t
omap T <Plug>Sneak_T
"
"follow case rules from ignorecase
let g:sneak#use_ic_scs = 1
"undocumented but this should turn off behaviour where you hit s, totally whiff
"on what you were trying to type, hit s again and go to the next match, then
"throw computer out the window in frustration. Instead it'll just let you sneak
"again. We already have <Space> and <C-Space> for repeating which is enough for
"me
let g:sneak#s_next = 0
"great for typing some stuff just as a quick note
call dein#add('mtth/scratch.vim')
"
"Comment out lines at the speed of thought
call dein#add('scrooloose/nerdcommenter')
"good for switching between buffers and files etc
call dein#add('Shougo/unite.vim')
"
"Allows asynchronous computations. Honestly I'm not sure if I'll ever use this
"myself but it lets unite make the list asynchronously instead of blocking which
"is nice
call dein#add('Shougo/vimproc.vim', {'build': 'make'})
call dein#add('scrooloose/syntastic')
let g:syntastic_check_on_open=1
let g:syntastic_php_checkers = ['php']
let g:syntastic_javascript_checkers = ['jslint']
let g:syntastic_ruby_checkers = ['ruby']
let g:syntastic_java_checker = 'javac'
let g:syntastic_cs_checkers = ['syntax', 'semantic', 'issues']
call dein#add('Omnisharp/omnisharp-vim')
call dein#add('OrangeT/vim-csharp')
"Surround real good
call dein#add('tpope/vim-surround')
"Git commands
call dein#add('tpope/vim-fugitive')
"dispatch to auto launch omnisharp
call dein#add('tpope/vim-dispatch')
"browse tags
call dein#add('majutsushi/tagbar')
call dein#add('altercation/vim-colors-solarized')
call dein#add('edkolev/tmuxline.vim')
let g:tmuxline_theme = 'solarized'
"improve the status line
call dein#add('vim-airline/vim-airline')
call dein#add('vim-airline/vim-airline-themes')
"show all the buffers
let g:airline_powerline_fonts=1
let g:airline_theme="solarized"
"This makes it always show
set laststatus=2
"call dein#add('Raimondi/delimtMate')
"let delimitMate_expand_cr = 1
"let delimitMate_expand_space = 1
"use ctrl-l to get out of delimiters, S-tab is used by YCM
"I'm not entirely sold on this mapping but I haven't come up with anything
"better yet
imap <C-l> <Plug>delimitMateS-Tab
"Visualize the undo tree because I don't really get it
call dein#add('sjl/gundo.vim')
"
"Real men live life in hard mode
"Makes moving incorrectly a huge pain with a 1 second timeout every
"time you use jkhl or arrow keys
call dein#add('takac/vim-hardtime')
let g:hardtime_default_on = 1
"Even real men need a break when browsing undo trees or tags
let g:hardtime_ignore_buffer_patterns = [ "Gundo", "Tagbar" ]
"Snippets ala textmate
call dein#add('SirVer/ultisnips')
"
"Tell it where to look for snippets and use tab to cycle through pieces
let g:UltiSnipsSnippetsDir = $HOME . '.config/nvim/MySnippets'
let g:UltiSnipsExpandTrigger = "<C-s>"
let g:UltiSnipsJumpForwardTrigger="<C-l>"
"let g:UltiSnipsJumpBackwardTrigger="<C-h>"
let g:UltiSnipsListSnippets="<C-e>"
"Note we need both this and the ultisnipssnippetsdir to get it all to work
let g:UltiSnipsSnippetDirectories=["MySnippets","UltiSnips"]
"snippets are separated from the engine now so we need to get the defaults
"separately if we want them
call dein#add('honza/vim-snippets')
call dein#add('tommcdo/vim-exchange')
call dein#end()
call dein#check_install()
filetype plugin indent on
nnoremap Y y$
"
"This (apparently) needs to be after dein#end()
let g:unite_source_history_yank = 1
"This could be better but it's a good start. Starts to get weird after 15 but I
"don't normally work with that many buffers..
let g:unite_quick_match_table = {
\ 'a' : 0, 'o' : 1, 'e' : 2, 'u' : 3, 'i' : 4, 'd' : 5, 'h' : 6,
\ 't' : 7, 'n' : 8, 's' : 9,'p' : 10, 'y' : 11, 'f' : 12, 'g' : 13,
\ 'c' : 14, 'r' : 15, 'l' : 16, 'q' : 17, 'j' : 18, 'k' : 19,'1' : 20,
\ '2' : 21, '3' : 22, '4' : 23, '5' : 24, '6' : 25, '7' : 26, '8' : 27,
\ '9' : 28, '0' : 29
\}
"allegedly this makes it better, I don't entirely understand fuzzy matching but
"I have had some trouble with the matches displayed so issue 276 seems like it
"may fix it
call unite#filters#matcher_default#use(['matcher_fuzzy'])
tnoremap <Esc><Esc> <C-\><C-n>
" Setup latex stuff
let g:tex_flavor = 'latex'
let g:tex_nine_config = {'compiler': 'pdflatex', 'synctex': 1, 'viewer': {'app': 'evince', 'target': 'pdf'} }
"look for the tags file
set tags=./tags;/
"For *nix systems type w!! when you forgot to open xorg.conf as super user
cmap w!! w !sudo tee % >/dev/null
"Why are you wasting kestrokes hitting shift to get a colon?
"nnoremap ; :
"Just kidding I'm too used to using shift to type colon. It doesn't seem to
"actually slow me down
"Get the tabs working nicely
set autoindent
set smartindent
set wrap
set expandtab
set shiftwidth=2
set tabstop=2
set softtabstop=2
set shiftround
set smarttab
" search without case unless I put in a capital letter
set ignorecase
set smartcase
set incsearch
set hlsearch
"I don't like all the menuy nonsense but I do like the way gvim renders text
"This should help with that
set guioptions =c
"make the file thing better by default
set wildmode=longest,list,full
" Show line numbers
set number
"In case you're using another editor
set autoread
" Set this higher than standard because the lower corner of this screen is
" terrible
set scrolloff=10
"Automatically wrap the line after 80 characters
set textwidth=80
"Show matching bracket
set showmatch
"maybe this is the annoying thing that in LaTeX?
"default is 60 which is a bit laggy
let g:matchparen_insert_timeout=5
"For working in the terminal. Give the terminal a more useful title
set title
"make regex better
set magic
"turn off annoying nonsense
set noerrorbells
set visualbell
set tm=500
"turn on syntax
syntax enable
set background=dark
colorscheme solarized
"No backups 'cause I live on the edge
set nobackup
set nowb
set noswapfile
"make these work right (although with 80 char lines it shouldn't really matter)
map j gj
map k gk
"get backspace to work properly
set backspace=indent,eol,start
"don't close buffers whe I open a new one
set hidden
"Window Moving
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
"Leader Stuff
let mapleader = ","
let g:mapleader = ","
" Switch CWD to the directory of the open buffer
noremap <leader>cd :cd %:p:h<cr>:pwd<cr>
"clear search highlight
noremap <silent> <leader>/ :nohlsearch<CR>
"edit vimrc
nnoremap <silent> <leader>ve :e $MYVIMRC<CR>
"reload vimrc
nnoremap <silent> <leader>vr :so $MYVIMRC<CR>
"Show the tags
nnoremap <leader>tb :TagbarToggle<CR>
nnoremap <leader>gu :GundoToggle<CR>
nnoremap <leader>ur :Unite -start-insert file_rec/async<CR>
nnoremap <leader>um :Unite file_mru<CR>
nnoremap <leader>uf :Unite -start-insert file<CR>
nnoremap <leader>ub :Unite -quick-match buffer<CR>
nnoremap <leader>uy :Unite history/yank<CR>
"Toggle HardTime
nnoremap <leader>ht :HardTimeToggle<CR>
"Toggle spell check
nnoremap <leader>sp :setlocal spell! spelllang=en_us<CR>
nnoremap <leader>z 1z=
"Still spell check, this actually adds kestrokes which is typcially bad but
"dvorak puts the square brackets so gosh danged far away that I can never hit
"them accurately
nnoremap <leader>sn ]s
nnoremap <leader>sN [s
"paragraph motions, not perfect but they're a start
nnoremap <leader>{ {j
nnoremap <leader>} }k
"Open new line above/below cursor
"It seems like it's more intuitive to use o and O but with the dvorak keymap and
"comma being the leader key that's the same finger which is a pain
"So we'll use l and L for line
nnoremap <leader>L :set paste<CR>m`O<Esc>``:set nopaste<CR>
nnoremap <leader>l :set paste<CR>m`o<Esc>``:set nopaste<CR>
"Scratch stuff
nnoremap <leader>sc :Scratch<CR>
"surround, not sure if I'll use this. Note: don't change to nnoremap or it won't
"work (that makes sense since it'll ignore the surround.vim mappings in the
"nnoremap environment
nmap <leader>$ ys$
"remove trailing whitespace. This is especially useful for LaTeX files where you
"want to browse by paragraphs using the } motion. Note this restores the
"previous search buffer and sets :nohl so the space won't be highlighted
nnoremap <leader>w :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
"I think this will make it put the tags in the right spot..
set tags=./tags,tags;$HOME
"Ctags is fantastic. [ buttons are a huge pain to hit on dvorak though so I may
"need to figure out a better way. Although I have tagbar which may be
"enough..
"Additionally this doesn't seem to be working... Not really sure what's going on
"here
"
"Additionally Additionally it might be nice to run this asynchronously. Maybe
"neovim will save me from this one day. In the meantime there are plugins that
"are fantastically confusing.. I'll look into it
au BufWritePost *.php silent! !ctags-exuberant -R
au BufWritePost *.js, silent! !ctags-exuberant -R
au BufWritePost *.c,*.cc,*.cpp,*.h,*.hpp, silent! !ctags-exuberant -R &
"These are both buffer savers for when you switch
set autowriteall
au FocusLost * silent! wa