Skip to content
qadzek edited this page May 8, 2024 · 21 revisions

To move all the URLs in the document body to the end of it, after a Links: header, add a file ~/.vim/ftplugin/mail.vim with the following content:

let b:link_heading = 'Links:'
let b:link_heading_before = '^-- $'
let b:link_skip_line = '^>'
let s:body_range = '1/^\s*$/,/\%$\|'..b:link_heading_before..'\|\V\^'..escape(b:link_heading,'\')..'\$/-1'

autocmd BufWrite <buffer> silent! exe s:body_range..'LinkConvertRange'

if exists(':Alias') != 2 || exists('b:mail_aliases')
    finish
endif
let b:mail_aliases = 1

Alias -buffer -range lc  LinkConvertRange
Alias -buffer        lo  LinkOpen
Alias -buffer        lp  LinkPeek
Alias -buffer        lj  LinkJump
Alias -buffer        lr  LinkReformat
Clone this wiki locally