-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvimrc
203 lines (163 loc) · 4.91 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
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
"
" My Bundles here:
"
"" original repos on github
Bundle 'gmarik/vundle'
Bundle 'vim-scripts/Decho'
Bundle 'kien/ctrlp.vim'
Bundle 'romanvbabenko/rails.vim'
Bundle 'tComment'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-rvm'
Bundle "scrooloose/syntastic"
Bundle "tpope/vim-surround"
" resource repos
Bundle "git://github.com/timcharper/textile.vim.git"
Bundle "git://github.com/tpope/vim-markdown.git"
Bundle "git://github.com/jinfield/vim-nginx.git"
Bundle "git://github.com/tpope/vim-haml.git"
Bundle "git://github.com/leshill/vim-json.git"
Bundle "git://github.com/tmatilai/vim-monit.git"
Bundle "git://github.com/t9md/vim-chef.git"
Bundle "romanvbabenko/vim-asciidoc"
Bundle "git://github.com/altercation/vim-colors-solarized.git"
Bundle "git://github.com/scrooloose/nerdtree.git"
Bundle "git://github.com/slim-template/vim-slim.git"
Bundle "git://github.com/thoughtbot/vim-rspec"
Bundle "git://github.com/kchmck/vim-coffee-script.git"
Bundle 'git://github.com/tpope/vim-pastie.git'
" Snippets support
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle 'garbas/vim-snipmate'
Bundle 'honza/vim-snippets'
filetype plugin indent on " required!
syntax enable
" http://serverfault.com/questions/130632/problems-with-vim-locale-as-non-root-user-on-solaris
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8 bomb
set fileencodings=ucs-bom,utf-8,latin1
endif
set tabstop=2
set expandtab
set shiftwidth=2
set list "display unprintable characters
set backspace=indent,eol,start
set listchars=tab:»·,nbsp:·,trail:·,extends:>,precedes:<
set number
set numberwidth=7
set ruler
set showcmd
set laststatus=2
set hlsearch
set incsearch
set ignorecase
set smartcase
"Autocomplete mode
set wildmenu
" bash style
"set wildmode=longest,list
" zsh style
set wildmode=list:longest,full
" Copy indent from current line when starting a new line
"set autoindent
"TODO should be handle exception if colorscheme not exists
try
colorscheme solarized "ir_black koehler
set background=dark
catch " /^Vim:E121/
colorscheme default
endtry
" Automatically removing all trailing whitespace
autocmd BufWritePre *.rb :%s/\s\+$//e
" File types autodetection
autocmd BufNewFile,BufRead *.txt setfiletype text
autocmd BufNewFile,BufRead Gemfile,Guardfile,Vagrantfile,Procfile,Rakefile setfiletype ruby
autocmd FileType text,markdown,html,xhtml,eruby,asc,slim setlocal wrap linebreak nolist
" Statusline
if has("statusline") && !&cp
set laststatus=2 " always show the status bar
" Start the status line
set statusline=%{hostname()}:
set statusline+=%f\ %m\ %r
" Add rvm
if exists('$rvm_path')
set statusline+=%{rvm#statusline()}
endif
" Add fugitive
set statusline+=%{fugitive#statusline()}
" display a warning if &paste is set
set statusline+=%#error#
set statusline+=%{&paste?'[paste]':''}
set statusline+=%*
" Finish the statusline
set statusline+=Line:%l/%L[%p%%]
set statusline+=Col:%v
set statusline+=Buf:#%n
set statusline+=[%b][0x%B]
endif
" Show syntax highlighting groups for word under cursor
" nmap <C-S-P> :call <SID>SynStack()<CR>
nmap <C-S-H> :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
nnoremap <c-l> :bp <cr>
let mapleader = "\\"
map <leader>l :bp<esc>
"Colorscheme hotfix
"hi Pmenu ctermfg=lightgray ctermbg=darkgray cterm=NONE
"hi PmenuSel ctermfg=black ctermbg=lightgray cterm=NONE
" Local config
if filereadable(".vimrc.local")
source .vimrc.local
endif
" Rails shortcuts
command! Rapplication :e config/application.rb
command! Rroutes :e config/routes.rb
command! Rschema :e db/schema.rb
command! Rgemfile :e Gemfile
command! RTapplication :tabnew config/application.rb
command! RTroutes :tabnew config/routes.rb
command! RTschema :tabnew db/schema.rb
command! RTgemfile :tabnew Gemfile
" Automatically load .vimrc source when saved
autocmd BufWritePost .vimrc source $MYVIMRC
set guifont=Monaco:h13
nnoremap <silent> <F12> :TagbarToggle<CR>
nnoremap <silent> <F2> :NERDTreeToggle<CR>
nnoremap <silent> <F3> :noh<CR>
nnoremap <silent> <F4> :Ztest<CR>
set colorcolumn=120
highlight ColorColumn ctermbg=lightgrey guibg=lightgrey
let g:NERDTreeWinSize = 40
let g:rspec_command = "!zeus test {spec}"
command! Ztest :call RunCurrentSpecFile()
let g:solarized_contrast = "high"
" map w <Plug>CamelCaseMotion_w
" map b <Plug>CamelCaseMotion_b
" map e <Plug>CamelCaseMotion_e
" sunmap w
" sunmap b
" sunmap e
let g:tagbar_left = 1
let g:tagbar_width = 40
let g:tagbar_autofocus = 1
call togglebg#map("<F5>")
function! s:setupMarkup()
nnoremap <leader>p :silent !open -a Marked.app '%:p'<cr>
endfunction
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()