aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim
diff options
context:
space:
mode:
authorGravatar Bart Trojanowski <bart@jukie.net>2009-11-21 23:14:53 -0500
committerGravatar Bart Trojanowski <bart@jukie.net>2009-11-25 00:48:53 -0500
commit5a9d5fb20091a34efdf6716d4481799097ec9269 (patch)
tree64980a7352c3790effa8d52ad9bdfa8efcdf863b /vim
parent33c896dd717b73dda48b0e4543aaf4376c57c44a (diff)
make searching, updates and returning to folder view work
Diffstat (limited to 'vim')
-rw-r--r--vim/README2
-rw-r--r--vim/plugin/notmuch.vim40
2 files changed, 22 insertions, 20 deletions
diff --git a/vim/README b/vim/README
index e4ad4eaa..38df560d 100644
--- a/vim/README
+++ b/vim/README
@@ -18,6 +18,8 @@ Buffer types:
Keybindings:
<Enter> - show the selected search
+ s - enter search criteria
+ = - refresh display
[notmuch-search]
You are presented with the search results when you run :NotMuch.
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim
index f134e652..308fc05d 100644
--- a/vim/plugin/notmuch.vim
+++ b/vim/plugin/notmuch.vim
@@ -82,9 +82,8 @@ let s:notmuch_folders_defaults = [
" --- --- bindings for folders mode {{{2
let g:notmuch_folders_maps = {
- \ 's': ':call <SID>NM_folders_notmuch_search()<CR>',
+ \ 's': ':call <SID>NM_search_prompt()<CR>',
\ 'q': ':call <SID>NM_kill_this_buffer()<CR>',
- \ '<': ':call <SID>NM_folders_beginning_of_buffer()<CR>',
\ '=': ':call <SID>NM_folders_refresh_view()<CR>',
\ '<Enter>': ':call <SID>NM_folders_show_search()<CR>',
\ }
@@ -163,20 +162,11 @@ endfunction
" --- --- folders screen action functions {{{2
-function! s:NM_folders_notmuch_search()
- echo 'not implemented'
-endfunction
-
-function! s:NM_kill_this_buffer()
- echo 'not implemented'
-endfunction
-
-function! s:NM_folders_beginning_of_buffer()
- echo 'not implemented'
-endfunction
-
-function! s:NM_folders_notmuch_folder()
- echo 'not implemented'
+function! s:NM_folders_refresh_view()
+ let lno = line('.')
+ setlocal bufhidden=delete
+ call s:NM_cmd_folders([])
+ exec printf('norm %dG', lno)
endfunction
function! s:NM_folders_show_search()
@@ -251,8 +241,17 @@ function! s:NM_search_prompt()
else
let tags = s:notmuch_initial_search_words_defaults
endif
- setlocal bufhidden=delete
+ let prev_bufnr = bufnr('%')
+ if b:nm_type == 'search'
+ " TODO: we intend to replace the current buffer,
+ " ... maybe we could just clear it
+ setlocal bufhidden=delete
+ else
+ setlocal bufhidden=hide
+ endif
call <SID>NM_cmd_search(tags)
+ setlocal bufhidden=delete
+ let b:nm_prev_bufnr = prev_bufnr
endfunction
function! s:NM_search_edit()
@@ -713,14 +712,15 @@ endfunction
" --- notmuch helper functions {{{1
-function! s:NM_newBuffer(ft, content)
+function! s:NM_newBuffer(type, content)
enew
setlocal buftype=nofile readonly modifiable
silent put=a:content
keepjumps 0d
setlocal nomodifiable
- execute printf('set filetype=notmuch-%s', a:ft)
- execute printf('set syntax=notmuch-%s', a:ft)
+ execute printf('set filetype=notmuch-%s', a:type)
+ execute printf('set syntax=notmuch-%s', a:type)
+ let b:nm_type = a:type
endfunction
function! s:NM_run(args)