-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
415 lines (361 loc) · 12.8 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
" Vundle
" --------------------------------------------------------------------
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Vundle is an awesome package built on top of Pathogen, which is the
" de-facto package manager for vim now.
"
" Commands:
" To install configured bundles:
" Launch vim, run :BundleInstall (or vim +BundleInstall +qall for CLI lovers)
"
" Site: https://www.github.com/gmarik/vundle
Bundle 'gmarik/vundle'
" Command-T works so much better than NERDTree if you want to speedily open
" files!
"
" Installation Notes:
" After doing a :BundleInstall, the C extension needs to be built
" > cd <Path to this repo>/bundle/command-t/ruby/command-t
" > ruby extconf.rb
" > make
"
" Commands:
" Just use <Leader>t to open file listing and type away.
" It works best when you open vim at your root directory.
"
" At prompt
" <C-a> move the cursor to the start (left)
" <C-e> move the cursor to the end (right)
" <C-u> clear the contents of the prompt
" <Tab> change focus to the file listing
" <C-c> to cancel
"
" There are different ways to open a file
" <CR> open the selected file
" <C-CR> open the selected file in a new split window
" <C-s> open the selected file in a new split window
" <C-v> open the selected file in a new vertical split window
" <C-t> open the selected file in a new tab
"
" Site: https://www.github.com/wincent/Command-T
Bundle 'wincent/Command-T'
" tcomment is a comment plugin that makes commenting and uncommenting easier.
"
" Commands:
" gc<motion> | To toggle comments
" gcip | To comment inner paragraph
" <Leader>_b | Comment the visually selected paragraph as block
"
" Site: https://github.com/tomtom/tcomment_vim/blob/master/doc/tcomment.txt
Bundle 'tomtom/tcomment_vim'
" vim-surround
"
" Commands:
" TODO: Add list
"
" Site: https://github.com/tpope/vim-surround
Bundle 'tpope/vim-surround'
" Fugitive is a very useful git wrapper by tpope!
"
" Description:
" View any blob, tree, commit, or tag in the repository with :Gedit (and
" :Gsplit, :Gvsplit, :Gtabedit, ...). Edit a file in the index and write to it
" to stage the changes. Use :Gdiff to bring up the staged version of the file
" side by side with the working tree version and use Vim's diff handling
" capabilities to stage a subset of the file's changes.
"
" Bring up the output of git status with :Gstatus. Press - to add/reset a
" file's changes, or p to add/reset --patch that mofo. And guess what :Gcommit
" does!
"
" :Gblame brings up an interactive vertical split with git blame output. Press
" enter on a line to edit the commit where the line changed, or o to open it in
" a split. When you're done, use :Gedit in the historic buffer to go back to
" the work tree version.
"
" :Gmove does a git mv on a file and simultaneously renames the buffer.
" :Gremove does a git rm on a file and simultaneously deletes the buffer.
"
" Use :Ggrep to search the work tree (or any arbitrary commit) with git grep,
" skipping over that which is not tracked in the repository. :Glog loads all
" previous revisions of a file into the quickfix list so you can iterate over
" them and watch the file evolve!
"
" :Gread is a variant of git checkout -- filename that operates on the buffer
" rather than the filename. This means you can use u to undo it and you never
" get any warnings about the file changing outside Vim. :Gwrite writes to both
" the work tree and index versions of a file, making it like git add when
" called from a work tree file and like git checkout when called from the index
" or a blob in history.
"
" Use :Gbrowse to open the current file on GitHub, with optional line range
" (try it in visual mode!). If your current repository isn't on GitHub, git
" instaweb will be spun up instead.
"
" Add %{fugitive#statusline()} to 'statusline' to get an indicator with the
" current branch in (surprise!) your statusline.
"
" Last but not least, there's :Git for running any arbitrary command, and Git!
" to open the output of a command in a temp file.)
"
" Site: https://www.github.com/tpope/vim-fugitive
Bundle 'tpope/vim-fugitive'
" vim-easymotion is an awesome plugin to move quickly to a given spot!
"
" Commands:
" Just use <Leader><Leader>w and then words will be highlighted. Go to the one
" you want to go to!
" <Leader><Leader>w to beginning of word forward
" <Leader><Leader>b to beginning of word backward
" <Leader><Leader>e to end of word forward
" <Leader><Leader>ge to end of word backward
" <Leader><Leader>f find char to the right
"
" Site: https://www.github.com/Lokaltog/vim-easymotion
Bundle 'Lokaltog/vim-easymotion'
" Powerline is the line at the bottom which tells you everything you need to
" know about a file! This one is currently in stable beta but I am going
" forward with putting it in anyway.
"
" Site: https://www.github.com/Lokaltog/powerline
Bundle 'Lokaltog/powerline'
set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
set laststatus=2 " Always show the statusline
" ColorV can be used as a color picker and works really well.
" I wish I could get insert to work. Let's see.
"
" :ColorV (<leader>cv) | Show ColorV window
" :ColorVView (<leader>cw) | Show ColorV window with color text under cursor.
" :ColorVPreview (<leader>cpp) | Preview colors in current buffer
" :ColorVEdit (<leader>ce) | Edit color text under cursor
" :ColorVName (<leader>cn) | Show color name list window.
" :ColorVInsert (<leader>cii) | Insert color with ColorV window. (Doesn't work)
"
" Site: https://github.com/Rykka/colorv.vim
Bundle 'Rykka/colorv.vim'
" Sparkup is used for quickly writing HTML!
" I wonder whether I should be using zencoding, though
"
" Some examples -
"
" div.align-left#header
" div#header + div#footer
" #header > h1{Welcome to our site}
" a[href=index.html]{Home}
" ul > li.item-$*3 > strong
" #header > ul > li < p{Footer}
"
" <C-e> to execute
" <C-n> to jump to next empty tag
"
" Site:
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
" Python Mode
"
" Commands:
" K Show python docs (g:pymode_doc enabled)
" <C-Space> Rope autocomplete (g:pymode_rope enabled)
" <C-c>g Rope goto definition (g:pymode_rope enabled)
" <C-c>d Rope show documentation (g:pymode_rope enabled)
" <C-c>f Rope find occurrences (g:pymode_rope enabled)
" <Leader>r Run python (g:pymode_run enabled)
" <Leader>b Set, unset breakpoint (g:pymode_breakpoint enabled)
" [[ Jump on previous class or function (normal, visual, operator modes)
" ]] Jump on next class or function (normal, visual, operator modes)
" [M Jump on previous class or method (normal, visual, operator modes)
" ]M Jump on next class or method (normal, visual, operator modes)
" aC C Select a class. Ex: vaC, daC, dC, yaC, yC, caC, cC (normal, operator modes)
" iC Select inner class. Ex: viC, diC, yiC, ciC (normal, operator modes)
" aM M Select a function or method. Ex: vaM, daM, dM, yaM, yM, caM, cM (normal, operator modes)
" iM Select inner function or method. Ex: viM, diM, yiM, ciM (normal, operator modes)]
"
" Site: https://github.com/klen/python-mode
Bundle 'klen/python-mode'
let g:pymode_syntax_space_errors=0
" Syntax, Indent and Filetype plugin
" Some Ruby specific motions defined
"
" ]m Go to start of next method definition.
" ]M Go to end of next method definition.
" [m Go to start of previous method definition.
" [M Go to end of previous method definition.
" ]] Go to start of next module or class definition.
" ][ Go to end of next module or class definition.
" [[ Go to start of previous module or class definition.
" [] Go to end of previous module or class definition.
"
" am "a method", select from "def" until matching "end" keyword.
" im "inner method", select contents of "def"/"end" block, excluding the "def" and "end" themselves.
" aM "a class", select from "class" until matching "end" keyword.
" iM "inner class", select contents of "class"/"end"
"
" Site: https://github.com/vim-ruby/vim-ruby/blob/master/doc/vim-ruby.txt
Bundle 'vim-ruby/vim-ruby'
Bundle 'pangloss/vim-javascript'
Bundle 'vim-scripts/php.vim--Hodge'
Bundle 'kchmck/vim-coffee-script'
Bundle 'hallison/vim-markdown'
Bundle 'derekwyatt/vim-scala'
Bundle 'vim-scripts/indenthtml.vim'
let g:html_indent_inctags = "html,body,head,tbody"
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"
Bundle 'sukima/xmledit'
Bundle 'tpope/vim-rails.git'
Bundle 'tpope/vim-rake'
Bundle 'tpope/vim-bundler'
Bundle 'leshill/vim-json'
Bundle 'itspriddle/vim-jquery'
Bundle 'nono/vim-handlebars'
Bundle 'mutewinter/nginx.vim'
Bundle 'tpope/vim-git'
" Proper Ending script
Bundle 'Raimondi/delimitMate'
let delimitMate_expand_cr = 1
au FileType html let b:delimitMate_matchpairs = "(:),[:],{:}"
" Theme bundle
" Using a patched twerth/ir_black to make it play better with vim-gitgutter
Bundle 'natansh/ir_black'
" Taglist.vim
" Brilliant for use with ctags!
"
" Commands:
" :TlistToggle
Bundle 'vim-scripts/taglist.vim'
" vim-conque is a terminal editor
"
" Commands:
" Type :ConqueTerm <command> to run your command in vim, for example:
"
" :ConqueTerm bash
" :ConqueTerm mysql -h localhost -u joe -p sock_collection
" :ConqueTerm Powershell.exe
" :ConqueTerm C:\Python27\python.exe
"
" To open ConqueTerm in a new horizontal or vertical buffer use:
"
" :ConqueTermSplit <command>
" :ConqueTermVSplit <command>
" :ConqueTermTab <command>
"
" All text typed in insert mode will be sent to your shell.
"
" Site: http://www.vim.org/scripts/script.php?script_id=2771
Bundle 'basepi/vim-conque'
Bundle 'skwp/vim-ruby-conque'
" vim-gitgutter
" See which lines have changed inside Vim itself.
Bundle 'airblade/vim-gitgutter'
" The sign column has grey as bg which I don't like. This shows up when the
" git gutter is enabled for showing diff of head and current inside vim.
" The following command changes the color back to black to match in with the
" rest.
"
" I had to put this inside ir_black as otherwise I used to get a flash of gray
" before it became black.
" highlight clear SignColumn
" Better to always have the sign column around.
let g:gitgutter_sign_column_always = 1
filetype plugin indent on " required!
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
" General Settings
" --------------------------------------------------------------------
" Graphical Movement
map <up> gk
map k gk
imap <up> <C-o>gk
map <down> gj
map j gj
imap <down> <C-o>gj
map E ge
" It is difficult to use '\' as it's position on the keyboard is non-standard
" and difficult to reach.
let mapleader=","
" It hides buffers instead of closing them.
set hidden
" No bells
set visualbell
set noerrorbells
" Showing characters
set listchars=tab:>.,trail:%,extends:#,nbsp:.
" Paste Toggle
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
" Indentation
set autoindent " Automatically indent the new line
set smartindent " si
" Scrolling
set sidescrolloff=10
set scrolloff=5
set nowrap
" Line numbering
set number
set numberwidth=4
" Window Splits
set equalalways
set splitbelow splitright
:noremap ,v :vsp^M^W^W<cr>
:noremap ,h :split^M^W^W<cr>
" Highlight cursor
set cursorline
" Searching
set hlsearch
set incsearch
set ignorecase
set wildignore=*.swp,*.bak,*.pyc,*.class
" Allow saving even when not in sudo mode
cmap w!! w !sudo tee % >/dev/null
" Use Q for formatting the current paragraph (or selection)
vmap Q gq
nmap Q gqap
" Clearing highlighted searches
nmap <silent> ,/ :nohlsearch<CR>
" Colors
set t_Co=256
"set background=dark
syntax on
silent! colorscheme ir_black
" Key Mappings
imap jj <Esc>
map <S-Enter> O<Esc>
map <Enter> o<Esc>
set encoding=utf-8 " Necessary to show unicode glyphs
" From Vimified
set undodir=~/.vim/tmp/undo// " undo files
set backupdir=~/.vim/tmp/backup// " backups
set directory=~/.vim/tmp/swap// " swap files
set backup
set noswapfile
set backspace=indent,eol,start
set tabstop=2
set softtabstop=2
set shiftwidth=2
set shiftround
set smarttab
set expandtab
au FileType python set tabstop=4
au FileType python set softtabstop=4
au FileType python set shiftwidth=4
au FileType markdown set wrap lbr formatoptions=l
" RSPEC
nmap <silent> <Leader>rcrr :call RunRubyCurrentFileConque()<CR>
nmap <silent> <Leader>rcss :call RunRspecCurrentFileConque()<CR>
nmap <silent> <Leader>rcll :call RunRspecCurrentLineConque()<CR>
nmap <silent> <Leader>rccc :call RunCucumberCurrentFileConque()<CR>
nmap <silent> <Leader>rccl :call RunCucumberCurrentLineConque()<CR>
nmap <silent> <Leader>rcRR :call RunRakeConque()<CR>
nmap <silent> <Leader>rcrl :call RunLastConqueCommand()<CR>
nnoremap <silent> <C-s> :call RelatedSpecVOpen()<CR>
nnoremap <silent> ,<C-s> :call RelatedSpecOpen()<CR>