-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
273 lines (236 loc) · 8.08 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
scriptencoding utf-8
let g:ale_disable_lsp = 1
call plug#begin('~/.vim/plugged')
Plug 'itchyny/lightline.vim'
Plug 'arcticicestudio/nord-vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
"Plug 'junegunn/fzf.vim'
Plug 'junegunn/vim-slash' "Highlight search results
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/syntastic'
Plug 'preservim/nerdcommenter'
Plug 'alvan/vim-closetag'
Plug 'chun-yang/auto-pairs'
Plug 'ap/vim-css-color'
Plug 'airblade/vim-gitgutter'
Plug 'dense-analysis/ale'
Plug 'maximbaz/lightline-ale'
Plug 'ryanpcmcquen/fix-vim-pasting' "Automatically set paste mode when inserting via insert mode
Plug 'bronson/vim-trailing-whitespace' "Highlight trailing whitespace
Plug 'tpope/vim-fugitive'
Plug 'gregsexton/matchtag' "Highlights matching tags
Plug 'mxw/vim-jsx'
Plug 'ervandew/supertab' "Tab completion
Plug 'mustache/vim-mustache-handlebars' "Handlebars syntax highlighting
Plug 'bkad/CamelCaseMotion' "Tab camelcase words
Plug 'haya14busa/vim-auto-mkdir' " Makes directories
if has('nvim')
Plug 'ellisonleao/glow.nvim'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'lvimuser/lsp-inlayhints.nvim'
Plug 'onsails/lspkind.nvim'
Plug 'L3MON4D3/LuaSnip', {'tag': 'v2.*', 'do': 'make install_jsregexp'}
Plug 'saadparwaiz1/cmp_luasnip'
Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate'} "We recommend updating the parsers on update
Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/plenary.nvim'
Plug 'jose-elias-alvarez/null-ls.nvim'
Plug 'lukas-reineke/lsp-format.nvim'
Plug 'akinsho/bufferline.nvim'
Plug 'kyazdani42/nvim-web-devicons' "Recommended (for coloured icons for bufferline.nvim)
Plug 'SmiteshP/nvim-navic'
Plug 'SmiteshP/nvim-navbuddy'
Plug 'MunifTanjim/nui.nvim'
Plug 'folke/noice.nvim'
Plug 'rcarriga/nvim-notify'
Plug 'shellRaining/hlchunk.nvim' "Highlight indent
Plug 'folke/trouble.nvim'
"Plug 'zbirenbaum/copilot.lua'
"Plug 'zbirenbaum/copilot-cmp'
Plug 'kevinhwang91/promise-async' "Folding
Plug 'kevinhwang91/nvim-ufo' "Folding
Plug 'folke/which-key.nvim' " better organization of key mappings
Plug 'Wansmer/treesj' " SplitJoin replacement
Plug 'sindrets/diffview.nvim' " File explorer for git diffs
Plug 'ibhagwan/fzf-lua', {'branch': 'main'}
Plug 'nvim-tree/nvim-web-devicons' "optional for icon support
endif
call plug#end()
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'relativepath', 'modified' ] ]
\ },
\ 'colorscheme': 'wombat',
\ 'component_function': {
\ 'filename': 'LightlineFilename',
\ 'modified': 'LightlineModified',
\ },
\ 'enable': {
\ 'tabline': 0
\ },
\ }
let g:lightline.active = {
\ 'right': [
\ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ],
\ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype']
\ ]
\ }
function! LightlineModified()
return &modifiable && &modified ? '💾' : ''
endfunction
" display relative file path rather than just name
" See https://github.com/itchyny/lightline.vim/issues/87#issuecomment-119130738
function! LightlineFilename()
return expand('%')
endfunction
nnoremap <C-n> :NERDTreeToggle<CR>
" ########### Ale ###########
let g:ale_set_quickfix = 1
let g:ale_open_list = 1
let g:ale_list_window_size = 0
let g:lightline#ale#indicator_checking = '👀'
let g:lightline#ale#indicator_errors = '🚨'
let g:lightline#ale#indicator_infos = 'ℹ️'
let g:lightline#ale#indicator_ok = '👍'
let g:lightline#ale#indicator_warnings = '🚫'
let g:lightline.component_expand = {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_infos': 'lightline#ale#infos',
\ 'linter_ok': 'lightline#ale#ok',
\ 'linter_warnings': 'lightline#ale#warnings',
\ }
let g:lightline.component_type = {
\ 'linter_checking': 'right',
\ 'linter_infos': 'right',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'right',
\ }
let g:lightline.active = {
\ 'right': [
\ [ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_ok' ],
\ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype']
\ ]
\ }
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'go': ['gofumpt'],
\ 'gohtml': ['prettier'],
\ 'java': ['google_java_format'],
\ 'javascript': ['eslint', 'prettier_eslint'],
\ 'javascriptreact': ['eslint', 'prettier'],
\ 'json': ['prettier'],
\ 'lua': ['luafmt'],
\ 'markdown': ['prettier'],
\ 'perl': ['perltidy', 'perlimports'],
\ 'ruby': ['rubocop'],
\ 'rust': ['rustfmt'],
\ 'sh': ['shfmt'],
\ 'typescript': ['prettier'],
\ 'typescriptreact': ['eslint', 'prettier'],
\ 'toml': ['prettier'],
\ 'yaml': ['prettier'],
\}
let g:ale_linters = {
\ 'ansible' : ['ansible-lint'],
\ 'go': ['gofmt', 'golangci-lint', 'gopls', 'revive'],
\ 'gohtml': ['prettier'],
\ 'dockerfile': ['hadolint'],
\ 'html': ['alex', 'fecs', 'htmlhint', 'stylelint', 'tidy',],
\ 'javascript': ['eslint', 'tsserver'],
\ 'markdown': ['markdownlint', 'write-good'],
\ 'perl': ['syntax-check', 'perlcritic', 'perlimports'],
\ 'rust': ['cargo', 'rls'],
\ 'sh': ['language_server','shell', 'shellcheck'],
\ 'typescript': ['tslint', 'tsserver'],
\ 'yaml': ['yamllint'],
\}
let g:ale_type_map = {
\ 'perlcritic': {'ES': 'WS', 'E': 'W'},
\}
let g:jsx_ext_required = 1
set number
set regexpengine=0
syntax on
colorscheme nord
set updatetime=100
set smartindent
set tabstop=2
set expandtab
set shiftwidth=2
let g:mapleader = ','
nnoremap <leader>f : <C-u>FZF<CR>
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
" vim-mustache-handlebars
let g:mustache_abbreviations = 1
"remove all trailing whitespace
:nnoremap <silent> - :FixWhitespace<CR>
let g:closetag_filenames = '*.html,*.jsx,*.tsx,*.js,*.pm,*.go'
let g:closetag_regions = {
\ 'typescript.tsx': 'jsxRegion,tsxRegion',
\ 'javascript.jsx': 'jsxRegion',
\ }
set laststatus=2
fun HideGutter()
:GitGutterDisable
:set nonumber
:set nolist
:set scl=no " sign column
endfun
fun! ShowGutter()
:GitGutterEnable
:set number
:set list
:set scl=auto
endfun
" CamelCaseMotion
map <silent> w <Plug>CamelCaseMotion_w
map <silent> b <Plug>CamelCaseMotion_b
map <silent> e <Plug>CamelCaseMotion_e
map <silent> ge <Plug>CamelCaseMotion_ge
sunmap w
sunmap b
sunmap e
sunmap ge
" Prevent vim swap files from being included with important files
set directory="$HOME"/.vimtmp
augroup filetypes
autocmd BufEnter .tidyallrc :setlocal filetype=dosini
autocmd BufRead,BufNewFile *.html.ep set filetype=html
autocmd BufRead,BufNewFile *.scss set filetype=scss
autocmd BufRead,BufNewFile bash_profile set filetype=sh
autocmd BufRead,BufNewFile *.tx set filetype=html
autocmd BufRead,BufNewFile *.gohtml set filetype=html
augroup END
"dictionary sort unique
:vnoremap <silent> su :!sort -d --ignore-case<bar> uniq<CR>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap .. :nohlsearch<cr>
" Split management
nnoremap <leader>v :vsplit<CR>
nnoremap <leader>s :split<CR>
nnoremap <leader>w <C-w>w
nnoremap <leader><leader> <c-^>
nnoremap <leader>b :Buffers<CR>
" Trouble
nnoremap <leader>xx <cmd>TroubleToggle<cr>
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
nnoremap gR <cmd>TroubleToggle lsp_references<cr>