-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
executable file
·205 lines (168 loc) · 5.49 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
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'vim-syntastic/syntastic'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'preservim/nerdtree'
Plugin 'PhilRunninger/nerdtree-visual-selection'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'mattn/emmet-vim'
Plugin 'mru.vim'
Plugin 'preservim/nerdcommenter'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-abolish'
"Git related plugins
Plugin 'tpope/vim-fugitive'
"paranthesse,brackets options and jump out"
Plugin 'delimitMate.vim'
"google code format plugin
Plugin 'google/vim-maktaba'
Plugin 'google/vim-codefmt'
Plugin 'google/vim-glaive'
"Theme
Plugin 'dracula/vim'
"LATEX
Plugin 'xuhdev/vim-latex-live-preview'
Plugin 'lervag/vimtex'
"FZF
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
"Javascipt
Plugin 'pangloss/vim-javascript'
" add all your plugins here (note older versions of Vundle
"used Bundle instead of Plugin)
" ...
" All of your Plugins must be added before the following line
call vundle#end() " required
call glaive#Install()
Glaive codefmt plugin[mappings]
Glaive codefmt google_java_executable="java -jar /path/to/google-java-format-VERSION-all-deps.jar"
filetype plugin indent on " required
set termbidi
syntax on
"html formatting
filetype indent on
set filetype=html
set smartindent
set number
set showmatch
set history=1000
set undolevels=1000
set wildignore=*.swp,*.bak,*.pyc
set noerrorbells
set encoding=utf-8
set foldmethod=indent
set foldlevel=99
set backspace=indent,eol,start
se mouse+=a
set modifiable
"Automatic close preview window after autocomplete
autocmd CompleteDone * pclose
"enabling auto format for google code formater
augroup autoformat_settings
autocmd FileType bzl AutoFormatBuffer buildifier
autocmd FileType c,cpp,proto,arduino AutoFormatBuffer clang-format
autocmd FileType dart AutoFormatBuffer dartfmt
autocmd FileType go AutoFormatBuffer gofmt
autocmd FileType gn AutoFormatBuffer gn
autocmd FileType css,sass,scss,less,json,javascript,vue AutoFormatBuffer prettier
autocmd FileType java AutoFormatBuffer google-java-format
autocmd FileType python AutoFormatBuffer autopep8
" Alternative: autocmd FileType python AutoFormatBuffer autopep8
autocmd FileType rust AutoFormatBuffer rustfmt
augroup END
"Theme config
colorscheme dracula
hi Normal guibg=NONE ctermbg=NONE
" Nerd commenter
let g:NERDToggleCheckAllLines = 1
"Save with ctrl+s
"nnoremap <c-s> :w<cr>
nnoremap <c-s> :w<cr>
inoremap <c-s> <Esc>:w<CR><Esc>
nnoremap <c-x> :x<cr>
inoremap <c-x> <Esc>:x<CR>a
"Status bar
set laststatus=2
set statusline=%<%f\ %h%m%r%{FugitiveStatusline()}%=%-14.(%l,%c%V%)\ %P
" Auto save
autocmd CursorHold,CursorHoldI * update
" ----------Rename Variable---------
" For local replace
nnoremap gr gd[{V%::s/<C-R>///gc<left><left><left>
" For global replace
nnoremap gR gD:%s/<C-R>///gc<left><left><left>
"----------------NERDTREE CONFIGS-----------------
"Nerdtree toggle view (open and close)
nmap <tab> :NERDTreeToggle<CR>
"---------------- MAP NAVIGATIONS---------------------
"map alt + arrows
nnoremap <Esc>[1;3C <C-w>l
nnoremap <Esc>[1;3D <C-w>h
nnoremap <Esc>[1;3A <C-w>k
nnoremap <Esc>[1;3B <C-w>j
"nap ctrl+w to close
noremap <c-w> :q <CR>
"map page up and page down to move between tabs
nnoremap <PageUp> gT
nnoremap <PageDown> gt
"arrange tabs
nmap <C-PageUp> :tabmove -1<cr>
nmap <C-PageDown> :tabmove +1<cr>
"-------------------Python settings-------------------------
au BufNewFile,BufRead *.py
\set tabstop=4
\set softtabstop=4
\set shiftwidth=4
\set textwidth=79
\set expandtab
\set autoindent
\set fileformat=unix
let python_highlight_all=1
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
highlight BadWhitespace ctermbg=red guibg=darkred
"---------------------JAVASCRIPT settings---------------------------
autocmd FileType javascript setlocal shiftwidth=4 tabstop=4 softtabstop=0 expandtab
"---------Syntastic configs-----------
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_python_checkers = ["flake8", "pyflakes"]
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_go_checkers = ['govet', 'errcheck', 'go']
"------------FZF-----------
nnoremap <C-e> :Files<Enter>
"--------DOCKER-------------
autocmd BufNewFile,BufRead *ockerfile.*,*.*ockerfile :set filetype=dockerfile
"-------YCM------------
nnoremap <C-f> :tab split \| YcmCompleter GoToDefinition<CR>
nnoremap t :YcmCompleter GetDoc<CR>
let g:ycm_enable_inlay_hints=1
map <Esc>l :lopen <CR>
nmap E <Plug>(YCMFindSymbolInWorkspace)
map <ESC>e <Plug>(YCMFindSymbolInDocument)
"------Emoji------
" Use emoji-fzf and fzf to fuzzy-search for emoji, and insert the result
function! InsertEmoji(emoji)
let @a = system('cut -d " " -f 1 | emoji-fzf get', a:emoji)
normal! "agP
endfunction
command! -bang Emoj
\ call fzf#run({
\ 'source': 'emoji-fzf preview',
\ 'options': '--preview ''emoji-fzf get --name {1}''',
\ 'sink': function('InsertEmoji')
\ })
" Ctrl-e in normal and insert mode will open the emoji picker.
" Unfortunately doesn't bring you back to insert mode 😕
map <C-n> :Emoj<CR>
imap <C-n> <C-o><C-e>