/
rc.vim
192 lines (148 loc) · 4.54 KB
/
rc.vim
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
"
" vimrc by fs
"
set nocompatible
set encoding=utf-8
set modelines=0
set autoread
set visualbell
set noshowmode
set showcmd
set clipboard=unnamed
set mouse=a
set number
set relativenumber
set cursorline
set colorcolumn=80
set hidden
set splitbelow
set splitright
set title
set showmatch
set list
" set listchars+=eol:$
set nobackup
set noswapfile
set undofile
set wildmenu
set wildmode=longest,full
"" Whitespace
set autoindent
set copyindent
set nowrap
set tabstop=2
set softtabstop=2
set shiftwidth=2
set shiftround
set smarttab
set expandtab " use soft tabs (spaces)
set backspace=indent,eol,start " backspace through everything in insert mode
set textwidth=79
"" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
set gdefault
if filereadable(expand('~/.vim/bundles.vim'))
filetype off
source ~/.vim/bundles.vim
endif
set omnifunc=syntaxcomplete#Complete " completion stuff
colorscheme hemisu
filetype plugin indent on
syntax on
if has("autocmd")
" Enable file type detection
" Syntax of these languages is fussy over tabs Vs spaces
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" Customisations based on house-style (arbitrary)
autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType javascript setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType java setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType cpp setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType c setlocal ts=4 sts=4 sw=4 expandtab
autocmd FileType go setlocal ts=4 sts=4 sw=4 noexpandtab
autocmd BufNewFile,BufRead *.rss setfiletype xml
" Seeing is Believing
let g:xmpfilter_cmd = 'seeing_is_believing'
autocmd FileType ruby nmap <buffer> <Leader>h <Plug>(seeing_is_believing-mark)
autocmd FileType ruby xmap <buffer> <Leader>h <Plug>(seeing_is_believing-mark)
autocmd FileType ruby imap <buffer> <Leader>h <Plug>(seeing_is_believing-mark)
autocmd FileType ruby nmap <buffer> <Leader>H <Plug>(seeing_is_believing-clean)
autocmd FileType ruby xmap <buffer> <Leader>H <Plug>(seeing_is_believing-clean)
autocmd FileType ruby imap <buffer> <Leader>H <Plug>(seeing_is_believing-clean)
autocmd FileType ruby nmap <buffer> <Leader>S <Plug>(seeing_is_believing-run_-x)
autocmd FileType ruby xmap <buffer> <Leader>S <Plug>(seeing_is_believing-run_-x)
autocmd FileType ruby imap <buffer> <Leader>S <Plug>(seeing_is_believing-run_-x)
autocmd FileType go nmap <buffer> = <Esc>:Fmt<CR>
endif
" enable powerline for airline
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" Enhance Netrw usability
let g:netrw_browse_split = 4
let g:netrw_altv = 1
let g:snipMate = {}
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['scss'] = 'scss,css'
let g:rspec_command = 'call Send_to_Tmux("rspec {spec}\n")'
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
" 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
" Keymaps
let mapleader = ','
" default / to perl-style regexp's
nnoremap / /\v
vnoremap / /\v
" use tab to jump between matching brackets
map <Tab> %
" go from insert to normal mode
inoremap jj <Esc>:w<CR>
inoremap kk <Esc>:w<CR>
" disable arrows
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
" disable ex mode mapping
map Q <Nop>
" ahw, what the hell!
cnoreabbrev W w
cnoreabbrev Q q
" easier navigation between split windows
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" C-s will save us all!
nnoremap <C-s> :w<CR>
inoremap <C-s> <Esc>:w<CR>
" remove highligted terms
nnoremap <Leader><Space> :noh<CR>
" delete trailing whitespace
nnoremap <Leader>W :%s/\s\+$//<CR>:let @/=''<CR>
" re-hardwrap text
nnoremap <Leader>q gqip
" reselect last pasted text
nnoremap <Leader>v V`]
" switch between the last two files
nnoremap <Leader>c <C-^>
map <Leader>m :TagbarToggle<CR>
map <Leader>, :tabedit $MYVIMRC<CR>
map <Leader>< :tabedit $MYGVIMRC<CR>
" gundo
nnoremap <Leader>u :GundoToggle<CR>
" vim rspec
nnoremap <Leader>t :call RunCurrentSpecFile()<CR>
nnoremap <Leader>s :call RunNearestSpec()<CR>
nnoremap <Leader>l :call RunLastSpec()<CR>
call togglebg#map('<F5>')