mirror of
https://github.com/preservim/vim-litecorrect.git
synced 2025-11-14 12:53:47 -05:00
114 lines
3.3 KiB
Markdown
114 lines
3.3 KiB
Markdown
# vim-litecorrect
|
||
|
||
> Lightweight auto-correction for Vim
|
||
|
||
We type `teh` when we meant to type `the`. This plugin is to help us catch
|
||
the most common of these typos and correct each upon hitting the space bar
|
||
(or non-keyword character.)
|
||
|
||
Features of this plugin:
|
||
|
||
* Focused on the most common of typos that we make
|
||
* Uses Vim’s `iabbrev`
|
||
* Buffer-scoped behavior
|
||
* User-extensible
|
||
|
||
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.
|
||
|
||
## Requirements
|
||
|
||
May require a recent version of Vim.
|
||
|
||
## Installation
|
||
|
||
Install using Pathogen, Vundle, Neobundle, or your favorite Vim package
|
||
manager.
|
||
|
||
## Configuration
|
||
|
||
Because you may not want auto-corrections in all file types you edit, you can
|
||
configure this plugin per file type. For example, to enable litecorrect support
|
||
in `markdown` and `textile` files, place in your `.vimrc`:
|
||
|
||
```vim
|
||
augroup litecorrect
|
||
autocmd!
|
||
autocmd FileType markdown call litecorrect#init()
|
||
autocmd FileType textile call litecorrect#init()
|
||
augroup END
|
||
```
|
||
|
||
Alternatively, you can build on the defaults by providing your own corrections:
|
||
|
||
```
|
||
let user_dict = {
|
||
\ 'maybe': ['mabye'],
|
||
\ 'medieval': ['medival', 'mediaeval', 'medevil'],
|
||
\ 'then': ['hten'],
|
||
\ }
|
||
augroup litecorrect
|
||
autocmd!
|
||
autocmd FileType markdown call litecorrect#init(user_dict)
|
||
autocmd FileType textile call litecorrect#init(user_dict)
|
||
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.
|
||
|
||
## Criteria to add to defaults
|
||
|
||
Suggestions for adding to the defaults are welcome, but good evidence is
|
||
needed that they are common typos.
|
||
|
||
## Related
|
||
|
||
For a more comprehensive approach, check out
|
||
[vim-autocorrect](https://github.com/panozzaj/vim-autocorrect).
|
||
|
||
## See also
|
||
|
||
If you find this plugin useful, you may want to check out these others by
|
||
the same author:
|
||
|
||
* [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-litecorrect][lc] - Lightweight auto-correction for Vim
|
||
* [vim-pencil][pn] - Rethinking Vim as a tool for writers
|
||
* [vim-quotable][qu] - Extends Vim to support typographic (‘curly’) quotes
|
||
* [vim-thematic][th] — appearance to suit your task and environment
|
||
* [vim-wordy][wo] - Uncovering potential usage problems in writing
|
||
|
||
[cp]: http://github.com/reedes/vim-colors-pencil
|
||
[lx]: http://github.com/reedes/vim-lexical
|
||
[lc]: http://github.com/reedes/vim-litecorrect
|
||
[pn]: http://github.com/reedes/vim-pencil
|
||
[qu]: http://github.com/reedes/vim-quotable
|
||
[th]: http://github.com/reedes/vim-thematic
|
||
[wo]: http://github.com/reedes/vim-wordy
|
||
|
||
## Future development
|
||
|
||
If you’ve spotted a problem or have an idea on improving this plugin,
|
||
please post it to the github project issue page.
|
||
|
||
<!-- vim: set tw=74 :-->
|