-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.vimrc
269 lines (232 loc) · 6.98 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
syntax enable
"install plug-vim
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
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
" Appearence {{{ "
"Plug 'itchyny/lightline.vim' " UI
"Plug 'ap/vim-buftabline' " buffers to tabline
"Plug 'connorholyday/vim-snazzy'
Plug 'morhetz/gruvbox'
Plug 'ayu-theme/ayu-vim'
Plug 'dylanaraps/wal.vim'
Plug 'mhinz/vim-startify'
" }}} Appearence "
" Side bars{{{
Plug 'scrooloose/nerdtree' " NERD Tree
Plug 'Xuyuanp/nerdtree-git-plugin' " show git status in Nerd tree
Plug 'mbbill/undotree'
Plug 'preservim/tagbar'
" }}}
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}} " Completion as in vscode
" Plug 'preservim/nerdcommenter' " comments code
" Plug 'junegunn/goyo.vim' " zen mode
"Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
" Plug 'vim-utils/vim-man'
Plug 'sheerun/vim-polyglot' "all lang packs :)
Plug 'qpkorr/vim-bufkill'
"JS {{{
" Plug 'https://github.com/pangloss/vim-javascript.git'
" Plug 'posva/vim-vue'
" Plug 'prettier/vim-prettier'
" Plug 'dense-analysis/ale' "ES-Lint
" Plug 'pangloss/vim-javascript'
" Plug 'heavenshell/vim-jsdoc', { 'for': ['javascript', 'javascript.jsx','typescript'], 'do': 'make install' }
Plug 'honza/vim-snippets'
" Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
" Plug 'junegunn/fzf.vim'
Plug 'francoiscabrol/ranger.vim'
" Plug 'rbgrouleff/bclose.vim'
Plug 'SirVer/ultisnips'
" Plug 'albanm/vuetify-vim'
"}}}
": Latex{{{
Plug 'lervag/vimtex'
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
"}}}
"Rust {{{
" Plug 'rust-lang/rust.vim'
"}}}
"V {{{
" Plug 'ollykel/v-vim'
"}}}
" Markdown {{{
" Plug 'godlygeek/tabular'
"Plug 'plasticboy/vim-markdown'
"}}}
" GIT {{{
" Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" }}}
Plug 'ryanoasis/vim-devicons' " icons
Plug 'ap/vim-css-color'
call plug#end()
" Globals
let mapleader = " "
let g:filetype = 'on'
let g:netrw_browse_split = 2
let g:netrw_banner = 0
let g:netrw_winsize = 25
set guifont=FiraCode:h11
" auto folds
let g:coc_global_extensions = [
\ 'coc-snippets',
\ 'coc-pairs',
\ 'coc-tsserver',
\ 'coc-eslint',
\ 'coc-html',
\ 'coc-css',
\ 'coc-prettier',
\ 'coc-clangd',
\ 'coc-json',
\ 'coc-emoji',
\ ]
"===================================================
" config
" =================================================
set noerrorbells
set tabstop=2 softtabstop=2
set shiftwidth=2
set expandtab
set hidden
set nu
set wrap
set smartcase
set ignorecase
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
set autoread
set backspace=indent,eol,start
set textwidth=80
set relativenumber
"set mouse=a " use mouse to place cursor
" Windows {{{
nnoremap <leader>qq :qall <CR> " quit all
nnoremap <leader>qQ :qall! <CR> " quit all force
nnoremap <leader>QQ :qall! <CR> " quit all force
nnoremap <leader>Qq :qall! <CR> " quit all force
nnoremap <leader>wh :wincmd h<CR> " focus left window
nnoremap <leader>wj :wincmd j<CR> " focus down window
nnoremap <leader>wk :wincmd k<CR> " focus up window
nnoremap <leader>wl :wincmd l<CR> " focus right window
nnoremap <leader>ws :split<CR> " split horizontally
nnoremap <leader>wv :vsplit<CR> " split Vertically
nnoremap <leader>wd :hide<CR> " hide window
" }}}
"
"Buffers {{{
nnoremap <leader>bs :w<CR> " save buffer
nnoremap <leader>bk :BD!<CR> " kill buffer, forcefully
nnoremap <leader>bd :BD<CR> " kill buffer, prompt save
nnoremap <leader>bh :bp<CR> " switch to left buffer
nnoremap <leader>bl :bn<CR> " switch to right buffer
nnoremap <leader>br! :e<CR> " refresh buffer
"}}}
"Tabs {{{
nnoremap <leader><tab>j :tabprevious<CR> " prev tab
nnoremap <leader><tab>k :tabnext<CR> " next tab
nnoremap <leader><tab>l :tablast<CR> " last tab
nnoremap <leader><tab>d :tabclose<CR> " close tab
nnoremap <leader><tab>n :tabnew<CR> " new tab
"}}}
" Files{{{
nnoremap <leader>op :NERDTreeToggle .<CR> " Nerd tree
nnoremap <leader>fp :e ~/.vimrc<CR> " open this file
" }}
"Open {{{
nnoremap <leader>ot :split <CR> :wincmd j <CR> :term <CR> :res 15 <CR> " open terminal in a split buffer
nnoremap <leader>oT :term<CR> " open terminal in this buffer
" }}}
"
"Function keys {{{
autocmd filetype tex nnoremap <F5> :LLPStartPreview<CR>
nnoremap <F8> :TagbarToggle<CR>
" }}}
" Other {{{
nnoremap <leader>u :UndotreeShow<CR> " show undotree
nnoremap <leader>. :Ranger<CR> " show ranger
"extras
tnoremap <Esc> <C-\><C-n>
tnoremap <C-g> <C-\><C-n>
" }}}
" key bindings {{{
" }}}
" coc config
" ======
" use tab
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
"use enter to confirm completion
if exists('*complete_info')
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Prettier {{{
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue PrettierAsync
" }}}
autocmd FileType vue syntax sync fromstart " fix sync in vue files
""auto complete for omnifunction
filetype plugin on
set omnifunc=youcompleteme#CompleteFunc
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
"set colorcolumn=80
highlight ColorColumn ctermbg=0 guibg=lightgrey
set termguicolors " enable true colors support
"let g:lightline = { 'colorscheme': 'snazzy' }
set background=dark
colorscheme gruvbox
hi Normal guibg=NONE ctermbg=NONE " trasnperant!
highlight SignColumn guibg=NONE
if executable('rg')
let g:rg_derive_root='true'
endif
let g:v_autofmt_bufwritepre = 0
" {{{ UltiSnipsExpandTrigger
let g:UltiSnipsExpandTrigger='<tab>'
let g:UltiSnipsJumpForwardTrigger = '<c-tab>'
let g:ltiSnipsJumpBackwardTrigger="<s-tab>"
" }}}
" Latex{{{
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mode=0
set conceallevel=1
let g:tex_conceal='abdmgs'
let g:livepreview_previewer = "zathura"
let g:livepreview_cursorhold_recompile = 1
" }}}
" Rust {{{
let g:rustfmt_autosave = 1
" }}}