summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.vim/ftplugin/mail.vim23
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