aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim
diff options
context:
space:
mode:
authorGravatar Felipe Contreras <felipe.contreras@gmail.com>2013-10-14 01:58:20 -0500
committerGravatar Felipe Contreras <felipe.contreras@gmail.com>2013-11-20 07:23:29 -0600
commit24dc32aef7d7bba4f54a7ff665940b3a7b419581 (patch)
treecf1df2ccdfee221d9fdb71b0c31804a5215dd244 /vim
parentde74431cfeb24ca72f6dfa4df93130ba49c59219 (diff)
vim: add option to compose new messages
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Diffstat (limited to 'vim')
-rw-r--r--vim/notmuch.vim33
1 files changed, 33 insertions, 0 deletions
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 8383fd65..42c5f188 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -12,6 +12,7 @@ let g:notmuch_rb_folders_maps = {
\ '<Enter>': 'folders_show_search()',
\ 's': 'folders_search_prompt()',
\ '=': 'folders_refresh()',
+ \ 'c': 'compose()',
\ }
let g:notmuch_rb_search_maps = {
@@ -24,6 +25,7 @@ let g:notmuch_rb_search_maps = {
\ 's': 'search_search_prompt()',
\ '=': 'search_refresh()',
\ '?': 'search_info()',
+ \ 'c': 'compose()',
\ }
let g:notmuch_rb_show_maps = {
@@ -38,6 +40,7 @@ let g:notmuch_rb_show_maps = {
\ 'r': 'show_reply()',
\ '?': 'show_info()',
\ '<Tab>': 'show_next_msg()',
+ \ 'c': 'compose()',
\ }
let g:notmuch_rb_compose_maps = {
@@ -148,6 +151,14 @@ function! s:show_reply()
startinsert!
endfunction
+function! s:compose()
+ ruby open_compose
+ let b:compose_done = 0
+ call s:set_map(g:notmuch_rb_compose_maps)
+ autocmd BufUnload <buffer> call s:compose_unload()
+ startinsert!
+endfunction
+
function! s:show_info()
ruby vim_puts get_message.inspect
endfunction
@@ -578,6 +589,28 @@ ruby << EOF
open_compose_helper(lines, cur)
end
+ def open_compose()
+ lines = []
+
+ lines << "Date: #{Time.now().strftime('%a, %-d %b %Y %T %z')}"
+ lines << "From: #{$email}"
+ lines << "To: "
+ cur = lines.count
+
+ lines << "Cc: "
+ lines << "Bcc: "
+ lines << "Message-Id: #{generate_message_id}"
+ lines << "Subject: "
+ lines << "Mime-Version: 1.0"
+ lines << "Content-Type: text/plain; charset=utf-8"
+ lines << "Content-Transfer-Encoding: 7bit"
+ lines << ""
+ lines << ""
+ lines << ""
+
+ open_compose_helper(lines, cur)
+ end
+
def folders_render()
$curbuf.render do |b|
folders = VIM::evaluate('g:notmuch_rb_folders')