[PATCH] VIM v2: Add a 'tag all' folder option.

Subject: [PATCH] VIM v2: Add a 'tag all' folder option.

Date: Wed, 1 Oct 2014 17:02:42 -0700

To: notmuch@notmuchmail.org

Cc:

From: Ian Main


This adds the ability to mark an entire folder as read (or any other
tags you like once you map it).

This update adds documentation for the command.

    Ian
---
 vim/notmuch.txt |  1 +
 vim/notmuch.vim | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/vim/notmuch.txt b/vim/notmuch.txt
index 4374102..33cbe6e 100644
--- a/vim/notmuch.txt
+++ b/vim/notmuch.txt
@@ -47,6 +47,7 @@ MAPPINGS					*notmuch-mappings*
 Folder view~
 
 <enter>	Show selected search
+A	Archive (-inbox -unread) an entire folder
 s	Enter a new search
 =	Refresh
 c	Compose a new mail
diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 331e930..3f2444b 100644
--- a/vim/notmuch.vim
+++ b/vim/notmuch.vim
@@ -11,6 +11,7 @@ let g:loaded_notmuch = "yep"
 let g:notmuch_folders_maps = {
 	\ '<Enter>':	'folders_show_search()',
 	\ 's':		'folders_search_prompt()',
+	\ 'A':		'folders_tag_all("-inbox -unread")',
 	\ '=':		'folders_refresh()',
 	\ 'c':		'compose()',
 	\ }
@@ -378,6 +379,16 @@ ruby << EOF
 EOF
 endfunction
 
+function! s:folders_tag_all(tags)
+ruby << EOF
+	n = $curbuf.line_number
+	s = $searches[n - 1]
+	t = VIM::evaluate('a:tags')
+	do_tag(s, t)
+EOF
+	call s:folders_refresh()
+endfunction
+
 function! s:folders()
 	call s:new_buffer('folders')
 	ruby folders_render()
-- 
1.9.3


Thread: