Correction Fluid
Vim script for spell correction on the fly
Usage
While in insert mode, type ,,
to correct the last word.
Installation
Add the following to your .vimrc
or other files that get sourced when starting vim.
inoremap ,, <C-O>:call CorrectionFluid()<CR>
function! CorrectionFluid()
let wrap = &wrap set nowrap normal mx let @l=col("$")-col(".")
normal [s1z=
let @/=expand("<cword>")
normal `x let @c=col("$")-@l execute "normal @c|"
if wrap == 1 | set wrap | endif endfunction
Notes
@l
is the distance from end of line. @c
returns to this point, which won't have changed, even if the spell correction made the line longer or shorter.
[s
find most recent mistake
1z=
correct with most common suggestion