Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mitchpaulus/autocorrect.vim
Autocorrect for Vim/Neovim built from scratch.
https://github.com/mitchpaulus/autocorrect.vim
autocompletion autocorrect neovim neovim-plugin vim vim-plugin
Last synced: 3 months ago
JSON representation
Autocorrect for Vim/Neovim built from scratch.
- Host: GitHub
- URL: https://github.com/mitchpaulus/autocorrect.vim
- Owner: mitchpaulus
- License: gpl-3.0
- Created: 2017-10-02T00:30:00.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T20:47:10.000Z (4 months ago)
- Last Synced: 2024-07-17T00:59:18.341Z (4 months ago)
- Topics: autocompletion, autocorrect, neovim, neovim-plugin, vim, vim-plugin
- Language: Vim Script
- Homepage:
- Size: 1.79 MB
- Stars: 15
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE.txt
Awesome Lists containing this project
README
# autocorrect.vim
This is an autocorrect plugin built from scratch. Every word added to
the autocorrect file was spelled incorrectly by me at some point while typing in Vim.
In fact, several were added during the writing of this README file.# How to Install
I highly suggest the use of a Vim package manager plugin. Do a search in
your favorite search engine, and you will see lots of examples.VIM 8.0 does do a much better job with package management (check out
[this screen cast](https://vimcasts.org/episodes/packages) from one of
the best, Drew Neil - every Vim user should read his book "Practical
Vim"), although I personally use [vim-plug](https://github.com/junegunn/vim-plug).
Check them out.# How to Use
By default, the autocorrect abbreviations are not executed to keep Vim
startup time fast. There are two main functions/commands to get started.
They are the commands:```vim
:AutocorrectTryLoad
```and
```vim
:AutocorrectForceLoad
```By default, `ta` maps to `AutocorrectTryLoad` and `fa`
maps to `AutocorrectForceLoad`. These will not overwrite existing
mappings.You can change the mappings to your preference with a line like
```vim
nmap {new map chars} (AutocorrectTryLoad)
nmap {new map chars} (AutocorrectForceLoad)
```in your vimrc file.
For example, you could change it to be `l` using
```vim
nmap l (AutocorrectTryLoad)
```If you don't want the default mappings at all,
then you can disable them by setting the variable `g:AutocorrectDisableDefaultMappings` to `1`.`ForceLoadAutocorrect` will always reread all the corrections. This is
important when you add in corrections to your personal autocorrect file
(See more on this [here](#extending)). `AutocorrectTryLoad` will do the
same thing as `AutocorrectForceLoad`, but only if it has never been run
before.At this point, type your prose as normal and let the autocorrections do
the hard work for you!# Extending
You can easily extend the list with your own personal autocorrect file.
By default, once the autocorrect plugin has been loaded you can quickly
add words to your personal autocorrect file with the mapping (standing
for [A]dd Abbreviation):```vim
a
```This mapping will by default open up a `.autocorrect` file in your home
directory, with the `iabbrev` command ready to go (`:h iabbrev`). If the
first suggested option isn't what you want the correction to be, just
change it.You can modify the key binding for adding words to the autocorrect list
by mapping to:```vim
nmap {new map chars} (AutocorrectAddToAbbrev)```
## Can I have this automatically loaded for particular filetypes?
Of course. All you have to do is add a List of filetypes to the variable
`g:AutocorrectFiletypes` in your vimrc. As an example,```vim
let g:AutocorrectFiletypes = ["text","markdown","tex"]
```Be aware these are case sensitive as they are directly put into an
autocommand behind the scenes like:```vim
autocmd FileType text,markdown,tex AutocorrectTryLoad
```## Can I change the default location of the `~/.autocorrect` file?
Yes you can. Just put something like
```vim
let g:AutocorrectPersonalFile='~/mydirectory/mynewfile.anyextension'
```in your vimrc file.
## Your corrections are terrible and I want to build my own list.
You can do that as well. To disable loading my list, just set the
variable `g:AutocorrectDisableBuiltIn` in your vimrc to anything. Now
only the personal autocorrect file will be sourced.
Example:```vim
let g:AutocorrectDisableBuiltIn = 1
```Now you can start building up your own personal autocorrect list without
any of my mistakes adding cruft!# Typical Workflow
I typically will just write and type quickly, and then use the `[s`
command to move backwards through the incorrect spellings. Then I use
the `a` mapping to add the autocorrection, press `ZZ` to save
and exit the file, and then use `1z=` to take the first autocorrection
if the correct word appeared in the personal autocorrect file, or just
`z=` if I want to see the other spell check options.# Additional Notes
Note that the personal autocorrect file is simply sourced as a vimscript
file. So if you put other commands besides `iabbrev` in there, Vim will
attempt to execute them. So if you put silly things in there and
exceptions result, that will be on you.# How was this built?
This list was built slowly, one word at a time, and only words that I
have actually typed incorrectly with my own fingers are on the list.
This list was not generated by an algorithm. Because of this, I feel
there is much less waste and more crazy misspelling that occurs in
practice.I don't plan on stopping using Vim for a long time, so this is only
going to grow, but I figured everyone should reap the benefits of this.