-
Notifications
You must be signed in to change notification settings - Fork 22
/
vimrc
executable file
·267 lines (218 loc) · 8.26 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
"
" File: .vimrc
" Author: Jake Zimmerman <[email protected]>
" Modified: 2015 Feb 10
"
" Adapted from Bram Moolenaar's example vimrc.
"
" This vimrc heavily favors Solarized colors. If you don't have your terminal
" configured to use these colors, you should head over to
"
" http://ethanschoonover.com/solarized
"
" and grab a color theme for your terminal (like iTerm2 or Terminal.app). If
" your terminal doesn't support theming, you'll want to manually change the
" appropriate colors.
"
" INSTALLATION INSTRUCTIONS
"
" Presumably, you've gotten your hands on this file because you forked my
" dotfiles repository. I keep all my Vim plugins as submodules, so after you
" clone you'll have to run
"
" $ git submodule init
" $ git submodule update
"
" to grab the required dependencies. Once you've done this, you can either
" manually move the `vimrc` file to `~/.vimrc` and the `vim/` folder to
" `~/.vim`, or you can be a little smarter and use a tool like rcm
" (https://github.com/thoughtbot/rcm) to manage this process.
"
" ISSUES
"
" If you encounter an issue while using this vimrc, please leave a *detailed*
" description of the issue and what'd you expect to happen in the issue
" tracker:
"
" https://github.com/jez/dotfiles/issues
"
" CONTRIBUTING
"
" These are my personal configuration files, so I might be a little hesitant
" to accept pull requests. If you've fixed a bug though, go ahead and I'll
" take a look at it.
" ----- General Settings -----------------------------------------------------
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set history=1000 " keep 1000 lines of command line history
set number " line numbers
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set linebreak " wrap lines on 'word' boundaries
set scrolloff=3 " don't let the cursor touch the edge of the viewport
set splitright " Vertical splits use right half of screen
set timeoutlen=100 " Lower ^[ timeout
set fillchars=fold:\ , " get rid of obnoxious '-' characters in folds
set tildeop " use ~ to toggle case as an operator, not a motion
if exists('&breakindent')
set breakindent " Indent wrapped lines up to the same level
endif
" Tab settings
set expandtab " Expand tabs into spaces
set tabstop=2 " default to 2 spaces for a hard tab
set softtabstop=2 " default to 2 spaces for the soft tab
set shiftwidth=2 " for when <TAB> is pressed at the beginning of a line
" ----- Convenience commands and cabbrev's ------------------------------------
" Make these commonly mistyped commands still work
command! WQ wq
command! Wq wq
command! Wqa wqa
command! W w
command! Q q
" Use :C to clear hlsearch
command! C nohlsearch
" Force write readonly files using sudo
command! WS w !sudo tee %
" open help in a new tab
cabbrev help tab help
" My LaTeX Makefiles all have a `view` target which compiles and opens the PDF
" This command saves the file then runs that target
command! Wv w | make view
command! WV w | make view
" ----- Custom keybindings ----------------------------------------------------
" Make navigating long, wrapped lines behave like normal lines
noremap <silent> k gk
noremap <silent> j gj
noremap <silent> 0 g0
noremap <silent> $ g$
noremap <silent> ^ g^
noremap <silent> _ g_
" use 'Y' to yank to the end of a line, instead of the whole line
noremap <silent> Y y$
" take first suggested spelling as correct spelling and replace
noremap <silent> z! z=1<CR><CR>
" NOTE: This feature requires a longer timeoutlen. To use it, up the
" timeoutlen above.
" ----- Terminal-as-GUI settings ----------------------------------------------
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
" ----- Not-quite-general-but-don't-belong-anywhere-else Settings -------------
augroup vimrc
" Clear the current autocmd group, in case we're re-sourcing the file
au!
" Jump to the last known cursor position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
" ----- Filetype Settings -----------------------------------------------------
" Enable file type detection.
filetype plugin indent on
augroup myFiletypes
au!
" Patch filetypes for common extensions
" SML signature files
au BufRead,BufNewFile *.sig setlocal filetype=sml
" Markdown files
au BufRead,BufNewFile *.md setlocal filetype=markdown
" LaTeX class files
au BufRead,BufNewFile *.cls setlocal filetype=tex
" Amethyst config file
au BufRead,BufNewFile .amethyst setlocal filetype=json
" Turn on spell checking and 80-char lines by default for these filetypes
au FileType markdown,tex setlocal spell
au FileType markdown,tex setlocal tw=80
augroup END
" ----- Pathogen and Plugin Settings ------------------------------------------
" Pathogen is in a non-standard location: modify the rtp to reflect that
set rtp+=~/.vim/bundle/pathogen
" Let Pathogen take over the runtimepath to make plugins in ~/.vim/bundle work
execute pathogen#infect()
" Generate all helptags on startup
Helptags
" ----- bling/vim-airline settings -----
" Fancy arrow symbols, requires a patched font
let g:airline_powerline_fonts = 1
" Show PASTE if in paste mode
let g:airline_detect_paste=1
" Always show statusbar
set laststatus=2
" Slightly modify the theme colors
let g:airline_theme_patch_func = 'AirlineThemePatch'
function! AirlineThemePatch(palette)
if g:airline_theme == 'solarized' && g:solarized_termcolors == 16
" normal mode background: s:base03
let a:palette.normal.airline_a[2] = 8
" normal mode foreground: s:green
let a:palette.normal.airline_a[3] = 2
" line no. background: s:base03
let a:palette.normal.airline_z[2] = 8
" line no. foreground: s:green
let a:palette.normal.airline_z[3] = 2
endif
endfunction
" ----- Raimondi/delimitMate settings -----
let delimitMate_expand_cr = 1
augroup mydelimitMate
au!
au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
au FileType tex let b:delimitMate_quotes = ""
au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},`:'"
au FileType python let b:delimitMate_nesting_quotes = ['"', "'"]
augroup END
" ----- majutsushi/tagbar settings -----
" Open/close tagbar with \b
nmap <silent> <leader>b :TagbarToggle<CR>
"autocmd BufEnter * nested :call tagbar#autoopen(0)
" ----- xolox/vim-easytags settings -----
set tags=./tags;,~/.vimtags
let g:easytags_events = ['BufReadPost', 'BufWritePost']
let g:easytags_async = 1
let g:easytags_dynamic_files = 2
let g:easytags_resolve_links = 1
let g:easytags_suppress_ctags_warning = 1
" ----- scrooloose/syntastic settings -----
let g:syntastic_error_symbol = '✘'
let g:syntastic_warning_symbol = "▲"
augroup mySyntastic
au!
au FileType tex let b:syntastic_mode = "passive"
augroup END
" ----- altercation/vim-colors-solarized settings -----
" Toggle this to "light" for light colorscheme
set background=dark
" Uncomment the next line if your terminal is not configured for solarized
"let g:solarized_termcolors=256
" Remove the underline Solarized places under Folded previews
hi! Folded cterm=NONE term=NONE
" Set the colorscheme
colorscheme solarized
" ----- airblade/vim-gitgutter settings -----
hi clear SignColumn
let g:airline#extensions#hunks#non_zero_only = 1
let g:airline#extensions#tabline#enabled = 1
" ----- jez/vim-superman settings -----
" better man page support
noremap K :SuperMan <cword><CR>
" ----- jistr/vim-nerdtree-tabs -----
" Open/close NERDTree Tabs with \t
nmap <silent> <leader>t :NERDTreeTabsToggle<CR>
" ----- Builtin Vim plugins -----
" When viewing directories, show nested tree mode
let g:netrw_liststyle=3
" Don't create .netrwhist files
let g:netrw_dirhistmax = 0
" -----------------------------------------------------------------------------