-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
198 lines (157 loc) · 4.16 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
"""
""" Plugins
"""
call plug#begin('~/.vim/.plugged')
" Gruvbox
Plug 'morhetz/gruvbox'
Plug 'tpope/vim-sensible'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" LSP
" Plug 'prabirshrestha/vim-lsp'
" Plug 'mattn/vim-lsp-settings'
"
" Plug 'prabirshrestha/asyncomplete.vim'
" Plug 'prabirshrestha/asyncomplete-lsp.vim'
" Rust
Plug 'rust-lang/rust.vim'
" CoC.nvim
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
" Plug 'junegunn/vim-easy-align'
" Multiple Plug commands can be written in a single line using | separators
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-default branch
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
call plug#end()
"""
""" Options
"""
set autoindent
set smartindent
set tabstop=8
set expandtab
set shiftwidth=4
set number
set relativenumber
set encoding=utf-8
set nobackup
set nowritebackup
set noshowmode
set updatetime=300
set signcolumn=yes
set cursorline
set scrolloff=5
set background=dark
" Use a line cursor within insert mode and a block cursor everywhere else.
"
" Reference chart of values:
" Ps = 0 -> blinking block.
" Ps = 1 -> blinking block (default).
" Ps = 2 -> steady block.
" Ps = 3 -> blinking underline.
" Ps = 4 -> steady underline.
" Ps = 5 -> blinking bar (xterm).
" Ps = 6 -> steady bar (xterm).
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
"""
""" Colorscheme Config
"""
colorscheme slate
"""
""" Normal Keybindings
"""
let mapleader=' '
nnoremap J 5j
nnoremap K 5k
" Line head and end
nnoremap H ^
nnoremap L $
" Switch buffer
nnoremap ]b :bn<cr>
nnoremap [b :bp<cr>
" Close buffer
nnoremap <leader>c :bdelete<cr>
" Save and quit
nnoremap <leader>w :write<cr>
nnoremap <leader>q :quit<cr>
" Jump window
nnoremap <C-l> <C-w><C-l>
nnoremap <C-h> <C-w><C-h>
nnoremap <C-j> <C-w><C-j>
nnoremap <C-k> <C-w><C-k>
" Change window size
nnoremap <C-Up> 5<C-w>+
nnoremap <C-Down> 5<C-w>-
nnoremap <C-Left> 5<C-w><
nnoremap <C-Right> 5<C-w>>
" File tree
nnoremap <leader>e <cmd>NERDTreeToggle<cr>
nnoremap <leader>o <cmd>NERDTreeFocus<cr>
" Plugin manager
nnoremap <leader>pi <cmd>PlugInstall<cr>
nnoremap <leader>pu <cmd>PlugUpdate<cr>
nnoremap <leader>pU <cmd>PlugUpgrade<cr>
nnoremap <leader>pc <cmd>PlugClean<cr>
nnoremap <leader>ps <cmd>PlugStatus<cr>
"""
""" LSP Config and Keybinds
"""
" if executable('rust-analyzer')
" au User lsp_setup call lsp#register_server({
" \ 'name': 'Rust Language Server',
" \ 'cmd': {server_info->['rust-analyzer']},
" \ 'whitelist': ['rust'],
" \ 'initialization_options': {
" \ 'cargo': {
" \ 'buildScripts': {
" \ 'enable': v:true,
" \ },
" \ },
" \ 'procMacro': {
" \ 'enable': v:true,
" \ },
" \ },
" \ })
" endif
"
" " Diagnostic navigation
" nmap <silent> ]g :LspNextDiagnostic<Cr>
" nmap <silent> [g :LspPreviousDiagnostic<Cr>
"
" " Code navigation
" nmap <silent> gd :LspDefinition<Cr>
" nmap <silent> gy :LspTypeDefinition<Cr>
" nmap <silent> gi :LspImplementation<Cr>
" nmap <silent> gr :LspReferences<Cr>
"
" " Symbol renaming
" nmap <leader>lr :LspRename<Cr>
"
" " Code action for whole buffer
" nmap <leader>la :LspCodeAction<Cr>
"
" " Run the Code Lens action on the current line
" nmap <leader>ll :LspCodeLens<Cr>
"""
""" FZF Config
"""
let $FZF_DEFAULT_COMMAND = "fd -tf --hidden --strip-cwd-prefix --exclude .git --exclude .cache --exclude .idea"
nmap <leader>ff :FZF<Cr>
"""
""" Airline Config
"""
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#formatter = 'unique_tail'
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#buffer_nr_format = '%s: '
let g:airline#extensions#battery#enabled = 1
let g:airline_left_sep = ' '
let g:airline_left_alt_sep = '|'