/
.vimrc
178 lines (154 loc) · 4.76 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
call plug#begin()
Plug 'junegunn/vim-peekaboo'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-haml'
Plug 'tpope/vim-surround'
Plug 'godlygeek/tabular'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-markdown'
Plug 'tpope/vim-abolish'
Plug 'kien/ctrlp.vim'
Plug 'JazzCore/ctrlp-cmatcher', { 'do' : './install.sh' }
Plug 'tpope/vim-repeat'
Plug 'SirVer/ultisnips'
Plug 'Lokaltog/vim-easymotion'
Plug 'rust-lang/rust.vim'
" Additional text objects.
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-indent'
Plug 'kana/vim-textobj-line'
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-endwise'
Plug 'bling/vim-airline'
Plug 'rking/ag.vim'
Plug 'fatih/vim-go'
Plug 'GEverding/vim-hocon'
Plug 'chase/vim-ansible-yaml'
Plug 'craigemery/vim-autotag' " Automatically regenerate ctags.
call plug#end()
set shell=/bin/sh
set nocompatible
runtime macros/matchit.vim
" The arrow keys suck. Don't let them do anything.
noremap <up> <nop>
inoremap <up> <nop>
vnoremap <up> <nop>
noremap <down> <nop>
inoremap <down> <nop>
vnoremap <down> <nop>
noremap <left> <nop>
inoremap <left> <nop>
vnoremap <left> <nop>
noremap <right> <nop>
inoremap <right> <nop>
vnoremap <right> <nop>
""""""""""
" Settings
""""""""""
" Use the system clipboard.
set clipboard=unnamed,unnamedplus
" The default vim backspace options are a little lacking. This makes backspace
" work over the following in insert mode:
"
" * line breaks (eol)
" * automatically inserted indentation (indent)
" * the start of insert mode (start)
set backspace=2
" TODO (check w/ vim-airline)
set laststatus=2 " The last window will always have a status line.
" In split mode, make the current window big, but leave others for context.
set winwidth=84
" This is an oddity of vim. We have to set winheight bigger than we want to
" set winminheight. If we set winheight to be huge, before winminheight, then
" winminheight set will fail.
set winheight=5
set winminheight=5
set winheight=999
" TODO (check w/ vim-sleuth)
" Default <Tab> Configuration
set tabstop=2 " Display <Tab> as two spaces in visual mode.
set softtabstop=2 " Insert <Tab> as two spaces when editing.
set shiftwidth=2 " Insert <Tab> as two spaces when auto-indenting.
set expandtab " In insert mode, use the appropriate number of spaes for <Tab>.
set hlsearch " Highlight searches.
set relativenumber " Relative line numbering...
set number " with the current line number being absolute.
set cursorline " Highlight the current line.
set ignorecase " Make searches case insensitive.
set smartcase " Make searches case-sensitive if they contain upper-case.
set formatprg=par " Use par as the format program.
" Wildignore - files we don't want to find/search.
set wildignore+=*.rbc,*/doc/*,*/spec/cassettes/*,tags,*/junit/*
set spelllang=en " Set spelling region to English.
""""""""""""""""""""""""""
" Convenience Key Mappings
""""""""""""""""""""""""""
" Leader
let mapleader="\<space>"
let maplocalleader=","
" Save the current file
nnoremap <leader>w :w<CR>
" Enter visual line mode
nmap <leader><leader> V
" Skip the stupid command window
map q: :q
" Switch between two files
nnoremap <leader>; <c-^>
" Edit files in the current directory
cnoremap %% <C-R>=expand('%:h').'/'<cr>
" Insert a hash rocket.
imap <c-l> <space>=><space>
" Clear the search buffer.
nnoremap <CR> :nohlsearch<CR>
" Toggle spell-check.
nmap <silent> <leader>sp :set spell!<CR>
" Quickly edit vimrc.
nnoremap <leader>ev :tabedit $MYVIMRC<CR>
" Source vimrc.
nnoremap <leader>sv :source $MYVIMRC<CR>
" Move in viewports
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
" Upcase the current word in normal mode.
nnoremap <leader>u viwU
" Easily exit insert mode.
inoremap jk <esc>
" Break the habbit of using <esc>
inoremap <esc> <nop>
" routes.rb and Gemfile
map <leader>gr :topleft :split config/routes.rb<cr>
map <leader>gg :topleft 100 :split Gemfile<cr>
" Command-Dash to split screen
map <leader>v :vsplit<ESC><C-w><C-w>
map <leader>s :split<ESC><C-w><C-w>
" Visually select the text that was last edited/pasted (compare to gv)
nmap gV `[v`]
" Goto File Horizontal and Vertical Splits
map gfv <C-w>L
map gfs <C-w>f
" Access CtrlP
map <leader>f :CtrlP<CR>
" Access CtrlPTags
map <leader>tf :CtrlPTag<CR>
" Reload CtlrP Cache.
map <leader>cf :CtrlPClearCache<CR>\|:CtrlP<CR>
" Use AG as the VIM grep command.
set grepprg=ag\ --nogroup\ --nocolor
" Only list version controlled files in CtrlP when possible.
if isdirectory('.git')
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
else
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
end
" Use ctrlp-cmatcher as the CtrlP matcher function.
let g:ctrlp_match_func = {'match' : 'matcher#cmatch' }
" Enable filetype detection.
filetype plugin indent on
" Syntax and Colors.
set t_Co=256
syntax enable
set background=dark
color grb256