-
Notifications
You must be signed in to change notification settings - Fork 0
/
.nvimrc
387 lines (302 loc) · 9.26 KB
/
.nvimrc
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
set nocompatible " be iMproved, required
"filetype off " required
"
"" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set scrolloff=9993
set cursorline
set noswapfile
set undofile
set lazyredraw
set et
set autoread
set list listchars=tab:\ \ ,trail:·
set undodir=~/.vim/undo
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
"Search
Plugin 'kana/vim-textobj-user'
Plugin 'tpope/vim-projectionist'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-rvm'
Plugin 'ag.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'dyng/ctrlsf.vim'
Plugin 'eiginn/netrw'
"Plugin 'FelikZ/ctrlp-py-matcher'
"Plugin 'JazzCore/ctrlp-cmatcher'
Plugin 'tpope/vim-vinegar'
Plugin 'incsearch.vim'
Plugin 'utl.vim'
"Edit
Plugin 'honza/vim-snipmate'
Plugin 'visual-increment'
"Plugin 'chrisbra/NrrwRgn'
Plugin 'honza/vim-snippets'
Plugin 'tpope/vim-surround'
Plugin 'junegunn/vim-easy-align'
Plugin 'pbrisbin/vim-mkdir'
Plugin 'simnalamburt/vim-mundo'
Plugin 'mattn/emmet-vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'kovisoft/paredit'
Plugin 'tpope/vim-eunuch'
Plugin 'tpope/vim-endwise'
"Move
Plugin 'vim-scripts/camelcasemotion'
Plugin 'ludovicchabant/vim-gutentags'
Plugin 'Lokaltog/vim-easymotion'
"Utilities
Plugin 'tpope/vim-rsi'
Plugin 'vim-scripts/TailMinusF'
Plugin 'tpope/vim-speeddating'
Plugin 'slim-template/vim-slim'
Plugin 'tmux-plugins/vim-tmux-focus-events'
Plugin 'itchyny/calendar.vim'
Plugin 'tomtom/tlib_vim'
Plugin 'jgdavey/tslime.vim'
Plugin 'vim-addon-mw-utils'
Plugin 'tpope/vim-dispatch'
Plugin 'jceb/vim-orgmode'
Plugin 'tpope/vim-fugitive'
Plugin 'cohama/agit.vim'
"Languages
Plugin 'Guns/vim-clojure-static'
Plugin 'tpope/vim-fireplace'
Plugin 'vim-javascript'
Plugin 'tpope/vim-leiningen'
Plugin 'mustache/vim-mustache-handlebars'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-bundler'
Plugin 'thoughtbot/vim-rspec'
Plugin 'vim-ruby/vim-ruby'
"Visual
Plugin 'edkolev/tmuxline.vim'
Plugin 'sickill/vim-monokai'
Plugin 'ap/vim-css-color'
Plugin 'vim-airline'
Plugin 'ntpeters/vim-airline-colornum'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-classpath'
call vundle#end()
autocmd FileType org let maplocalleader=','
autocmd FileType org set ts=2
autocmd FileType org set sts=2
let g:utl_cfg_hdl_scm_http = ":Start open '%u'"
let g:utl_cfg_hdl_mt_application_pdf = ":Start open '%p'"
let g:utl_cfg_hdl_mt_text_directory='VIM'
set encoding=utf-8
imap jk <Esc>
imap Jk <Esc>
let mapleader=","
tnoremap jk <C-\><C-n>
noremap Q q
noremap q <NOP>
nmap k gk
nmap j gj
nmap D "_d
vmap <C-c><C-d> <Plug>SendSelectionToTmux
nmap <C-c><C-d> <Plug>NormalModeSendToTmux
nmap <C-d>r <Plug>SetTmuxVars
nmap <C-c><C-d> vip<C-c><C-d>
nmap <leader>bi :!bundle install<cr>
"nmap <C-c><C-d> yap<C-w><C-w>p<C-w><C-w>
"vmap <C-c><C-d> y<C-w><C-w>p<C-w><C-w>
set wildmenu
set wildmode=list:longest,full
syntax on
runtime macros/matchit.vim
set laststatus=2
filetype plugin indent on
set tabstop=2
set shiftwidth=2
set softtabstop=2
set grepprg=ag
set relativenumber
set number
"" Use a blinking upright bar cursor in Insert mode, a blinking block in normal
set shell=bash
nmap <C-w>n :vnew<cr>
nmap <C-w><C-n> :vnew<cr>
""" SPEC
autocmd FileType ruby map <Leader>t :call RunCurrentSpecFile()<CR>
autocmd FileType ruby map <Leader>s :call RunNearestSpec()<CR>
autocmd FileType ruby map <Leader>l :call RunLastSpec()<CR>
autocmd FileType ruby map <Leader>a :call RunAllSpecs()<CR>
map <space>rr :R<CR>
map <space>rg :Rgenerate
xnoremap <space>re :Rextract
map <space>a :A<CR>
nmap cqr vap:Eval<CR>
""let g:rspec_command = 'call Tmux("rspec {spec}\n")'
let g:rspec_command = ":execute 'Dispatch rspec {spec}' | :cw"
let g:ctrlp_extensions = ['tag']
let g:ctrlp_use_caching = 0
"let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
"let g:ctrlp_match_func = {'match' : 'matcher#cmatch' }
let g:ctrlp_custom_ignore = 'node_modules\|bower_components\|DS_Store\|git\|tmp\|bundle\|doc'
""" TABS
nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprevious<CR>
set t_Co=256
color monokai
""color monokai
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers = 0
let g:airline_theme="zenburn"
"let g:GeeknoteExplorerWidth=40
highlight clear SignColumn
nnoremap <c-j> i<CR><Esc>
""not suitable for working with foreign repos
""autocmd FileType c,cpp,java,php,ruby,eruby autocmd BufWritePre <buffer> :%s/\s\+$//e
"let g:table_mode_corner='+'
"let g:table_mode_fillchar='-'
set tabstop=2 shiftwidth=2 expandtab
""set hlsearch
set smartcase
let g:go_disable_autoinstall = 1
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
highlight! link DiffText MatchParen
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
let g:vimfiler_as_default_explorer=1
let g:ag_prg="ag --column"
ab rpy pry
ab slef self
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
let g:incsearch#auto_nohlsearch = 1
nmap <C-q> :noh<CR>
"map n <Plug>(incsearch-n)
"map N <Plug>(incsearch-N)
"map * <Plug>(incsearch-*)
"map # <Plug>(incsearch-#)
"map g* <Plug>(incsearch-g*)
"map g# <Plug>(incsearch-g#)
"" Press Space to turn off highlighting and clear any message already
"" displayed.
hi Search cterm=NONE ctermfg=black ctermbg=lightcyan
let g:over_enable_cmd_window = 1
let g:over#command_line#search#enable_incsearch = 1
let g:ruby_indent_access_modifier_style = 'indent'
let ruby_spellcheck_strings = 1
let g:rubycomplete_load_gemfile = 1
command! -bar -nargs=1 OpenURL :!open -a '/Applications/Google Chrome.app' <args>
cnoremap %% <C-R>=expand('%:h').'/'<cr>
noremap <space>s :w<cr>
noremap <space>f :CtrlSF<space>
noremap <space>F :CtrlSFOpen<cr>
noremap <space>* :CtrlSF <C-r><C-w><cr>
let g:org_agenda_files=['~/org/**/*.org']
let g:calendar_google_calendar = 1
let g:calendar_google_task = 1
noremap <space>C :Calendar -view=week <cr>
noremap <space>c :Calendar -view=day -position=topright -width=40<cr>
noremap <space>n :65vsp ~/org/index.org<cr>
autocmd VimEnter * :65vsp ~/org/index.org
let g:netrw_winsize=20
inoremap <C-l> <C-R>=ListRegisters() <cr>
func! SearchTag()
let tag = input("Enter tag: ")
execute ":Ag :" . tag . ": ~/org"
endfunc
noremap <space>fn :call SearchTag()<cr>
func! ListRegisters()
let lis=[]
for reg in split('" 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m', ' ')
call add(lis, getreg(reg))
endfor
call complete(col('.'), lis)
return ''
endfunc
let g:mustache_abbreviations = 1
noremap H <Plug>Howdoi
"noremap <space>r :reg<cr>
noremap <space>R :RV<cr>
noremap <space>t :tabnew<cr>
noremap <space>T :tabclose<cr>
noremap <space>q jk:bd<CR>
noremap <space>w jk:w<bar>bd<CR>
"noremap <space>e :Geeknote<CR>
noremap <space>h :r ! howdoi
noremap <space>H :vs<cr>:enew<cr>:r ! howdoi -a
noremap ,r :! rake test<cr>
let g:gutentags_exclude = ['bundle']
vmap <Enter> <Plug>(EasyAlign)
map <C-l> <Plug>CamelCaseMotion_w
map <C-j> <Plug>CamelCaseMotion_b
nnoremap <space>u :GundoToggle<CR>
"Fugitive
nnoremap <space>gs :Gstatus<CR>
nnoremap <space>gb :Gblame<CR>
xnoremap <space>gb :Gblame<CR>
nnoremap <space>gc :Gcommit<CR>
nnoremap <space>gd :Gdiff<CR>
nnoremap <space>gw :Gwrite<CR>
nnoremap <space>ge :Gedit<CR>
nnoremap <space>gl :AgitFile<CR>
xnoremap <space>gl :Glog<CR><CR>
nnoremap <space>gL :Git log<CR>
nnoremap <space>gm :Agit<CR>
nnoremap <space>gf :AgitFile<CR>
nnoremap <space>gC :Git checkout
nnoremap <space>gp :Git add -p<CR>
nnoremap <space>d :diffthis<CR>
if filereadable(glob(".vimrc.local"))
"source '.vimrc.local'
endif
:tnoremap <A-h> <C-\><C-n><C-w>h
:tnoremap <A-j> <C-\><C-n><C-w>j
:tnoremap <A-k> <C-\><C-n><C-w>k
:tnoremap <A-l> <C-\><C-n><C-w>l
:nnoremap <A-h> <C-w>h
:nnoremap <A-j> <C-w>j
:nnoremap <A-k> <C-w>k
:nnoremap <A-l> <C-w>l
" OpenChangedFiles (<Leader>O)---------------------- {{{
function! OpenChangedFiles()
only " Close all windows, unless they're modified
let status = system('git status -s | grep "^ \?\(M\|A\)" | cut -d " " -f 3')
let filenames = split(status, "\n")
if len(filenames) < 1
let status = system('git show --pretty="format:" --name-only')
let filenames = split(status, "\n")
endif
exec "edit " . filenames[0]
for filename in filenames[1:]
if len(filenames) > 4
exec "tabedit " . filename
else
exec "sp " . filename
endif
endfor
endfunction
command! OpenChangedFiles :call OpenChangedFiles()
noremap<space>o :OpenChangedFiles <CR>
function! RemoveFancyCharacters()
let typo = {}
let typo["“"] = '"'
let typo["”"] = '"'
let typo["‘"] = "'"
let typo["’"] = "'"
let typo["–"] = '--'
let typo["—"] = '---'
let typo["…"] = '...'
:exe ":%s/".join(keys(typo), '\|').'/\=typo[submatch(0)]/ge'
endfunction
command! RemoveFancyCharacters :call RemoveFancyCharacters()
autocmd BufWritePre *_spec.rb call RunAllSpecs()
autocmd BufWinEnter *.rb :%s/\s\+$//e
autocmd BufWinEnter *.{rb,html,erb,slim,js} call RemoveFancyCharacters()
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
augroup Terminal
au!
au TermOpen * let g:last_terminal_job_id = b:terminal_job_id
augroup END
function! REPLSend(lines)
call jobsend(g:last_terminal_job_id, add(a:lines, ''))
endfunction
command! -range REPLSendLine call REPLSend(getline(<line1>, <line2>))
nmap <C-d><C-t> vap:REPLSendLine<cr>
vmap <C-d><C-t> :REPLSendLine<cr>