From: Michael D. Lowis Date: Mon, 22 Sep 2014 13:21:54 +0000 (-0400) Subject: Added spellchecking to vim config X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=18c06741391716433dcacd59c108f621899cd13f;p=archive%2Fvim_config.git Added spellchecking to vim config --- diff --git a/vimrc b/vimrc index a564965..90dfd8f 100644 --- a/vimrc +++ b/vimrc @@ -51,6 +51,7 @@ set omnifunc=syntaxcomplete#Complete " Auto complete based on syntax set completeopt=menu,longest " Show a popup menu with the longest common prefix selected set wildmode=list:full set wildmenu +set title "============================================================================== " Global Variables @@ -94,7 +95,7 @@ function! LoadProject() endif if (!empty(proj)) - exec "source " . proj + exec "source project.vim" endif endfunction @@ -165,6 +166,23 @@ function! UpdateStatus(lmarg,rmarg) endif endfunction +"============================================================================== +" Spell Checking Rules For Code +"============================================================================== +function! SpellCheck() + " Turn on spell checking + set spell + " Ignore Doxygen Tags + syn match DoxyTags /[@\\][a-z]\+/ contains=@NoSpell transparent + syn cluster Spell add=DoxyTags + " Ignore Camel Cased Identifiers + syn match CamelCase /[A-Z][a-z0-9_]*[A-Z][A-Za-z0-9_]*/ contains=@NoSpell transparent + syn cluster Spell add=CamelCase + " Ignore Variable Names + syn match VarNames /[a-z0-9]\+_[a-z0-9_]*/ contains=@NoSpell transparent + syn cluster Spell add=VarNames +endfunction + "============================================================================== " Keyboard Mappings "============================================================================== @@ -186,6 +204,9 @@ vnoremap > >gv " ---- Clear Search Highlighting ---- map h :nohl +" ---- Toggle Spell Checking ---- +map s :set spell! + " ---- Omni Complete ---- inoremap @@ -193,10 +214,10 @@ inoremap map t :call Template(getline("."))jdd " ---- Buffer Management ---- -map :bp -imap :bp -map :bn -imap :bn +map :bp +imap :bp +map :bn +imap :bn " ---- Moving Lines Around ---- nmap ddp @@ -236,6 +257,9 @@ cnoreabbrev ff "============================================================================== " Auto Commands "============================================================================== +" Automatically turn on spell checking +autocmd BufRead,BufNewFile * call SpellCheck() + " Auto locate and load project specific settings autocmd BufEnter * call LoadProject()