-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
269 lines (228 loc) · 7.21 KB
/
Copy pathvimrc
File metadata and controls
269 lines (228 loc) · 7.21 KB
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
" automagically install a vim plug plugin manager
" https://github.com/junegunn/vim-plug
let vimplug_exists=expand('~/.vim/autoload/plug.vim')
if !filereadable(vimplug_exists)
if !executable("curl")
echoerr "Install curl"
execute "q!"
endif
echo "Installing junegunn/vim-plug"
echo ""
silent !\curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall
endif
set encoding=utf-8
" Install all the plugins
call plug#begin('~/.vim/plugged')
Plug 'kien/rainbow_parentheses.vim'
Plug 'majutsushi/tagbar'
Plug 'scrooloose/nerdcommenter'
Plug 'ntpeters/vim-better-whitespace'
Plug 'xuhdev/SingleCompile'
"Plug 'flazz/vim-colorschemes'
Plug 'fatih/vim-go'
Plug 'easymotion/vim-easymotion'
Plug 'Vimjas/vim-python-pep8-indent'
Plug 'w0rp/ale'
" Plug 'bluz71/vim-moonfly-colors'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'catppuccin/vim', { 'as': 'catppuccin' }
Plug 'rking/ag.vim'
"Plug 'elixir-editors/vim-elixir'
Plug 'ziglang/zig.vim'
Plug 'rust-lang/rust.vim'
Plug 'preservim/nerdtree'
Plug 'Valloric/YouCompleteMe'
Plug 'vimwiki/vimwiki'
Plug 'Yggdroot/indentLine'
call plug#end()
set nu
"syntax enable
filetype on
filetype plugin on
" this is my 'theme'
" tab bar colors
highlight TabLine ctermfg=White ctermbg=none cterm=none
highlight TabLineSel ctermfg=Red ctermbg=none cterm=none
highlight TabLineFill ctermfg=none ctermbg=none cterm=none
" status bar
highlight statusline ctermfg=Red ctermbg=none cterm=none
set laststatus=2
set statusline=%<%f\ %h%M%r%=%-14.(%l,%c%V%)\ %p%%
set cc=80
set autoindent
set smartindent
set expandtab
set showmatch
set cursorline
set ts=4
set sts=4
set sw=4
set splitbelow
set splitright
set showcmd
set smartcase
set modelines=0
set nomodeline
set number relativenumber
set encoding=utf-8
set fileencodings=utf-8,iso-2022-jp,euc-jp,sjis
set fileformats=unix,dos,mac
set termguicolors
" display the paste information in the status line
nnoremap <F2> :set invpaste paste?<CR>
" :set paste/nopaste toggle
set pastetoggle=<F2>
"colorscheme monokain
"colorscheme moonfly
" Set dracula_italic before changing the colorscheme to disable bg highlights
"let g:dracula_colorterm = 0
"let g:dracula_italic = 0
"colorscheme dracula
colorscheme catppuccin_mocha
"highlight Normal guibg=NONE ctermbg=NONE
"highlight NonText ctermbg=none
" brighter purple
"highlight Comment ctermfg=104
autocmd BufRead,BufNewFile *.csv,*.tsv, set filetype=csv
autocmd FileType csv set noexpandtab
autocmd BufRead,BufNewFile *.sls set filetype=yaml
autocmd BufRead,BufNewFile *.asm set filetype=nasm nospell
" tabs for go and make files
autocmd FileType go set noexpandtab
autocmd FileType make set noexpandtab
" Go does CamelCase instead of underscore, so identifiers often get marked as mistakes.
autocmd FileType go set nospell
" 2 spaces instead of 4 spaces
autocmd FileType racket set ts=2 sts=2 sw=2
autocmd FileType html set ts=2 sts=2 sw=2
autocmd FileType yaml set ts=2 sts=2 sw=2
autocmd FileType json set ts=2 sts=2 sw=2
" please don't put comments at the start of the line for python
au! FileType python setl nosmartindent
let mapleader=","
imap jj <esc>
" python quick pdb
imap <Leader>p import pdb; pdb.set_trace()<enter><esc>
noremap <Leader>p oimport pdb; pdb.set_trace()<esc>
" go quick fill structs
imap <Leader>f <esc> :GoFillStruct<enter>
noremap <Leader>f :GoFillStruct<enter>
" spell check
set spell spelllang=en_us
highlight clear SpellBad
highlight clear SpellCap
highlight clear SpellLocal
highlight clear SpellRare
highlight SpellBad cterm=underline ctermfg=red
" word wrapping on cursor movement
set whichwrap+=<,>,h,l,[,]
" 256 color term
set t_Co=256
" switching between panes easier
noremap <C-l> <C-w>l
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
" tab control
noremap <leader>x :tabnext<CR>
noremap <leader>z :tabprevious<CR>
noremap <leader>n :tabnew<CR>
noremap <leader>q :tabclose<CR>
" Center the cursor after every up/down.
noremap j jzz
noremap k kzz
"""""""""""""""""""""""""""""
" plugins "
"""""""""""""""""""""""""""""
" vim-better-whitespace
let g:better_whitespace_enabled=1
let g:strip_whitespace_on_save=1
let g:strip_whitelines_at_eof=1
let g:strip_whitespace_confirm=0
highlight ExtraWhitespace ctermbg=blue
" rainbow-parentheses
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
" rainbow-parentheses color definitions
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
" Tagbar
nmap <F8> :TagbarToggle<CR>
" SingleCompile
imap <F6> <esc>:w<cr>:SCCompile<cr>
imap <F5> <esc>:w<cr>:SCCompileRun<cr>
nmap <F6> :SCCompile<cr>
nmap <F5> :SCCompileRun<cr>
" ycm
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_gopls_binary_path = "$GOPATH/bin"
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
" vim-go
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
let g:go_auto_type_info = 1
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1
let g:go_imports_autosave = 1
let g:go_doc_keywordprg_enabled = 1
let g:go_fmt_command="gopls"
let g:go_gopls_gofumpt=1
" rust.vim
let g:rustfmt_autosave = 1
"let g:deoplete#enable_at_startup = 1
" ale
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s'
" astyle needs an ~/.astylerc because the defaults are not very opinionated.
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'python': ['ruff_format', 'ruff'],
\ 'sh': ['shfmt'],
\ 'c': ['clang-format'],
\ 'cpp': ['clang-format'],
\ 'html': ['prettier'],
\ 'javascript': ['prettier'],
\ 'typescript': ['prettier'],
\ 'yaml': ['prettier'],
\}
"\ 'lua': ['stylua'],
"let g:ale_python_isort_options="--black"
let g:ale_fix_on_save = 1
let g:ag_working_path_mode = 'r'
let g:ale_nasm_nasm_options = '-f 64'
let g:ale_sh_shfmt_options = '-i=4'
let g:ale_go_golangci_lint_package = 1
"nerdtree
nnoremap <C-n> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFocus<CR>
let g:NERDTreeFileLines = 1
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | call feedkeys(":quit\<CR>:\<BS>") | endif
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif