-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
257 lines (200 loc) · 7.19 KB
/
.vimrc
File metadata and controls
257 lines (200 loc) · 7.19 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
" Getting started
" - install vim-plug https://github.com/junegunn/vim-plug
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" - mkdir ~/.vim/{_temp,_backup}
syntax on
filetype plugin indent on
set autoindent
set smartindent
set encoding=utf-8
set nofixendofline
set clipboard=unnamed " Use the default OS Clipboard
" set pastetoggle=<F2>
set ruler
set cursorline
set cursorcolumn
set relativenumber " Show in column relative number of line
set number " Show current line number
set tabstop=2
set shiftwidth=2 expandtab
"" Colors
set termguicolors
"" Highlight found search patterns
"set hlsearch
" Press jj to escape of insert mode
inoremap jj <Esc>
" vv to generate new vertical split
nnoremap <silent> vv <C-w>v
" ss to generate new horizontal split
nnoremap <silent> ss <C-w>s
" split sanity
set splitbelow
set splitright
"fzf Ag
nnoremap <C-g>g :Ag!<CR>
" to have Ag ignore specific files run this command in your project folder
" echo package-lock.json > .ignore
"fzf Find
" install bat to enable file preview
nnoremap <C-p> :Files<CR>
" on osx the <leader> key is \
nnoremap <leader><leader> :w<cr>
inoremap <leader><leader> <ESC>:w<cr>
nnoremap <tab><tab> :NERDTreeToggle<cr>
nnoremap <tab>m :NERDTreeFind<cr>
inoremap ;; <C-o>A;
inoremap ;;; <C-o>A;<cr>
inoremap ,, <C-o>A,
"ref: https://stackoverflow.com/questions/21888869/how-to-make-ctrlps-search-directory-change-according-to-nerdtrees-root
let g:NERDTreeChDirMode = 2
nnoremap <Leader>= :vertical resize +15<cr>
nnoremap <Leader>- :vertical resize -15<cr>
set backspace=indent,eol,start
""
"" Backup and swap files
""
set backupdir=~/.vim/_backup// " where to put backup files.
set directory=~/.vim/_temp// " where to put swap files.
""
"" mustache
""
let g:mustache_abbreviations = 1
""
"" htmlbars
""
""autocmd BufRead,BufNewFile *.js HighlightInlineHbs
let g:AutoPairsShortcutFastWrap = '<C-e>'
let g:mustache_abbreviations = 1
let g:vim_javascript_imports_map = '<Leader>e'
" ----------------------------------------------------------------------------
" Vim terminal
" ----------------------------------------------------------------------------
" vim-powered terminal in split window
map <Leader>t :term ++close<cr>
tmap <Leader>t <c-w>:term ++close<cr>
" vim-powered terminal in new tab
map <Leader>T :tab term ++close<cr>
tmap <Leader>T <c-w>:tab term ++close<cr>
" ----------------------------------------------------------------------------
" auto-pairs
" ----------------------------------------------------------------------------
" disable auto-pairs on '>' as it is already handled by coc-html
let g:AutoPairs = {'(':')', '[':']', '{':'}', "'":"'", '"':'"', '`':'`'}
" scroll within the coc popup
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
" ----------------------------------------------------------------------------
" Emmet
" ----------------------------------------------------------------------------
" CTRL + y + ,
" ----------------------------------------------------------------------------
" Coc
" ----------------------------------------------------------------------------
" Show documentation/hover popup
nnoremap <silent> K :call CocActionAsync('doHover')<CR>
" Go to definition
nmap <silent> gd <Plug>(coc-definition)
" Go to references
nmap <silent> gr <Plug>(coc-references)
" Rename symbol
nmap <leader>rn <Plug>(coc-rename)
" autocompletion
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ "\<Tab>"
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
" toggle inlay hints
nnoremap <Leader>ih :CocCommand document.toggleInlayHint<CR>
let g:coc_global_extensions = [
\ 'coc-html',
\ 'coc-rust-analyzer',
\ 'coc-tsserver',
\ 'coc-eslint',
\ 'coc-css',
\]
" ----------------------------------------------------------------------------
" ZIG LSP with Coc
" https://zigtools.org/zls/editors/vim/coc/
" ----------------------------------------------------------------------------
" don't show parse errors in a separate window
let g:zig_fmt_parse_errors = 0
" disable format-on-save from `ziglang/zig.vim`
let g:zig_fmt_autosave = 0
" code action on save
" autocmd BufWritePre *.zig,*.zon call CocActionAsync('fixAll')
" autocmd BufWritePre *.zig,*.zon call CocActionAsync('format')
" source.organizeImport
" autocmd BufWritePre *.zig,*.zon call CocActionAsync('organizeImport')
" ----------------------------------------------------------------------------
" ALE
" ----------------------------------------------------------------------------
let g:ale_disable_lsp = 1 " Let coc handle all LSP, ALE just fixes
nnoremap <Leader>ln :ALENextWrap<CR>
nnoremap <Leader>lp :ALEPreviousWrap<CR>
nnoremap <leader>p :ALEFix<CR>
autocmd FileType html.handlebars let g:ale_javascript_prettier_options = '--parser=glimmer'
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['eslint'],
\ 'css': ['stylelint'],
\ 'scss': ['stylelint'],
\ 'html': ['prettier'],
\ 'html.handlebars': ['prettier'],
\ 'markdown': ['prettier'],
\}
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'css': ['stylelint'],
\ 'scss': ['stylelint'],
\ 'html': [''],
\ 'html.handlebars': ['ember-template-lint'],
\}
let g:ale_cpp_cc_options = '-std=c++17 -Wall -I/usr/local/Cellar/sdl2/2.32.0/include/SDL2 -L/usr/local/Cellar/sdl2/2.32.0/lib'
let g:ale_c_cc_executable = 'clang'
let g:ale_c_cc_options = '-std=c23 -Wall -I/usr/local/Cellar/raylib/5.5/include -L/usr/local/Cellar/raylib/5.5/lib'
let g:ale_sign_error = '🍄'
let g:ale_sign_warning = '🙀'
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o "Disable automatic comment insertion
"Start of vim-plug manager
call plug#begin()
Plug 'w0rp/ale'
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-surround'
Plug 'pangloss/vim-javascript'
Plug 'vim-scripts/matchit.zip'
Plug 'joukevandermaas/vim-ember-hbs'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'jiangmiao/auto-pairs'
Plug 'mattn/emmet-vim'
Plug 'tomtom/tcomment_vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'slashmili/alchemist.vim'
Plug 'elixir-lang/vim-elixir'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'ap/vim-css-color'
Plug 'hail2u/vim-css3-syntax'
" Git extensions
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
" a commit browser
Plug 'junegunn/gv.vim'
Plug 'sukima/vim-javascript-imports'
Plug 'terryma/vim-multiple-cursors'
Plug 'dracula/vim'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'vim-utils/vim-man'
Plug 'fidian/hexmode'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'ziglang/zig.vim'
Plug 'neoclide/jsonc.vim'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
call plug#end()
"End vim-plug manager
"" Must come after vim-plug config
"" https://github.com/altercation/vim-colors-solarized/issues/190
" colorscheme solarized
colorscheme dracula