-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvimrc
208 lines (145 loc) · 3.62 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
198
199
200
201
202
203
204
205
206
207
208
" General {{{
" Tabs {{{
" Tabs are 2 characters
set tabstop=4
" (Auto)indent uses 2 characters
set shiftwidth=4
set softtabstop=4
set smartindent
" spaces instead of tabs
set expandtab
" }}}
" Search {{{
" highlight the searchterms
set hlsearch
" jump to the matches while typing
set incsearch
" ignore case while searching
set ignorecase
" execpt when searching for upper case
set smartcase
" }}}
" enable all features
set nocompatible
" dont wrap long lines
set nowrap
" guess indentation
set autoindent
set smartindent
" don't reset cursor to start of line when moving around
set nostartofline
" show line numbers
set number
" fold using {{{ }}}
set foldmethod=marker
" open folds when searching, etc...
set foldopen=jump,mark,search,tag,undo
" powerful backspaces
set backspace=indent,eol,start
" don't wrap words
set textwidth=0
" history
set history=50
" 1000 undo levels
set undolevels=1000
" persistent undo
set undofile
" show a ruler
set ruler
" show partial commands
set showcmd
" show matching braces
set showmatch
" highlight current line
set cursorline
" leave 4 lines on top or bottom when scrolling
set scrolloff=4
set sidescrolloff=4
" when buffer is brought to foregroup, remember undo history and marks
set hidden
" auto-detect the filetype
filetype plugin indent on
" disable auto commenting
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" indent c preprocessors
set cinkeys=0{,0},0),:,!^F,o,O,e
" load local vimrc files
set exrc
" }}}
" Tab completion {{{
" Always show the menu, insert longest match
set completeopt=menuone,longest
" Expand the command line using tab
set wildchar=<Tab>
set wildmode=longest:full
set wildmenu
" tab complete text
set omnifunc=syntaxcomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
"}}}
" Title bar {{{
let &titleold=getcwd()
set titlestring=%t
if &term == "screen" || &term == "screen-bce" || &term == "screen-256color"
set t_ts=k
set t_fs=\
endif
if &term == "screen" || &term == "screen-bce" || &term == "screen-256color" || &term == "xterm"
set title
endif
" }}}
" Keybindings {{{
" clear the ctrl+j binding
let g:BASH_Ctrl_j = 'off'
let g:C_Ctrl_j = 'off'
" change leader key to comma
let mapleader=","
" better split switching
"map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
command WA wa
command Wa wa
command WQ wq
command Wq wq
command W w
command Q q
" yank from cursor to end of line
nnoremap Y y$
" Toggle paste mode
nmap <silent> ,p :set invpaste<CR>:set paste?<CR>
" force write with sudo
cmap w!! w !sudo tee >/dev/null %
" }}}
" Color {{{
" syntax highlight
syntax on
" enable 256 bit color mode
set t_Co=256
" use dark color scheme
set bg=dark
" line numbers are grey with black
highlight LineNr ctermbg=0 ctermfg=235
" current line highlighting
highlight CursorLine ctermbg=234
" }}}
" gvim specific options
if has("gui_running")
set go-=T
set guifont=Bitstream\ Vera\ Sans\ Mono\ 14
end
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
source $HOME/.vim/bundles.vim