-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
192 lines (150 loc) · 5.25 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
set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8
" Add optional or external plugins before enabling syntax and filetype
" detection in defaults.vim.
packadd! matchit
packadd! editexisting
if v:version >= 901
packadd! editorconfig
else
packadd! editorconfig-vim
endif
" If installed, add GNU LilyPond Vim plugins from distribution
if executable('lilypond')
let &runtimepath .= ',' . escape(trim(system('lilypond -e "(display (ly:get-option ''datadir)) (exit)"')) . '/vim', '\,')
endif
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
function! OverrideHighlights() abort
" Override Doxygen highlight colors to mostly look like regular comments
highlight default link doxygenParamName Identifier
highlight default link doxygenBody Comment
highlight default link doxygenBrief Comment
highlight default link doxygenParam String
highlight default link doxygenSpecialHeading Comment
highlight default link doxygenSpecialOnelineDesc Comment
highlight default link doxygenSpecialTypeOnelineDesc Comment
" Highlight ALE error signs to match the error block
highlight default link ALEErrorSign SpellBad
" Use the error color in ALE virtual text
highlight default link ALEVirtualTextError WarningMsg
" Use the saturated yellow from the wombat airline theme's insert mode
" instead of SpellCaps for ALE warnings
highlight ALEWarning guifg=#141413 guibg=#fde76e ctermfg=232 ctermbg=203
highlight ALEVirtualTextWarning ctermfg=203 guifg=#fde76e
highlight default link ALEWarningSign ALEWarning
" Set add/change/delete sign colors
highlight GitGutterAdd guifg=#95e454 ctermfg=113
highlight GitGutterChange guifg=#fde76e ctermfg=3
highlight GitGutterDelete guifg=#e5786d ctermfg=1
highlight default link cSpaceError ALEWarning
endfunction
augroup OverrideColors
autocmd ColorScheme * call OverrideHighlights()
augroup END
colorscheme wallaby
let g:airline_theme='wombat'
" Highlight current line and column
set cursorline
set cursorcolumn
" color column after textwidth
set colorcolumn=+1
" Show line numbers
set number
" vim-gitgutter options
" Enable faster updates
set updatetime=100
highlight! link SignColumn LineNr
let g:gitgutter_set_sign_backgrounds = 1
" vim-airline options
let g:airline_powerline_fonts = 1
let g:airline#extensions#ale#enabled = 1
" Enable Doxygen highlighting in supported languages
let g:load_doxygen_syntax = 1
" Search highlighting, press space to clear
set hlsearch
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" Lowercase searches are case-insensitive
set ignorecase
set smartcase
" File completion is case-insensitive
set wildignorecase
" Command-line completion shows matches in a popup menu
set wildmenu
if has('patch-8.2.4325')
set wildoptions=pum
endif
" Indentation defaults
set autoindent
set tabstop=4
set shiftwidth=4
set expandtab
let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
let g:EditorConfig_enable_for_new_buf = 1
" When joining lines, remove the second line's leading comment characters
set formatoptions+=j
" Disable error bells
set belloff=all
" Use the system clipboard for the default yank register
if has('win32') || has('osx')
set clipboard=unnamed
else
set clipboard=unnamedplus
endif
" Prefer user directory for swap instead of working dir
if has('win32')
set directory=$USERPROFILE/vimtemp,.
else
set directory=~/.vimtemp,.
endif
" Remove object files from file globs
set wildignore+=*.o
" Use project-specific spellfiles if present in the current directory.
" Based on https://superuser.com/a/716958/24336, but preserves the global
" spellfile that's alredy known to exist
let s:encoding = &l:fileencoding ==# '' ? &l:encoding : &l:fileencoding
let s:projectspellfile = getcwd() . '/.vimspell.' . s:encoding . '.add'
if filereadable(s:projectspellfile)
let &spellfile = s:projectspellfile.',~/.vim/spell/en.utf-8.add'
endif
" Include suggestions in completion results
set complete+=kspell
" Regenerate binary spell files if the .add files were modified
for d in glob('~/.vim/spell/*.add', 1, 1)
if filereadable(d) && (!filereadable(d . '.spl') || getftime(d) > getftime(d . '.spl'))
exec 'mkspell! ' . fnameescape(d)
endif
endfor
" Show a tree-style netrw listing
let g:netrw_home = '~/.netrw'
let g:netrw_liststyle = 3
let g:netrw_winsize = 30
let g:netrw_list_hide = netrw_gitignore#Hide()
" Toggle netrw with F7
nmap <F7> :Lexplore<CR>
" Toggle tagbar with F8
nmap <F8> :TagbarToggle<CR>
let g:ctrlp_working_path_mode = 'rw'
let g:ctrlp_show_hidden = 1
let g:ctrlp_user_command = ['.git', 'git -C %s ls-files -oc --exclude-standard']
" Only load requested linters
let g:ale_linters_explicit = 1
let g:ale_lint_delay = 1000
let g:ale_lint_on_text_changed = 'normal'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
" Automatically lint after switching back to a window
function! LintOnFocusGained()
if mode() ==# 'n'
execute 'ALELint'
endif
endfunction
augroup LintOnFocusGainedGroup
autocmd FocusGained * call LintOnFocusGained()
autocmd TabEnter * call LintOnFocusGained()
augroup END
let g:ale_completion_enabled = 1
set omnifunc=ale#completion#OmniFunc
" Don't prefill a new bitbake file
let g:bb_create_on_empty=0