"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=<f2> " 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<CR>
nmap ,v :e $MYVIMRC<CR> :load<CR>
" 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 <C-A> <Home>
" back one character
cnoremap <C-B> <Left>
" delete character under cursor
cnoremap <C-D> <Del>
" end of line
cnoremap <C-E> <End>
" forward one character
cnoremap <C-F> <Right>
" recall newer command-line
cnoremap <C-N> <Down>
" recall previous (older) command-line
cnoremap <C-P> <Up>
" back one word
cnoremap <Esc><C-B> <S-Left>
" forward one word
cnoremap <Esc><C-F> <S-Right>
" Delete words and line quicker
inoremap <C-Backspace> <ESC>bdwi
inoremap <C-S-Backspace> <ESC>bddi
"CTRL-V remap for Visual block (bypass CTRL-V hijacking environemnts,
"gnome-terminal, windows, etc.
nnoremap <Esc>v <C-V>
" Shortcut for arrows
noremap! <C-b> <Backspace>
noremap! <C-h> <Left>
noremap! <C-j> <Down>
noremap! <C-k> <Up>
noremap! <C-l> <Right>
" Go easier to end, beginning (bash style) in insert
inoremap <C-e> <End>
inoremap <C-a> <Home>
" Go up and down the file too
inoremap <C-f> <Esc>ggi
inoremap <C-g> <Esc>Gi
" File explorer shortcuts.
nnoremap <F8> :Vex <CR>
nnoremap <F9> :Sex<CR>
" Buffer switching with Tab in non-insert (quicker)
nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprevious<CR>
" Faster automation of last ex command
map , @:<CR>
" 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\<CR>"
endif
endfunction
map gb :call OpenURL(expand("<cfile>"))<CR>
" Open files in same directory quickly
if has("unix")
map ,e :e <C-R>=expand("%:p:h") . "/" <CR>
else
map ,e :e <C-R>=expand("%:p:h") . "\" <CR>
endif
" Compile and run keymappings
au FileType sh,php,perl,python,ruby map <F5> :!./%<CR>
au FileType c,cpp map <F6> :make<CR>
au FileType php map <F6> :!php &<CR>
au FileType python map <F6> :!python %<CR>
au FileType perl map <F6> :!perl %<CR>
au FileType ruby map <F6> :!ruby %<CR>
au FileType html,xhtml map <F5> :OpenUrl(%)<CR>
" 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