forked from antekpiechnik/vimrc
/
vimrc
161 lines (117 loc) · 2.8 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
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle;
" required!
Bundle 'gmarik/vundle'
Bundle 'altercation/vim-colors-solarized'
Bundle 'pangloss/vim-javascript'
Bundle 'ervandew/supertab'
Bundle 'kien/ctrlp.vim'
Bundle 'tpope/vim-endwise'
Bundle 'vim-ruby/vim-ruby'
Bundle 'airblade/vim-rooter'
Bundle 'kchmck/vim-coffee-script'
Bundle 'nono/vim-handlebars'
"Bundle 'tpope/vim-commentary'
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
" --------------
" Basic settings
" --------------
" choose no compatibility with legacy vi
set nocompatible
syntax on
set encoding=utf-8
" disable swap
set noswapfile
" disable bell
set vb
" -------
" Editing
" -------
" tabs.
set tabstop=2 " columns = 2
set shiftwidth=2 " reindent takes 2 spaces too
set expandtab " softtabs
set softtabstop=2 " tab in insert takes 2 spaces
" auto indent
set autoindent
" backspace through everything in insert mode
set backspace=indent,eol,start
" highlight matches
set hlsearch
" incremental searching
set incsearch
" searches are case insensitive...
set ignorecase
" ... unless they contain at least one capital letter
set smartcase
" show special chars at eol/trailing spaces etc.
set list
" define those special chars
set listchars=tab:»\ ,trail:·
" re-select in visual after shifting
vnoremap > >gv
vnoremap < <gv
vnoremap . :norm.<CR>
" -----
" Looks
" -----
" Solarized colortheme
color solarized
" Light background based on time ?
set background=dark
" No toolbar by default
set guioptions-=T
" Fontsize
set guifont=Monaco:h13
" Rows + columns
set lines=60 columns=228
" Line numbers
set number
" don't wrap lines
set nowrap
" display incomplete commands
set showcmd
" -----------------
" Keyboard mappings
" -----------------
" disable arrow keys
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
" map leader to space
let mapleader = "\<Space>"
nmap <leader>rc :tabedit $MYVIMRC<cr>
nmap <Leader>bi :source ~/.vimrc<cr>:BundleInstall<cr>
" Ctrl-P fuzzy finder
nmap <Leader>f :CtrlP<cr>
" split windows
map <Leader>l <C-w>l
map <Leader>h <C-w>h
map <Leader>v :vsp<cr>
map <Leader>n :call ToggleBackground()<cr>
" ------------------------
" Coding-specific settings
" ------------------------
" handlebars
autocmd! BufRead,BufNewFile *.handlebars.erb set ft=html
" ignore build for agility
set wildignore+=*/build/*
" ----------------
" Custom functions
" ----------------
" My background haxx
function! ToggleBackground()
if &background == 'dark'
set background=light
else
set background=dark
endif
endfunction