-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
302 lines (270 loc) · 7.96 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
syntax on
colorscheme artefakt
scriptencoding utf-8
set encoding=utf-8
set hidden
set modeline
set cmdheight=1
set showtabline=2
set wildmenu
set ttyfast
set ttymouse=xterm2
set showcmd
set autoread
set nobackup
set nowritebackup
set noswapfile
set undofile
set undodir=$HOME/.vim/undodir
set autowrite
set backspace=indent,eol,start
set noerrorbells vb t_vb=
set mouse=a
set lazyredraw
set synmaxcol=140
set showmatch
set matchpairs+=<:>
set incsearch
set ignorecase
set hlsearch
set smartcase
set shiftwidth=2
set tabstop=2
set softtabstop=2
set expandtab
set shiftround
set smarttab
set nowrap
set linebreak
set ruler
set colorcolumn=140
set titlestring=%f title
set sidescroll=2
set number
set listchars=tab:·\ ,extends:,trail:·
set list
let &showbreak = '⤷ '
set breakindent
set fillchars=fold:-
set showmode
set formatoptions+=j
if !has('gui_running')
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
set termguicolors
set t_Co=256
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
let g:guicolors=1
set t_ZH=[3m
set t_ZR=[23m
endif
if &diff
set nocursorline
set norelativenumber
set foldcolumn=2
endif
set viewoptions=
\folds,
\options,
\cursor,
\unix,
\slash
vnoremap J :m '>+1<cr>gv=gv
vnoremap K :m '<-2<cr>gv=gv
cnoremap <c-p> <Up>
cnoremap <c-n> <Down>
if !has('gui_running')
function! ToggleCopyPasteMode()
set invpaste paste?
if &paste
setlocal clipboard=unnamed
else
setlocal clipboard=
endif
endfunction
map <silent> <F2> :call ToggleCopyPasteMode()<cr>
endif
function! ToggleHome()
let l:position = getpos('.')
execute 'normal! ^'
if l:position == getpos('.')
execute 'normal! 0'
endif
endfunction
nnoremap <silent> 0 :call ToggleHome()<cr>
function! s:WindowEnter()
if &number
setlocal relativenumber
endif
highlight CursorLineNR guibg=#2d2d2d guifg=#f5f5f5 gui=bold
setlocal cursorline
endfunction
function! s:WindowLeave()
if &number && &relativenumber
setlocal norelativenumber
endif
highlight CursorLineNR guibg=#242424 guifg=#f5f5f5 gui=bold
setlocal nocursorline
endfunction
if has('gui_running')
augroup CurrentWindow
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * call s:WindowEnter()
autocmd WinLeave * call s:WindowLeave()
augroup END
endif
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline' " https://github.com/vim-airline/vim-airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#tabline#buffer_nr_format = '%s '
let g:airline#extensions#tabline#fnamemod = ':t:.'
if !exists('g:airline_symbols')
let g:airline_symbols = {
\ 'linenr': '☰',
\ 'maxlinenr': '',
\ 'branch': '',
\ 'readonly': ''
\ }
endif
Plug 'vim-airline/vim-airline-themes' " https://github.com/vim-airline/vim-airline-themes
let g:airline_theme='minimalist'
Plug 'tpope/vim-commentary' " https://github.com/tpope/vim-commentary
Plug 'scrooloose/nerdtree' " https://github.com/scrooloose/nerdtree
nmap <silent> tt :NERDTreeToggle<cr>
nmap <silent> tf :NERDTreeFind<cr>
let g:NERDTreeIgnore = ['\.DS_Store$', '\Icon$', '\~$']
let g:NERDTreeShowBookmarks = 1
let g:NERDTreeBookmarksSort = 0
let g:NERDTreeMinimalUI = 1
Plug 'Xuyuanp/nerdtree-git-plugin' | Plug 'tpope/vim-fugitive' " https://github.com/Xuyuanp/nerdtree-git-plugin
let g:NERDTreeShowIgnoredStatus = 0
let g:NERDTreeUseSimpleIndicator = 0
let g:NERDTreeIndicatorMapCustom = {
\ 'Modified' : '~',
\ 'Staged' : '+',
\ 'Untracked' : '•',
\ 'Renamed' : '→',
\ 'Unmerged' : '═',
\ 'Deleted' : '-',
\ 'Dirty' : '×',
\ 'Clean' : '*',
\ 'Ignored' : '¬',
\ 'Unknown' : '?'
\ }
Plug 'airblade/vim-gitgutter' | Plug 'tpope/vim-fugitive' " https://github.com/airblade/vim-gitgutter
let g:gitgutter_sign_added = '·'
let g:gitgutter_sign_modified = '·'
let g:gitgutter_sign_removed = '·'
let g:gitgutter_sign_removed_first_line = '·'
let g:gitgutter_sign_modified_removed = '·'
Plug 'Valloric/YouCompleteMe', {
\ 'do': './install.py --go-completer --rust-completer --java-completer --clangd-completer'
\ }
let g:ycm_error_symbol = '!'
let g:ycm_warning_symbol = '△'
let g:ycm_semantic_triggers = {}
let g:ycm_filetype_specific_completion_to_disable = {
\ 'gitcommit': 1
\ }
let g:ycm_add_preview_to_completeopt = 1
let g:ycm_confirm_extra_conf = 0
let g:ycm_always_populate_location_list = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 1
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_mappings_filetypes = ['typescript', 'javascript', 'python', 'rust', 'go']
function! MapYcmCompleter()
if (!empty(&filetype) && join(g:ycm_mappings_filetypes) =~ &filetype)
noremap <buffer> <silent> <C-LeftMouse> :YcmCompleter GoToDefinition<cr>
nnoremap <buffer> <silent> <M-LeftMouse> :YcmCompleter GoToReferences<cr>
nmap <buffer> <silent> <C-]> :YcmCompleter GoToDefinition<cr>
nmap <buffer> <silent> gr :YcmCompleter GoToReferences<cr>
nmap <buffer> <silent> ty :YcmCompleter GetType<cr>
endif
endfunction
augroup MapYcmCompleter
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * call MapYcmCompleter()
augroup END
Plug 'ctrlpvim/ctrlp.vim' " https://github.com/ctrlpvim/ctrlp.vim
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_root_markers = ['package.json']
let g:ctrlp_custom_ignore = 'node_modules\|bower_components\|DS_Store\|git'
let g:ctrlp_user_command = ['.git/', 'git ls-files -oc --exclude-standard']
let g:ctrlp_cmd = 'call CallCtrlP()'
func! CallCtrlP()
if exists('s:called_ctrlp')
CtrlPLastMode
else
let s:called_ctrlp = 1
CtrlPMRU
endif
endfunc
Plug 'juszczak/semantic-highlight.vim' " https://github.com/jaxbot/semantic-highlight.vim
let g:semantic_highlight_filetypes = [
\ 'typescript',
\ 'javascript',
\ 'python',
\ 'rust',
\ 'java',
\ 'dart',
\ 'go',
\ 'erlang',
\ 'solidity',
\ 'haskell',
\ 'lua'
\ ]
function! s:Escape()
if (!empty(&filetype) && join(g:semantic_highlight_filetypes) =~ &filetype)
:SemanticHighlight
endif
endfunction
augroup SemanticHighlightFiletypeEvents
autocmd!
autocmd FileType * :call s:Escape()
autocmd InsertLeave,InsertEnter * :call s:Escape()
augroup END
Plug 'editorconfig/editorconfig-vim' " https://github.com/editorconfig/editorconfig-vim
Plug 'w0rp/ale' " https://github.com/w0rp/ale
let g:ale_sign_error = '!'
let g:ale_sign_warning = '!'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
nmap <silent> [a <Plug>(ale_previous_wrap)
nmap <silent> ]a <Plug>(ale_next_wrap)
let g:ale_fixers = {
\ 'typescript': ['tslint'],
\ 'scss': ['stylelint'],
\ }
let g:ale_completion_enabled = 0
let g:ale_fix_on_save = 0
let g:ale_dart_dartanalyzer_executable = '/usr/local/bin/dartanalyzer'
let g:ale_linters = {
\ 'javascript': ['tsserver'],
\ }
Plug 'sbdchd/neoformat' " https://github.com/sbdchd/neoformat
let g:neoformat_enabled_typescript = ['prettier']
let g:neoformat_enabled_javascript = ['prettier']
let g:format_on_save_filetypes = ['dart', 'go']
Plug 'alvan/vim-closetag' " https://github.com/alvan/vim-closetag
Plug 'jiangmiao/auto-pairs' " https://github.com/jiangmiao/auto-pairs
Plug 'tpope/vim-surround' " https://github.com/tpope/vim-surround
Plug 'tmhedberg/matchit' " https://github.com/tmhedberg/matchit
Plug 'Valloric/MatchTagAlways' " https://github.com/Valloric/MatchTagAlways
Plug 'kshenoy/vim-signature' " https://github.com/kshenoy/vim-signature
let g:SignatureMarkTextHLDynamic = 1
Plug 'ap/vim-css-color' " https://github.com/ap/vim-css-color
Plug 'mbbill/undotree' " https://github.com/mbbill/undotree
Plug 'tpope/vim-scriptease' " https://github.com/tpope/vim-scriptease
call plug#end()