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
|
""""""""""""""""""""""""""
" Plugins
""""""""""""""""""""""""""
" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
call plug#begin('~/.vim/plugged')
" UI & Themes
Plug 'joshdick/onedark.vim' " Onedark themes for vim
Plug 'vim-airline/vim-airline' " Vim statusline
Plug 'ryanoasis/vim-devicons' " Devicons
Plug 'liuchengxu/vim-which-key' " Show leader mapping cheatsheet
" Git integration
Plug 'airblade/vim-gitgutter' " Git diff
" Autocompletion, linter, syntax
Plug 'prabirshrestha/vim-lsp' " Linter & formatter
Plug 'mattn/vim-lsp-settings' " Automatic vim-lsp installation
Plug 'prabirshrestha/asyncomplete.vim' " Autocompletion
Plug 'prabirshrestha/asyncomplete-lsp.vim' " Autocompletion & connection with vim-lsp
" Tools
Plug 'wakatime/vim-wakatime' " Wakatime
Plug 'ap/vim-css-color' " rgb, hex color preview
" Language
Plug 'mattn/emmet-vim', { 'for': ['html', 'css', 'js', 'vue'] }
call plug#end()
filetype plugin indent on " Allow filetype detection, plugins, indentation
"""""""""""""""""""""""""
" Configuration
"""""""""""""""""""""""""
" VIM airline
let g:airline_theme='onedark' " Status line color & configuration
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.colnr = ' ㏇:'
let g:airline_symbols.crypt = '🔒'
let g:airline_symbols.linenr = ' ¶'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.spell = 'Ꞩ'
let g:airline_symbols.notexists = 'Ɇ'
let g:airline_symbols.whitespace = ' Ξ'
" VIM lsp
let g:lsp_diagnostics_echo_cursor = 1
let g:lsp_diagnostics_virtual_text_enabled = 0
" Which Key
call which_key#register('<Space>', "g:which_key_map")
let g:which_key_map = {}
" Buffer key help
let g:which_key_map.b = {
\ 'name' : '+buffer',
\ 'd' : 'current buffer close',
\ 'a' : 'close all buffers',
\ 'n' : 'go to next buffer',
\ 'p' : 'go to previous buffer',
\ }
" Tab key help
let g:which_key_map.t = {
\ 'name' : '+tab',
\ 't<leader>' : 'go to next tab',
\ 'n' : 'open new tab',
\ 'o' : 'close other tabs',
\ 'c' : 'close current tab',
\ 'm' : 'move tab after another',
\ 'l' : 'switch between this & last tab',
\ 'e' : 'open new tab with current buffer',
\ }
" Spell key help
let g:which_key_map.s = {
\ 'name' : '+spell',
\ 's' : 'toggle spell check',
\ 'n' : 'next spell word',
\ 'p' : 'previous spell word',
\ 'a' : 'add word in dict',
\ '?' : 'list word alternatives',
\ }
" Hunk key help
let g:which_key_map.h = {
\ 'name' : '+git hunk',
\ 'l' : 'remove highlight',
\ 'p' : 'go previous hunk',
\ 'n' : 'go next hunk',
\ 't' : 'enable/disable gitgutter',
\ 's' : 'stage hunk',
\ 'u' : 'undo hunk',
\ 'P' : 'preview hunk',
\ }
" LSP key help
let g:which_key_map.l = {
\ 'name' : '+LSP',
\ 'd' : 'go to definition',
\ 'nd' : 'next diagnostic',
\ 'pd' : 'previous diagnostic',
\ 'f' : 'go to reference',
\ 'r' : 'rename object',
\ 's' : 'stop LSP server',
\ 'p' : 'peek definition',
\ 'a' : 'code action',
\ 'h' : 'hover information',
\ 'df' : 'format document',
\ }
" Emmet
let g:user_emmet_leader_key='é'
|