-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
287 lines (232 loc) · 7.1 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
set nocompatible
filetype off
" 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 'scrooloose/nerdtree'
Plugin 'bling/vim-airline'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'airblade/vim-gitgutter'
Plugin 'scrooloose/nerdcommenter'
Plugin 'ap/vim-css-color'
Plugin 'posva/vim-vue'
Plugin 'mustache/vim-mustache-handlebars'
Plugin 'w0ng/vim-hybrid'
Plugin 'tpope/vim-surround'
Plugin 'xuyuanp/nerdtree-git-plugin'
Plugin 'yggdroot/indentline'
Plugin 'mxw/vim-jsx'
Plugin 'dense-analysis/ale'
Plugin 'flowtype/vim-flow'
Plugin 'prettier/vim-prettier'
Plugin 'alampros/vim-styled-jsx'
Plugin 'crusoexia/vim-javascript-lib'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'elzr/vim-json'
Plugin 'townk/vim-autoclose'
Plugin 'leafgarland/typescript-vim'
Plugin 'dyng/ctrlsf.vim'
Plugin 'udalov/kotlin-vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" Syntax highlighting
syntax on
" Set Line Numbers
set number
" make backspace work like most other apps
set backspace=2
" Show matching brackets when hovering over
set showmatch
" Autocompletion
set omnifunc=syntaxcomplete#Complete
" Color Scheme
set background=dark
colorscheme hybrid
set termguicolors
let g:hybrid_custom_term_colors = 1
let g:hybrid_reduced_contrast = 1
hi Normal guibg=NONE ctermbg=NONE
hi htmlArg gui=italic
hi Comment gui=italic
hi Type gui=italic
hi Comment cterm=italic
hi Type cterm=italic
set showcmd
" Turn Backkup off
set nobackup
set nowb
set noswapfile
" Persistent Undo
if has('persistent_undo')
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
endif
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Make search act like search in modern browsers
set incsearch
" This makes vim act like all other editors, buffers can
" exist in the background without being in a window.
" http://items.sjbach.com/319/configuring-vim-right
set hidden
" Keep 5 lines below and above the cursor
set scrolloff=3
" Fast saving
map <leader>w :w!<cr>
" Fast quitting
map <leader>q :q!<cr>
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs
set smarttab
" 1 tab == 2 spaces
set shiftwidth=2
set tabstop=2
set autoindent "Auto indent
set smartindent "Smart indent
" Always Show current position
set ruler
"Reload files changed outside vim
set autoread
" Wrap lines at convenient points
set linebreak
"Window Management
map <leader>j <C-W>j
map <leader>k <C-W>k
map <leader>h <C-W>h
map <leader>l <C-W>l
map <leader>s <C-W>s
map <leader>v <C-W>v
map <leader>+ <C-W>>
map <leader>- <C-W>>
" Open new splits easily
map vv <C-W>v
map ss <C-w>s
map Q <C-W>q
" Open splits on the right and below
set splitbelow
set splitright
" Load all buffers and prompt for number to go to
nnoremap gb :ls<CR>:b<Space>
autocmd VimResized * wincmd = " Automatically resize splits when resizing window
" Suffix .js for imports and using gf
set suffixesadd+=.js
set path+=$PWD/node_modules
" Automatically set correct Vue Syntax highlighting
autocmd FileType vue syntax sync fromstart
" Complete brackets and parentheses
inoremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap {{ {
inoremap {} {}
inoremap ( ()<Left>
" Use Ctrl-c to copy and Ctrl-v to paste
vnoremap <C-c> :w !pbcopy<CR><CR>
noremap <C-v> :r !pbpaste<CR><CR>
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" bind | to grep shortcut
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
nnoremap \ :Ag<SPACE>
" Nerd Tree shortcuts
map <leader>\ :NERDTreeToggle<cr>
" Close vim if Nerd Tree is the only thing left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" CtrlP Settings
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
let g:ctrlp_show_hidden = 1
" NerdCommenter
let g:NERDSpaceDelims = 2
vnoremap <leader>/ :call NERDComment(0,"toggle")<CR>
" NerdTree
map <C-n> :NERDTreeToggle<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Close NERDTree if no files are open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let NERDTreeShowHidden=1
"Vim Airline
let g:airline#extensions#tabline#enabled = 1
set laststatus=2
let g:airline_powerline_fonts=1
" Not have weird line of text at beginnning of fim in hyper terminal
set t_RV=
" Allow jsx syntax in js files
let g:jsx_ext_required = 0
" json syntax highlighting
autocmd BufNewFile,BufRead *.json set ft=javascript
" Use deoplete
" let g:deoplete#enable_at_startup = 1
" let g:deoplete#auto_complete_delay = "200"
" Ale settings
let g:ale_linters = {}
let g:ale_linters['javascript'] = ['eslint']
let g:ale_linters['jsx'] = ['eslint']
let g:ale_fixers = {}
let g:ale_fixers['javascript'] = ['prettier']
let g:ale_fixers['jsx'] = ['prettier']
let g:ale_fixers['scss'] = ['prettier']
let g:ale_fixers['css'] = ['prettier']
let g:ale_javascript_prettier_options = '--single-quote --trailing-comma es5 --print-width 100 --no-semi'
let g:airline#extensions#ale#enabled = 1
let g:ale_fix_on_save = 1
" Prettier Settings
let g:prettier#config#print_width = 100
let g:prettier#config#single_quote = 'true'
let g:prettier#config#trailing_comma = 'es5'
let g:prettier#config#bracket_spacing = 'true'
let g:prettier#config#semi = 'false'
let g:prettier#config#parser = 'babylon'
" Flow
let g:javascript_plugin_flow = 1
" ctrlsf
nmap <C-F>f <Plug>CtrlSFPrompt
nmap <C-F>n <Plug>CtrlSFCwordPath
nmap <C-F>p <Plug>CtrlSFPwordPath
let g:ctrlsf_ignore_dir = ['.next', 'node_modules']
let g:ctrlsf_auto_focus = {
\ "at": "done",
\ "duration_less_than": 1000
\ }
let g:ctrlsf_mapping = {
\ "next": "n",
\ "prev": "N",
\ }
let g:ctrlsf_search_mode = 'async'