-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
229 lines (178 loc) · 6.7 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
set nocompatible " Welcome to the 21st
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => HUD
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax enable
set background=light
set termguicolors
colorscheme selenized
"https://github.com/jan-warchol/selenized/tree/master/editors/vim
" TODO: how does it gel with my Linux setup?
"set t_Co=256 " enable all the colors xD
" ^ what? - this important?
set relativenumber number " hybrid line numbering
set numberwidth=5
set ruler
set wildmenu
set hlsearch " highlight search matches
set visualbell " disable emmiting bell
set laststatus=2 " always show statusline
set rulerformat=%19(%l,%c%V%7(<0x%B>%)%=%P%)
set ttimeoutlen=10 " wait before sequence completes [ms], no idea why, but I've changed it
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Editorial behaviours
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set magic " you're a wizzard, Harry!
" but in all seriousness, this is the default, I'd just like to keep it
" explicit
" Smart tabs
set tabstop=4 " The width of a TAB is set to 4
set shiftwidth=4 " Indents will have a width of 4
set softtabstop=4 " Treat 4 spaces as single TAB
set expandtab " Expand TABs to spaces
set shiftround " Round identation to multiples
set nrformats-=octal " I don't work with octal literals really
set nojoinspaces
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugins
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'Yggdroot/indentLine'
Plugin 'scrooloose/nerdcommenter'
Plugin 'fidian/hexmode'
Plugin 'ctrlpvim/ctrlp.vim'
" Testing
Plugin 'jiangmiao/auto-pairs'
" ^ this is nice, but requires some tweaking, while I have a moment
Plugin 'dense-analysis/ale'
" Syntax highlighters
Plugin 'posva/vim-vue'
Plugin 'pearofducks/ansible-vim'
Plugin 'hashivim/vim-terraform'
Plugin 'cespare/vim-toml'
Plugin 'rust-lang/rust.vim'
Plugin 'LnL7/vim-nix'
Plugin 'kongo2002/fsharp-vim'
Plugin 'digitaltoad/vim-pug'
Plugin 'idris-hackers/idris-vim'
Plugin 'isRuslan/vim-es6'
Plugin 'google/vim-jsonnet'
Plugin 'allgreed/vim-java-bytecode'
Plugin 'ziglang/zig.vim'
Plugin 'torrancew/vim-openscad'
Plugin 'leafgarland/typescript-vim'
Plugin 'peitalin/vim-jsx-typescript'
call vundle#end()
filetype plugin indent on
let g:hexmode_patterns = '*.bin,*.exe,*.dat,*.o'
"let g:hexmode_xxd_options = '-g 1'
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
let g:ale_disable_lsp = 1
let g:ale_use_neovim_diagnostics_api = 1
let g:syntastic_javascript_eslint_args = "--cache"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => OS integration
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set clipboard=unnamedplus " Use system clipboard as default buffer
set undofile
set undodir=$HOME/.vim/undo
set directory^=$HOME/.vim/swap// " that's swap
" prevent exploiting modeline vulnerability
if has('patch-8.1.1366') || has('nvim-0.3.6')
set nomodelineexpr
set modeline
else
set modelines=0
set nomodeline
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set encoding=utf-8
set ff=unix
augroup vimrc
autocmd FileType make setlocal softtabstop=0 noexpandtab " Use actual tab chars in Makefiles
autocmd FileType make let b:EditorConfig_disable = 1
autocmd FileType markdown let g:indentLine_enabled = 0 " Disable identLine for .md
autocmd FileType json let g:indentLine_enabled = 0
autocmd FileType python setlocal autoindent textwidth=119
autocmd FileType gitcommit let g:indentLine_enabled = 0
autocmd FileType gitcommit let b:EditorConfig_disable = 1
autocmd FileType gitcommit setlocal spell colorcolumn=72
autocmd BufNewFile,BufRead .envrc setlocal syntax=sh
autocmd BufNewFile,BufRead .gitignore setlocal syntax=conf
autocmd BufNewFile,BufRead *.j setlocal ft=java-bytecode
augroup END
autocmd! BufWritePost ~/.vimrc nested :source ~/.vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Custom
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" preloaded macros
let @r= 'y:%s/"/"/g€kl€kl€kl' " replace locally visually highlighted text
let @g= 'y:%s/"//g€kl€kl' " replace globally visually highlighted text
let @c= 'A,j' " add comma at the end of the line
let mapleader=" "
:map <Leader>h :noh<CR>
:map <Leader>s i<!--s--><Esc>
:map <Leader>v i<!--v--><Esc>
:map <Leader>/ /\<\><Left><Left>
" double space => alternate file, instanely usefull
nnoremap <Leader><Leader> <C-^>
"usefull alisaes
:command! Wsudo w ! doas tee %
" typos
:command! Q q
:command! W w
"NERDComment integration
:nnoremap \ :call nerdcommenter#Comment('n', 'Toggle')<CR>
:vnoremap \ :call nerdcommenter#Comment('x', 'Toggle')<CR>
" faster window navigation
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" that's just nicer than typing :set paste ;)
set pastetoggle=<f5>
noh " don't show search highlights on vimrc reload
set nospell " nor activate spell check by default
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Lessons learned
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" line swapping via single key combination is not nearly as usefull as it
" apperas. Most of the time I've ended up triggering it indientally, wasting
" time in the process
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Testin area
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" if this works well -> use the \ for the TODO comment mapping
:nnoremap # :call nerdcommenter#Comment('n', 'Toggle')<CR>
:vnoremap # :call nerdcommenter#Comment('x', 'Toggle')<CR>
set ignorecase
set smartcase
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'typescriptreact': ['eslint'],
\}
nmap <Leader>f <Plug>(ale_fix)
" autopairs
" # how about only in insert mode?
let g:AutoPairsShortcutJump = '<C-F>'
set history=100 "is this enough?
noremap <silent> <C-S> :update<CR>
vnoremap <silent> <C-S> <C-C>:update<CR>v
inoremap <silent> <C-S> <C-O>:update<CR>
set scrolloff=3
set smartindent
set wildignore+=node_modules/**,dist/**
" Do I need-want Polish search?
" what the shit is this?
"set complete+=kspell
":command! Pl :set spelllang=pl spell
"set nospell " fixes interpreting the above, but possible messes with spellcheck on gitcommit
"
":command! Plm :normal! ggO # vim: set spelllang=pl spell:<ESC>^x
"set nospell " fixes interpreting the above, but possible messes with spellcheck on gitcommit