-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
290 lines (228 loc) · 6.15 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
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
language en_US.UTF-8
""" Basics
" Disable Vi compatibility mode.
set nocompatible
" Enable file type plugins.
filetype detect
" Load Vim default configuration.
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
" Enable hidden buffers.
set hidden
" Show line numbers.
set number
" Always show the sign column.
set signcolumn=yes
" Highlight search results.
set hlsearch
" Ignore case when searching, unless the search term
" contains at least one capital letter.
set ignorecase
set smartcase
" Use two-space indentation by default.
set tabstop=2 shiftwidth=2 expandtab smarttab
" Put swapfiles into a dedicated folder, rather than using
" the same folder as the actual file.
set directory^=$HOME/.vim/tmp//
" Enable persistent undo.
set undodir=$HOME/.vim/undo
set undofile
" Customize completion in the Ex command line.
set wildmode=longest,list
" Decrease the update time (milliseconds of inactivity before
" updating the swap file). Also used by some plugins.
set updatetime=500
" Don't show messages from ins-completion-menu in command line.
set shortmess+=c
" Disable line wrapping and tweak horizontal scrolling.
set nowrap
set sidescroll=1
" Use the space key as <leader>.
let mapleader = " "
" Open horizontal splits below the current window rather than above.
set splitbelow
""" GUI
" Font
set guifont=Menlo:h13,UbuntuMono-Regular:h14
" Disable all scrollbars
set guioptions-=l
set guioptions-=r
set guioptions-=L
set guioptions-=R
" Disable GUI cursor blinking
:set guicursor+=a:blinkon0
""" Statusline
" Left
set statusline=
set statusline+=\ \ %f
set statusline+=\ %m
" Right
set statusline+=%=
set statusline+=%{FugitiveStatusline()}
set statusline+=\ %y
set statusline+=\ %3l:%2c
set statusline+=\ \ %*
" Truecolor
if exists('+termguicolors')
let &t_8f="\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b="\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
" Plugin Preconfiguration (before load)
" lightline.vim
let g:lightline = {
\ 'active': {
\ 'left': [
\ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified' ],
\ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ],
\ ],
\ },
\ 'component_expand': {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_infos': 'lightline#ale#infos',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ },
\ 'component_type': {
\ 'linter_checking': 'right',
\ 'linter_infos': 'right',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'right',
\ },
\ }
""" Plugins
call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'bkad/CamelCaseMotion'
Plug 'hashivim/vim-terraform'
Plug 'itchyny/lightline.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'junegunn/goyo.vim'
Plug 'lambdalisue/fern.vim'
Plug 'maximbaz/lightline-ale'
Plug 'mileszs/ack.vim'
Plug 'ntpeters/vim-better-whitespace'
Plug 'sheerun/vim-polyglot'
Plug 'ton/vim-alternate'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-vinegar'
" ALE
let g:ale_completion_enabled = 1
Plug 'dense-analysis/ale'
" Color schemes
Plug 'ayu-theme/ayu-vim'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'lifepillar/vim-solarized8'
Plug 'rakr/vim-one'
Plug 'NLKNguyen/papercolor-theme'
call plug#end()
""" Plugin configuration
" ALE
let g:ale_sign_column_always = 1
let g:ale_floating_preview = 1
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─']
" Better Whitespace
let g:strip_whitespace_on_save = 1
let g:better_whitespace_filetypes_blacklist = ['diff', 'gitcommit', 'unite', 'qf', 'help']
" FZF
let $FZF_DEFAULT_COMMAND='rg --files --follow'
" NERDTree
let NERDTreeHijackNetrw = 0
" PaperColor
let g:PaperColor_Theme_Options = {
\ 'theme': {
\ 'default': {
\ 'allow_bold': 0
\ }
\ }
\ }
" Prettier
let g:prettier#autoformat_config_present = 1
let g:prettier#autoformat_require_pragma = 0
let g:prettier#exec_cmd_async = 1
" vim-better-whitespace
let g:better_whitespace_enabled=1
let g:strip_whitespace_on_save=1
let g:strip_whitespace_confirm=0
""" Color Scheme
" Disable Truecolor in Terminal.app (as it doesn't support it)
if $TERM_PROGRAM == 'Apple_Terminal'
set notermguicolors
end
function! Light()
set background=light
colorscheme PaperColor
endfunction
function! Dark()
set background=dark
colorscheme dracula
endfunction
" Define mappings to quickly switch between light and dark mode
command! Light :call Light()
command! Dark :call Dark()
" Choose the scheme to enable on startup
call Dark()
""" Key Mappings
" Ack.vim
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" ALE
nnoremap <silent> gd :ALEGoToDefinition<CR>
nnoremap <silent> K :ALEHover<CR>
nnoremap <leader>ci :ALEImport<CR>
nnoremap <leader>cf :ALEFix<CR>
nnoremap <leader>cr :ALERename<CR>
nnoremap <leader>ca :ALECodeAction<CR>
nnoremap <leader>ee :ALEDetail<CR>
nnoremap <leader>en :ALENext<CR>
nnoremap <leader>ep :ALEPrevious<CR>
" CamelCaseMotion
map <silent> <leader>w <Plug>CamelCaseMotion_w
map <silent> <leader>e <Plug>CamelCaseMotion_e
map <silent> <leader>ge <Plug>CamelCaseMotion_ge
" fern.vim
nnoremap <leader>- :Fern . -reveal=%<CR>
nnoremap <leader>fd :Fern . -drawer -reveal=%<CR>
" fugitive.vim
nnoremap <C-x>g :Git<CR>
nnoremap <leader>gs :Git<CR>
" fzf
map <C-P> :Files<CR>
map <C-x>b :Buffers<CR>
map <leader>fb :Buffers<CR>
map <leader>fg :Rg<CR>
" vim-alternate
nmap <leader>aa :Alternate<CR>
" vim-commentary
nmap <D-/> gcc
vmap <D-/> gc
" NERDTree
map <C-N> :NERDTreeToggle<CR>
" Terminal
function! Term()
let l:window = 1
let l:window_count = winnr('$')
while l:window <= window_count
let l:window_buffer = winbufnr(l:window)
if bufname(l:window_buffer) =~ '^!/'
execute l:window . "wincmd w"
return
endif
let l:window += 1
endwhile
:term++rows=10
endfunction
map <leader>t :call Term()<CR>