From: Bart Trojanowski Date: Fri, 20 Nov 2009 16:13:49 +0000 (-0500) Subject: added support for archive command X-Git-Tag: 0.1~313^2~81 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=de85b4752d51567ded73e9bbed75d0b8f5bfea71;hp=882621927483635d37eed70eef007f1ef97662d0 added support for archive command --- diff --git a/vim/README b/vim/README index ba6eb5fe..dffc88a4 100644 --- a/vim/README +++ b/vim/README @@ -18,6 +18,7 @@ Buffer types: Keybindings: - show the selected message + a - archive message (remove inbox tag) s - enter search criteria S - alter search criteria + - add tag(s) to selected message diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index d661c565..ecf7b9de 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -136,7 +136,10 @@ function! s:NM_search_edit() endfunction function! s:NM_search_archive_thread() - call NM_search_remove_tags('inbox') + call NM_add_remove_tags('-', ['inbox']) + setlocal modifiable + s/(\([^)]*\)\\([^)]*\))$/(\1\2)/ + setlocal nomodifiable norm j endfunction @@ -190,23 +193,27 @@ function! s:NM_search_find_thread_id() endfunction function! s:NM_search_add_remove_tags(prompt, prefix, intags) - let id = NM_search_find_thread_id() - if id != '' - if type(a:intags) != type([]) || len(a:intags) == 0 - " TODO: input() can support completion - let text = input(a:prompt) - if !strlen(text) - return - endif - let tags = split(text, ' ') - else - let tags = a:intags + if type(a:intags) != type([]) || len(a:intags) == 0 + " TODO: input() can support completion + let text = input(a:prompt) + if !strlen(text) + return endif - call map(tags, 'a:prefix . v:val') - " TODO: handle errors - call NM_run(['tag'] + tags + ['--', id]) - call NM_search_refresh_view() + call NM_add_remove_tags(prefix, split(text, ' ')) + else + call NM_add_remove_tags(prefix, a:intags) + endif + call NM_search_refresh_view() +endfunction + +function! s:NM_add_remove_tags(prefix, tags) + let id = NM_search_find_thread_id() + if id == '' + echoe 'Eeek! I couldn''t find the thead id!' endif + call map(a:tags, 'a:prefix . v:val') + " TODO: handle errors + call NM_run(['tag'] + a:tags + ['--', id]) endfunction " --- implement show screen {{{1