Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
95 lines (73 sloc) 2.93 KB
" .vimrc - settings for vimproved
" General Settings
set nocompatible " no vi defaults, use the more modern vim settings
set enc=utf-8 " use utf-8 encoding, where available
set smartcase " ignore case if search term is all lower-case
set backspace=2 " more powerful backspacing
" Display Settings
set tw=75 " set textwidth = 75 columns
set linebreak " don't break in the middle of words
set display+=lastline " show paragraphs, even if they go off screen
set fo+=r " insert comment leader on enter
set ruler " display line,col, when there is room
set showmode " display mode ( -- INSERT --, etc.)
if has("syntax")
syntax on " turn on syntax highlighting
" Indentation and Tab Settings
set tabstop=4 " set tabstop to 4 spaces
set shiftwidth=4 " make >> shift 4, not 8
set shiftround " round to nearest 4, don't just move 4
set expandtab " tabs are spaces
set modeline " parse file specific modeline settings
set autoindent " automatically indent to level of previous line
set cindent " uses some brains to change indent level
" Enable filetype detection
filetype plugin indent on
" Return cursor to previous position when file opened
au BufReadPost *
\ if ! exists("g:leave_my_cursor_position_alone") |
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
\ endif
" don't write backups when called by `crontab -e`
au BufWrite /private/tmp/crontab.* set nowritebackup
" dont' write backups when called by `chpass`
au BufWrite /private/etc/pw.* set nowritebackup
" enable spell check by default on some filetypes
au BufNewFile,BufRead *.txt,*.tex,*.html,svn-commit.tmp,*mutt* set spell
" source Xinu specific settings
au BufNewFile,BufRead ~/xinu/* source ~/.files/vim/xinu.vim
" source cscope definitions
source ~/.files/vim/cscope.vim
" set a default color scheme
colorscheme koehler
" source some color settings
source ~/.files/vim/colors.vim
" some mappings
" make current line an h4
map h4 :s/^[A-z0-9"].*$/<h4>&<\/h4>/g<CR>
" wrap everything in paragraph tags
map p :%s/^[A-z0-9"].*$/<p>&<\/p>/g<CR>
" toggle hidden chars
map <silent> <F2> :set invlist<CR>
imap <silent> <F2> <C-O>:set invlist<CR>
" toggle search highlighting
map <silent> <F3> :set invhlsearch<CR>
imap <silent> <F3> <C-O>:set invhlsearch<CR>
" toggle paste to disable formatting temporarily
map <silent> <F4> :set invpaste<CR>
imap <silent> <F4> <C-O>:set invpaste<CR>
set pastetoggle=<F4>
" reload ~/.vimrc
map <silent> <F5> :source ~/.vimrc<CR>
imap <silent> <F5> <Esc>:source ~/.vimrc<CR>i
" comment/uncomment block of code
map <silent> /c :s/^/\/\//<CR>
map <silent> /d :s/^\/\///<CR>
" spelling settings
map <silent> <F7> :setlocal spell spelllang=en_us<CR>
imap <silent> <F7> <C-O>:setlocal spell spelllang=en_us<CR>
map <silent> <F8> :setlocal nospell<CR>
imap <silent> <F8> <C-O>:setlocal nospell<CR>