summaryrefslogtreecommitdiff
path: root/.vimrc
blob: c3c4b13d96aa227c88a06d5a57f8bceea110068f (plain)
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
" {{{ General settings
set nocompatible	" Forget about (N)VI
set noerrorbells	" No annoying bells
set vb t_vb=
set hidden		" allow buffer switching without saving

" Don't highlight search results
" set nohlsearch

" Type-ahead find
set incsearch

" Indent of 8, but no spaces
set shiftwidth=8
set tabstop=8

" Allow backspacing over indentation, end-of-line and start-of-line
set backspace=2

" smart autoindenting
set smartindent

" Paste toggle (a.k.a set paste/set nopaste)
set pastetoggle=<F11>

" Enable folding by fold markers
set foldmethod=marker

" Wrap line longer than the display
"set wrap
" Textwidth of 80 (Standard terminal)
set tw=80

" Number of undo operations to store
set undolevels=50

set laststatus=2	" Always show the statusline
set ruler		" Display ruler with cursor positions

"set cursorline		" Highlight the cursor line and column

" Buffer, filename, line, total lines, column, ASCII value
"set statusline=[%n]\ %f\ %m\ %l/%L,%c\ ASCII:\ %3b
"set statusline+=[%{strlen(&fenc)?&fenc:'none'}, " file encoding
"set statusline+=%{&ff}] 			" file format

" maximum number of tabs to open
set tabpagemax=20

set showmode
set modeline
set backupcopy=auto,breakhardlink

filetype on		" Enable filetype detection
filetype indent on	" Enable filetype specific indenting
filetype plugin on	" Enable filetype specific plugins

au FileType c set cindent

let g:git_diff_spawn_mode=2

" }}}
" {{{ Colors and fonts

set background=dark
let g:solarized_termtrans=1
colorscheme solarized

" Syntax highlighting
if &t_Co > 2 || has("gui_running")
	syntax on
endif

" Highlight trailing whitespaces
let c_space_errors=1
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

" }}}
" {{{ Completion
autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType ruby,eruby set omnifunc=rubycomplete#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
" }}}
" {{{ Mappings
let mapleader=","

" Line numbering toggle
nmap <C-x>n :set invnumber<CR>
"highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE

map <C-x>s ^iSigned-off-by: <C-r>=$GIT_AUTHOR_NAME<CR> <<C-r>=$GIT_AUTHOR_EMAIL<CR>><ESC>^
map! <C-x>s Signed-off-by: <C-r>=$GIT_AUTHOR_NAME<CR> <<C-r>=$GIT_AUTHOR_EMAIL<CR>><CR>

map <C-x>a ^iAcked-by: <C-r>=$GIT_AUTHOR_NAME<CR> <<C-r>=$GIT_AUTHOR_EMAIL<CR>><ESC>^
map! <C-x>a Acked-by: <C-r>=$GIT_AUTHOR_NAME<CR> <<C-r>=$GIT_AUTHOR_EMAIL<CR>><CR>

map <C-x>r ^iReviewed-by: <C-r>=$GIT_AUTHOR_NAME<CR> <<C-r>=$GIT_AUTHOR_EMAIL<CR>><ESC>^
map! <C-x>r Reviewed-by: <C-r>=$GIT_AUTHOR_NAME<CR> <<C-r>=$GIT_AUTHOR_EMAIL<CR>><CR>

map <C-x>y ^iCopyright (C) <C-R>=strftime("%Y")<CR> <C-r>=$GIT_AUTHOR_NAME<CR> <<C-r>=$GIT_AUTHOR_EMAIL<CR>><CR><ESC>^
map! <C-x>y Copyright (C) <C-R>=strftime("%Y")<CR> <C-r>=$GIT_AUTHOR_NAME<CR> <<C-r>=$GIT_AUTHOR_EMAIL<CR>><CR>

map <C-x>c i<C-R>=strftime("%F %R")<CR> Tobias Klauser <tklauser@distanz.ch><CR><TAB>* <ESC>
map! <C-x>c <C-R>=strftime("%F %R")<CR> Tobias Klauser <tklauser@distanz.ch><CR><TAB>* 

map <C-x>f ^iFrom: Tobias Klauser <tklauser@distanz.ch><CR><ESC>^
map! <C-x>f From: Tobias Klauser <tklauser@distanz.ch><CR>

map <F9> :let &background = ( &background == "dark" ? "light" : "dark" )<CR>
map <F10> <ESC>:! make<CR>

map! <C-x><SPACE> &nbsp;

map <C-p> :Files<CR>
map <C-f> :NERDTreeFind<CR>

" Remove all trailing whitespaces in file
map <leader>w :%s/\s\+$//<CR>^
map! <leader>w <ESC>:%s/\s\+$//<CR>

" Remove Mac/DOS line-breaks
map <leader>lb :%s/
//<CR>^
map! <leader>lb <ESC>:%s/
//<CR>

" Navigate non-breaking lines more easily
" from http://zinformatik.de/tipps-tricks/vim-tipps/einige-tipps-und-tricks-fur-vim/
noremap <C-J> gj
noremap <C-K> gk

" Thanks mikap! http://michael-prokop.at/computer/config/.vimrc
map !f !perl -MText::Autoformat -e'autoformat'
map ;0 <ESC>:'<,'>!boxes
map ;1 <ESC>:'<,'>!boxes -d boxquote
map ;2 <ESC>:'<,'>!boxes -d peek -a c -s 40x5
map ;3 <ESC>:'<,'>!boxes -d c-cmt
map ;4 <ESC>:'<,'>!boxes -d dog -a c
map ;5 <ESC>:'<,'>!boxes -d simple -a jr
map ;6 <ESC>:'<,'>!boxes -d headline

map <Leader>hon :%!xxd<CR>
map <Leader>hof :%!xxd -r<CR>

" delete the text until start of the mail signature with ,k
map <Leader>k d/^-- $<CR>

" line numbering
map <Leader>ln :%s/^/\=line('.')/<CR><ESC>

" add a comment
map <Leader>mkc i/*  */<Left><Left><Left>

" greet to the person you write a mail
map <Leader>a  G/^\* /e+1<CR>ye1G}oHallo <c-r>",<cr><ESC>

" }}}
" {{{ VIM LaTeX
let g:Imap_UsePlaceHolders = 0
" }}}
" {{{ Always use tabs in Makefiles
autocmd BufEnter ?akefile* set noet ts=8 sw=8 nocindent
" }}}
" {{{ pathogen plugin
execute pathogen#infect()
" }}}
" {{{ settings for bundles installed by pathogen

" NERDTree
autocmd vimenter * if !argc() | NERDTree | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
map <Leader>nt :NERDTreeToggle<CR>

" }}}
" {{{ localvimrc plugin
" disable sandbox to allow autocmd
let g:localvimrc_sandbox=0
" don't ask before loading
let g:localvimrc_ask=0
" }}}
s'>-7/+7 2011-06-13doc: fix wrong arch/i386 referencesWanlong Gao1-1/+1 2011-03-31sched, doc: Beef up load balancing descriptionBorislav Petkov1-9/+23 2011-03-23sched, doc: Update sched-design-CFS.txtBorislav Petkov1-6/+1 2011-02-01sched, docs: Update schedstats documentation to version 15Javi Merino1-18/+15 2010-11-02Docs: typo: Complete -> CompletelyMichael Witten1-1/+1 2010-04-02sched: Remove USER_SCHED from documentationLi Zefan2-67/+7