This repository has been archived by the owner on Oct 2, 2022. It is now read-only.
/
vimrc.symlink
356 lines (299 loc) · 10.5 KB
/
vimrc.symlink
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
" -*- mode: vimscript -*-
" vi: set ft=vimscript :
" Environment {
" Basics {
set nocompatible " be viMproved
filetype off " required as per vundle install
" vundle bits
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" clipboard stuffs
if has ("unix") && "Darwin" != system("echo -n \"$(uname)\"")
" on Linux use + register for copy-paste
set clipboard=unnamedplus
else
" one mac and windows, use * register for copy-paste
set clipboard=unnamed
endif
" }
" Windows Compatibility {
if has('win32') || has('win64')
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
endif
" }
" Bundles! {
" required as per vundle install
Bundle 'gmarik/vundle'
" General { general purpose library of vimscript
Bundle 'tomtom/tlib_vim'
" mah theme! or not mine, specifically, but the one that I use
Bundle 'chriskempson/vim-tomorrow-theme'
" ensures that there's only ever one NERDTree, which is the behavior
" that I want
Bundle 'jistr/vim-nerdtree-tabs'
" the NERDTree, because NetRW is nice, but not so nice at the same
" time
Bundle 'scrooloose/nerdtree'
let NERDTreeHijackNetrw = 0
" something I need to learn to use more often
Bundle 'tpope/vim-surround'
" another thing that I need to learn to use more often
Bundle 'kien/ctrlp.vim'
" fancy stuff in the status bar!
Bundle 'Lokaltog/vim-powerline'
let g:Powerline_symbols = 'fancy'
set guifont=Menlo\ for\ Powerline
" a motions tool I need to learn to use more
Bundle 'Lokaltog/vim-easymotion'
" stuff gets stupid without this
Bundle 'nathanaelkane/vim-indent-guides'
" a thing I honestly don't use
Bundle 'tpope/vim-git'
" hit <C-O> and then everything goes away! it's so zen!
Bundle 'vim-scripts/ZoomWin'
" }
" Programming {
" syntax checking for many languages. truly useful feature to have
" around.
Bundle 'scrooloose/syntastic'
" some kind of git integration. i don't use this much (even at all)
Bundle 'tpope/vim-fugitive'
" but i use this ALL the time!
Bundle 'scrooloose/nerdcommenter'
" if we have ctags, enable the tagbar (which i don't use much at all)
if executable('ctags')
Bundle 'majutsushi/tagbar'
endif
" puts end statements where it makes sense in certain programming
" languages (ruby, mainly)
Bundle 'tpope/vim-endwise'
" something i need to learn to use more
Bundle 'michaeljsmith/vim-indent-object'
" }
" Python {
Bundle 'klen/python-mode'
Bundle 'python.vim'
Bundle 'python_match.vim'
Bundle 'pythoncomplete'
Bundle 'vim-scripts/scons.vim'
Bundle 'vim-scripts/Scons-compiler-plugin'
" }
" JS & Less CSS {
Bundle 'leshill/vim-json'
Bundle 'groenewege/vim-less'
Bundle 'pangloss/vim-javascript'
Bundle 'briancollins/vim-jst'
Bundle 'kchmck/vim-coffee-script'
" }
" HTML, CSS, SASS, & friends {
Bundle 'amirh/HTML-AutoCloseTag'
Bundle 'ChrisYip/Better-CSS-Syntax-for-Vim'
Bundle 'ap/vim-css-color'
Bundle 'tpope/vim-haml'
Bundle 'cakebaker/scss-syntax.vim'
" }
" Ruby! {
Bundle 'vim-ruby/vim-ruby'
Bundle 'tpope/vim-rails'
let g:rubycomplete_buffer_loading = 1
Bundle 'skwp/vim-rspec'
" }
" Etc? {
Bundle 'tpope/vim-markdown'
Bundle 'timcharper/textile.vim'
" }
" }
" }
" Configuration! {
" theme bollocks {
set background=dark
if has('gui_running')
colorscheme Tomorrow-Night
else
colorscheme Tomorrow-Night-Bright
endif
" }
" resize window intelligently
if has('gui_running') && has('autocmd')
au VimResized * wincmd =
endif
" enable spelling in gui mode, which has nice underlining, but don't do it
" in console mode, which doesn't have nice underlining (that i've seen)
if has('gui_running')
set spell
endif
" vundle wants this; not totally sure why
filetype plugin indent on
" pilfered from Janus (mostly) {
function! s:setupWrapping()
set wrap
set linebreak
set textwidth=72
set nolist
endfunction
if has("autocmd")
" In Makefiles, use real tabs, not tabs expanded to spaces
au FileType make setlocal noexpandtab
" Force ftypes on markdown and use wrapping
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} setf markdown | call s:setupWrapping()
" use 4 spaces for python indentation, as per Python preferences in like
" PEP4 or something like that.
au FileType python setlocal softtabstop=4 tabstop=4 shiftwidth=4
" Remember last location in file, but not for commit messages.
" see :help last-position-jump - btw, this little bugger rocks!
au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
endif
" maps! {
" w!! = sudo save file - mighty userful little booger!
cmap w!! %!sudo tee > /dev/null %
" format entire file
nmap <leader>fef ggVG=
" use arrows to go up a screen line, not a literal line
map <Down> gj
map <Up> gk
" Default mapping, <leader>n
map <leader>n :NERDTreeToggle<CR>
" }
" close vim if nerdtree is the only thing open {
if has('autocmd')
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
endif
let NERDTreeIgnore=['\.pyc$', '\.pyo$', '\.rbc$', '\.rbo$', '\.class$', '\.o$', '\~$']
" }
" NERDTree configuration stuff {
augroup AuNERDTreeCmd
autocmd AuNERDTreeCmd VimEnter * call s:CdIfDirectory(expand("<amatch>"))
autocmd AuNERDTreeCmd FocusGained * call s:UpdateNERDTree()
" If the parameter is a directory, cd into it
function s:CdIfDirectory(directory)
let explicitDirectory = isdirectory(a:directory)
let directory = explicitDirectory || empty(a:directory)
if explicitDirectory
exe "cd " . fnameescape(a:directory)
endif
" Allows reading from stdin
" ex: git diff | mvim -R -
if strlen(a:directory) == 0
return
endif
if directory
NERDTree
wincmd p
bd
endif
if explicitDirectory
wincmd p
endif
endfunction
" NERDTree utility function
function s:UpdateNERDTree(...)
let stay = 0
if(exists("a:1"))
let stay = a:1
end
if exists("t:NERDTreeBufName")
let nr = bufwinnr(t:NERDTreeBufName)
if nr != -1
exe nr . "wincmd w"
exe substitute(mapcheck("R"), "<CR>", "", "")
if !stay
wincmd p
end
endif
endif
endfunction
" }
" Other and misc configuration {
" syntax highlighting is very nice!
syntax on
" use the mouse on supporting ttys and stuff
set mouse=a
" utf-8 is da bomb!
scriptencoding utf-8
" slightly less annoying command failures
set shortmess+=filmnrxoOtT
" view folds, cursor, and other things i don't know about
set viewoptions=folds,options,cursor,unix,slash
" go one past line end for slightly more betterer editing experience
set virtualedit=onemore
" gimme a fat history, albert!
set history=1000
" wtf?
set hidden
" write buffering? sounds too slow to me
set nowb
" LINE NUMBERZ!!!! <3
set number
" personally I use a meterstick
set ruler
" syntax on, and now enabled. perhaps redundant
syntax enable
" set up tabstops and widths
set tabstop=2
set shiftwidth=2
set expandtab
" not sure what this does
set list
" backspace over stuff, yoh
set backspace=indent,eol,start
" not sure what this does, either
if exists("g:enable_mvim_shift_arrow")
let macvim_hig_shift_movement = 1 " mvim shift-arrow-keys
endif
" List chars {
set listchars="" " Reset the listchars
set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "."
set listchars+=trail:. " show trailing spaces as dots
set listchars+=extends:> " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the last column when wrap is
" }
" Searching {
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
" Wild settings {
" TODO: Investigate the precise meaning of these settings
" set wildmode=list:longest,list:full
" Disable output and VCS files
set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem
" Disable archive files
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz
" Ignore bundler and sass cache
set wildignore+=*/vendor/gems/*,*/vendor/cache/*,*/.bundle/*,*/.sass-cache/*
" Disable temp and backup files
set wildignore+=*.swp,*~,._*
" }
" }
" Backup and swap files {
set backupdir=~/.vim_backup// " where to put backup files.
set directory=~/.vim_temp// " where to put swap files.
" }
" statusline {
if has("statusline") && !&cp
set laststatus=2 " always show the status bar
" Start the status line
set statusline=%f\ %m\ %r
set statusline+=Line:%l/%L[%p%%]
set statusline+=Col:%v
set statusline+=Buf:#%n
set statusline+=[%b][0x%B]
endif
" }
" scrolling {
set scrolloff=3
set sidescrolloff=5
set sidescroll=1
" }
set cursorline " show the cursor line by highlight
set showcmd " what did this do?
set ttyfast " just assume we have a fast terminal
au BufNewFile,BufRead SCons* set filetype=scons
" cursor shape
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
" }
" }
" } i am the master of gratuitous indentation, ain't i?