diff --git a/README.markdown b/README.markdown index 467d286..9dcb5ae 100644 --- a/README.markdown +++ b/README.markdown @@ -11,26 +11,11 @@ Features of this plugin: * Focused on the most common of typos that we make * Uses Vim’s `iabbrev` * Buffer-scoped behavior -* User-extensible +* User-extensible +* Limited to a maximum of 500 `iabbrev`s for quick load (currently at ~450) -Note that this plugin is not a replacement for teh spell checker in Vim. - -The default typos and their corrections are stored in a global dictionary: - - ``` - let g:litecorrect#defaults = - \{'I' : ['i'], - \ 'The' : ['TEh', 'Teh'], - \ 'that' : ['htat'], - \ 'the' : ['hte', 'teh'], - \ 'this' : ['htis'], - \ 'then' : ['tehn'], - \ 'what' : ['waht'], - \} - ``` - -Note that the corrections are stored as key-value entries where the value -is a list of the common misspellings for the key. +Note that this plugin is not intended to be a replacement for teh spell +checker in Vim. It’s best used with spell-check enabled. ## Requirements @@ -60,7 +45,9 @@ in `markdown` and `textile` files, place in your `.vimrc`: augroup END ``` -Alternatively, you can build on the defaults by providing your own corrections: +Alternatively, you can build on the defaults by providing your own +corrections. Note that the corrections are stored as key-value entries +where the value is a list of the common misspellings for the key. ``` let user_dict = { @@ -75,32 +62,41 @@ Alternatively, you can build on the defaults by providing your own corrections: augroup END ``` -The corrections you provide will be in addition to those in those in -`g:litecorrect#defaults`. Where there’s a conflict, your correction will -prevail. +The corrections you provide will be in addition to the defaults. Where +there’s a conflict, your correction will prevail. ## Criteria to add to defaults Suggestions for adding to the defaults are welcome, but good evidence is needed that they are common typos. +Short words are preferable to long words to avoid the list becoming too +large and slow to load. + +Note that existing `iabbrev`s may be removed to make way for new ones, to +keep within the stated limit. + ## Related -For a more comprehensive approach, check out -[vim-autocorrect](https://github.com/panozzaj/vim-autocorrect). +For a more comprehensive approach with support for many more words, check +out: + +* [vim-autocorrect](https://github.com/panozzaj/vim-autocorrect) +* [wordlist.vim](https://github.com/vim-scripts/wordlist.vim) ## See also If you find this plugin useful, you may want to check out these others by -the same author: +[@reedes][re]: -* [vim-colors-pencil][cp] — color scheme for Vim inspired by IA Writer +* [vim-colors-pencil][cp] - color scheme for Vim inspired by IA Writer * [vim-lexical][lx] - building on Vim’s spell-check and thesaurus/dictionary completion * [vim-pencil][pn] - rethinking Vim as a tool for writers -* [vim-quotable][qu] - Extends Vim to support typographic (‘curly’) quotes -* [vim-thematic][th] — modify Vim’s appearance to suit your task and environment +* [vim-quotable][qu] - extends Vim to support typographic (‘curly’) quotes +* [vim-thematic][th] - modify Vim’s appearance to suit your task and environment * [vim-wordy][wo] - uncovering usage problems in writing +[re]: http://github.com/reedes [cp]: http://github.com/reedes/vim-colors-pencil [lx]: http://github.com/reedes/vim-lexical [pn]: http://github.com/reedes/vim-pencil @@ -113,4 +109,3 @@ the same author: If you’ve spotted a problem or have an idea on improving this plugin, please post it to the github project issue page. - diff --git a/autoload/litecorrect.vim b/autoload/litecorrect.vim new file mode 100644 index 0000000..4f9dfc6 --- /dev/null +++ b/autoload/litecorrect.vim @@ -0,0 +1,397 @@ +" ============================================================================ +" File: litecorrect.vim +" Description: autoload functions for vim-litecorrect plugin +" Maintainer: Reed Esau +" Created: January 20, 2014 +" License: The MIT License (MIT) +" ============================================================================ + +scriptencoding utf-8 + +if exists("autoloaded_litecorrect") + finish +endif +let autoloaded_litecorrect = 1 + +function! s:unicode_enabled() + return &encoding == 'utf-8' +endfunction + +function! litecorrect#init(...) + ia TEh The + ia Teh The + ia abbout about + ia abotu about + ia abouta about a + ia aboutit about it + ia aboutthe about the + ia acn can + ia adn and + ia afterthe after the + ia aganist against + ia agian again + ia ahppen happen + ia ahve have + ia alawys always + ia allready already + ia almots almost + ia almsot almost + ia alomst almost + ia alot a lot + ia alraedy already + ia alreayd already + ia alreday already + ia alwasy always + ia alwats always + ia alway always + ia alwyas always + ia amde made + ia amke make + ia amkes makes + ia andone and one + ia andteh and the + ia andthe and the + ia anothe another + ia appeares appears + ia arond around + ia asthe as the + ia atthe at the + ia awya away + ia aywa away + ia bakc back + ia baout about + ia bcak back + ia beacuse because + ia becasue because + ia becaus because + ia becausea because a + ia becauseof because of + ia becausethe because the + ia becauseyou because you + ia becuase because + ia becuse because + ia befoer before + ia betwen between + ia butthe but the + ia bve be + ia chaneg change + ia chanegs changes + ia cheif chief + ia chekc check + ia chnage change + ia claer clear + ia claered cleared + ia claerly clearly + ia cna can + ia comming coming + ia comntain contain + ia comntains contains + ia comtain contain + ia comtains contains + ia coudl could + ia couldthe could the + ia cpoy copy + ia cxan can + ia deatils details + ia didnot did not + ia doese does + ia doign doing + ia doimg doing + ia donid doing + ia donig doing + ia drnik drink + ia efel feel + ia ehr her + ia esle else + ia eyt yet + ia feild field + ia feilds fields + ia fianlly finally + ia fidn find + ia finalyl finally + ia firts first + ia fo of + ia follwo follow + ia fora for a + ia forthe for the + ia foudn found + ia frmo from + ia fro for + ia fromthe from the + ia fwe few + ia gaurd guard + ia gerat great + ia gievn given + ia goign going + ia gonig going + ia gruop group + ia gruops groups + ia grwo grow + ia hadbeen had been + ia haev have + ia hasbeen has been + ia havebeen have been + ia haveing having + ia hda had + ia hewas he was + ia hge he + ia hismelf himself + ia hlep help + ia hsa has + ia hsi his + ia htat that + ia hte the + ia htere there + ia htese these + ia htey they + ia hting thing + ia htink think + ia htis this + ia httpL http: + ia hvae have + ia hvaing having + ia hwich which + ia i I + ia idae idea + ia idaes ideas + ia ihs his + ia includ include + ia insted instead + ia inteh in the + ia inthe in the + ia inwhich in which + ia isthe is the + ia itis it is + ia itwas it was + ia iused used + ia iwll will + ia iwth with + ia jsut just + ia knwo know + ia knwon known + ia knwos knows + ia konw know + ia konwn known + ia konws knows + ia lastyear last year + ia lenght length + ia liek like + ia liekd liked + ia liev live + ia likly likely + ia littel little + ia litttle little + ia liuke like + ia loev love + ia lookign looking + ia makeing making + ia mkaes makes + ia mkaing making + ia moeny money + ia mroe more + ia myfles myself + ia mysefl myself + ia myu my + ia nkow know + ia nothign nothing + ia nver never + ia nwe new + ia nwo now + ia ocur occur + ia ofits of its + ia ofthe of the + ia oging going + ia ohter other + ia omre more + ia oneof one of + ia onthe on the + ia onyl only + ia optoin option + ia optoins options + ia otehr other + ia otu out + ia outof out of + ia overthe over the + ia owrk work + ia owuld would + ia partof part of + ia peice piece + ia peices pieces + ia peolpe people + ia peopel people + ia perhasp perhaps + ia perhpas perhaps + ia poeple people + ia pwoer power + ia realyl really + ia reult result + ia reveiw review + ia rwite write + ia saidhe said he + ia saidit said it + ia saidthat said that + ia saidthe said the + ia seh she + ia shesaid she said + ia shoudl should + ia showinf showing + ia simalar similar + ia similiar similar + ia simpyl simply + ia sitll still + ia smae same + ia smoe some + ia soem some + ia sohw show + ia soical social + ia somethign something + ia someting something + ia somewaht somewhat + ia somthing something + ia somtimes sometimes + ia soudn sound + ia soudns sounds + ia stnad stand + ia stopry story + ia stoyr story + ia stpo stop + ia stroy story + ia tahn than + ia taht that + ia talekd talked + ia talkign talking + ia tath that + ia teh the + ia tehn then + ia tehy they + ia tghe the + ia tghis this + ia thansk thanks + ia thatthe that the + ia thefirst the first + ia themself themselves + ia themselfs themselves + ia thenew the new + ia theri their + ia thesame the same + ia thetwo the two + ia thgat that + ia thge the + ia thier their + ia thigsn things + ia thisyear this year + ia thme them + ia thna than + ia thne then + ia thnig thing + ia thnigs things + ia thsi this + ia thsoe those + ia thta that + ia tihs this + ia timne time + ia tiogether together + ia tje the + ia tjhe the + ia tkae take + ia tkaes takes + ia tkaing taking + ia tlaking talking + ia ot to + ia todya today + ia togehter together + ia tothe to the + ia towrad toward + ia truely truly + ia truley truly + ia tryed tried + ia tthe the + ia tyhat that + ia tyhe the + ia unliek unlike + ia untilll until + ia useing using + ia usualyl usually + ia veyr very + ia vrey very + ia waht what + ia watn want + ia wehn what + ia werre were + ia whcih which + ia wherre where + ia whic which + ia whihc which + ia whta what + ia wihch which + ia wiht with + ia willbe will be + ia witha with a + ia withe with + ia withthe with the + ia wiull will + ia wnat want + ia wnated wanted + ia wnats wants + ia woh who + ia wohle whole + ia wokr work + ia woudl would + ia wouldbe would be + ia write write + ia writting writing + ia wrod word + ia wroet wrote + ia wtih with + ia wuould would + ia wya way + ia yera year + ia yeras years + ia yersa years + ia yoiu you + ia youare you are + ia ytou you + ia yuo you + ia yuor your + + if s:unicode_enabled() + ia couldnt couldn’t + ia didint didn’t + ia didnt didn’t + ia doesnt doesn’t + ia dont don’t + ia hasnt hasn’t + ia shouldent shouldn’t + ia shouldnt shouldn’t + ia thats that’s + ia theyll they’ll + ia theyve they’ve + ia wasnt wasn’t + ia wouldnt wouldn’t + ia youve you’ve + else + ia couldnt couldn't + ia didint didn't + ia didnt didn't + ia doesnt doesn't + ia dont don't + ia hasnt hasn't + ia shouldent shouldn't + ia shouldnt shouldn't + ia thats that's + ia theyll they'll + ia theyve they've + ia wasnt wasn't + ia wouldnt wouldn't + ia youve you've + endif + + " user overrides + let l:user_dict = a:0 ? a:1 : {} + for l:item in items(l:user_dict) + let l:fixed = l:item[0] + for l:subitem in l:item[1] + execute 'ia ' . l:subitem . ' ' . l:fixed + endfor + endfor +endfunction diff --git a/plugin/litecorrect.vim b/plugin/litecorrect.vim deleted file mode 100644 index ecc921f..0000000 --- a/plugin/litecorrect.vim +++ /dev/null @@ -1,44 +0,0 @@ -" ============================================================================ -" File: litecorrect.vim -" Description: vim-litecorrect plugin -" Maintainer: Reed Esau -" Last Change: December 29, 2013 -" License: The MIT License (MIT) -" ============================================================================ - -scriptencoding utf-8 - -if exists('g:loaded_litecorrect') || &cp | finish | endif -let g:loaded_litecorrect = 1 - -" Save 'cpoptions' and set Vim default to enable line continuations. -let s:save_cpo = &cpo -set cpo&vim - -" a dictionary of the most common of typos -let g:litecorrect#defaults = - \{'I' : ['i'], - \ 'The' : ['TEh', 'Teh'], - \ 'that' : ['htat'], - \ 'the' : ['hte', 'teh'], - \ 'this' : ['htis'], - \ 'then' : ['tehn'], - \ 'what' : ['waht'], - \ 'of' : ['fo'], - \} - -function! litecorrect#init(...) - let l:user_dict = a:0 ? a:1 : {} - for l:dict in [ g:litecorrect#defaults, l:user_dict ] - for l:item in items( l:dict ) - let l:fixed = l:item[0] - for l:subitem in l:item[1] - execute 'ia ' . l:subitem . ' ' . l:fixed - endfor - endfor - endfor -endfunction - -let &cpo = s:save_cpo -unlet s:save_cpo -" vim:ts=2:sw=2:sts=2