-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
356 lines (300 loc) · 10.2 KB
/
Copy path.vimrc
File metadata and controls
356 lines (300 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
set nocompatible
let mapleader=" "
" vim-plug auto install
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Plugins
call plug#begin()
if !filereadable("/usr/share/vim/google/google.vim")
Plug 'Valloric/YouCompleteMe'
endif
Plug 'jiangmiao/auto-pairs'
Plug 'flazz/vim-colorschemes'
Plug 'rafi/awesome-vim-colorschemes'
Plug 'jiangmiao/auto-pairs'
Plug 'fholgado/minibufexpl.vim'
Plug 'scrooloose/nerdtree'
Plug 'majutsushi/tagbar'
Plug 'Quramy/tsuquyomi'
Plug 'leafgarland/typescript-vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'easymotion/vim-easymotion'
" Plug 'tpope/vim-fugitive'
Plug 'jlfwong/vim-mercenary'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'junegunn/goyo.vim'
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
Plug 'scrooloose/nerdcommenter'
Plug 'mhinz/vim-signify'
Plug 'christoomey/vim-tmux-navigator'
Plug 'w0rp/ale'
Plug 'ntpeters/vim-better-whitespace'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/async.vim'
Plug 'lepture/vim-jinja'
Plug 'terryma/vim-smooth-scroll'
Plug 'yuttie/comfortable-motion.vim'
Plug 'myusuf3/numbers.vim'
Plug 'haya14busa/incsearch.vim'
Plug 'joshdick/onedark.vim'
Plug 'luochen1990/rainbow'
Plug 'inside/vim-search-pulse'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'Yggdroot/indentLine'
Plug 'liuchengxu/vim-clap'
Plug 'vimwiki/vimwiki'
Plug 'rust-lang/rust.vim'
Plug 'da-x/name-assign.vim'
" Add new plugins here
call plug#end()
" vim-rust options.
let g:rustfmt_autosave = 1
set number
" Use relative line numbers.
set rnu
set cc=81
set mouse=a
set hlsearch
set incsearch
set wildmenu " Menu for command autocompletion
set laststatus=2 " Always show status line
set autoread " Automatically read a file changed outside of vim
set backspace=indent,eol,start " Backspace for dummies
set display=lastline " Show as much as possible of the last line
set encoding=utf-8 " Default encoding
set history=10000 " Maximum history record
set smarttab " Smart tab
set ttyfast " Faster redrawing
set viminfo+=! " Viminfo include !
if !has('nvim')
set ttymouse=xterm2
endif
" No help Uganda information, and overwrite read messages to avoid PRESS ENTER prompts
set shortmess=atOI
set ignorecase " Case sensitive search
set smartcase " Case sensitive when uc present
set scrolloff=3 " Minumum lines to keep above and below cursor
set shiftwidth=2 " Use indents of 2 spaces
set tabstop=2 " An indentation every two columns
set softtabstop=2 " Let backspace delete indent
set expandtab " Use spaces instead of tabs
set splitright " Puts new vsplit windows to the right of the current
"set splitbelow " Puts new split windows to the bottom of the current
set autowrite " Automatically write a file when leaving a modified buffer
set mousehide " Hide the mouse cursor while typing
set hidden " Allow buffer switching without saving
set t_Co=256 " Use 256 colors
set ruler " Show the ruler
set showcmd " Show partial commands in status line and Selected characters/lines in visual mode
set showmode " Show current mode in command-line
set showmatch " Show matching brackets/parentthesis
set matchtime=5 " Show matching time
set report=0 " Always report changed lines
set linespace=0 " No extra spaces between rows
set winminheight=0
set wildmode=list:longest,full
set listchars=tab:→\ ,eol:↵,trail:·,extends:↷,precedes:↶
set whichwrap+=<,>,h,l " Allow backspace and cursor keys to cross line boundaries
"
" Visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
" Treat long lines as break lines (useful when moving around in them)
map j gj
map k gk
" Easy navigation between splits. Instead ctrl-w then j, it's just ctrl-j.
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enabled spell checking for English.
" setlocal spell spelllang=en_us
if has('gui_running')
set guioptions-=r " Hide the right scrollbar
set guioptions-=L " Hide the left scrollbar
set guioptions-=T " Hide the toolbar
set guioptions-=m " Hide the menu bar
set guioptions-=e
set shortmess+=c
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
endif
set cursorline " Highlight current line
" Remap Escape to jk
imap jk <Esc>
" Show current branch in status line
"set stl=%F-%{fugitive#statusline()}
if filereadable("/usr/share/vim/google/google.vim")
source /usr/share/vim/google/google.vim
filetype plugin indent on
Glug youcompleteme-google
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_key_list_stop_completion = ['<C-y>', '<CR>']
Glug blazedeps
Glug blaze plugin[mappings]='<leader>b'
" Run goimports and gofmt on file save
Glug codefmt gofmt_executable=goimports
Glug codefmt-google auto_filetypes+=go
Glug syntastic-google checkers=`{'borg': 'borgcfg', 'proto': 'glint', 'gcl': 'gcl', 'bzl': 'bzl'}`
Glug critique
Glug grok
" Glug coverage
" Glug coverage-google
" Format BUILD files
autocmd FileType bzl AutoFormatBuffer buildifier
" Format Markdown files
autocmd FileType md AutoFormatBuffer mdformat
let g:ale_linters = { 'python': ['glint'], 'go': ['glint'], 'cpp': ['glint'], 'proto': ['glint'], 'javascript': ['glint'], 'markdown': []}
" vim-go tuning for google3
let g:go_disable_autoinstall = 1
let g:go_gocode_bin = 'gocode'
let g:go_def_mapping_enabled = 0
let g:go_null_module_warning = 0
" automatically run lint on :w
" set rtp+=$GOPATH/src/golang.org/x/lint/misc/vim
" autocmd BufWritePost,FileWritePost *.go execute 'Lint' | cwindow
" vim-lsp tuning
au User lsp_setup call lsp#register_server({
\ 'name': 'Kythe Language Server',
\ 'cmd': {server_info->['/google/data/ro/teams/grok/tools/kythe_languageserver', '--google3']},
\ 'whitelist': ['python', 'go', 'cpp'],
\})
nmap <Leader>gd :LspDefinition<cr>
" nmap <Leader>gt :tab split<cr>:LspDefinition<cr>
nmap <Leader>gt :windo :LspDefinition<cr>
nmap <Leader>gs :sp<cr>:LspDefinition<cr>
nmap <Leader>gv :vsp<cr>:LspDefinition<cr>
" source /google/data/ro/users/er/ershov/bin/iblaze.vim
" source ~/iblaze.vim
else
filetype plugin indent on
endif
" Show tabs as 2 spaces in .go files
autocmd BufNewFile,BufRead,BufWritePost *.go setlocal noexpandtab tabstop=2 shiftwidth=2 cc=100 textwidth=100
" Tagbar support for Go with gotags
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
" Toggle tagbar on <leader>+L
nmap <leader>l :TagbarToggle<CR>
" Toggle NERDTree on <leader>+K
nmap <leader>k :NERDTreeToggle<CR>
" Do YCM FixIt on <leader>+y
nmap <leader>y :YcmCompleter FixIt<CR>
nmap <leader>f :FormatLines<CR>
" Open tagbar on the left
" let g:tagbar_left = 1
" Usa patched fonts in airline
let g:airline_powerline_fonts = 1
let g:airline_theme = 'violet'
" Syntastic recommended settings
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_mode_map = {
\ "mode": "active",
\ "passive_filetypes": ["html", "typescript", "cpp"] }
" NERDCommenter settings
let g:NERDSpaceDelims = 1
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
" AutoPairs settings
"let g:AutoPairsFlyMode = 1
let g:AutoPairsCenterLine = 0
let g:AutoPairsMultilineClose = 0
" vim-workspace settings
noremap <Tab> :MBEbn<CR>
noremap <S-Tab> :MBEbp<CR>
" let g:solarized_termtrans = 1
" set background=dark
" color solarized
"
" color molokai
" color railscasts
" color jellybeans
" color tender
" Onedark color scheme
" set t_ut=
" if (empty($TMUX))
" if (has("nvim"))
" let $NVIM_TUI_ENABLE_TRUE_COLOR=1
" endif
" if (has("termguicolors"))
" set termguicolors
" endif
" endif
" let g:onedark_termcolors=16
" syntax on
color onedark
" Highlight variable under cursor
" autocmd CursorMoved * exe printf('match FoldColumn /\V\<%s\>/', escape(expand('<cword>'), '/\'))
" vim-smooth-scroll setting
noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 0, 2)<CR>
noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 0, 2)<CR>
noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 0, 4)<CR>
noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 0, 4)<CR>
" Wrap text at 80 characters in Markdown files
au BufRead,BufNewFile *.md setlocal textwidth=80 spell
" Wrap text in hg editor
au BufRead,BufNewFile *.hg.txt setlocal textwidth=80 spell
" Syntax check in Piper editor
au BufRead,BufNewFile .pipertmp* setlocal textwidth=80 spell
" vim-better-whitespace settings
let g:better_whitespace_enabled = 1
let g:strip_whitespace_on_save = 1
highlight ExtraWhitespace ctermbg=5
" comfortable-scrolling
" let g:comfortable_motion_friction = 0.0
" let g:comfortable_motion_air_drag = 0.0
" incsearh settings
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" vim-signify
let g:singify_vcs_list = ['hg', 'perforce']
let g:signify_vcs_cmds = {
\ 'perforce': 'p4 info >& /dev/null && env G4MULTIDIFF=0 P4DIFF=%d p4 diff -dU0 %f'
\ }
" enable rainbow
let g:rainbow_active = 1
" vim-clap
nmap <Leader>/ :Clap blines<cr>
" Custom mapping for name-assign.vim
vmap <leader>n <Plug>NameAssign
" Use Markdown in vimwiki
" let g:vimwiki_list = [{'path': '~/vimwiki/',
" \ 'syntax': 'markdown', 'ext': '.md'}]