-
Notifications
You must be signed in to change notification settings - Fork 0
/
pi32_vimrc
381 lines (333 loc) · 9.04 KB
/
pi32_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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
" _
" __ __(_) _ __ ___ _ __ ___
" \ \ / /| || '_ ` _ \ | '__|/ __|
" _\ V / | || | | | | || | | (__
" (_)\_/ |_||_| |_| |_||_| \___|
"
"" Table (Search for [nn])
"" settings [sx]
"" vim plug [px]
"" mappings [mx]
"" groups [gx]
"" FUNCTIONS (((
function GetLine()
": Remove escape char at ( exe \" ) and ( "\" | endif )
" autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe \"normal g'\"\" | endif
if line("'\"") > 1 && line("'\"") <= line("$")
exec "normal g'\""
endif
endfunction
function Indent()
:normal! mpHmogg=G'ozt`p
endfunction
function NoWhitespace()
let l:posit = winsaveview()
%s/\s\+$//e
call winrestview(l:posit)
endfunction
function ShowWhitespace()
match ErrorMsg '\s\+$'
endfunction
function TestMe()
echom "TestMe function"
endfunction
"" )))
"" settings sx (((
filetype indent plugin on
syntax on
set backspace=indent,eol,start
set guicursor=""
set background=dark
set tabstop=4
set shiftwidth=4
set softtabstop=4
set textwidth=0
set expandtab
set nowrap
set autoindent
set copyindent
set smartindent
set autochdir
set autoread
set hidden
set cursorline
set cursorlineopt=both
set ignorecase
set smartcase
set incsearch
set nohlsearch
set number
set relativenumber
set foldmarker=(((,)))
set foldlevel=4
set foldlevelstart=3
set foldcolumn=3
set signcolumn=yes
set laststatus=2
set noruler
set modeline
" set statusline=(%n)\ %F\ %m%r%w%h%q%a\ %y\ \ \ col:\ %c\ \ %p%%%=[%c:%L]\ \ \ %p%%\ -\ %P\ \ \ |
set showmatch
set showcmd
set noshowmode
set scrolloff=5
set sidescrolloff=8
set path+=**
set updatetime=250
set timeoutlen=1000
set completeopt=menuone,popup
set wildmode=list:longest,full
set noundofile
set noswapfile
set backupdir=~/.vim/backup
set writebackup
set backup
" if has("persistent_undo")
" let target_path = expand("~/.vim/undodir")
"
" if !isdirectory(target_path)
" call mkdir(target_path, 'p', 0700)
" endif
"
" let &undodir=target_path
" set undofile
" set swapfile
" else
" set noundofile
" set nobackup
" set noswapfile
" endif
call ShowWhitespace()
let mapleader=" "
let maplocalleader="\\"
" )))
"" ALE (((
let g:ale_set_signs = 1
let g:ale_max_signs = -1
let g:ale_close_preview_on_insert = 1
let g:ale_completion_enabled = 1
let g:ale_completion_autoimport = 1
let g:ale_disable_lsp = 0
let g:ale_lsp_suggestions = 1
let g:ale_linters_explicit = 1
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
let g:ale_virtualtext_cursor = 0 " 'current', 'disabled', 'all'
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--'
let g:ale_sign_column_always = 1
let g:ale_set_highlights = 0
let g:ale_exclude_highlights = [
\ 'docstring',
\ 'Unused argument',
\ 'import-error',
\ 'SC2164',
\ 'inconsistent-return-statement',
\]
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_info_str = 'I'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_loclist_msg_format = '[%linter%] %s [%severity%]'
let g:ale_python_pylint_options = '--rcfile ~/python/pylint.conf'
let g:ale_popup_menu_enabled = 0
let g:ale_detail_to_floating_preview = 1
let g:ale_cursor_detail = 0 " 1 gives popup
let g:ale_hover_cursor = 1
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─']
let g:ale_echo_cursor = 1
let g:ale_disable_lsp = 0
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
let g:ale_open_list = 0
let g:ale_keep_list_window_open = 0
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1
let g:ale_enabled = 1
"" )))
"" vim plug (((
call plug#begin()
Plug 'mattn/emmet-vim'
Plug 'easymotion/vim-easymotion'
Plug 'christoomey/vim-tmux-navigator'
Plug 'dense-analysis/ale'
Plug 'mbbill/undotree'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
if $TERM == 'xterm-256color' || $TERM == 'tmux-256color'
Plug 'itchyny/lightline.vim'
endif
Plug 'honza/vim-snippets'
Plug 'liuchengxu/vim-which-key'
call plug#end()
if $TERM == 'linux'
set t_Co=32
colorscheme default
elseif $TERM == 'xterm-256color' || $TERM == 'tmux-256color'
set t_Co=256
colorscheme retrobox
endif
"" )))
"" ALE (((
let g:ale_linters = {
\ 'python': ['pycodestyle'],
\ 'rust': ['analyzer'],
\ 'vim': [''],
\ 'cpp': ['clangd', 'cpplint'],
\ 'c': ['cppcheck', 'cpplint'],
\ 'json': ['eslint'],
\ }
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'python': ['autopep8', 'yapf', 'isort'],
\ 'rust': ['rustfmt'],
\ 'cpp': ['clang-format'],
\ 'c': ['clang-format'],
\ 'json': ['prettier'],
\ }
nnoremap <leader>af :ALEFix<cr>
nnoremap <leader>ao :lopen<cr>
nnoremap <leader>ac :copen<cr>
nnoremap <leader>al :ALELint<cr>
nnoremap <leader>at :ALEToggle<cr>
nnoremap <leader>ai :ALEInfo<cr>
nmap <silent> <C-p> <Plug>(ale_previous_wrap)
nmap <silent> <C-n> <Plug>(ale_next_wrap)
"" )))
"" LESSER PLUGINS (((
let g:user_emmet_mode='inv'
let g:user_emmet_leader_key=','
map <leader>ff <Plug>(easymotion-bd-f)
nmap <leader>ff <Plug>(easymotion-overwin-f)
nmap <leader>fs <Plug>(easymotion-overwin-f2)
map <leader>fl <Plug>(easymotion-bd-jk)
nmap <leader>fl <Plug>(easymotion-overwin-line)
map <leader>fw <Plug>(easymotion-bd-w)
nmap <leader>fw <Plug>(easymotion-overwin-w)
nnoremap <leader>ut :UndotreeToggle<cr><C-w>h<C-w>l
nnoremap <leader>ga :Git add .<cr>
nnoremap <leader>gc :Git commit<cr> "
nnoremap <silent> <leader> :WhichKey '<Space>'<cr>
nnoremap <silent> <localleader> :WhichKey '\'<cr>
" The colorscheme for lightline.vim.
" Currently, wombat, solarized, powerline, powerlineish,
" jellybeans, molokai, seoul256, darcula,
" selenized_dark, selenized_black, selenized_light, selenized_white,
" Tomorrow, Tomorrow_Night, Tomorrow_Night_Blue,
" Tomorrow_Night_Bright, Tomorrow_Night_Eighties, PaperColor,
" landscape, one, materia, material, OldHope, nord, deus,
" simpleblack, srcery_drk, ayu_mirage, ayu_light, ayu_dark,
" apprentice, rosepine, and 16color are available.
let g:lightline = {
\ 'colorscheme': 'jellybeans',
\ }
"" )))
"" mappings mx (((
inoremap kj <ESC>
vnoremap kj <ESC>
nnoremap <leader>ut :UndotreeToggle<cr><C-w>h<C-w>l
nnoremap <leader>w :write<cr>
nnoremap <leader>q ZQ<cr>
nnoremap <leader>z ZZ<cr>
nnoremap <leader>o :edit .<cr>
nnoremap <localleader>e :edit $MYVIMRC<cr>
nnoremap <localleader>ve :vsplit<cr><C-w>l:edit $MYVIMRC<cr>
nnoremap <localleader>s :write<cr>:source $MYVIMRC<cr>
nnoremap <leader>ts :shell<cr>
nnoremap <leader>tt :terminal<cr>
nnoremap <C-f> <C-d>
nnoremap <silent> <leader>bn :bnext<cr>
nnoremap <silent> <leader>bp :bprevious<cr>
nnoremap <S-b> _
nnoremap <S-e> $
nnoremap <S-y> y$
nnoremap <F8> @
nnoremap <F9> @@
nnoremap w W
nnoremap n nzz
nnoremap N Nzz
nnoremap ' `
nnoremap '' ``
vnoremap J :m '>+1<cr>gv=gv
vnoremap K :m '<-2<cr>gv=gv
vnoremap < <gv
vnoremap > >gv
nnoremap <leader>* :%s/\<<C-r><C-w>\>//gI<left><left><left>
nnoremap <leader>& :%s/\<<C-r><C-w>\>//gIc<left><left><left><left>
nnoremap <leader>to :tabnew<cr>
nnoremap <leader>tn :tabnext<cr>
nnoremap <leader>tp :tabprevious<cr>
nnoremap <leader>tc :tabclose<cr>
nnoremap <silent> <leader>v :vsplit<cr><C-w>l
nnoremap <silent> <leader>s :split<cr><C-w>j
nnoremap <silent> <C-h> <C-w>h
nnoremap <silent> <C-j> <C-w>j
nnoremap <silent> <C-k> <C-w>k
nnoremap <silent> <C-l> <C-w>l
nnoremap <silent> <leader>hh :vertical resize+1<cr>
nnoremap <silent> <leader>ll :vertical resize-1<cr>
nnoremap <silent> <leader>jj :resize+1<cr>
nnoremap <silent> <leader>kk :resize-1<cr>
nnoremap <silent> <leader>rs <C-w>=
" )))
"" GROUPS gx (((
augroup ALL " (((
au!
au BufEnter * call GetLine()
au BufWritepre *.sh,*.py,*.c,*.cpp,*.h call Indent()
au BufWritepre * call NoWhitespace()
au InsertEnter * silent set nornu
au InsertLeave * silent set rnu
au BufEnter * iabbrev teh the
au BufEnter * iabbrev tow two
augroup END " )))
augroup COMMON " (((
au!
au FileType c,rust,arduino setlocal ts=4 sw=4 sts=4 tw=0 fdm=indent fdl=2 fdls=1 cc=80 noai nosi cin cino=ln,c2
au BufEnter *.c,*.h,*.rs nnoremap <buffer> <leader>b 0A {<cr>}<esc>ko
augroup END " )))
augroup VIM " (((
au!
au FileType vim setlocal ts=2 sw=2 sts=2 tw=0 fdm=marker
augroup END " )))
augroup PYTHON " (((
au!
au FileType python setlocal ts=4 sw=4 sts=4 tw=0
" au BufEnter *.py let @s=":vsplitl:edit ~/notes/pysnips.snippets:vertical resize-44h"
augroup END " )))
" let @s=":vsplitl:edit ~/notes/pysnips.snippets:vertical resize-44h"
augroup C " (((
au!
au FileType c echo &filetype
au BufEnter *.c,*.h,*.rs let @s=":vsplitl:edit ~/notes/c_snips.txt:vertical resize-44h"
augroup END " )))
augroup RUST " (((
au!
au FileType rust echo &filetype
augroup END " )))
augroup ARDUINO " (((
au!
au FileType arduino silent setlocal ts=2 sw=2 sts=2 tw=0
au FileType arduino echo &filetype
au BufEnter *.ino let @s=":vsplitl:edit ~/notes/c_snips.txt:vertical resize-45h"
augroup END " )))
augroup BASH " (((
au!
au FileType sh setlocal noet cc=80
augroup END " )))
" )))