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 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | "
" V I M R C
"
" @updated: Mi 29 Jun 2012
" @revision: 3
set nocompatible " be iMproved
" Vundle {{{
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
Bundle 'gmarik/vundle'
" Vundles
"
" github repos
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-haml'
Bundle 'tpope/vim-endwise'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-ragtag'
Bundle 'tpope/vim-markdown'
Bundle 'tpope/vim-unimpaired'
Bundle 'scrooloose/nerdtree'
Bundle 'msanders/snipmate.vim'
Bundle 'ervandew/supertab'
Bundle 'tomtom/tlib_vim'
Bundle 'tomtom/tcomment_vim'
Bundle 'tomtom/tselectbuffer_vim'
Bundle 'tsaleh/vim-matchit'
Bundle 'vim-scripts/taglist.vim'
Bundle 'Townk/vim-autoclose'
Bundle 'trapd00r/x11colors.vim'
Bundle 'lilydjwg/colorizer'
" Bundle 'fholgado/minibufexpl.vim'
Bundle 'shemerey/vim-project'
" Bundle 'Twinside/vim-codeoverview'
" vim-scripts repos
" non github repos
" }}}
" General settings {{{
filetype on
filetype plugin indent on
syntax on
set title
set mouse=a
set shortmess=at " shorten error messages
set nrformats+=alpha " in-/decrease letters with C-a/C-x
set modeline " enable modelines
set modelines=5
set number " enable line numbers
set ruler " enable something
set cursorline " enable hiliting of cursor line
set backspace=2 " backspace over EOL etc.
set background=dark " i prefer dark backgrounds
set hidden " buffer switching should be quick
set confirm " ask instead of just print errors
set equalalways " make splits equal size
set lazyredraw " don't redraw while executing macros
set noshowmode " don't display mode, it's already in the status line
let mapleader=","
let maplocalleader=","
" }}}
" General Keybinds {{{
" Set MapLeader
let mapleader = ","
" Delete previous word with C-BS
imap <C-BS> <C-W>
" Toggle Buffer Selection and list Tag Lists
map <F2> <Esc>:TSelectBuffer<CR>
map <F4> <Esc>:TlistToggle<CR>
" Set text wrapping toggles
nmap <silent> <leader>w :set invwrap<CR>:set wrap?<CR>
" Set up retabbing on a source file
nmap <silent> <leader>rr :1,$retab<CR>
" cd to the directory containing the file in the buffer
nmap <silent> <leader>cd :lcd %:h<CR>
" Make the directory that contains the file in the current buffer.
" This is useful when you edit a file in a directory that doesn't
" (yet) exist
nmap <silent> <leader>md :!mkdir -p %:p:h<CR>
" Increase @revision # by 1
nmap <silent> <leader>incr /@updated
wwwd$"=strftime("%a %d %b %Y")
p/@revision
$
" }}}
" {{{ Window movement
nmap <M-h> :winc h<CR>
nmap <M-j> :winc j<CR>
nmap <M-k> :winc k<CR>
nmap <M-l> :winc l<CR>
" }}}
" GUI or no GUI, that's the question {{{
if has('gui_running')
set guicursor+=a:blinkon0 " Cursor doesn't blink - it's annoying
set guioptions-=m " No Menubar
set guioptions-=T " No Toolbar
set guioptions-=l " No Scrollbar left
set guioptions-=L " No Scrollbar left when split
set guioptions-=r " No Scrollbar right
set guioptions-=r " No Scrollbar right when split
set laststatus=2 " always show statusline
" set gfn=Pragmata\ 6.5
set gfn=Neep\ Medium\ Semi-Condensed\ 9
" set gfn=Mensch\ 7
set lines=40 " Height
set columns=85 " Width
colorscheme nucolors
else
colorscheme xdefaults
endif
" }}}
" Status line {{{
set laststatus=2 " always show statusline
" Generic Statusline {{{
function! SetStatus()
setl statusline+=
\%1*\ %f
\%H%M%R%W%7*\ ┃
\%2*\ %Y\ <<<\ %{&ff}%7*\ ┃
endfunction
function! SetRightStatus()
setl statusline+=
\%5*\ %{StatusFileencoding()}%7*\ ┃
\%5*\ %{StatusBuffersize()}%7*\ ┃
\%=%<%7*\ ┃
\%5*\ %{StatusWrapON()}
\%6*%{StatusWrapOFF()}\ %7*┃
\%5*\ %{StatusInvisiblesON()}
\%6*%{StatusInvisiblesOFF()}\ %7*┃
\%5*\ %{StatusExpandtabON()}
\%6*%{StatusExpandtabOFF()}\ %7*┃
\%5*\ w%{StatusTabstop()}\ %7*┃
\%3*\ %l,%c\ >>>\ %P
\\
endfunction " }}}
" Update when leaving Buffer {{{
function! SetStatusLeaveBuffer()
setl statusline=""
call SetStatus()
endfunction
au BufLeave * call SetStatusLeaveBuffer() " }}}
" Update when switching mode {{{
function! SetStatusInsertMode(mode)
setl statusline=%4*
if a:mode == 'i'
setl statusline+=\ Einfügen\ ◥
elseif a:mode == 'r'
setl statusline+=\ Ersetzen\ ◥
elseif a:mode == 'normal'
setl statusline+=\ \ ◥
endif
call SetStatus()
call SetRightStatus()
endfunction
au VimEnter * call SetStatusInsertMode('normal')
au InsertEnter * call SetStatusInsertMode(v:insertmode)
au InsertLeave * call SetStatusInsertMode('normal')
au BufEnter * call SetStatusInsertMode('normal') " }}}
" Some Functions shamelessly ripped and modified from Cream
"fileencoding (three characters only) {{{
function! StatusFileencoding()
if &fileencoding == ""
if &encoding != ""
return &encoding
else
return " -- "
endif
else
return &fileencoding
endif
endfunc " }}}
" &expandtab {{{
function! StatusExpandtabON()
if &expandtab == 0
return "tabs"
else
return ""
endif
endfunction "
function! StatusExpandtabOFF()
if &expandtab == 0
return ""
else
return "tabs"
endif
endfunction " }}}
" tabstop and softtabstop {{{
function! StatusTabstop()
" show by Vim option, not Cream global (modelines)
let str = "" . &tabstop
" show softtabstop or shiftwidth if not equal tabstop
if (&softtabstop && (&softtabstop != &tabstop))
\ || (&shiftwidth && (&shiftwidth != &tabstop))
if &softtabstop
let str = str . ":sts" . &softtabstop
endif
if &shiftwidth != &tabstop
let str = str . ":sw" . &shiftwidth
endif
endif
return str
endfunction " }}}
" Buffer Size {{{
function! StatusBuffersize()
let bufsize = line2byte(line("$") + 1) - 1
" prevent negative numbers (non-existant buffers)
if bufsize < 0
let bufsize = 0
endif
" add commas
let remain = bufsize
let bufsize = ""
while strlen(remain) > 3
let bufsize = "," . strpart(remain, strlen(remain) - 3) . bufsize
let remain = strpart(remain, 0, strlen(remain) - 3)
endwhile
let bufsize = remain . bufsize
" too bad we can't use "¿" (nr2char(1068)) :)
let char = "b"
return bufsize . char
endfunction " }}}
" Show Invisibles {{{
function! StatusInvisiblesON()
"if exists("g:LIST") && g:LIST == 1
if &list
if &encoding == "latin1"
return "¶"
elseif &encoding == "utf-8"
return "¶"
else
return "$"
endif
else
return ""
endif
endfunction
function! StatusInvisiblesOFF()
"if exists("g:LIST") && g:LIST == 1
if &list
return ""
else
if &encoding == "latin1"
return "¶"
elseif &encoding == "utf-8"
return "¶"
else
return "$"
endif
endif
endfunction " }}}
" Wrap Enabled {{{
function! StatusWrapON()
if &wrap
return "wrap"
else
return ""
endif
endfunction
function! StatusWrapOFF()
if &wrap
return ""
else
return "wrap"
endif
endfunction
" }}}
" }}}
" Tabstops {{{
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
set smartindent
set expandtab
" }}}
" Invisibles {{{
set listchars=tab:>\ ,eol:<
set list
nmap <silent> <F5> :set list!<CR>
" }}}
" Tabstops {{{
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
set smartindent
set expandtab
" }}}
" Invisibles {{{
set listchars=tab:>\ ,eol:<
set list
nmap <silent> <F5> :set list!<CR>
" }}}
" Folds {{{
set foldmethod=marker
set foldcolumn=1
" au BufWinLeave * mkview
" au BufWinEnter * silent loadview
" }}}
" Pairings {{{
set showmatch
" }}}
" Margins {{{
set scrolloff=5
set sidescroll=5
" }}}
" Search {{{
set incsearch
set ignorecase
" Toggle that stupid highlight search
nmap <silent> ,n :set invhls<CR>:set hls?<CR>
" }}}
" Backup files {{{
set nobackup
set nowb
set noswapfile
" }}}
" Completion {{{
set wildmenu
set wildmode=longest,full,list
set ofu=syntaxcomplete#Complete
" }}}
" Snipmate {{{
imap <tab> <C-r>=TriggerSnippet()<CR>
" }}}
" NERDTree {{{
map <F3> :NERDTreeToggle<CR>
let NERDTreeChDirMode = 2
let NERDTreeShowBookmarks = 1
" }}}
" Wrapping {{{
set linebreak
set showbreak=↳\
" toggle wrapping
nmap <silent> <F12> :let &wrap = !&wrap<CR>
" }}}
" RagTag {{{
imap <M-O> <Esc>o
imap <C-J> <Down>
let g:ragtag_global_maps = 1
imap <C-Space> <C-X><Space>
imap <C-CR> <C-X><CR>
" }}}
" 'Bubbling' {{{
nmap <C-up> [e
nmap <C-down> ]e
vmap <C-up> [egv
vmap <C-down> ]egv
" }}}
" Formatting with Par (gqip) {{{
set formatprg=par\ -req
nmap <F9> gqip
" }}}
" Pasting {{{
set paste
nnoremap p ]p
nnoremap <c-p> p
" }}}
" Macros {{{
" Execute macro "q" with space
nmap <Space> @q
" Map @ to + for more comfortable macros on DE kb layout
nmap + @
" }}}
|
x
Notes
Font: Mensch
Colors: Vim::NuColors
trapd00r said about 13 years ago
2012 already?
crshd said about 13 years ago
Yeah - I come from the future. You didn’t know that yet? Get with the times!