-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
197 lines (158 loc) · 4.88 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
"
" Vundle + plugins
"
set nocompatible
filetype off
let g:polyglot_disabled = ['javascript', 'javascriptreact', 'json', 'kotlin', 'typescript', 'typescriptreact']
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'wincent/command-t'
Plugin 'preservim/nerdtree'
Plugin 'sheerun/vim-polyglot'
Plugin 'elzr/vim-json'
Plugin 'yuezk/vim-js'
Plugin 'HerringtonDarkholme/yats.vim'
Plugin 'maxmellon/vim-jsx-pretty'
Plugin 'samtheprogram/kotlin-vim'
Plugin 'neoclide/coc.nvim'
call vundle#end()
filetype plugin indent on
syntax on
let g:javascript_plugin_jsdoc = 1
let g:javascript_plugin_ngdoc = 1
let g:vim_json_syntax_conceal = 0
"
" Workarounds
"
set backspace=indent,eol,start
"
" General
"
set backspace=indent,eol,start
set re=0
set showtabline=2
set number
set noruler " splits (+ coc?) breaks ruler
set laststatus=2 " always show statusline
set colorcolumn=101
" remove & add so vimrc can be sourced repeatedly
set statusline-=\ %l\,%c " custom ruler
set statusline+=\ %l\,%c " custom ruler
set statusline-=\ %f " add filename
set statusline+=\ %f " add filename
fun! WordWrap()
set nolist " just in case it's been switched on to see tabs + newlines
set linebreak
set wrap
set textwidth?
endfun
set tabstop=8
set shiftwidth=2
set softtabstop=-1 " insert mode only: treat shiftwidth # of spaces as a tab
set expandtab
fun! HardTabs()
set noexpandtab
set shiftwidth=8
set softtabstop=0
endfun
map \R :source $HOME/.vimrc<CR>
nn \d :nohlsearch<CR>
nn \2 :setlocal shiftwidth=2<CR>
nn \4 :setlocal shiftwidth=4<CR>
nn \<TAB> :set shiftwidth=8 softtabstop=0 noexpandtab<CR>
nn \<S-TAB> :set shiftwidth=2 softtabstop=-1 expandtab<CR>
nn \\<TAB> :set foldmethod=indent<CR>
nn \a :! git add %<CR>
nn \B :! git blame %<CR>
nn \Dd :! git diff %<CR>
nn \DD :! git diff<CR>
nn \c :! git rebase --continue<CR>
nn \C :! git commit<CR>
nn \s :! git status<CR>
nn \U :! git add -u<CR>
nn \< /<<<<<<CR>
"
" Kotlin
"
autocmd BufReadPost *.kt setlocal filetype=kotlin
autocmd FileType kotlin setlocal shiftwidth=4
autocmd FileType kotlin setlocal cinoptions=+8 " intellij-style continuation indent
autocmd BufReadPost *ServerApplication.kt setlocal paste
autocmd BufReadPost application.properties setlocal noeol
autocmd BufReadPost application.properties setlocal nofixendofline
"
" NERDTree
"
map <C-n> :NERDTreeToggle<CR>
"
" command-t
"
set wildignore+=*/node_modules
set wildignore+=*/build
set wildignore+=*/dist
" typescript-specific wildignore stuff
let s:MY_typescriptArtifactExtensions = ['*.d.ts', '*.map', '*.js']
fun! ToggleIgnoreTypescriptArtifacts()
for ext in s:MY_typescriptArtifactExtensions
if &wildignore =~ ext
execute 'set wildignore-='.ext
else
execute 'set wildignore+='.ext
endif
endfor
endfun
if filereadable(expand("tsconfig.json"))
call ToggleIgnoreTypescriptArtifacts()
endif
" TODO: seems like command-t doesn't support wildignore changes after startup
nmap \j :call ToggleIgnoreTypescriptArtifacts()<CR>
let g:CommandTTraverseSCM="pwd"
"
" coc
"
" TextEdit might fail if hidden is not set
set hidden
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=4
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience
set updatetime=1000
" Don't pass messages to |ins-completion-menu|
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostic appear/become resolved.
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Use <cr> to confirm completion
inoremap <expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<CR>"
" Use `[g` and `]g` to navigate diagnostics
" NOTE: swapped chars / changed to match Zed shortcut
nmap <silent> g[ <Plug>(coc-diagnostic-prev)
nmap <silent> g] <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
" NOTE: changed to match Zed shortcut
nmap <silent> gI <Plug>(coc-implementation)
nmap <silent> gA <Plug>(coc-references)
" NOTE: [...] this coc config is abridged here
" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" NOTE: [...] this coc config is abridged here