-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
315 lines (251 loc) · 7.1 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
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
set nocompatible " be iMproved, required
filetype off
runtime macros/matchit.vim
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
if has('macunix')
set rtp+=/usr/local/opt/fzf
else
set rtp+=~/.fzf
endif
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" languages
" all
Plugin 'scrooloose/syntastic'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'w0rp/ale'
Plugin 'valloric/youcompleteme'
" javascript
Plugin 'pangloss/vim-javascript', {'for': 'javascript'}
" Plugin 'walm/jshint.vim', {'for': 'javascript'}
Plugin 'eslint/eslint', {'for': 'javascript'}
Plugin 'moll/vim-node', {'for': 'javascript'}
Plugin 'elzr/vim-json'
" typescript
Plugin 'leafgarland/typescript-vim', {'for': 'typescript'}
Plugin 'quramy/tsuquyomi', {'for': 'typescript'}
" haskell
Plugin 'neovimhaskell/haskell-vim', {'for': 'haskell'}
" html
Plugin 'docunext/closetag.vim'
" sql
Plugin 'Align'
Plugin 'dbext.vim'
Plugin 'SQLUtilities'
" terraform
Plugin 'hashivim/vim-terraform'
.
" productivity
Plugin 'junegunn/fzf.vim'
Plugin 'mileszs/ack.vim'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'nelstrom/vim-visual-star-search'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-abolish'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat'
Plugin 'vim-utils/vim-husk'
Plugin 'tpope/vim-dispatch'
Plugin 'machakann/vim-swap'
Plugin 'tpope/vim-rhubarb'
Plugin 'tpope/vim-eunuch'
"snippets
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
" formating
Plugin 'godlygeek/tabular'
Plugin 'prettier/vim-prettier'
" config
Plugin 'thinca/vim-localrc'
" themes - colourtokens
Plugin 'rakr/vim-one'
Plugin 'chriskempson/base16-vim'
" repl
Plugin 'jpalardy/vim-slime'
" status
Plugin 'itchyny/lightline.vim'
Plugin 'maximbaz/lightline-ale'
call vundle#end() " required
filetype plugin indent on " required
" indentation stuff
set smartindent
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" cursor
set cursorline
" quirks
set backspace=2 " make backspace work like most other apps
set complete+=k " dictionary autocomplete
set completeopt-=preview " disable preview window
set number " view line numbers
set ruler " view current position
highlight LineNr ctermfg=grey
set listchars=tab:▸▸,trail:~ " nicer whitespace chars
set list " show whitespace
set mouse=nv " allow mouse
" skip backup & swap files
set nobackup
set nowritebackup
set noswapfile
" save readonly files with sudo using w!!
cmap w!! %!sudo tee > /dev/null %
set exrc " allow per folder configs
set secure " disallow dangerous commands in per folder configs
syntax enable
set background=dark
" safely set colorscheme
try
" colorscheme one
colorscheme base16-default-dark
catch
endtry
if (has("termguicolors"))
set termguicolors
endif
hi Normal guibg=black
" custom key mappings
" fuzzy-finder
nnoremap <C-p> :Files<CR>
nnoremap <C-b> :Buffers<CR>
nnoremap <leader>hc :History:<CR>
nnoremap <leader>hs :History/<CR>
" navigation
" windows
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" last two files
nnoremap <leader><leader> <C-^>
" general
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%' " expand %% to current dir
vnoremap <C-c> "+y " use os copy shortcut
let mapleader=","
map <leader>g :Ack<space>
map <leader>r :source ~/.vimrc<CR>
map <leader>e :e ~/.vimrc<CR>
map <leader>w :w<CR>
map <leader>q :q<CR>
" repeat last command with the same params
nnoremap & :&&<CR>
xnoremap & :&&<CR>
" formatting
map <leader>pj :%!jq '.'<CR>
map <leader>px :%!xmllint --format -<CR>
" open new split panes to right and bottom
set splitbelow
set splitright
" do not redraw screen in the middle of a macro
set lazyredraw
" smart search
set ignorecase
set smartcase
set incsearch
" case intelligent auto complete
set infercase
set hls " highlight search results
nnoremap <space> :let @/ = ""<CR><space> " clear last used search pattern
set pastetoggle=<f5>
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.idea/*,*/.DS_Store,*/vendor,*/node_modules,*/log,*/logs,tags,*/.nyc_output,*/lcov-report,*/.cache-loader,*/.webpack,*/.serverless
set wildmenu
set wildmode=full
set history=200 " increase command history
set laststatus=2
" folds
set foldmethod=syntax
set foldlevel=20
" ctags
nnoremap <f5> :!ctags -R<CR>
" quick-fix
nnoremap <F9> :YcmCompleter FixIt<CR>
nnoremap <leader>x :cclose<CR>
" code navigation
nnoremap <leader>cd :YcmCompleter GoToDefinition<CR>
nnoremap <leader>cr :YcmCompleter GoToReferences<CR>
nnoremap <leader>ts :TsuSearch
" linting
nnoremap <leader>ln :ALENext<CR>
nnoremap <leader>lp :ALEPrevious<CR>
nnoremap <leader>lt :ALEToggle<CR>
nnoremap <leader>lf :ALEFix<CR>
" plugins
" syntastic
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
" syntastic
" disable linting
let g:syntastic_check_on_open = 0
let g:syntastic_javascript_checkers = []
let g:syntastic_typescript_checkers = []
" typecript
" let g:tsuquyomi_disable_quickfix = 1
" haskell
let g:haskell_indent_case_alternative = 1
let g:haskell_indent_in = 0
let g:haskell_indent_before_where = 2
let g:haskell_indent_after_bare_where = 2
" ale
let g:ale_linters = {
\'javascript': ['prettier'],
\'typescript': ['tsuquyomi', 'tslint'],
\'python': ['flake8']
\}
let g:ale_fixers = {
\'*': ['remove_trailing_lines', 'trim_whitespace'],
\'javascript': ['standard'],
\'typescript': ['tslint'],
\'python': ['autopep8', 'isort']
\}
let g:ale_lint_on_text_changed = 'always'
" let g:ale_fix_on_save = 1
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 0
" prettier
let g:prettier#autoformat = 0
let g:prettier#exec_cmd_async = 1
" youcompleteme
let g:ycm_key_list_select_completion = []
" slime
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": "default", "target_pane": "{right-of}"}
let g:slime_dont_ask_default = 1
" sql
let g:dbext_default_profile_localhost = 'type=MYSQL:user=root:passwd=root:port=3306:host=localhost'
let g:dbext_default_profile = 'localhost'
let g:sqlutil_align_where = 0
let g:sqlutil_align_comma = 1
" lightline
let g:lightline = { 'colorscheme': 'one' }
let g:lightline.component_expand = {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ }
let g:lightline.component_type = {
\ 'linter_checking': 'left',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'left',
\ }
let g:lightline.active = { 'right': [
\ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ],
\ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ],
\ ] }
" lightline ale icons
let g:lightline#ale#indicator_checking = "\uf110 "
let g:lightline#ale#indicator_warnings = "\uf071 "
let g:lightline#ale#indicator_errors = "\uf05e "
let g:lightline#ale#indicator_ok = "\uf00c "
let g:terraform_fmt_on_save=1