-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
159 lines (138 loc) · 4.45 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
" helps prevent lag
set timeoutlen=1000
set ttimeoutlen=0
" enforces format
set encoding=utf-8
" smartcase search
set ignorecase
set smartcase
" highlight all isntances of word
set hlsearch
" change the no wordwrap
set wrap!
" remove whitespace on save
autocmd BufWritePre *.py :%s/\s\+$//e
noremap <F12> <Esc>:syntax sync fromstart<CR>
" nnoremap U :syntax sync fromstart<cr>:redraw!<cr>
"yank to clipboard
set clipboard=unnamedplus
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"===> TABS AND SPACE 4 INDENTS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
filetype plugin indent on
" " show existing tab with 4 spaces width
" set tabstop=4
" " when indenting with '>', use 4 spaces width
" set shiftwidth=4
" " On pressing tab, insert 4 spaces
" set expandtab
" set softtabstop=4
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"===> Line Numbering
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set number
set relativenumber
function! g:ToggleNuMode()
if(&nu == 1 && &rnu==1)
set nornu
set nu
else
set nu
set rnu
endif
endfunc
nnoremap <silent><C-l> :call g:ToggleNuMode()<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"===> Plugins
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
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()
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tomtom/tcomment_vim'
Plug 'scrooloose/nerdtree', {'on':'NERDTreeToggle' }
Plug 'kien/ctrlp.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'romainl/vim-cool'
Plug 'brgmnn/vim-opencl'
Plug 'mileszs/ack.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'morhetz/gruvbox'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'dense-analysis/ale'
Plug 'fatih/vim-go', {'do': ':GoInstallBinaries'}
Plug 'sheerun/vim-polyglot'
" Plug 'flazz/vim-colorschemes'
" Plug 'vim-syntastic/syntastic'
call plug#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"===> Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax enable
colorscheme gruvbox
set background=dark
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"===> NERDTree
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"shortcut
map <C-n> :NERDTreeToggle<CR>
let NERDTreeShowHidden=1
let g:NERDTreeDirArrows=0
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" "===> coc.nvim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" autocomplete
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
if has ('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" goto next lint error
try
nmap <silent> [c :call CocAction('diagnosticNext')<cr>
nmap <silent> ]c :call CocAction('diagnosticPrevious')<cr>
endtry
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" "===> ale
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace'], 'python': ['black'],}
" let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace']}
let g:ale_fix_on_save = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"===> Shortcuts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"inoremap { {<CR>}<Esc>k$a
" $TERM=xterm-256color
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"===> zfz
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" let g:ackprg = 'ag --vimgrep --smart-case'
" cnoreabbrev ag Ack
" cnoreabbrev aG Ack
" cnoreabbrev Ag Ack
" cnoreabbrev AG Ack
" if executable('ag')
" let g:ackprg = 'ag --vimgrep'
" endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"===> vim go
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:go_fmt_command = "goimports"