-
Notifications
You must be signed in to change notification settings - Fork 4
/
vimrc
197 lines (167 loc) · 6.44 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
set encoding=utf-8
set nocompatible " choose no compatibility with legacy vi
filetype off " Set this off whilst we do our Vundle thing
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" --- Motion utilities
Bundle "vim-scripts/matchit.zip"
Bundle "haya14busa/incsearch.vim"
Bundle "easymotion/vim-easymotion"
Bundle "haya14busa/incsearch-easymotion.vim"
Bundle "ctrlpvim/ctrlp.vim"
"Bundle "terryma/vim-expand-region"
" --- Interface tweaks
"Bundle "mhinz/vim-startify"
Bundle "sjl/vitality.vim"
Bundle "bling/vim-airline"
Bundle "vim-airline/vim-airline-themes"
Bundle 'edkolev/tmuxline.vim'
" --- Colour schemes
"Bundle "altercation/vim-colors-solarized"
Bundle 'morhetz/gruvbox'
"Bundle "junegunn/seoul256.vim"
"Bundle 'chriskempson/tomorrow-theme', {'rtp': 'vim/'}
"Bundle 'jgdavey/vim-railscasts'
"Bundle 'tomasr/molokai'
"Bundle 'sjl/badwolf'
"Bundle 'nanotech/jellybeans.vim'
"Bundle 'itchyny/lightline.vim'
" Watch for file updates
Bundle 'gee-forr/vim-watch_for_changes'
" --- Ruby utils
Bundle "vim-scripts/ruby-matchit"
Bundle "vim-ruby/vim-ruby"
Bundle "tpope/vim-rails"
Bundle "tpope/vim-endwise"
" --- JS plugins
"Bundle "kchmck/vim-coffee-script"
Plugin 'jelera/vim-javascript-syntax'
Plugin 'pangloss/vim-javascript'
"Bundle 'heartsentwined/vim-emblem'
Bundle 'mustache/vim-mustache-handlebars'
"Bundle 'mxw/vim-jsx'
" --- Haskell
"Bundle "lukerandall/haskellmode-vim"
"Bundle "vim-scripts/haskell.vim"
" --- General dev utils
Bundle 'gee-forr/vim-slurper'
Bundle 'EinfachToll/DidYouMean'
Bundle 'dietsche/vim-lastplace'
Bundle "airblade/vim-gitgutter"
"Bundle "scrooloose/syntastic"
Bundle "benekastah/neomake"
Bundle "tpope/vim-fugitive"
Bundle "ervandew/supertab"
"Bundle "wellle/tmux-complete.vim"
Bundle "godlygeek/tabular"
Bundle "majutsushi/tagbar"
Bundle "tpope/vim-surround"
Bundle "scrooloose/nerdtree"
"Bundle "jistr/vim-nerdtree-tabs"
Bundle "scrooloose/nerdcommenter"
Bundle "mileszs/ack.vim"
Bundle "kana/vim-smartinput"
Bundle "Yggdroot/indentLine"
"Bundle 'kien/rainbow_parentheses.vim' " Colour parens depending on nesting
Bundle 'closetag.vim'
" Ansible plugins
Bundle "Glench/Vim-Jinja2-Syntax"
Bundle "chase/vim-ansible-yaml"
" Snippet management
"Bundle "MarcWeber/vim-addon-mw-utils"
"Bundle "tomtom/tlib_vim"
"Bundle "garbas/vim-snipmate"
" Vim Dev Icons. Needs to be included last
Bundle "ryanoasis/vim-devicons"
au BufWritePost .vimrc so ~/.vimrc " automatically reload vimrc when it's saved
"" Some general editor stuff
"set clipboard=unnamed " send yanks to the OS clipboard
set mouse=a
set nobackup " Do not keep a backup file
set showcmd " display incomplete commands
set scrolloff=7 " Never scroll to the edge of the window
set history=50 " Keep the last 50 commands
set t_ti= t_te= " Do not clear the screen when exiting vim, and preserve the window
au FocusLost * :silent! wall " Autosave on losing focus (works in iTerms2 and tmux using VITality plugin)
syntax enable
filetype plugin indent on " load file type plugins + indentation
" Leader stuff
let mapleader = "\<Space>"
nnoremap <Leader>o :CtrlP<CR>
nnoremap <Leader>w :w<CR>
nmap <Leader><Leader> V
" Store temporary files in a central spot
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
"" Folding
set nofoldenable
set foldmethod=indent
set foldlevelstart=20
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set shiftround " Always indent/outdent to nearest tabstop
set backspace=indent,eol,start " backspace through everything in insert mode
set pastetoggle=<leader>pt " "Set to toggle paste on and off.
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
set gdefault " Make global search and replace the default (use /g to make it singular)
set wildmenu
set wildignore+=*/.hg/*,*/.svn/*,*.swp,*.swo
set bg=dark " Dark background
colorscheme gruvbox
"set t_Co=256 " 256 colours
set cursorline " Highlight current line
set ruler " Show a ruler
set relativenumber " Show lines numbers relative to where you are
au InsertEnter * :set nu " absolute line numbers in insert mode,
au InsertLeave * :set rnu " relative otherwise for easy movement
set showmatch " Show matching brackets
"set guifont=Inconsolata:h18 "Set the font to Inconsolata at 18pt. (Yes, it's huge)
"set bg=light " Light background
set listchars=tab:▸\ ,eol:¬,trail:⋅,extends:❯,precedes:❮ " Make the list chars less hideous (and more like textmate)
set showbreak=↪
function! CurDir()
let curdir = substitute(getcwd(), '/home/gabrielf/', "~/", "g")
return curdir
endfunction
set laststatus=2 " Show statusline on second last line
set statusline=\ [%F%m%r%h\ %w]\ \ \ [CWD:%r%{CurDir()}%h]\ \ \ [Type=%Y]\ \ \ %{fugitive#statusline()}\ \ \ [Line:%l/%L:%c\ %p%%]\
"" Tab shortcuts
map <leader>tn :tabnew
map <leader>tm :tabmove
map <leader>te :tabe
map <leader>tc :tabclose<cr> " Close
map <leader><right> :tabn<cr> " Select tab to the right
map <leader><left> :tabp<cr> " Select tab to the left
map <leader>k :tabn<cr> " Select tab to the right using k
map <leader>j :tabp<cr> " Select tab to the left using j
"" Split window shortcuts
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
"" Make vim jump to the last known line
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
"" Fix silly typos to DWIM, not DWIS
"cmap W w
cmap Q q
"" Load up bundle specfic configuration
"" -- doesn't clutter up the rest of the vimrc this way.
runtime! bundle_config/*.vim
" Speed up start times when dealing with Ruby files
" For rbenv
let g:ruby_path = system('echo $HOME/.rbenv/shims')
" For rvm
"let g:ruby_path = system('rvm current')
" Abbreviations
iabbrev trye true
iabbrev tiem item