Skip to content

Instantly share code, notes, and snippets.

@quwubin
Created May 16, 2014 06:55
Show Gist options
  • Save quwubin/a358c89c74f7defd4ce3 to your computer and use it in GitHub Desktop.
Save quwubin/a358c89c74f7defd4ce3 to your computer and use it in GitHub Desktop.
.vimrc
" ~./vimrc
" Kompatibilitätsmodus abschalten
set nocompatible
" Im GUI-Modus Consolas Zeichensatz setzen und fruity Farbschema benutzen.
if has("gui_running")
colorscheme fruity
set guifont=Consolas\ 12
else
colorscheme delek
" colorscheme fruity
endif
set nu
set autoindent
set shiftwidth=2
set showmode
set showmatch
set ruler
set nojoinspaces
set cpo+=$
set whichwrap=""
set modelines=0
set nobackup
set encoding=utf-8
set wildmenu
filetype plugin indent on
syntax enable
" python support
" --------------
" don't highlight exceptions and builtins. I love to override them in local
" scopes and it sucks ass if it's highlighted then. And for exceptions I
" don't really want to have different colors for my own exceptions ;-)
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
let python_highlight_all=1
let python_highlight_exceptions=0
let python_highlight_builtins=0
" ruby support
" ------------
autocmd FileType ruby setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
" template language support (SGML / XML too)
" ------------------------------------------
" and disable taht stupid html rendering (like making stuff bold etc)
fun! s:SelectHTML()
let n = 1
while n < 50 && n < line("$")
" check for jinja
if getline(n) =~ '{%\s*\(extends\|block\|macro\|set\|if\|for\|include\|trans\)\>'
set ft=htmljinja
return
endif
" check for django
if getline(n) =~ '{%\s*\(extends\|block\|comment\|ssi\|if\|for\|blocktrans\)\>'
set ft=htmldjango
return
endif
let n = n + 1
endwhile
" go with html
set ft=html
endfun
autocmd FileType html,xhtml,xml,htmldjango,htmljinja,eruby,mako setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
autocmd BufNewFile,BufRead *.rhtml setlocal ft=eruby
autocmd BufNewFile,BufRead *.tmpl setlocal ft=htmljinja
autocmd BufNewFile,BufRead *.py_tmpl setlocal ft=python
autocmd BufNewFile,BufRead *.html,*.htm call s:SelectHTML()
let html_no_rendering=1
let g:closetag_default_xml=1
autocmd FileType html,htmldjango,htmljinja,eruby,mako let b:closetag_html_style=1
autocmd FileType html,xhtml,xml,htmldjango,htmljinja,eruby,mako source /usr/share/vim-scripts/macros/closetag.vim
" CSS
" ---
autocmd FileType css setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
" Lisp
" ---
autocmd FileType lisp setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
" rst
" ---
autocmd BufNewFile,BufRead *.txt setlocal ft=rst
autocmd FileType rst setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
" Javascript
" ----------
autocmd FileType javascript setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
let javascript_enable_domhtmlcss=1
" File Browser
" ------------
" hide some files and remove stupid help
let g:explHideFiles='^\.,.*\.sw[po]$,.*\.pyc$'
let g:explDetailedHelp=0
map  :Explore!<CR>
" Better Search
" -------------
set hlsearch
set incsearch
set cursorline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment