Adam Katz<p>It's not often that I deploy a quick change to my <code>~/.vimrc</code> and it so thoroughly improves my life, but setting <code><Shift>+<Tab></code> to correct the most recent misspelled word has done exactly that, right up there with when I learned about <code><Ctrl>+p</code> and <code><Ctrl>+n</code> in insert mode. <a href="https://infosec.exchange/tags/vim" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>vim</span></a> </p><pre><code>" Correct the closest misspelled word (with spellcheck off, the current word)<br>" assuming the #1 option is the best (`2<S-Tab>` in normal mode uses #2, etc.)<br>if exists('&spell')<br> function! SpellFix(count)<br> if (&spell)<br> normal [S<br> endif<br> exec "normal " . a:count . "z="<br> endfunction<br> " corrections have their own undo: https://stackoverflow.com/a/16481737/519360<br> imap <silent><S-Tab> <C-g>u<Esc>:call SpellFix(1)<CR>`]a<C-g>u<br> nmap <silent><S-Tab> :<C-u>call SpellFix(v:count1)<CR>`'<br>endif<br></code></pre>