-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
212 lines (167 loc) · 5.53 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
" Leader key
let mapleader = ","
set binary
set nocompatible " Be iMproved
set nobackup
set nowritebackup
set noswapfile
set incsearch " Enable incremental searching
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set smarttab
set autoindent
set nowrap
" allow vim to put buffers on the background without writing to disk and
" remember history and marks when buffer becomes current
set hidden
" shows file title when editing
set title
" fold settings
"set foldmethod=syntax
"set foldlevelstart=2
"set foldnestmax=3
set number
set history=100 " Save the last 100 commands/search terms
set laststatus=2 " Always display the status line
" search settings
set hlsearch
set ignorecase " Ignore case in searches.
set smartcase " Case sensitive if capitals are included.
set autoread " automatically reload a file if it's changed outside vim
set backspace=indent,eol,start " backspace deletes back
" Use Ag instead of Grep when available
if executable("ag")
set grepprg=ag\ --nogroup\ --nocolor\ --column
" Automatically include quotes, because they never hurt and forgetting them is a pain.
" Use <Leader>a to prompt you for an Ag search
nnoremap <Leader>a :Ag!<SPACE>"<LEFT>"
" Use <Leader>A to ag for the word under the cursor
nnoremap <leader>A *<C-O>:AgFromSearch!<CR>
let g:ctrlp_user_command = 'ag %s -l --nocolor --ignore-dir ./spec/reports -g ""'
else
" Use Ack instead of Grep when available
if executable("ack")
set grepprg=ack\ -H\ --nogroup\ --nocolor
" Automatically include quotes, because they never hurt and forgetting them is a pain.
" Use <Leader>a to prompt you for an Ack search
nnoremap <Leader>a :Ack!<SPACE>"<LEFT>"
" Use <Leader>A to Ack for the word under the cursor
nnoremap <leader>A *<C-O>:AckFromSearch!<CR>
endif
endif
set tags=./tags; " TagList
set gfn=Meslo\ LG\ S\ for\ Powerline:h11
" check to make sure vim has been compiled with colorcolumn support before enabling it
if exists("+colorcolumn")
set colorcolumn=120
endif
syntax on " Enable syntax highlighting
filetype off " Enable filetype detection
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Let Vundle manage Vundle
Plugin 'gmarik/Vundle.vim'
" Original repos on github
Plugin 'airblade/vim-gitgutter'
Plugin 'kien/ctrlp.vim'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'maxbrunsfeld/vim-yankstack'
Plugin 'rking/ag.vim'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'scrooloose/nerdtree'
Plugin 'Raimondi/delimitMate'
Plugin 'sjl/gundo.vim'
Plugin 'tpope/vim-endwise'
Plugin 'tpope/vim-bundler'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-rails.git'
Plugin 'vim-ruby/vim-ruby'
Plugin 'vim-scripts/ctags.vim'
Plugin 'vim-scripts/tComment'
Plugin 'derekwyatt/vim-scala'
Plugin 'thoughtbot/vim-rspec'
" Colorschemes
Plugin 'tomasr/molokai'
call vundle#end()
" Syntax and indent
set showmatch "Show matching bracets when text indicator is over them
" Switch on filetype detection and loads
filetype plugin indent on " required!
filetype on
set autoindent " Copy indent from the row above
set si " Smart indent
" Brief help
" :PluginList - list configured bundles
" :PluginInstall(!) - install(update) bundles
" :PluginSearch(!) foo - search(or refresh cache first) for foo
" :PluginClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Plugin command are not allowed..
" CtrlP configuration
let g:ctrlp_map = '<Leader>f'
" Vim gutter configuration
let g:gitgutter_enabled = 1
" Airline/Powerline configuration
let g:airline_powerline_fonts = 1
let g:airline_theme='powerlineish'
" Center screen when scrolling search results
nmap n nzz
nmap N Nzz
" Yankstack configuration
let g:yankstack_map_keys = 0
nmap <leader>v <Plug>yankstack_substitute_older_paste
nmap <leader>V <Plug>yankstack_substitute_newer_paste
" Available colorschemes
colorscheme molokai
" Go learn vim
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" Automatically change to the current directory
nnoremap <Leader>cd :cd %:p:h<CR>:pwd<CR>
" Turn search highlight off
nnoremap <leader><space> :noh<cr>
" Gundo default key
nnoremap <F5> :GundoToggle<CR>
" Navigate in buffers.
map <Leader>n :bnext<CR>
map <Leader>p :bprevious<CR>
" Navigate in splits.
nnoremap <Leader>h <C-w>h
nnoremap <Leader>j <C-w>j
nnoremap <Leader>k <C-w>k
nnoremap <Leader>l <C-w>l
" use C-j and C-k to 'bubble' lines (see
" " http://vimcasts.org/episodes/bubbling-text/)
map <C-j> ddp
map <C-k> ddkP
" NerdTree
map <Leader>t :NERDTreeToggle<CR>
nnoremap <F1> :NERDTreeFind<CR>
" Generate ctags
map <leader>ct :!ctags --extra=+f --languages=-javascript --exclude=.git --exclude=log -R .<CR>
" When vimrc, either directly or via symlink, is edited, automatically reload it
autocmd! bufwritepost .vimrc source %
autocmd! bufwritepost vimrc source %
" RSpec.vim mappings
let g:rspec_runner = "os_x_iterm2"
let g:rspec_command = "!bundle exec rspec {spec}"
map <Leader>q :call RunCurrentSpecFile()<CR>
map <Leader>w :call RunNearestSpec()<CR>
map <Leader>e :call RunLastSpec()<CR>
map <Leader>r :call RunAllSpecs()<CR>
""""""""""""""""""""""""""""""""""
" Some other comfy settings
""""""""""""""""""""""""""""""""""
com W w
set nocompatible "Not vi compatible (Vim is king)
" set nu " Number lines
set hls " highlight search
set lbr " linebreak