after/ftplugin/text.vim

Enforce vim script implementation to reduce ambiguities and improve robustness:

scriptversion 4

Set useful defaults for formatting prose:

call filetypes#apply_ftplugin('formatoptions+=2')

Add dictionary from miscfiles if available:

if filereadable('/usr/share/dict/words')
    call filetypes#apply_ftplugin('complete+=k/usr/share/dict/words')
endif

Tip

On Debian systems this file tends to be provided by packages from the wordlist project(see aptitude search '~Pwordlist' for options). On other systems, and possibly on Debian too, it may be provided by GNU’s miscfiles package.

Break undo sequence on sentence level punctuation. This kind of feels better when editing prose and also when making liberal use of undo-tree. Not yet sure if it is too granular.

for s:key in split(',.!?:;', '\zs')
    execute 'inoremap <buffer> ' .. s:key .. ' ' .. s:key .. '<C-g>u'
endfor

Support increment and decrement on single characters for easy list prefix manipulation:

call filetypes#apply_ftplugin('nrformats+=alpha')