-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
356 lines (276 loc) · 9.26 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
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
" ,,,
" Rac@@n.Vim .' `/\_/\
" .' <@I@>
" <(((((((((( )____( \./
" \( \( \(\(
" `-"`-" " "
" - Playful little VimStarter for WebDev & More
" -------------------------------------------------
" URL : https://github.com/AndiKod/racoon.vim
" :help : https://vimhelp.org
"--------------------------------------------------
" <za> on {{{ folds }}} will toggle them ;)
" --- &:PLUGINS via VimPlug --- :
" {{{
" If VimPlug not here, auto-download it.
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Actual Plugins list:
call plug#begin()
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'ap/vim-buftabline'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'ap/vim-css-color'
Plug 'catppuccin/vim', { 'as': 'catppuccin' }
Plug 'tribela/vim-transparent'
Plug 'mhinz/vim-startify'
" Plug 'preservim/nerdtree'
" Plug 'chriszarate/yazi.vim'
call plug#end()
" Plugins configs are below, with the Mappings
" as they are often linked.
" End of Plugins section
" }}}
" --- &:OPTIONS ---
" {{{
set nocompatible " Disable Vi compatibility
set history=10000 " Lines to be remembered
set noshowmode " Let VimAirline show the mode
set encoding=utf-8
" ::indentation
set autoindent
set smartindent
set expandtab
set smarttab
set softtabstop=2
set shiftwidth=2
set shiftround
set cinoptions=l1,p0,)50,*50,t0
" ::display
filetype on " Enable file type detection
filetype plugin on " Enable plugins according to filetype
syntax on
" set display +=lastline
" set laststatus=2
" set list
" set modeline
" set modeline=1
" set nosttartofline
set numberwidth=2
" set ruler
set number " Line numbers
set relativenumber
let &t_SI = "\e[6 q" " Thin cursor for Insert mode
let &t_EI = "\e[2 q"
set showmatch " Show parentheses matching
set showcmd " Show the normalMode command in status bar
set matchpairs+=<:> " append pairable chars to the default set '(:),{:},[:]'
set signcolumn=yes
" -- Use Git for backup --
" ::backup/swap/info/undo settings
set nobackup
set nowritebackup
set noswapfile
" ::navigation
set cursorline " Current line highlight
set foldmethod=marker
set foldopen -=hor
set foldopen +=jump
set foldtext =pliMe
set incsearch " incremental searching as we type
set hlsearch " highlight all search results
set mouse =a " Allow Mickey
set scrolloff =4
set ignorecase
set smartcase
set tagcase =match
" ::vrac settings (aka misc)
set clipboard =unnamed " clipboard yanks?
set hidden " Switch buffer without saving
" ::wildMenu
set wildmenu
set wildmode=longest:full,list:full "Complete longest common string,
" then list alternatives.
" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
" delays and poor user experience
set updatetime=300
" FzF setting
"from: thevaluable.dev/fzf-vim-integration
set rtp+=/usr/bin/fzf
" End of the OPTIONS section
" }}}
" --- &:MAPPINGS + PluginsConfig --- :
" {{{
" ----------------------- /
" General Mappings /
" ------------------------/
" Set the <Leader> key
let mapleader = " "
let g:mapleader = " "
" The other <Esc> or <C-c>
inoremap jj <Esc>
" Edit or Source vimrc Settings
nnoremap <leader>ev :e $MYVIMRC<CR>
nnoremap <leader>sv :source $MYVIMRC<CR>
" Netrw Files Browser
nnoremap <leader>n :E<cr>
augroup VimStartup
au!
au VimEnter * if expand("%") == "" | e . | endif
augroup END
let g:netrw_banner=0
let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+,\(^\|\s\s\)ntuser\.\S\+'
autocmd FileType netrw set nolist
" Integrated terminal
nnoremap <leader>t :term<CR>
nnoremap <leader>tv :vert ter<CR>
" Manually use one of the next commands:
" exit # Close the terminal from within
" To run a dev server, consider Terminal tabs, Tmux,...
" CtrS from both modes and back to Normal
nnoremap <C-s> :w <CR> :Prettier <cr>
inoremap <C-s> <Esc> :w <CR> :Prettier <cr>
" Navigate the splits
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Remove highlight
nnoremap <Esc> :nohl<CR>
" Keep the selection while indenting
xnoremap < <gv
xnoremap > >gv
" --- &:Autocomands ---
" Line highlight, only in Normal mode
autocmd InsertLeave,WinEnter * set cursorline
autocmd InsertEnter,WinLeave * set nocursorline
" ------------------------------/
" Plugings specific Settings /
" ------------------------------/
" &:BuffTabline
set hidden
nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprev<CR>
nnoremap <leader>b :ls<CR>
" --------------------------------------------
" &:FzF
" :Files {directory} to search outside
" Find Files (inside the project)
nnoremap <leader>ff :Files<cr>
" Find GitFiles
nnoremap <leader>fg :GFiles<cr>
" Find sometimes opened files
nnoremap <leader>fh :History<cr>
" Search trough all open buffers
nnoremap <leader>sb :Buffers<cr>
" Search trough the content of all open buffers
nnoremap <leader>sl :Lines<cr>
" Search trough the content of the current buffer
nnoremap <leader>sc :BLines<cr>
" --------------------------------------------
" &:BuffLine
" Close a buffer
nnoremap <leader>x :bd <cr>
" --------------------------------------------
" &:NerdTree
" Toggle the sidebar
" nnoremap <leader>e :NERDTreeToggle<CR>
" NerdTree Files management
" Hit m when hovering a file/folder
" Pick the needed option: a to add, etc
"
" --------------------------------------------
" &:Yazi
" nnoremap <silent> - :Yazi<cr>
" nnoremap <silent> _ :YaziWorkingDirectory<cr>
" --------------------------------------------
" &:Prettier
" Adding the :Prettier command
command! -nargs=0 Prettier :CocCommand prettier.forceFormatDocument
" --------------------------------------------
" &:Catppuccin
set termguicolors
set background=dark
colorscheme catppuccin_mocha
let g:airline_theme = 'catppuccin_mocha'
" --------------------------------------------
" &:Startify
" https://github.com/mhinz/vim-startify/blob/master/doc/startify.txt
" Closed on startup
let g:startify_disable_at_vimenter = 1
nnoremap <leader>s :Startify<CR>
let g:ascii = [
\'',
\' . --- `/\_/\ ',
\' .: <@I@> ',
\' <(((((((((( )____( \./ ',
\' \( \( \(\( ',
\' `-"`-" " " ',
\ ' Rac@@n say ...',
\]
let g:asciiFooter = [
\' Howdy mate, Rac@@n docs are on github.com/AndiKod/racoon ',
\]
let g:startify_custom_header = g:ascii + startify#fortune#boxed()
let g:startify_custom_footer = g:asciiFooter
" Show other commands
let g:startify_enable_special = 1
" Show last 5 paths in the lists
let g:startify_files_number = 5
" Use relative path
let g:startify_relative_path = 1
let g:startify_bookmarks = [
\ { 'v': '$MYVIMRC' },
\ { 'b': '~/.bashrc' },
\ ]
let g:startify_lists = [
\ { 'header': [' Bookmarks'], 'type': 'bookmarks' },
\ { 'header': [' RecentlyUsed in '. getcwd()], 'type': 'dir' },
\ { 'header': [' RecentlyUsed Files'], 'type': 'files' },
\ ]
" --------------------------------------------
" &:COC
" pand by <Tab> C-n or C-p for next/previous
inoremap <silent><expr> <tab> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
" Auto install basic extentions
let g:coc_global_extensions = [ 'coc-vimlsp', 'coc-tabnine', 'coc-snippets', 'coc-prettier', 'coc-pairs', 'coc-html', 'coc-eslint', 'coc-emmet', 'coc-tsserver', 'coc-json', 'coc-css', '@yaegassy/coc-tailwindcss3' ]
" You can add or :CocInstall more to add support for Astro, Svelte, PHP ...
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
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)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> K :call ShowDocumentation()<CR>
" Mappings for CoCList
" Show all diagnostics
nnoremap <silent><nowait> <Leader>cd :<C-u>CocList diagnostics<cr>
" Manage [c]oc e[x]tensions
nnoremap <silent><nowait> <Leader>cx :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent><nowait> <Leader>cc :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent><nowait> <Leader>co :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent><nowait> <Leader>cs :<C-u>CocList -I symbols<cr>
" Do default action for next item
nnoremap <silent><nowait> <Leader>cj :<C-u>CocNext<CR>
" Do default action for previous item
nnoremap <silent><nowait> <Leader>ck :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent><nowait> <Leader>cp :<C-u>CocListResume<CR>
" --------------------------------------------
" End of Mappings section
" }}}