myconfig

my config files
git clone https://a3nm.net/git/myconfig/
Log | Files | Refs | README

spell.vim (517B)


      1 fun! SpellNext()
      2     " from https://vi.stackexchange.com/a/17267/
      3     " Go to start of buffer and enable spell checking.
      4     normal! gg
      5     set spell
      6 
      7     " Record cursor position.
      8     let l:pos = getpos('.')
      9 
     10     " Special case: first word is misspelled.
     11     if spellbadword()[1] isnot# ''
     12         return
     13     endif
     14 
     15     " Try to find a misspelled word.
     16     normal! ]s
     17 
     18     " No more words left if the position is unchanged from last
     19     " time, so quit Vim.
     20     if getpos('.') == l:pos
     21         quit
     22     endif
     23 endfun