-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
260 lines (220 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
" Automatic reloading of .vimrc
autocmd! bufwritepost .vimrc source %
" System Environment
set nocompatible " Vim, not vi
set shell=bash
set ttyfast " We have a fast terminal
set noerrorbells " No error bells please
set novisualbell " Don't blink
if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal"
set t_Co=256
endif
set exrc " Local vimrc
set secure " Prevent certain commands in local vimrc
" Encoding
set fileformat=unix " Default
set fileformats=unix,dos,mac " Supporting end-of-line
set encoding=utf-8
set fileencodings=utf-8
" Editing
set autoindent
set smartindent
set nostartofline " Don't change cursor position
set tabstop=2 " A tab looks like 2 columns
set shiftwidth=2 " 2 columns are indented with << or >>
set shiftround " Shift round to nearest indentation
set smarttab " Backspace delete appropriate spaces
set expandtab " Replace tab with spaces
set backspace=indent,eol,start
set clipboard+=unnamed
" Navigating
set mouse=a " Use mouse everywhere
map <Leader>n <esc>:tabprevious<CR>
map <Leader>m <esc>:tabnext<CR>
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
" Spell check
set spell
highlight clear SpellBad
highlight SpellBad cterm=underline
" Appearance
set background=dark
set ruler " Show the line number on the bar
set number " Line numbers
set cursorline " Line under cursor
set scrolloff=5 " Keep at least 10 lines above/below
set sidescrolloff=10 " Keep at least 10 lines left/right
set lazyredraw " Don't redraw when don't have to
set noerrorbells " Don't make noise
set linespace=0 " Don't insert any extra pixel betweens rows
set list " Show tabs and spaces so we can remove them
set listchars=tab:\ \ ,trail:.
" Backup
set hidden " Hide buffers when they are abandoned
set history=9999 " Big old history
set timeoutlen=300 " Super low delay
set undolevels=1000 " 1000 undo
set updatecount=100 " Switch every 100 chars
set autoread " Watch for file changes
set noautowrite " Don't automatically write on :next
set formatoptions+=n " Recognize numbered lists
set formatlistpat=^\\s*\\(\\d\\\|[-*]\\)\\+[\\]:.)}\\t\ ]\\s*
" And bullets, too
set viminfo+=! " Store upper-case registers in viminfo
set nomore " Short nomore
" Vim Command
set wildmenu " Menu has tab completion
set wildchar=<Tab>
set wildmode=longest,list,full
set laststatus=2
set showcmd " Show (partial) command in status line
set showmode " Show current mode
set more " Use more prompt
set cmdheight=2 " Command line two lines high
set report=0 " Always report all messages
set shortmess=aOstT " To avoid 'press a key' prompt
" Searching
set incsearch " Incremental search
set ignorecase " Search ignoring case
set smartcase " Do smart case matching
set showmatch " Show matching bracket
set matchtime=5 " How many 1/10 seconds to blink
set diffopt=filler,iwhite " Ignore all whitespace and sync
set hlsearch " Highlight the search
set iskeyword+=_,$,@,%,#
nnoremap <Leader>q :nohlsearch<CR>
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.o,*~,*.pyc,*.class
" Folding
set foldenable
set foldlevelstart=0
nnoremap <space> za
vnoremap <space> zf
nnoremap j gj
nnoremap k gk
nnoremap 0 g0
nnoremap $ g$
nnoremap <F5> :make<CR>
" Syntax and Semantics
syntax on
set complete=.,w,b,u,U,t,i,d " Scan upon tab completion
set completeopt=menu,preview
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
" Vundle
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" Gist
Plugin 'mattn/webapi-vim'
Plugin 'mattn/gist-vim'
" Directory Navigation
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
noremap <F2> :NERDTreeToggle<CR>
" Tagging
Plugin 'majutsushi/tagbar'
nmap <F3> :TagbarToggle<CR>
" Semantic Completer
Plugin 'Valloric/YouCompleteMe'
Plugin 'rdnetto/YCM-Generator'
nnoremap <leader>g :YcmCompleter GoTo<CR>
set completeopt=menu,menuone
let g:ycm_python_binary_path = 'python3'
let g:ycm_min_num_identifier_candidate_chars = 2
let g:ycm_add_preview_to_completeopt = 0
let g:ycm_confirm_extra_conf = 0
let g:ycm_show_diagnostics_ui = 0
let g:ycm_complete_in_comments = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 0
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'info'
let g:ycm_key_invoke_completion = '<c-z>'
noremap <c-z> <NOP>
" Project Navigation
Plugin 'ctrlpvim/ctrlp.vim'
let g:ctrlp_map = '<c-p>'
let g:ctrlp_match_window_bottom = 0
let g:ctrlp_match_window_reversed = 0
let g:ctrlp_custom_ignore = '\v\~$|\.(o|swp|pyc|wav|mp3|ogg|blend)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|__init__\.py'
let g:ctrlp_working_path_mode = 0
let g:ctrlp_dotfiles = 0
let g:ctrlp_switch_buffer = 0
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
" Searching
Plugin 'dyng/ctrlsf.vim'
Plugin 'mileszs/ack.vim'
let g:ackprg = 'ag --vimgrep --smart-case'
cnoreabbrev ag Ack
cnoreabbrev aG Ack
cnoreabbrev Ag Ack
cnoreabbrev AG Ack
" Syntax Checking
Plugin 'vim-syntastic/syntastic'
" Git inside Vim
Plugin 'tpope/vim-fugitive'
" C/C++
Plugin 'a.vim'
nnoremap <F4> :A<CR>
set foldmethod=syntax
" Python
Plugin 'plytophogy/vim-virtualenv'
Plugin 'tmhedberg/SimpylFold'
Plugin 'tshirtman/vim-cython'
let g:SimpylFold_docstring_preview = 1
" Go
Plugin 'fatih/vim-go'
autocmd FileType go nnoremap <leader>g :GoDef<CR>
" Rust
Plugin 'rust-lang/rust.vim'
let g:ycm_rust_src_path = '/usr/local/src/rust/src'
" Bazel
Plugin 'google/vim-ft-bzl'
" Maven
Plugin 'NLKNguyen/vim-maven-syntax'
" Pandoc
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'vim-pandoc/vim-pandoc'
" Org Mode
Plugin 'jceb/vim-orgmode'
" Sudo on *nix
Plugin 'SudoEdit.vim'
" HTML
Plugin 'mattn/emmet-vim'
let g:user_emmet_leader_key='<C-E>'
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
" CSS
Plugin 'ap/vim-css-color'
" JavaScript
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
Plugin 'leafgarland/typescript-vim'
Plugin 'Quramy/tsuquyomi'
autocmd FileType typescript nnoremap <leader>g :YcmCompleter GoToDefinition<CR>
" Code Format
Plugin 'google/vim-maktaba'
Plugin 'google/vim-selector'
Plugin 'google/vim-codefmt'
Plugin 'google/vim-codereview'
Plugin 'google/vim-jsonnet'
Plugin 'google/vim-searchindex'
Plugin 'google/vim-glaive'
Plugin 'google/vim-syncopate'
augroup autoformat_settings
autocmd FileType bzl AutoFormatBuffer buildifier
autocmd FileType c,cpp,proto,java,javascript AutoFormatBuffer clang-format
autocmd FileType dart AutoFormatBuffer dartfmt
autocmd FileType go AutoFormatBuffer gofmt
autocmd FileType gn AutoFormatBuffer gn
autocmd FileType html,css,json AutoFormatBuffer js-beautify
autocmd FileType python AutoFormatBuffer autopep8
augroup END
call vundle#end()
call glaive#Install()
Glaive syncopate plugin[mappings]
filetype plugin indent on