-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
356 lines (274 loc) · 8.52 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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
"###########################################################################
" _
" _ __(_)___ ___ __________
" | | / / / __ `__ \/ ___/ ___/
" | |/ / / / / / / / / / /__
" |___/_/_/ /_/ /_/_/ \___/
" written by <3 mo1ein
"############################################################################
filetype plugin on
set ls=2
set nocp
set nowrap
set t_Co=256
syntax enable
set noswapfile
set noerrorbells
set encoding=utf8
set clipboard=unnamed
set clipboard=+unnamedplus
" For Persian language
set termbidi
" Colorscheme
"colorscheme molokai
colorscheme neodark
"colorscheme dracula
"packadd! dracula
" molokai background transparency
" hi Normal guibg=NONE ctermbg=NONE
"let g:rehash256 = 1
"let g:molokai_original = 1
" for neodark transparency
"let g:neodark#terminal_transparent = 1
" Tab size
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab
" Line numbers
set number
set relativenumber
set ruler
hi LineNr ctermbg=NONE ctermfg=blue
" Indent
set si
set cindent
set autoindent
set showmatch
" Search
set hlsearch
set ignorecase
hi Search ctermbg=51
" Highlight current line
set cursorline
hi CursorLine cterm=underline,bold ctermbg=NONE ctermfg=NONE
" Mouse
set mouse=a
" Resize vim panes with mouse inside tmux
set mouse+=a
if &term =~ '^screen'
" tmux knows the extended mouse mode
set ttymouse=xterm2
endif
" Colors in autocomplete
let g:ycm_use_clangd = 0
let g:ycm_confirm_extra_conf = 1
hi Pmenu ctermfg=NONE ctermbg=236 cterm=NONE guifg=NONE guibg=#64666d gui=NONE
hi PmenuSel ctermfg=NONE ctermbg=24 cterm=NONE guifg=NONE guibg=#204a87 gui=NONE
""highlight Pmenu ctermfg=15 ctermbg=0 guifg=#ffffff guibg=#000000
" Indent line
let g:indentLine_setColors = 1
let g:indentLine_color_term = 239
let g:indentLine_color_tty_light = 7 " (default: 4)
let g:indentLine_color_dark = 1 " (default: 2)
let g:indentLine_char_list = ['|', '¦', '┆', '┊']
" NerdTree
map <F9> :NERDTreeToggle<CR>
let g:nerdtreefileextensionhighlightfullname = 1
" Open file in new tab with ctrl + t
let NERDTreeMapOpenInTab='<c-t>'
let g:NERDTreeWinPos = "right"
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ "Unknown" : "?"
\ }
" Open a NERDTree automatically when vim starts up if no files were specified
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" ALE
let g:ale_fix_on_save = 1
let g:ale_lint_on_enter = 1
let g:ale_list_window_size = 5
let g:airline#extensions#ale#enabled = 1
let b:ale_warn_about_trailing_whitespace = 0
let g:ale_sign_error = '✘'
let g:ale_sign_warning = "◉"
let g:ale_linters = {
\ 'c': ['clang'],
\ 'cpp': ['clang', 'g++'],
\ 'python': ['flake8'],
\ 'javascript': ['eslint'],
\ 'vue': ['eslint']
\ }
"\ 'python': ['black'],
"\ 'javascript': ['prettier', 'eslint']
let g:ale_fixers = {
\ 'python': ['autopep8'],
\ 'javascript': ['eslint'],
\ 'typescript': ['prettier', 'tslint'],
\ 'vue': ['eslint'],
\ 'scss': ['prettier'],
\ 'html': ['prettier'],
\ 'reason': ['refmt'],
\ '*': ['remove_trailing_lines', 'trim_whitespace']
\ }
hi SignColumn ctermbg=NONE
highlight ALEErrorSign ctermfg=9 ctermbg=NONE
highlight ALEWarningSign ctermfg=11 ctermbg=NONE
" Airline
"let g:airline_theme='minimalist' " set airline plugin theme
let g:airline_theme='dracula' " set airline plugin theme
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline_powerline_fonts = 1
let g:airline_exclude_preview = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" Deoplete
let g:deoplete#enable_at_startup = 1
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" vim markdown preview
let vim_markdown_preview_browser='firefox'
" Vim-commentary
" Ctrl + / Toggle comment/uncomment
map <C-_> :Commentary<CR>
" Vimplayer
let g:default_player = 'mocp'
" Ctrl + p Toggle play/pause
nnoremap <C-p> :Pp<CR>
" Ctrl + l Next music
nnoremap <C-l> :Pnext<CR>
" Ctrl + k Previous music
nnoremap <C-k> :Prev<CR>
" Ctrl + i Current music info
" nnoremap <C-i> :Current<CR>
" Ctrl + x Toggle repeat
nnoremap <C-x> :Repeat<CR>
" Ctrl + s Toggle shuffle
nnoremap <C-s> :Shuffle<CR>
" Ctrl + a Toggle autonext
nnoremap <C-a> :Autonext<CR>
" closetag
" filenames like *.xml, *.html, *.xhtml, ...
" These are the file extensions where this plugin is enabled.
"
let g:closetag_filenames = '*.html,*.xhtml,*.phtml'
" filenames like *.xml, *.xhtml, ...
" This will make the list of non-closing tags self-closing in the specified files.
"
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx'
" filetypes like xml, html, xhtml, ...
" These are the file types where this plugin is enabled.
"
let g:closetag_filetypes = 'html,xhtml,phtml'
" filetypes like xml, xhtml, ...
" This will make the list of non-closing tags self-closing in the specified files.
"
let g:closetag_xhtml_filetypes = 'xhtml,jsx'
" integer value [0|1]
" This will make the list of non-closing tags case-sensitive (e.g. `<Link>` will be closed while `<link>` won't.)
"
let g:closetag_emptyTags_caseSensitive = 1
" dict
" Disables auto-close if not in a "valid" region (based on filetype)
"
let g:closetag_regions = {
\ 'typescript.tsx': 'jsxRegion,tsxRegion',
\ 'javascript.jsx': 'jsxRegion',
\ }
" Shortcut for closing tags, default is '>'
"
let g:closetag_shortcut = '>'
" Add > at current position without closing the current tag, default is ''
"
let g:closetag_close_shortcut = '<leader>>'
" Unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
" Key maps
" Paste mode toggle with F2
set pastetoggle=<F2>
"Going to normal mode with <jk> , <esc> is too far :)
inoremap jk <esc>
vnoremap jk <esc>
" Disable arrow movement, resize splits instead.
nnoremap <Up> :resize -1<CR>
nnoremap <Down> :resize +1<CR>
nnoremap <Left> :vertical resize -1<CR>
nnoremap <Right> :vertical resize +1<CR>
" Auto complete for ( , " , ' , [ , {
"noremap ( ()<Left>
"noremap " ""<Left>
"noremap ` ``<Left>
"noremap ' ''<Left>
"noremap [ []<Left>
"noremap { {}<Left>
" buffers & tabs
" this is enable to switch buffers when file is not saved
set hidden
" this can be conflict with Ctrl+Tab and Ctrl+i
" https://unix.stackexchange.com/questions/563469/conflict-ctrl-i-with-tab-in-normal-mode
nnoremap <C-i> :b#<CR>
" Switch Between Tabs (with F3 and F4)
noremap <silent> #3 :tabprevious<CR>
noremap <silent> #4 :tabnext<CR>
" Reload config from ~/.vimrc
"nnoremap jr :source $MYVIMRC<CR>
"so important for run plugins :))
execute pathogen#infect()
" Plugins
call plug#begin('~/.vim/plugged')
" You can add every plugin here and install it.
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ryanoasis/vim-devicons'
Plug 'dense-analysis/ale'
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'Yggdroot/indentLine'
Plug 'tpope/vim-fugitive'
Plug 'dhruvasagar/vim-zoom'
Plug 'junegunn/vim-slash'
Plug 'haya14busa/incsearch.vim'
Plug 'iamcco/markdown-preview.vim'
Plug 'davidhalter/jedi-vim'
Plug 'xuhdev/vim-latex-live-preview'
Plug 'mo1ein/Vimplayer'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" autocomplete (deoplete)
Plug 'deoplete-plugins/deoplete-jedi'
Plug 'roxma/vim-hug-neovim-rpc'
Plug 'Shougo/deoplete-clangx'
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
"Plug 'ycm-core/YouCompleteMe'
Plug 'deoplete-plugins/deoplete-go', { 'do': 'make' }
"Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
" color/theme
Plug 'KeitaNakamura/neodark.vim'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'ErichDonGubler/vim-sublime-monokai'
" web development
Plug 'mattn/emmet-vim'
Plug 'ap/vim-css-color'
Plug 'tpope/vim-surround'
Plug 'alvan/vim-closetag'
Plug 'jiangmiao/auto-pairs'
Plug 'turbio/bracey.vim', {'do': 'npm install --prefix server'}
" other
Plug 'davidhalter/jedi-vim'
Plug 'gabrielsimoes/cfparser.vim'
Plug 'tpope/vim-commentary'
call plug#end()