-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
188 lines (157 loc) · 4.77 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
"---------------------------------------------------------------------
" Plugins
"---------------------------------------------------------------------
" Auto install vim-plug if it's missing
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/bundle')
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-haml'
Plug 'tpope/vim-markdown'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tomtom/tcomment_vim'
Plug 'Townk/vim-autoclose'
Plug 'tsaleh/vim-supertab'
Plug 'gregsexton/gitv'
Plug 'kana/vim-textobj-user'
Plug 'nelstrom/vim-textobj-rubyblock'
Plug 'nanotech/jellybeans.vim'
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-bundler'
Plug 'kien/ctrlp.vim'
Plug 'slim-template/vim-slim'
Plug 'kchmck/vim-coffee-script'
Plug 'tpope/vim-endwise'
Plug 'rking/ag.vim'
call plug#end()
"---------------------------------------------------------------------
"---------------------------------------------------------------------
" Macros
"---------------------------------------------------------------------
runtime macros/matchit.vim
"---------------------------------------------------------------------
"---------------------------------------------------------------------
" General
"---------------------------------------------------------------------
filetype on
filetype plugin on
filetype indent on
syntax on
set ar
set hi=50
set pt=<F12>
set nobk
set nowb
set noswf
"---------------------------------------------------------------------
"---------------------------------------------------------------------
" User interface
"---------------------------------------------------------------------
" General
set t_Co=256
colo jellybeans
set bg=dark
set wmnu
set ru
set ch=1
set lz
set bs=eol,start,indent
set ic
set scs
set is
set sm
set mat=2
set hls
set ls=2
set stl=%f\ %m\ %r\ Line:%l/%L[%p%%]\ Col:%c\ Buf:%n\ ASCII:%b
set nu
set rnu
" Wrap
set lbr
set ww+=h,l
" Indent
set ai
set si
" Tab
set et
set ts=2
set sw=2
set sta
set tpm=30
" Folding
set nofen
set fdm=indent
set fdn=10
set fdl=1
" Window splitting
set splitbelow
set splitright
"---------------------------------------------------------------------
"---------------------------------------------------------------------
" Ruby
"---------------------------------------------------------------------
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading=1
autocmd FileType ruby,eruby let g:rubycomplete_rails=1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global=1
"---------------------------------------------------------------------
"---------------------------------------------------------------------
" Git
"---------------------------------------------------------------------
autocmd Filetype gitcommit setlocal spell textwidth=72
"---------------------------------------------------------------------
"---------------------------------------------------------------------
" Key mappings
"---------------------------------------------------------------------
" Key bindings while typing non-latin text
set langmap=Ч~,ЯQ,ВW,ЕE,РR,ТT,ЪY,УU,ИI,ОO,ПP,Ш{,Щ},АA,СS,ДD,ФF,ГG,ХH,ЙJ,КK,ЛL,ЗZ,ЬX,ЦC,ЖV,БB,НN,МM,ч`,яq,вw,еe,рr,тt,ъy,уu,иi,оo,пp,ш[,щ],аa,сs,дd,фf,гg,хh,йj,кk,лl,зz,ьx,цc,жv,бb,нn,мm
" Disable arrow keys
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
nnoremap <Up> <NOP>
nnoremap <Down> <NOP>
nnoremap <Left> <NOP>
nnoremap <Right> <NOP>
" Disable page keys
inoremap <PageUp> <NOP>
nnoremap <PageDown> <NOP>
" Disable entering Ex mode with Q
map Q <Nop>
" Switch between windows
map <C-K> <C-W>k
map <C-J> <C-W>j
map <C-H> <C-W>h
map <C-L> <C-W>l
" Swapping windows
map <C-S> <C-W>r
" Copy/Paste
map <C-V> "+gP
cmap <C-V> <C-R>+
vnoremap <C-C> "+y""
" Stop the highlighting
map <F2> :noh<CR>
" AutoClose
map <F3> :AutoCloseToggle<CR>
"---------------------------------------------------------------------
"---------------------------------------------------------------------
" Plugins
"---------------------------------------------------------------------
if executable('ag')
let g:ag_working_path_mode='r'
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
"---------------------------------------------------------------------