From: Felipe Contreras Date: Sat, 2 Nov 2013 13:55:47 +0000 (+1800) Subject: [PATCH 14/21] vim: add option to compose new messages X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=29435833148a6da419ef74c275c2ebaae2d8967b;p=notmuch-archives.git [PATCH 14/21] vim: add option to compose new messages --- diff --git a/0b/027057727dfe567ff50fa2cc466c38df7cea00 b/0b/027057727dfe567ff50fa2cc466c38df7cea00 new file mode 100644 index 000000000..16e851225 --- /dev/null +++ b/0b/027057727dfe567ff50fa2cc466c38df7cea00 @@ -0,0 +1,142 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 64768431FAF + for ; Sat, 2 Nov 2013 07:03:54 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id u4j0GMEUADA6 for ; + Sat, 2 Nov 2013 07:03:49 -0700 (PDT) +Received: from mail-ob0-f175.google.com (mail-ob0-f175.google.com + [209.85.214.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 2FF24431FC3 + for ; Sat, 2 Nov 2013 07:03:12 -0700 (PDT) +Received: by mail-ob0-f175.google.com with SMTP id wm4so5550809obc.6 + for ; Sat, 02 Nov 2013 07:03:11 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=r/du2J/bmZ2YJ8fGvUcMS5dYvOq/yYyH4PxNGmD8LBE=; + b=qk5wjgKjr81qIrDcX5UuBkofvMLt155yK1qad2FA6qtx/lW+p44QH/XTocEhS5FyFw + PRVIPtxSBph9h0zzmEvx2QElKnKeouq4l0MLEBGbiXIoF0QwKoeTMS4BMALYsY8HFGpo + sFXgtq+g55evIFRrMwBwH1eMWtGV2thHCIr+LjXYhuGckIQAj81EjnP1pgKotty2s993 + QSJxVo6bAG0dJiqD+kQ+fJnnChU+oScvNyY1bB0dtWoVZYSi4vKRbLM8H1pAuNQjluou + VEkRnhgaQjaSShZZu0KdfDQiKZuRfE9tZHa6F90NEX4I7NgFZE22ZR7QEZUnRMFc/3Cn + RLiA== +X-Received: by 10.60.39.67 with SMTP id n3mr6441829oek.2.1383400991718; + Sat, 02 Nov 2013 07:03:11 -0700 (PDT) +Received: from localhost (187-162-140-241.static.axtel.net. [187.162.140.241]) + by mx.google.com with ESMTPSA id j9sm5189597oef.8.2013.11.02.07.03.10 + for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sat, 02 Nov 2013 07:03:10 -0700 (PDT) +From: Felipe Contreras +To: notmuch@notmuchmail.org +Subject: [PATCH 14/21] vim: add option to compose new messages +Date: Sat, 2 Nov 2013 07:55:47 -0600 +Message-Id: <1383400554-1832-15-git-send-email-felipe.contreras@gmail.com> +X-Mailer: git-send-email 1.8.4.2+fc1 +In-Reply-To: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com> +References: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 02 Nov 2013 14:03:54 -0000 + +Signed-off-by: Felipe Contreras +--- + vim/notmuch.vim | 33 +++++++++++++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/vim/notmuch.vim b/vim/notmuch.vim +index 8383fd6..42c5f18 100644 +--- a/vim/notmuch.vim ++++ b/vim/notmuch.vim +@@ -12,6 +12,7 @@ let g:notmuch_rb_folders_maps = { + \ '': '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()', + \ '': '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 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') +-- +1.8.4.2+fc1 +