-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
executable file
·217 lines (158 loc) · 5.18 KB
/
vimrc
File metadata and controls
executable file
·217 lines (158 loc) · 5.18 KB
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
scriptencoding utf-8
set encoding=utf-8
execute pathogen#infect()
set nocompatible
set autochdir
set incsearch
set ignorecase
set smartcase
set tags=./.tags
" read/write tags relative to current buffer location
let g:easytags_dynamic_files = 2
let g:powerline_loaded = 1
let g:airline_powerline_fonts = 1
set list
set listchars=tab:→\ ,trail:-
set number
set cpoptions=d
set background=dark
" syntax on
syntax enable
filetype plugin indent on
set cursorcolumn
set laststatus=2 " Always display the statusline in all windows
set showtabline=1 " Always display the tabline, even if there is only one tab
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
" 12 messages and info
set showcmd
set showmode
set ruler
set visualbell
" 14 editing text
set backspace=indent,eol,start
set completeopt=menu,longest,preview
set showmatch
" 15 tabs and indenting
set tabstop=2
set shiftwidth=2
set smarttab
set autoindent
set smartindent
" 19 reading and writing files
set autowrite
set autoread
" 20 the swap file
set directory=~/.vim/swap
" 21 command line editing
set wildignore=*.o,*.obj,*.tmp,*.sw[op],*rbc,*pyc,~*
set wildignorecase
set wildmenu
set undofile
set undodir=~/.vim/undo
" XX other stuff
set conceallevel=2
" colorscheme vividchalk
colorscheme solarized
set grepprg=ack
function! PrepareRebaseCommitMessage()
" Remove comments
silent! 1,/# Please enter the commit message for your changes./-1g/^#/d
" Remove empty lines
silent! 1,/# Please enter the commit message for your changes./-1g/^$/d
" Turn the previous commit messages in to list items
silent! 1,/# Please enter the commit message for your changes./-1g!/^$/exe "normal! I* \<ESC>"
silent! normal gg[ [ gg
endfunction
" Autocommands
augroup RUBY
autocmd!
autocmd BufNewFile,BufRead */spec/**/*.rb,*_spec.rb compiler rspec " set the rspec compiler
autocmd BufNewFile,BufRead */test/**/*.rb,*_test.rb compiler rubyunit " set the test unit compiler
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete " use rubycomplete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby compiler ruby
autocmd FileType cucumber,haml,sass,ruby,eruby setlocal textwidth=75 formatoptions+=t
" autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby set fdm=syntax fdl=99 " fold based on syntax, default fully open
autocmd FileType ruby set tabstop=2 shiftwidth=2 softtabstop=2 et
autocmd FileType cucumber set tabstop=2 shiftwidth=2 softtabstop=2 et
augroup END
autocmd BufReadPost fugitive://* set bufhidden=delete
autocmd FileType coffee set tabstop=2 shiftwidth=2 softtabstop=2 et
autocmd FileType python set et
autocmd FileType c set tabstop=4 shiftwidth=4 softtabstop=4 et
autocmd FileType asm set tabstop=4 shiftwidth=4 softtabstop=4 et
autocmd FileType yaml set tabstop=2 shiftwidth=2 softtabstop=2 et
autocmd FileType haskell set et
autocmd FileType java set tabstop=2 shiftwidth=2 softtabstop=2 et
autocmd BufReadPost gitcommit call PrepareRebaseCommitMessage()
" SuperTab
let g:SuperTabDefaultCompletionType = "context"
" ragtag
let g:ragtag_global_maps = 1
" Mappings
let mapleader=","
let g:mapleader=","
map Y y$
nmap <Leader>n :NERDTreeToggle<CR>
nmap <Leader>m :NERDTreeToggle %<CR>
nmap <Leader>fb :CtrlPBuffer<CR>
nmap <Leader>ff :FufFile<CR>
nmap <Leader>tl :TlistToggle<CR>
nmap <Tab> :R<CR>
nmap <C-Tab> :A<CR>
nmap <Leader>bd :bd<CR>
nmap <Leader>tb :TagbarOpenAutoClose<CR>
" Functions
function! OpenURL(url)
if has("win32")
exe "!start cmd /cstart /b ".a:url.""
elseif $DISPLAY !~ '^\w'
exe "silent !google-chrome \"".a:url."\""
else
exe "silent !google-chrome -T \"".a:url."\""
endif
redraw!
endfunction
command! -nargs=1 OpenURL :call OpenURL(<q-args>)
command! W :execute ':silent w !sudo tee % > /dev/null' | :edit!
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
let ruby_operators = 1
let ruby_space_errors = 1
let g:rubycomplete_buffer_loading = 1
let g:tagbar_type_ruby = {
\ 'kinds' : [
\ 'm:modules',
\ 'c:classes',
\ 'd:describes',
\ 'C:contexts',
\ 'f:methods',
\ 'F:singleton methods'
\ ]
\ }
autocmd FileType c,cpp,java,php,ruby autocmd BufWritePre <buffer> :%s/\s\+$//e
set encoding=utf-8
" syntastic recommended settings via its github page
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
" Scala has fsc and scalac checkers--running both is pretty redundant and
" slow. An explicit `:SyntasticCheck scalac` can always run the other.
let g:syntastic_scala_checkers = ['fsc']
let g:syntastic_ignore_files = ['\m\.sbt$']
let g:ctrlp_custom_ignore = {
\ 'file': '\v\.(class|pyc|xz|tar|bz2|gz|jar|png|jpeg|gif|jpg|docx|doc|pdf)$',
\ }
let g:easytags_async = 1
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files'],
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
\ },
\ 'fallback': 'find %s -type f'
\ }