Skip to content

Instantly share code, notes, and snippets.

@itsthomson
Created April 15, 2009 11:41
Show Gist options
  • Save itsthomson/95726 to your computer and use it in GitHub Desktop.
Save itsthomson/95726 to your computer and use it in GitHub Desktop.
" .vimrc, 15 Apr 2009
" Thomson Nguyen
syn on
" command-line completion
set wildmode=list:longest,full
set showmode
set showcmd
" squeak
set mouse=a
" 2 space indent, copied down lines
set shiftwidth=2
set shiftround
set expandtab
set autoindent
" why 74? why not?
set textwidth=74
set formatoptions-=t
set number
filetype on
autocmd FileType css set smartindent
autocmd FileType html set formatoptions+=tl
autocmd FileType make set noexpandtab shiftwidth=8
" i like my searches w/o case sensitivity
set ignorecase
set smartcase " upper-case letters toggle it on though
set incsearch
let IspellLang = 'american'
let PersonalDict = '~/.ispell_' . IspellLang
""""""the following five commands were stolen from stripey:
" \si ("spelling interactive") saves the current file then spell checks it
" interactively through `Ispell' and reloads the corrected version:
execute 'nnoremap \si :w<CR>:!ispell -x -d ' . IspellLang . ' %<CR>:e<CR><CR>'
" \sl ("spelling list") lists all spelling mistakes in the current buffer,
" but excludes any in news/mail headers or in ("> ") quoted text:
execute 'nnoremap \sl :w ! grep -v "^>" <Bar> grep -E -v "^[[:alpha:]-]+: " ' .
\ '<Bar> ispell -l -d ' . IspellLang . ' <Bar> sort <Bar> uniq<CR>'
" \sh ("spelling highlight") highlights (in red) all misspelt words in the
" current buffer, and also excluding the possessive forms of any valid words
" (EG "Lizzy's" won't be highlighted if "Lizzy" is in the dictionary); with
" mail and news messages it ignores headers and quoted text; for HTML it
" ignores tags and only checks words that will appear, and turns off other
" syntax highlighting to make the errors more apparent [function at end of
" file]:
nnoremap \sh :call HighlightSpellingErrors()<CR><CR>
nmap <F9> \sh
" \sc ("spelling clear") clears all highlighted misspellings; for HTML it
" restores regular syntax highlighting:
nnoremap \sc :if &ft == 'html' <Bar> sy on <Bar>
\ else <Bar> :sy clear SpellError <Bar> endif<CR>
nmap <F10> \sc
" \sa ("spelling add") adds the word at the cursor position to the personal
" dictionary (but for possessives adds the base word, so that when the cursor
" is on "Ceri's" only "Ceri" gets added to the dictionary), and stops
" highlighting that word as an error (if appropriate) [function at end of
" file]:
nnoremap \sa :call AddWordToDictionary()<CR><CR>
nmap <F8> \sa
" end!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment