forked from sbernheim4/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
422 lines (299 loc) · 12.4 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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Using Vim-Plug for plugin manager
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
" Next generation completion framework after neocomplcache
" Plug 'Shougo/deoplete.nvim'
" A tree explorer plugin for vim.
Plug 'scrooloose/nerdtree'
" Vim plugin for intensely orgasmic commenting
Plug 'scrooloose/nerdcommenter'
" Vim motions on speed!
Plug 'easymotion/vim-easymotion'
" Vim plugin, provides insert mode a uto-completion for quotes, parens, brackets, etc.
Plug 'Raimondi/delimitMate'
" A Vim plugin which shows a git diff in the gutter (sign column) and stages/undoes hunks.
Plug 'airblade/vim-gitgutter'
" Command-line fuzzy finder
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all'}
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim'
" Plug '/usr/local/opt/fzf'
" fugitive.vim: a Git wrapper so awesome, it should be illegal
Plug 'tpope/vim-fugitive'
" lean & mean status/tabline for vim that's light as air
Plug 'vim-airline/vim-airline'
" A collection of themes for vim-airline
Plug 'vim-airline/vim-airline-themes'
" 🔗 The fancy start screen for Vim.
Plug 'mhinz/vim-startify'
" Vim plugin that displays tags in a window, ordered by scope
" NOTE: Requires ctags to be installed to do so, run the following from ~/
" 1. run `brew install ctags`
" 2. run `which ctags` if the result is /usr/local/bin/ctags you are using
" brew's version
" 3. run `PATH=/usr/local/bin:$PATH`
" brew's version
Plug 'majutsushi/tagbar'
" Asynchronous Lint Engine
Plug 'w0rp/ale'
" 🔣 Adds file type glyphs/icons to popular Vim plugins: NERDTree, vim-airline, Powerline, Unite, vim-startify and more
Plug 'ryanoasis/vim-devicons'
" Extra syntax and highlight for nerdtree files
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
" Quantify your coding inside Vim.
" Plug 'wakatime/vim-wakatime'
" Vastly improved Javascript indentation and syntax support in Vim. https://www.vim.org/scripts/script.php?script_id=4452
Plug 'pangloss/vim-javascript'
" JSX syntax highlighting
Plug 'mxw/vim-jsx'
" True Sublime Text style multiple selections for Vim
" Plug 'terryma/vim-multiple-cursors'
"
" Modern buffer manager for Vim - https://github.com/zefei/vim-wintabs
" Plug 'zefei/vim-wintabs'
" Plug 'zefei/vim-wintabs-powerline'
" TabNine is the all-language autocompleter. It uses machine learning to provide responsive, reliable, and relevant suggestions.
Plug 'zxqfl/tabnine-vim'
" A code-completion engine for Vim http://valloric.github.io/YouCompleteMe/
" --> Needed by TabNine
Plug 'Valloric/YouCompleteMe'
call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" GLOBAL SETTINGS FOR VIM
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Make the Leader key , instead of the default \
let mapleader=","
syntax enable
syntax on
set t_Co=256
let base16colorspace=256
" set background=dark " for the dark version
colorscheme neodark
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ENVIRONMENT VARIABLES
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Highlight the current cursor line
set cursorline
" Wrap text on the screen appropriately (don't wrap in the middle of the word)
set linebreak
" Shows line numbers by default when opening files
set number
" Shows relative line numbers
set relativenumber
" Have line wrapping off by default
set nowrap
" Displays the special characters like eol, indents etc
" DON'T MODIFY. OTHERWISE THE TAB CHARACTER WILL BE MESSED UP AND NOT DISPLAY CORRECTLY
set listchars=tab:\|\ ,
set listchars=tab:•\ ,
" set listchars=tab:•\ ,eol:¬
set list
" Hide the default mode indicator. Do so because airline will show the current mode
set noshowmode
" Display vim airline at the botom of the window
set laststatus=2
" If search string contains only lowercase letters search is case insensitive.
" If search string contains capital letters search is case sensative
set ignorecase
set smartcase
set encoding=utf8
" Allow the backspace button to work as normal
set backspace=indent,eol,start
" ****************** Tabs and Spaces Settings ********************
" Set the tab stop to 4
set tabstop=4
" Helps with autoindenting when using =
set shiftwidth=4
" This sets vim to indent with tabs instead of spaces
" set noexpandtab
" This sets vim to indent with spaces instead of tabs
set expandtab
" ****************************************************************
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Key Bindings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Toggle paste mode
nnoremap <Leader>a :set paste!<CR>
" Toggle wrap mode
nnoremap <Leader>wr :set wrap!<CR>
" Toggle highlighting of search results
nnoremap <Leader>hl :set hlsearch!<CR>
" Toggle cursor line highlight
nnoremap <Leader>cll :set cursorline!<CR>
" Unbinds the arrow keys and makes them stop working
noremap <UP> <NOP>
noremap <DOWN> <NOP>
noremap <LEFT> <NOP>
noremap <RIGHT> <NOP>
" SETTINGS FOR THE BUFFER
" Create a new buffer
nnoremap <Leader>b :enew<cr>
" Move to the next buffer
nnoremap <Leader>n :bn<CR>
" Move to the previous buffer
nnoremap <Leader>p :bp<CR>
" Close the current buffer and move to the previous one
" This replicates the idea of closing a tab
nnoremap <Leader>q :bp <BAR> bd #<CR>
" Show all open buffers and their status --> Unnecessary since I am displaying open buffers at the top using airline
" nnoremap <Leader>bl :ls<CR>
" Split the curent window vertically or horizontally (Useful when you want to have the same file open at two different locations at the same time)
nnoremap <Leader>sp :vsplit<CR>
nnoremap <Leader>hsp :split<CR>
" Vertically and horizontally resize a window
nnoremap <Leader>vrs :vertical resize
nnoremap <Leader>hrs :resize
" Use tt to togle the tagbar open and close
nnoremap tt :TagbarToggle<CR>
" Use fzf to open files --> Alternative to Ctrl-P
" Toggles NERDTree and then opens fzf window to find file so new file isn't
" opened in the NERDTree space --> ONLY WORKS THIS WAY IF NERDTree is already
" open and file is opened in a new buffer
" nnoremap nff :NERDTreeToggle<CR> :Files<CR>
" Opens fzf window without toggling NERDTree
nnoremap ff :Files<CR>
nnoremap <c-f> :Ag<CR>
" Delete trailing whitespace on save
autocmd BufWritePre * %s/\s\+$//e
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SETTINGS TO MODIFY SPECIFIC PACKAGES
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" #########################
" ###### Deocomplete
" ########################
let g:deoplete#enable_at_startup = 1
" Use tab to auto cycle through autocmoplete list instead of arrows
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" #########################
" ###### NERDTree
" ###### VimFiler
" ########################
" Toggle NERDTree
nnoremap <Leader>d :NERDTreeToggle<CR>
nnoremap <Leader>nt :NERDTree<CR>
" Choose the arrow character NERDTree will use
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▿'
" ▾
" Have NERDTree be open automatically when vim starts --> Handled by cmd for use with startify
" autocmd VimEnter * NERDTree
" let NERDTreeShowHidden=1
" #########################
" ###### NerdCommenter
" ########################
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" #########################
" ###### EasyMotion
" ########################
" Run easymotion commands in a direction --> based off of hjkl
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
map <Leader>h <Plug>(easymotion-linebackward)
" #########################
" ###### Airline
" ########################
" Using the font Meslo LG S Regular for Powerline which can be found here:
" https://github.com/powerline/fonts/tree/master/Meslo
" Currently using DejaVu Sans Mono for Powerline
" It is also installed on my computer
"
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_theme='angr'
let g:airline_symbols.branch = ""
let g:airline_symbols.paste = "Þ"
" let g:airline_left_sep = "\uE0B4"
" let g:airline_right_sep = "\uE0B6"
let g:airline_left_sep=""
let g:airline_right_sep=""
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
" Hide whitespace errors
let g:airline#extensions#whitespace#enabled = 0
" Display only the filename in section c
let g:airline_section_c = airline#section#create(['%t'])
" Display the file type in section x
let g:airline_section_x = airline#section#create('%y')
" Display only the file encoding in section y
let g:airline_section_y = airline#section#create("%{strlen(&fenc)?&fenc:'none'}")
" Display only the line and column information in section z
let g:airline_section_z = airline#section#create(['Line %03l/%03L (%02p%%) Col:%03c'])
let g:airline_section_error = airline#section#create('')
let g:airline_section_warning = airline#section#create ('')
" Display syntax errors from Ale in the status line
let g:airline#extensions#ale#enabled = 1
" EXAMPLES FROM :help airline
" let g:airline_section_a (mode, crypt, paste, spell, iminsert)
" let g:airline_section_b (hunks, branch)
" let g:airline_section_c (bufferline or filename)
" let g:airline_section_gutter (readonly, csv)
" let g:airline_section_x (tagbar, filetype, virtualenv)
" let g:airline_section_y (fileencoding, fileformat)
" let g:airline_section_z (percentage, line number, column number)
" let g:airline_section_error (ycm_error_count, syntastic, eclim)
" let g:airline_section_warning (ycm_warning_count, whitespace)
" #########################
" ###### Startify
" ########################
let g:startify_update_oldfiles = 1
autocmd VimEnter *
\ if !argc()
\ | Startify
\ | NERDTree
\ | wincmd w
\ | endif
let g:startify_custom_header = [
\ ' ',
\ ' o o o----o o o-----o o-----o o o o----o ',
\ ' \ o / | | | | | | \ / | | ',
\ ' \ / \ / |----o | | | | | \ / | |----o ',
\ ' \ / \ / | | | | | | o | | ',
\ ' o o o----o o----o o-----o o-----o o o o----o ',
\ ' ',
\ ' o---o o-----o o-----o o o ',
\ ' | | | | | | / ',
\ ' o---o |-----| | |-- ',
\ ' | \ | | | | \ ',
\ ' o----o o o o-----o o o ',
\ ]
" #########################
" ###### Tagbar
" ########################
" Set the width to be x columns
let g:tagbar_width = 30
" Display tagbar info compactly
let g:tagbar_compact = 1
" Open the tagbar when vim starts if the file being opened is supported
" autocmd VimEnter * nested :call tagbar#autoopen(1)
" To view a list of colors available run :highlight
highlight TagbarHighlight ctermfg=109 ctermbg=237 guifg=#83a598 guibg=#3c3836
" Sort by order of appearence in the file, not by alphabetical
let g:tagbar_sort = 0
" #########################
" ###### Ale
" ########################
" Use the quickfix list
let g:ale_set_loclist = 0
let g:ale_set_quickfix = 1
" Open the list
let g:ale_open_list = 1
" Wait n ms before linting after text is changed
let g:ale_lint_delay = 700
nnoremap <Leader>tl :ALEToggle<CR>
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'SCSS': ['styleint'],
\}
" #########################
" ###### Vim Devicons
" ########################
" the amount of space to use after the glyph character (default ' ')
let g:WebDevIconsUnicodeDecorateFolderNodes = 0
let g:WebDevIconsNerdTreeAfterGlyphPadding = ' '