-
Notifications
You must be signed in to change notification settings - Fork 0
/
skinnyvimrc
executable file
·296 lines (257 loc) · 8.98 KB
/
skinnyvimrc
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
" Skinny vimrc: no airline and doesn't require terminal download for nord
" (uses one dark)
filetype plugin indent on
set tabstop=2
set shiftwidth=2
set expandtab
set splitright
set nornu
set synmaxcol=300
set ttyfast " u got a fast terminal
set ttyscroll=3
set lazyredraw " to avoid scrolling problems
xnoremap p pgvy
let mapleader = "\<Space>"
nnoremap <leader>pr :Neoformat<CR>
nnoremap <leader>vs :vsp<CR>
nnoremap <leader>sp :sp<CR>
nnoremap <leader>w :w<CR>
nnoremap <leader>wq :wq<CR>
nnoremap <leader>w :w <CR>
nnoremap <leader>l :CtrlP <C-R>=expand("%:p:h") . "/" <CR><CR>
nnoremap <leader>gs :Gstatus <CR>
nnoremap <leader>gc :Gcommit <CR>
nnoremap <leader>gb :Gblame<CR>
nnoremap <leader>ga :!git add .<CR>
nnoremap <leader>gd :Gdiff<CR>
nnoremap <leader>gp :Gpush origin HEAD<CR>
nnoremap <leader>gl :0Gclog<CR>
nnoremap <leader>' <C-W><C-W>
nnoremap <leader>; <C-W>h
nnoremap <leader>1 <C-W><C-H>
" Load vim-plug - install if not present
" vim
if empty(glob("~/.vim/autoload/plug.vim"))
execute '!curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
endif
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
" Git things
Plug 'tpope/vim-fugitive'
Plug 'xolox/vim-notes'
Plug 'xolox/vim-misc'
Plug 'gabrielelana/vim-markdown'
" Fuzzy search folder tree
Plug 'ctrlpvim/ctrlp.vim'
" Allows you to prefix movements with ',' to move through
" CamelCased/snake_cased word movements (e.g. ,w ,b ,e)
Plug 'vim-scripts/camelcasemotion'
" Nicely formats JSON
Plug 'leshill/vim-json'
" LSP
"Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
"https://github.com/ycm-core/YouCompleteMe/issues/914
Plug 'ycm-core/YouCompleteMe'
" Press ctrl+n to browse directory tree
Plug 'scrooloose/nerdtree'
" Shows changes to git repo files in nerdtree
Plug 'Xuyuanp/nerdtree-git-plugin'
" COLORS
" Status bar
Plug 'vim-scripts/CSApprox'
Plug 'joshdick/onedark.vim'
" Improved syntax highlighting
Plug 'sheerun/vim-polyglot'
" post install (yarn install | npm install) then load plugin only for editing supported files
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install --frozen-lockfile --production',
\ 'for': ['javascript', 'typescript', 'tsx', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'svelte', 'yaml', 'html'] }
Plug 'sbdchd/neoformat'
Plug 'dkprice/vim-easygrep'
" Fuzzy find
" Ag required, on timeshare use conda to download
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'ryanoasis/vim-devicons'
" CSE 130 C shit
Plug 'mechatroner/minimal_gdb'
" All of your Plugins must be added before the following line
call plug#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Plugged package manager commands
" :PlugList - lists configured plugins
" :PlugInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PlugSearch foo - searches for foo; append `!` to refresh local cache
" :PlugClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
let g:neoformat_try_node_exe = 1
map <C-t> :TagbarToggle<CR>
let g:tagbar_show_linenumbers = -1
" NERDTree shit
" Toggle NERDTree with Ctrl+n
if has('nvim')
nnoremap <C-n> :CHADopen<CR>
else
map <C-n> :NERDTreeToggle<CR>
endif
" Ignore certain files in NERDTree
let NERDTreeIgnore = ['\.pyc$','\.class$']
" Show relative line numbers in NERDTree
" enable line numbers
let NERDTreeShowLineNumbers=1
" ctrlp shit
" Force files searched for to be open in a new buffer,
" even if they're already open in another split
let g:ctrlp_switch_buffer = 0
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|py_modules'
" don't make git repo the working directory
let g:ctrlp_working_path_mode = ''
"ignore subdirectory stuff using .gitignore
let g:ctrlp_user_command = [
\ '.git', 'cd %s && git ls-files . -co --exclude-standard',
\ 'find %s -type f'
\ ]
let g:lsp_diagnostics_echo_cursor = 1
let g:lsp_log_verbose = 1
let g:lsp_log_file = expand('~/vim-lsp.log')
let g:lsp_diagnostics_enabled = 1
" for asyncomplete.vim log
let g:asyncomplete_log_file = expand('~/asyncomplete.log')
" Enable filetype plugin
filetype on
filetype plugin on
filetype indent on
" COLORS
" Turn on syntax highlighting
syntax on
colorscheme onedark
" Color scheme
:hi Comment gui=italic cterm=italic term=italic
"idk if these are necessary below
set encoding=UTF-8
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
highlight Comment gui=italic
highlight Comment cterm=italic
" autoindent stuff as you are coding
set autoindent
" json highlighting
au! BufRead,BufNewFile *.json set filetype=json "foldmethod=syntax
let g:lsp_document_highlight_enabled = 1
" highlight lspReference ctermfg=red guifg=red ctermbg=green guibg=green
" python
let g:neoformat_enabled_python = ['autopep8', 'yapf', 'docformatter']
let g:neoformat_enabled_javascript = ['prettier', 'eslint_d']
" convert tabs to spaces
map <LocalLeader>kt :%s/\t/ /g<CR>
" set history to be longer
set history=1000
" shut the F*** up
set visualbell
" Highlight text that goes beyond 90 char column limit
"highlight OverLength ctermbg=red ctermfg=white guibg=#592929
"match OverLength /\%91v.\+/
" Automatically show line numbers
set nu
" OPTIONAL: This enables automatic indentation as you type.
filetype indent on
let g:notes_suffix = '.txt'
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
set backspace=indent,eol,start
" Jump to the next or previous line that has the same level or a lower
" level of indentation than the current line.
"
" exclusive (bool): true: Motion is exclusive
" false: Motion is inclusive
" fwd (bool): true: Go to next line
" false: Go to previous line
" lowerlevel (bool): true: Go to line with lower indentation level
" false: Go to line with the same indentation level
" skipblanks (bool): true: Skip blank lines
" false: Don't skip blank lines
function! NextIndent(exclusive, fwd, lowerlevel, skipblanks)
let line = line('.')
let column = col('.')
let lastline = line('$')
let indent = indent(line)
let stepvalue = a:fwd ? 1 : -1
while (line > 0 && line <= lastline)
let line = line + stepvalue
if ( ! a:lowerlevel && indent(line) == indent ||
\ a:lowerlevel && indent(line) < indent)
if (! a:skipblanks || strlen(getline(line)) > 0)
if (a:exclusive)
let line = line - stepvalue
endif
exe line
exe "normal " column . "|"
return
endif
endif
endwhile
endfunction
" To use:
" 1. Move to the window to mark for the swap via ctrl-w movement
" 2. Type \mw
" 3. Move to the window you want to swap
" 4. Type \pw
" Always display the statusline:
:set laststatus=2
" Incremental searching - start search as soon as first char entered after /
set incsearch
" Highlight search matchces
set hlsearch
" Clear search highlight after hitting enter in normal mode
nnoremap <CR> :noh<CR><CR>
" Search for word under cursor
nnoremap <silent> <Leader>ag :Ag <C-R><C-W><CR>
" Don't suggest filenames with these extensions when vs or sp or edit etc.
set wildignore+=*.pdf,*.d,*.o,*.pyc,*.jpg,*.jpeg,*.png,*.class,*.output,*.DS_Store,
if executable('pyls')
" pip install python-language-server
au User lsp_setup call lsp#register_server({
\ 'name': 'pyls',
\ 'cmd': {server_info->['pyls']},
\ 'allowlist': ['python'],
\ })
endif
function! s:on_lsp_buffer_enabled() abort
setlocal omnifunc=lsp#complete
setlocal signcolumn=yes
if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
nmap <buffer> gd <plug>(lsp-definition)
nmap <buffer> gs <plug>(lsp-document-symbol-search)
nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
nmap <buffer> gr <plug>(lsp-references)
nmap <buffer> gi <plug>(lsp-implementation)
nmap <buffer> gt <plug>(lsp-type-definition)
nmap <buffer> <leader>rn <plug>(lsp-rename)
nmap <buffer> [g <plug>(lsp-previous-diagnostic)
nmap <buffer> ]g <plug>(lsp-next-diagnostic)
nmap <buffer> K <plug>(lsp-hover)
inoremap <buffer> <expr><c-f> lsp#scroll(+4)
inoremap <buffer> <expr><c-d> lsp#scroll(-4)
" Asyncomplete
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>"
let g:lsp_format_sync_timeout = 1000
autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
" refer to doc to add more commands
endfunction
augroup lsp_install
au!
" call s:on_lsp_buffer_enabled only for languages that has the server registered.
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END