1. Bruce Wang
  2. dotfiles


dotfiles / dot.vimrc

The default branch has multiple heads

" Enable Syntax Color
" -------------------
set nocompatible
syntax on
colorscheme torte

set isk+=_,$,@,%,#,- " none of these should be word dividers, so make them not be
set lz " do not redraw while running macros (much faster) 

" Disable Generation of Backup Files
" ----------------------------------
set nobackup
set noswapfile

" Some File Type Stuff
" --------------------
filetype on
filetype plugin on

" Leader
" ------
" sets leader to ',' and localleader to "\"
let mapleader=","
let maplocalleader="\\"

" User Interface
" --------------
" activate wildmenu, permanent ruler and disable Toolbar, and add line
" highlightng as well as numbers
set wildmenu
set ruler
set guioptions-=T
"set cursorline
set completeopt-=preview

" Set Better Indention
" --------------------
set smartindent

" Statusbar
" ---------
set cmdheight=2
set laststatus=2
set statusline=[%l,%c\ %P%M]\ %f\ %r%h%w
set number

" Tab Settings
" ------------
set smarttab
set tabstop=4

" utf-8 default encoding
" ----------------------
set enc=utf-8

" python support
" --------------
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4 fileformats=unix smarttab textwidth=80 smartindent
autocmd FileType php setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4 fileformats=unix smartindent smarttab textwidth=80

" ruby support
" ------------
autocmd FileType ruby setlocal shiftwidth=2 tabstop=2 softtabstop=2 smartindent smarttab

" python.vim
" ----------
let python_highlight_all=1

" html/xml support
" ----------------

autocmd FileType html,xhtml,xml,htmldjango,htmljinja,eruby,mako setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
"autocmd FileType html,xhtml,xml,htmldjango,htmljinja,eruby,mako source d:/vim/vimfiles/plugin/closetag.vim
autocmd BufNewFile,BufRead *.rhtml setlocal ft=eruby
autocmd BufNewFile,BufRead *.tmpl setlocal ft=htmljinja
"autocmd BufNewFile,BufRead *.html,*.htm  call s:SelectHTML()
autocmd BufNewFile,BufRead *.module,*.inc setlocal ft=php
autocmd BufNewFile,BufRead *.mako setlocal ft=mako

let html_no_rendering=1
let eruby_percent_processing=1

" ---
autocmd FileType css setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4

" rst
" ---
autocmd FileType rst setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4

" Javascript
" ----------
autocmd FileType javascript setlocal 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

" Highlight Search
set hlsearch
set incsearch

map <C-S-d>     :bdelete<Return>
map <F2> a<C-R>=strftime("%c")<CR><Esc>
map <C-w>w <ESC>:args % <cword><CR>:n<CR>
map <C-w>i <ESC>:args % index<CR>:n<CR>

imap ,q <Esc>
imap ,t <Esc>:tabnew<CR>
set showtabline=0
let loaded_project = 1

"" Highlight redundant whitespaces and tabs.
"highlight RedundantSpaces ctermbg=red guibg=red
"match RedundantSpaces /\s\+$\| \+\ze\t\|\t/

" use 4 spaces instead of tabs
set tabstop=4
set shiftwidth=4
set expandtab

" always show ^M in DOS files
"set fileformats=unix
" caseinsensitive incremental search
set ignorecase
set incsearch

" Show matching brackets
set showmatch

" start in paste mode by default (cancel with [ESC]:nopaste)
set nopaste

" always show line and col number and the current command
set ruler
set showcmd

function! CHANGE_CURR_DIR()
let _dir = expand("%:p:h")
exec "cd " . _dir
unlet _dir

autocmd BufEnter * call CHANGE_CURR_DIR() 

fun BenIndent()
 let oldLine=line('.')
 execute ':' . oldLine
map -- :call BenIndent()<cr>

" Minibuffer
" ----------
"  one click is enough and fix some funny bugs
let g:miniBufExplUseSingleClick = 1
let g:miniBufExplForceSyntaxEnable = 1
let g:miniBufExplMapCTabSwitchBufs = 1

" BufClose
" --------
" map :BufClose to :bq and ^B and configure it to open a file browser on close
let g:BufClose_AltBuffer = '.'
cnoreabbr <expr> bq 'BufClose'
map ^Q :BufClose<CR>

" BufTabs
set laststatus=2
let g:buftabs_in_statusline=1 

noremap <C-left> :bprev<CR>
noremap <C-right> :bnext<CR> 

" Disable mouse activate visual mode
set mouse-=a