-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvim-you-autocorrect.txt
240 lines (200 loc) · 11.5 KB
/
vim-you-autocorrect.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
*vim-you-autocorrect.txt* Why should smartphones get all the fun?
*autocorrect* *vim-you-autocorrect*
Author: Rich Cheng <http://whileyouweregone.co.uk>
Homepage: http://github.com/sedm0784/vim-you-autocorrect
Copyright: © 2018–2021 Rich Cheng
Licence: Vim You, Autocorrect! uses the same licence as Vim. (See
|license|.)
Version: 1.1.4
==============================================================================
_ _ _ _ ___ _ ~
\ \ / | | | |\/| \ \_/ / / \ | | | __ ~
\_\/ |_| |_| | |_| \_\_/ \_\_/ /_/) ~
__ _ _____ ___ __ ___ ___ ___ ____ __ _____ __ ~
/ /\ | | | | | / / \ / /` / / \ | |_) | |_) | |_ / /` | | |_/ ~
/_/--\ \_\_/ |_| \_\_/ \_\_, \_\_/ |_| \ |_| \ |_|__ \_\_, |_| (_) ~
Why should smartphones get all the fun?
==============================================================================
CONTENTS *autocorrect-contents*
1. Introduction ......................|autocorrect-introduction|
2. Usage .............................|autocorrect-usage|
2.1 Commands .....................|autocorrect-commands|
3. How Does It Work? .................|autocorrect-how-does-it-work|
4. Advanced Configuration.............|autocorrect-advanced-configuration|
4.1 Highlighting .................|autocorrect-highlighting|
4.2 Mappings .....................|autocorrect-mappings|
5. Changelog .........................|autocorrect-changelog|
6. Issues ............................|autocorrect-issues|
6.1 Known Issues .................|autocorrect-known-issues|
6.2 Reporting Issues .............|autocorrect-reporting-issues|
7. Credits ...........................|autocorrect-credits|
==============================================================================
1. Introduction *autocorrect-introduction*
Vim You, Autocorrect! releases you from the DRUDGERY of having to correct your
spelling mistakes and typos by automatically accepting Vim's suggestions for
each misspelled word as you type.
==============================================================================
2. Usage *autocorrect-usage*
Simply switch Vim You, Autocorrect! on by typing |:EnableAutocorrect|, and
never have to worry about spelling errors again!
------------------------------------------------------------------------------
2.1 Commands *autocorrect-commands*
*autocorrect-:EnableAutocorrect*
:EnableAutocorrect
This turns on Vim You, Autocorrect! for the current buffer. Most
likely you will want to enable autocorrections globally by
adding something like the following to your .vimrc file:
>
augroup ILoveCorrections
autocmd!
autocmd BufEnter * EnableAutocorrect
augroup END
<
*autocorrect-:DisableAutocorrect*
:DisableAutocorrect
This turns Vim You, Autocorrect! off again. You will probably
never want to do this I don't know why I implemented it.
==============================================================================
3. How Does It Work? *autocorrect-how-does-it-work*
Vim You, Autocorrect! has a very sophisticated and subtle mechanism. The full
details of how it works are almost impossible to explain, but essentially it
does something like the following:
1. As you finish typing each word, Vim You, Autocorrect! issues a `[s`
motion command,
2. If a spelling error is detected, Vim You, Autocorrect! issues a `1z=`
command to accept the first spelling suggestion.
==============================================================================
4. Advanced Configuration *autocorrect-advanced-configuration*
------------------------------------------------------------------------------
4.1 Highlighting *autocorrect-highlighting*
Vim You, Autocorrect! adds a new |highlight| group, which is used to highlight
the most recent correction for a short period of time.
*autocorrect-hl-AutocorrectGood*
AutocorrectGood
The most recently corrected word. By default, this simply
links to your current |hl-SpellBad| highlight group (because
otherwise, you might get sad because you never get to see that
colour). If you want to define your own highlighting instead,
add a line such as the following to your |vimrc|:
>
highlight AutocorrectGood ctermfg=Red guifg=Red gui=undercurl
<
If you set a |colorscheme| in your |vimrc|, ensure that you do so BEFORE
setting your |AutocorrectGood| highlight: some colorschemes will clear
existing highlighting when they are set. Alternatively, use a |ColorScheme|
autocommand; this is the mechanism Vim provides for ensuring specified
highlights are always respected.
*'g:vim_you_autocorrect_disable_highlighting'*
'g:vim_you_autocorrect_disable_highlighting'
boolean (default off)
global
To disable highlighting entirely, add the following option to
your |vimrc|:
>
let g:vim_you_autocorrect_disable_highlighting = 1
<
------------------------------------------------------------------------------
4.2 Mappings *autocorrect-mappings*
Version 1.0 of Vim You, Autocorrect! ensures that everything you type is
spelled CORRECTLY. However, subsequent to its release, I have been informed
that some users occasionally want to include words that are spelled
INCORRECTLY or LESS correctly in the things they write. Why do they want
this? It is a mystery to modern science.
Nevertheless, I am nothing if not ACCOMMODATING: I have prepared a number of
features to facilitate this unusual request. Vim You, Autocorrect! does not
add any mappings by default, that would be RUDE, but it provides a number of
internal mappings you can map to in your |vimrc|. (See |using-<Plug>|.)
*autocorrect-undo*
<Plug>VimyouautocorrectUndo
Undo the most recent correction, returning the word to its
originally typed (incorrect) spelling. e.g. Add this mapping
to your |vimrc| to invoke this feature by typing |<Leader>|u
in normal mode:
>
nmap <Leader>u <Plug>VimyouautocorrectUndo
<
Or add this mapping to undo corrections by pressing <F3>
in insert mode:
>
imap <F3> <C-O><Plug>VimyouautocorrectUndo
<
*autocorrect-jump*
<Plug>VimyouautocorrectJump
Position cursor at the start of the most recent
correction. e.g. To override the default behaviour of |[s|
(Because, hey, you're not using that now anyway, are you?) and
use it instead to jump back to the last correction,
add the following mapping to your |vimrc|:
>
nmap [s <Plug>VimyouautocorrectJump
<
Or to jump back and open Vim's regular interface for selecting
a spelling correction by typing |z=| (You're not using
that any more, either, right?) try this mapping:
>
nmap z= <Plug>VimyouautocorrectJump<Plug>VimyouautocorrectUndo:call feedkeys('z=', 'n')<CR>
<
*autocorrect-next*
<Plug>VimyouautocorrectNext
For the most recent correction, select the next of Vim's
suggested corrections.
*autocorrect-previous*
<Plug>VimyouautocorrectPrevious
For the most recent correction, select the previous of Vim's
suggested corrections.
These commands allow you to step through Vim's list of spelling suggestions.
e.g. to set up |]s| and |[s| to iterate forwards and backwards through
Vim's list of suggestions, use the following normal mode mappings:
>
nmap ]s <Plug>VimyouautocorrectNext
nmap [s <Plug>VimyouautocorrectPrevious
<
Or if you don't want to exit insert mode, try these mappings:
>
imap <F4> <C-O><Plug>VimyouautocorrectPrevious
imap <F5> <C-O><Plug>VimyouautocorrectNext
<
Wait, I thought of a reason you might want to do this! Maybe you are QUOTING
text from elsewhere, and you need to preserve the INCORRECT spelling rather
than MISQUOTE the source. Perhaps a future version of Vim You, Autocorrect!
will add a feature to append [sic] to the text whenever you invoke the
VimyouautocorrectUndo mapping.
==============================================================================
5. Changelog *autocorrect-changelog*
Version 1.1.3 - Fix corrections at end of line at top of file when |scrolloff|
is set.
Version 1.1.2 - Boring technical stuff. No real changes unless you care about
global namespace POLLUTION.
Version 1.1.1 - Fix MYSTERIOUS stuttering issue reported by users.
https://github.com/sedm0784/vim-you-autocorrect/issues/5
Version 1.1.0 - Add features to allow incorrect and less correct words to be
entered.
Version 1.0.1 - Use `1z=` instead of `z=1<CR>` . Minor updates to :help.
Version 1.0.0 - Vim You, Autocorrect! released
==============================================================================
6. Issues *autocorrect-issues*
------------------------------------------------------------------------------
6.1 Known Limitations *autocorrect-known-issues*
Vim You, Autocorrect! is flawless, both in execution and more importantly in
conception.
------------------------------------------------------------------------------
6.2 Reporting Issues *autocorrect-reporting-issues*
If your issue is anything other than, “I'm struggling to cope with how
remarkably SPECTACULAR Vim You, Autocorrect! is,” then it seems likely your
problem is caused by user error, because Vim You, Autocorrect! is PERFECT.
(See |autocorrect-known-issues|, above).
Nevertheless, you can still contact me via the GitHub repository:
https://github.com/sedm0784/vim-you-autocorrect
Or if you prefer, feel free to email or tweet instead:
vim dot you dot autocorrect at whileyouweregone dot co dot uk
@sedm0784
==============================================================================
7. Credits *autocorrect-credits*
Vim You, Autocorrect! was written by Rich Cheng.
It includes some code improvements suggested by Luc Hermitte (or Lac Hermit,
if this plugin had its druthers), who kindly reviewed the code.
The banner at the top of this help file was created using the “Broadway KB”
FIGlet font at the Text ASCII Art Generator:
http://patorjk.com/software/taag/
==============================================================================
vim:tw=78:ts=8:ft=help:norl: