-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvimrc
194 lines (162 loc) · 5.51 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
" vimrc: part of the 4U6U57/dotfiles project
" A configuration file for the Vim text editor
" Sets vim preferences and imports various plugins I find useful
" Note some preferences are externalized to the file ~/.editorconfig
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" INSTALLATION/UPDATING
" Vimrc is maintained through 4U6U57/dotfiles, and can be updated by:
" running :VimrcUpdate or by pressing <F12> in Normal mode
" TODO: If you modify this file to suit your own needs, you MUST modify
" the following line or the VimrcUpdate script will revert your changes
" OVERWRITE: true
"
" For more information, see https://github.com/4U6U57/dotfiles
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PLUGIN IMPORTS
" junegunn/vim-plug
" Plugins for Vim
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 * PlugUpdate | source $MYVIMRC
!echo [vimrc] "This is your first time running vim after installing
\ 4U6U57/dotfiles's vimrc. As soon as it's done installing, I highly
\ suggest you run the Vim command :VimrcUpdate to make sure all the
\ dependencies were installed correctly. This is also the way to update
\ the vimrc file and imported plugins when future versions are released.
\ Also, please ignore the following errors, they are expected and
\ unavoidable. Have fun with your new Vim\!" | fmt
endif
call plug#begin('~/.vim/plugged')
Plug 'jiangmiao/auto-pairs'
Plug 'vim-scripts/bats.vim'
Plug 'chrisbra/csv.vim', { 'for': 'csv' }
Plug 'vim-scripts/DoxygenToolkit.vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'albertorestifo/github.vim'
Plug 'othree/html5.vim', { 'for': 'html' }
Plug 'yggdroot/indentline'
Plug 'gregsexton/matchtag'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'ervandew/supertab'
Plug 'bronson/vim-trailing-whitespace'
Plug 'bling/vim-airline'
Plug 'chiel92/vim-autoformat'
Plug 'conradirwin/vim-bracketed-paste'
Plug 'altercation/vim-colors-solarized'
Plug 'octol/vim-cpp-enhanced-highlight', { 'for': 'cpp' }
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-git'
Plug 'airblade/vim-gitgutter'
Plug 'dietsche/vim-lastplace'
Plug 'gabrielelana/vim-markdown', { 'for': 'markdown' }
Plug 'tpope/vim-sensible'
Plug 'dhruvasagar/vim-table-mode'
Plug 'lervag/vimtex', { 'for': 'latex' }
call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" GENERAL PREFERENCES
" Shows matching braces and such
set showmatch
" Error sounds
set noerrorbells
set visualbell
set t_vb=
set tm=500
" Highlighting search results
set hlsearch
" Regular expressions
set magic
" Use spaces instead of tabs, smart tabbing
"set expandtab
"set smarttab
"set shiftwidth=2
"set tabstop=2
" Color scheme
" Note that this is overriden by vim-colors-solarized
set background=dark
colorscheme darkblue
set term=xterm-256color
" Line numbers
set number
" Sets hotdogs
set listchars=tab:>-
" Syntax color-coding
syntax on
set whichwrap+=<,>,h,l,[,]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" KEYBINDINGS
" Mouse
set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
" PageUp and PageDown keys
map <PageUp> <C-U>
map <PageDown> <C-D>
" Autoformat
map <F3> <Esc>:Autoformat<CR>i
imap <F3> <Esc><F3>
" Update Vimrc
function! VimrcUpdater()
PlugUpgrade
if empty(glob('~/.dotfiles')) &&
\ matchstr(readfile('~/.vimrc'),'OVERWRITE:\s*true')
!curl -fLo ~/.vimrc --create-dirs
\ https://raw.githubusercontent.com
\/4U6U57/dotfiles/master/vimrc
\ && echo "[vimrc] updated by curl"
else
!echo "[vimrc] ignored: update with dotfiles"
endif
if empty(glob('~/.editorconfig')) || empty(glob('~/.dotfiles')) &&
\ (filereadable('~/.editorconfig') &&
\ matchstr(readfile('~/.editorconfig'),
\'part of the 4U6U57/dotfiles project') &&
\ matchstr(readfile('~/.editorconfig'),'OVERWRITE:\s*true'))
!curl -fLo ~/.editorconfig --create-dirs
\ https://raw.githubusercontent.com
\/4U6U57/dotfiles/master/editorconfig
\ && echo "[editorconfig] updated by curl"
else
!echo "[editorconfig] ignored: to keep edits"
endif
PlugUpdate
:q!
endfunction
command! VimrcUpdate call VimrcUpdater()
map <F12> :VimrcUpdate<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" FILE SPECIFIC PREFERENCES
"
" Vim specific things only, try to use editorconfig.org as much as possible
" Spellcheck
autocmd FileType md,tex,txt,gitcommit setlocal spell
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PLUGIN PREFERENCES
" csv
let g:csv_autocmd_arrange = 1
" DoxygenToolkit
let g:DoxygenToolkit_authorName = system("git config --get user.name")
" nerdtree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
map <C-n> :NERDTreeToggle<CR>
autocmd bufenter *
\ if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree())
\ | q | endif
" vim-airline
let g:airline#extensions#tabline#enabled = 1
" vim-colors-solarized
let g:solarized_termcolors=256
let g:solarized_contrast="high"
colorscheme solarized
" vim-editorconfig
" let g:EditorConfig_max_line_indicator = "fill"
" vim-gitgutter
let g:gitgutter_realtime = 1
" indentline
let g:indentLine_color_term = 236
" table
let g:table_mode_corner='|'