-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc.old
More file actions
434 lines (362 loc) · 10.2 KB
/
vimrc.old
File metadata and controls
434 lines (362 loc) · 10.2 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
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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
" #########################
" Vundle
" #########################
" Vundle set up
" set nocompatible
" filetype off
call plug#begin('~/.vim/plugged')
" Syntastic
Plug 'vim-syntastic/syntastic'
" NERD tree
Plug 'scrooloose/nerdtree'
" Nvim-R
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'jalvesaq/Nvim-R'
Plug 'gaalcaras/ncm-R'
" vim-go
" Plug 'fatih/vim-go'
" Super Tab
" Perform all your vim insert mode completions with Tab
" Plug 'ervandew/supertab'
" Tagbar
" Vim plugin that displays tags in a window
Plug 'majutsushi/tagbar'
" CamelCaseMotion
Plug 'bkad/CamelCaseMotion'
" bugexplorer (it needs vim patches 1261 and 1264)
Plug 'jlanzarotta/bufexplorer'
" YankRing
" Maintains a history of previous yanks, changes and deletes
" Plug 'vim-scripts/YankRing.vim'
" vim-airline for status/tabline
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" vim markdown for markdown syntax
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
" Vim Markdown runtime files
" Plug 'tpope/vim-markdown'
" fugitive for Git integration
Plug 'tpope/vim-fugitive'
" commentary
Plug 'tpope/vim-commentary'
" surround
Plug 'tpope/vim-surround'
" Vim Slime
Plug 'jpalardy/vim-slime'
" SLIME
Plug 'epeli/slimux'
" gruvbox
Plug 'morhetz/gruvbox'
" increment
Plug 'triglav/vim-visual-increment'
" incsearch
Plug 'haya14busa/incsearch.vim'
" vim-snipe
Plug 'yangmillstheory/vim-snipe'
" vim-pandoc
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
" vim-rmarkdown
Plug 'vim-pandoc/vim-rmarkdown'
" vim-signify
Plug 'mhinz/vim-signify'
" grammar check
Plug 'rhysd/vim-grammarous'
" lsp
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
" Deoplete
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" for languageserver
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" (Optional) Multi-entry selection UI.
Plug 'junegunn/fzf'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
call plug#end()
filetype plugin indent on
" #########################
" NCM2
" #########################
" enable ncm2 for all buffers
autocmd BufEnter * call ncm2#enable_for_buffer()
" IMPORTANT: :help Ncm2PopupOpen for more information
set completeopt=noinsert,menuone,noselect
" #########################
" languageserver
" #########################
" Required for operations modifying multiple buffers like rename.
" set hidden
" let g:LanguageClient_serverCommands = {
" \ 'r': ['r', '--slave', '-e', 'languageserver::run()'],
" \ }
" nnoremap <F5> :call LanguageClient_contextMenu()<CR>
" Or map each action separately
" nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
" nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
" nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
" nnoremap <silent> fmt :call LanguageClient_textDocument_formatting()<CR>
" #########################
" syntastic
" #########################
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_cpp_compiler_options = ' -std=c++11'
" #########################
" vim-airline
" #########################
" make status bar always appear
set laststatus=2
" air-line
let g:airline_powerline_fonts = 1
" tabline
let g:airline#extensions#tabline#enabled = 1
" #########################
" vim-snipe
" #########################
map <leader><leader>f <Plug>(snipe-f)
" #########################
" Aesthetics
" #########################
" gruvbox dark theme
syntax enable
set background=dark
" let g:gruvbox_italic=1
set termguicolors
let g:gruvbox_contrast_dark = 'hard'
colorscheme gruvbox
hi clear SpellBad
hi SpellBad cterm=underline,bold
set t_Co=256
" show line number
set number
" highlight the 80th column
set colorcolumn=80
" highlight search matches
set incsearch
" formatoptions to disable auto comment headers
au FileType * set fo-=c fo-=r fo-=o
" hidden to allow multiple unsaved buffers
set hidden
" backspace to allow using backspace button
set backspace=indent,eol,start
" #########################
" Mappings
" #########################
" easy editing vimrc
nnoremap <leader>ov :edit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" spell
nmap <silent> <leader>s :set spell!<CR>
" mapping settings
let mapleader=","
let maplocalleader=";"
" remap comma key to back slash
nmap \ ,
" map jk to ESC in insert mode
imap jk <esc>
tmap jk <esc>
" Copy into the end of line
nmap Y y$
" Copy until the end of line into system clipboard
nmap <C-Y> "+y$
" Copy an entire line and paste before the current line
nmap _ ggY``P
" Copy to clipboard
vmap <C-c> "+y
" Map ctrl+Del to delete until the end of line in insert mode
imap <C-Del> <C-\><C-O>D
" Keep the visual block intact after indenting
vmap > >gv
vmap < <gv
" split pane settings
set splitbelow
set splitright
nmap <C-J> <C-W><C-J>
nmap <C-K> <C-W><C-K>
nmap <C-L> <C-W><C-L>
nmap <C-H> <C-W><C-H>
" invisible character mapping
nmap <leader>l :set list!<CR>
set listchars=tab:▸\ ,eol:¬
" edit mappings
cnoremap %% <C-R>=fnameescape(expand('%:h')).'/'<cr>
map <leader>ew :e %%
map <leader>es :sp %%
map <leader>ev :vsp %%
map <leader>et :tabe %%
" #########################
" Tab/indentation
" #########################
" how many columns a tab counts for
set tabstop=2
" tab inserts spaces
set expandtab
" how many columns when Tab in insert mode
set softtabstop=2
" how many columns text is indented
set shiftwidth=2
" #########################
" Tab completion
" #########################
" enable a menu at the bottom
set wildmenu
" first tab = command will be completed to the longest common command
" second tab = show all completion matches
set wildmode=longest,list,full
" #########################
" vim markdown
" #########################
" disable folding
" let g:vim_markdown_folding_disabled=1
" #########################
" Nvim-R
" #########################
let R_assign = 0
let R_cmd='R0'
vmap <Space> <Plug>RDSendSelection
nmap <Space> <Plug>RDSendLine
function! SendInvisibleV()
let Rsource = g:rplugin_tmpdir . "/Rsource-" . getpid()
call writefile(["invisible("] + getline("'<", "'>") + [")"], Rsource)
call g:SendCmdToR('source("' . Rsource . '")')
call cursor(line("'>"), 0)
call GoDown()
endfunction
vmap <silent> <LocalLeader>ri <Esc>:call SendInvisibleV()<CR>
autocmd BufReadPre *.r let $R_HOME='/usr/local/lib/R'
autocmd BufReadPre *.r let R_path='/usr/local/bin'
autocmd BufReadPre *.r let R_app='rtichoke'
autocmd BufReadPre *.r let R_cmd='r'
autocmd BufReadPre *.r let R_hl_term = 0
autocmd BufReadPre *.r let R_bracketed_paste = 1
autocmd BufReadPre *.R let R_app='R'
" Emulate Tmux ^az
function ZoomWindow()
let cpos = getpos(".")
tabnew %
redraw
call cursor(cpos[1], cpos[2])
normal! zz
endfunction
nmap gz :call ZoomWindow()<CR>
" #########################
" vim-slime
" #########################
let g:slime_target = "tmux"
let g:slime_paste_file = "$HOME/.slime_paste"
" #########################
" CamelCaseMotion
" #########################
call camelcasemotion#CreateMotionMappings('<leader>')
" #########################
" bufexplorer
" #########################
nnoremap <silent> <F11> :BufExplorer<CR>
nnoremap <silent> <s-F11> :ToggleBufExplorer<CR>
nnoremap <silent> <m-F11> :BufExplorerHorizontalSplit<CR>
nnoremap <silent> <c-F11> :BufExplorerVerticalSplit<CR>
" #########################
" stripping trailing whitespaces
" #########################
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
nmap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>
" #########################
" vimdiff
" #########################
map <silent> <leader>1 :diffget 1<CR> :diffupdate<CR>
map <silent> <leader>2 :diffget 2<CR> :diffupdate<CR>
map <silent> <leader>3 :diffget 3<CR> :diffupdate<CR>
" #########################
" vim-go
" #########################
" let g:go_highlight_functions = 1
" let g:go_highlight_methods = 1
" let g:go_highlight_fields = 1
" let g:go_highlight_types = 1
" let g:go_highlight_operators = 1
" let g:go_highlight_build_constraints = 1
" let g:go_fmt_command = "goimports"
" #########################
" incsearch.vim
" #########################
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" #########################
" vim-pandoc
" #########################
" Disable folding module
let g:pandoc#modules#disabled = ["folding"]
" #########################
" vim-markdown
" #########################
" Enable TOC autofit
let g:vim_markdown_toc_autofit = 1
" #########################
" youcompleteme
" #########################
" Turn off ycm for R
let g:ycm_filetype_blacklist = {'R': 1, 'r': 1}
" #########################
" ctags
" #########################
let g:tagbar_type_r = {
\ 'ctagstype' : 'r',
\ 'kinds' : [
\ 'f:Functions',
\ 'g:GlobalVariables',
\ 'v:FunctionVariables',
\ ]
\ }
" #########################
" Tagbar
" #########################
" Turns on the TagBar
nnoremap <leader>tb :TagbarToggle<CR>
let g:tagbar_left = 1
" #########################
" others
" #########################
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
if !has('nvim')
set viminfo='10,\"100,:20,%,n~/.viminfo
endif
" Restore cursor position
:au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif
" F2 toggles paste mode and insert mode
set pastetoggle=<F2>
" maximum number of tabs
set tabpagemax=100
" use par to format
set formatprg=par\ -w80
" Auto-save folds state
" augroup AutoSaveFolds
" autocmd!
" autocmd BufWinLeave ?* mkview
" autocmd BufWinEnter ?* silent loadview
" augroup END