after/ftplugin/rst.vim
¶
Enforce vim script implementation to reduce ambiguities and improve robustness:
scriptversion 4
This creates reST headings using my favourite adornments:
call keymaps#mnemonic_map('Heading', #{buffer: v:true, local: v:true})
for s:level in [1, 2, 3]
for s:pad in [v:true, v:false]
execute printf('nnoremap <silent> <buffer> [Heading]%s%d ' ..
\ ':call filetypes#make_reST_header(%d, %s)<CR>',
\ s:pad != v:true ? 's' : '', s:level, s:level, s:pad)
endfor
endfor
Set useful defaults for formatting prose:
call filetypes#apply_ftplugin('formatoptions+=2')
See also
Add dictionary from miscfiles if available:
if filereadable('/usr/share/dict/words')
call filetypes#apply_ftplugin('complete+=k/usr/share/dict/words')
endif
See also
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')
Enable thesaurus support; annoying in code, but great in prose.
call filetypes#apply_ftplugin('complete+=s')
See also
The vast majority of the time I spend editing reST documents I am actually
editing files from a Sphinx project. It is nice being able to gf when
in a :doc:
role or toctree
directive:
call filetypes#apply_ftplugin('suffixesadd+=.rst')
See also