vim: use <Space> more consistently in search view
authorBart Trojanowski <bart@jukie.net>
Fri, 27 Nov 2009 23:02:05 +0000 (18:02 -0500)
committerBart Trojanowski <bart@jukie.net>
Fri, 27 Nov 2009 23:02:05 +0000 (18:02 -0500)
In search view <Space> will show the thead, but folding messages that
don't match the current search expression.  Conversly, <Enter> always
shows all messages in the thread.

vim/README
vim/plugin/notmuch.vim

index 299c7f8944d8980651a1fa3bc7b447a21cbe5c09..8cd3b1a2fe87267697773a1ba81502a12d15907f 100644 (file)
@@ -42,7 +42,8 @@ Buffer types:
         You are presented with the search results when you run :NotMuch.
 
         Keybindings:
-            <Enter> - show the selected message
+            <Space> - show the selected thread colapsing unmatched items
+            <Enter> - show the entire selected thread
             a       - archive message (remove inbox tag)
             f       - filter the current search terms
             o       - toggle search screen order
index c5655617c862fcbd6da463c58fc0b3397ee4de08..b415f500a167619151afc3d623542a8aabb7efaa 100644 (file)
@@ -114,7 +114,8 @@ let g:notmuch_folders_maps = {
 
 " --- --- bindings for search screen {{{2
 let g:notmuch_search_maps = {
-        \ '<Enter>':    ':call <SID>NM_search_show_thread()<CR>',
+        \ '<Space>':    ':call <SID>NM_search_show_thread(0)<CR>',
+        \ '<Enter>':    ':call <SID>NM_search_show_thread(1)<CR>',
         \ '<C-]>':      ':call <SID>NM_search_expand(''<cword>'')<CR>',
         \ 'a':          ':call <SID>NM_search_archive_thread()<CR>',
         \ 'f':          ':call <SID>NM_search_filter()<CR>',
@@ -266,17 +267,14 @@ endfunction
 
 " --- --- search screen action functions {{{2
 
-function! s:NM_search_show_thread()
-        let id = <SID>NM_search_thread_id()
-        if id != ''
-                let words = [id]
-                if exists('b:nm_search_words')
-                        let words = ['('] + b:nm_search_words + [')', 'AND', id]
-                endif
-                if len(words)
-                        call <SID>NM_cmd_show(words)
-                endif
+function! s:NM_search_show_thread(everything)
+        let words = [ <SID>NM_search_thread_id() ]
+        if !a:everything && exists('b:nm_search_words')
+                call extend(words, ['AND', '('])
+                call extend(words, b:nm_search_words)
+                call add(words, ')')
         endif
+        call <SID>NM_cmd_show(words)
 endfunction
 
 function! s:NM_search_prompt()