diff options
author | Florian Pritz <bluewind@xinu.at> | 2019-01-04 13:44:21 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2019-01-04 13:45:35 +0100 |
commit | 80c78d39b0b9983ec156a9c2c19aef113f603e15 (patch) | |
tree | 3d40ec0b33fa4170f74bdbd7181e2f8f59cab920 | |
parent | 164f04a4c62319571de91cece546db14464182dd (diff) | |
download | dotfiles-80c78d39b0b9983ec156a9c2c19aef113f603e15.tar.gz dotfiles-80c78d39b0b9983ec156a9c2c19aef113f603e15.tar.xz |
vim: Add mail snippet helper
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | .vim/ftplugin/mail.vim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/.vim/ftplugin/mail.vim b/.vim/ftplugin/mail.vim new file mode 100644 index 0000000..8fcbb5e --- /dev/null +++ b/.vim/ftplugin/mail.vim @@ -0,0 +1,23 @@ +if exists("b:loaded_Mail_plugin") + finish +endif +let b:loaded_Mail_plugin = 1 + +function MailGetRecipient() + let savedpos = getpos('.') + call setpos('.', [0, 1, 1, 0]) + let line = getline(search("^To:")) + let linesplit = split(line) + call setpos('.', savedpos) + + if len(linesplit) > 1 + let elements = linesplit[1:-1] + if len(elements) > 1 + return elements + else + return elements[0:0] + [""] + endif + else + return ["", ""] + endif +endfu |