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
|
set nocp
" Load pathogen
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
" Load powerline
set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
" Remap leader to ,
noremap \ ,
let mapleader = ","
" General
set backspace=indent,eol,start
set hidden
set backup
set history=50
set ruler
set showcmd
set incsearch
set ignorecase
set smartcase
set autoindent
set smartindent
set number
set spell
set colorcolumn=80
set title
set shortmess=atI
set visualbell t_vb=
set cursorline
set smarttab
set hlsearch
set list
set listchars=tab:»·,trail:·
set foldmethod=syntax
set foldlevel=1000
set laststatus=2 " Always show statusline
set noshowmode
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
syntax on
set background=dark
"let base16colorspace=256
colorscheme base16-default
" Enable mouse in terminals
if has('mouse')
set mouse=a
endif
" GUI options
set guioptions-=mrLtT " Disable menus, toolbar, scrollbars
set guioptions+=c " Disable GUI dialogs
set guifont=Monospace\ 9
set browsedir=buffer " Open dialog starts in working directory
" Jump to the last cursor position when opening
au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
" Default to 2-space indents, 4-character tabs
set expandtab
set shiftwidth=2
set tabstop=4
set shiftround
filetype plugin indent on
" Indentation exceptions
autocmd FileType c,cpp,lua setlocal sw=4
autocmd FileType markdown setlocal tw=72
" C/C++ indent options
" :0 Align case with switch
" l1 Indent case bodies with braces to case
" g0 Align "public:" and friends to class
set cinoptions=:0,l1,g0
" Indent Compojure correctly
autocmd FileType clojure set lispwords+=GET,POST,PUT,DELETE
" Better tab-complete when opening
set wildmenu
set wildmode=list:longest
set wildignore=*.o,*.d,*~
" Smarter %
runtime macros/matchit.vim
" Disable visible whitespace in insert mode
autocmd InsertEnter * setlocal nolist
autocmd InsertLeave * setlocal list
" Syntastic options
let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=0
let g:syntastic_auto_loc_list=2
let g:gitgutter_eager = 0
" Custom maps
nnoremap ' `
nnoremap ` '
nmap <leader>n :nohlsearch<CR>
nmap <leader>s :set list!<CR>
nmap <leader>z :set spell!<CR>
nmap <leader>p "+p
nmap <leader>P "+P
nmap <leader>y "+y
nmap <leader>Y "+Y
nmap <leader>d "+d
nmap <leader>D "+D
nmap Y y$
" Insert hard tab
imap <S-tab> <C-v><tab>
nmap Q gq
nmap <leader>b :CtrlPBuffer<CR>
nmap <leader>e :CtrlP<CR>
nmap <leader>gs :Gstatus<CR>
nmap <leader>gc :Gcommit<CR>
nmap <leader>gp :Git push<CR>
nmap <leader>gg :GitGutterToggle<CR>
nmap <leader>gh <Plug>GitGutterNextHunk
nmap <leader>gH <Plug>GitGutterPrevHunk
nmap <leader>u :GundoToggle<CR>
" Toggle relative/absolute numbers
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
nmap <C-n> :call NumberToggle()<CR>
" Custom commands
command! W :w
|