"bal .vimrc " Place in /etc/vimrc " Sun Oct 29 15:03:14 PST 2006 syntax on filetype on set autoindent set background=dark set backspace=indent,eol,start " allow backspacing over everything in insert mode set backup set backupdir=~/.vim/backup,/tmp/,C:\TEMP,./," set cindent " stricter c indenting set cursorline set dictionary=/usr/share/dict/english "set dictionary () set display+=lastline set encoding=utf-8 set expandtab set foldclose=all " automatically close folds set foldcolumn=2 " show where folds are set foldmethod=manual " automatically create folds set foldopen+=search " open folds when searching " set foldopen+=undo " open folds during undo operations set hidden " allow no save when switching buffers set hlsearch " hilight search set ignorecase " ignore case on search set incsearch " find as you type set joinspaces " two spaces after . ? etc set laststatus=2 " always show status line set linebreak set modelines=5 " read syntax specifications set mouse=a " mouse on term set mousemodel=popup " right click mouse action set nocompatible " non vi compatible set noerrorbells " no bells set noexpandtab set nostartofline " keep horizonatal position of CR when scrooling set novisualbell " no vbells set nu " line numbers set pastetoggle= " correct pasting set preserveindent " see copyindent set ruler " show the cursor position all the time set shortmess=In set showcmd " display incomplete commands set showmatch " brackets auto completion set smartcase " Case insensitive searches become sensitive with capitals set smartindent set smarttab " set spell spelllang=en_us " Spell checking set splitbelow " split below set tabstop=4 set termencoding=utf-8 set timeoutlen=1200 " A little bit more time for macros set title " set term title set ttimeoutlen=200 " Make Esc work faster set ttyfast " faster output for completion set virtualedit=block " allow selecting blank characters set whichwrap=b,s,h,l " allow backspacing/moving on first character (to top) set wildignore+=*~ set wildmenu set wildmode=longest:full,full set wrap let &guioptions = "aegimrLT" " disable detachable menus (t) let s:split_minwidth = 30 " split window min width " Shortcuts to edit this file nmap ,s :source $MYVIMRC nmap ,v :e $MYVIMRC :load " Hide (hidden) files in browsers let g:netrw_hide = 1 let g:netrw_list_hide = "^\\..*" " Handle common typos command! Q quit command! W write command! Wq wq " Go back to the previous (used) buffer command! Bb b# " Functions to make :command editing like readline " start of line cnoremap " back one character cnoremap " delete character under cursor cnoremap " end of line cnoremap " forward one character cnoremap " recall newer command-line cnoremap " recall previous (older) command-line cnoremap " back one word cnoremap " forward one word cnoremap " Delete words and line quicker inoremap bdwi inoremap bddi "CTRL-V remap for Visual block (bypass CTRL-V hijacking environemnts, "gnome-terminal, windows, etc. nnoremap v " Shortcut for arrows noremap! noremap! noremap! noremap! noremap! " Go easier to end, beginning (bash style) in insert inoremap inoremap " Go up and down the file too inoremap ggi inoremap Gi " File explorer shortcuts. nnoremap :Vex nnoremap :Sex " Buffer switching with Tab in non-insert (quicker) nnoremap :bnext nnoremap :bprevious " Faster automation of last ex command map , @: " Quickly insert date command! Date r!date " Open URLs quickly function! OpenURL(url) if has("win32") exe "!start cmd /cstart /b ".a:url."" else exe "normal:!sensible-browser \"".a:url."\" > /dev/null\" endif endfunction map gb :call OpenURL(expand("")) " Open files in same directory quickly if has("unix") map ,e :e =expand("%:p:h") . "/" else map ,e :e =expand("%:p:h") . "\" endif " Compile and run keymappings au FileType sh,php,perl,python,ruby map :!./% au FileType c,cpp map :make au FileType php map :!php & au FileType python map :!python % au FileType perl map :!perl % au FileType ruby map :!ruby % au FileType html,xhtml map :OpenUrl(%) " MS Word document reading au BufReadPre *.doc set ro au BufReadPost *.doc %!antiword "%" " TXT is text au BufRead,BufNewFile *.txt setfiletype text " Set filetype specific plugins if has("autocmd") filetype plugin indent on " Python autocmd FileType python source $VIMRUNTIME/ftplugin/python.vim autocmd FileType python source $VIMRUNTIME/ftplugin/pydoc.vim autocmd FileType python set complete+=k$VIMRUNTIME/ftplugin/pydiction iskeyword+=.,( autocmd BufNewFile *.py 0r $VIMRUNTIME/skeleton/skeleton.py | normal Gi " HTML autocmd FileType html source $VIMRUNTIME/ftplugin/xhtml.vim autocmd BufNewFile *.html 0r $VIMRUNTIME/skeleton/skeleton.xhtml | normal Gi endif " has("autocmd") "colo marc