]> git.notmuchmail.org Git - notmuch/blobdiff - vim/plugin/notmuch.vim
vim: place ... more inteligently when shortening 'from' list in search
[notmuch] / vim / plugin / notmuch.vim
index 308fc05d8010094bffe66678d54ceecfbc7301cf..9cee5008f7848a4835649027dd399d329a28f6b8 100644 (file)
@@ -212,7 +212,7 @@ function! s:NM_cmd_search_fmtline(line)
         let max = g:notmuch_search_from_column_width
         let from = m[3]
         if strlen(from) >= max
-                let from = m[3][0:max-4] . '...'
+                let from = substitute(m[3][0:max-4], '[^A-Za-z1-9_]*$', '', '') . '...'
         endif
         return printf('%s %-20s | %s (%s)', m[2], from, m[4], m[5])
 endfunction
@@ -241,12 +241,13 @@ function! s:NM_search_prompt()
         else
                 let tags = s:notmuch_initial_search_words_defaults
         endif
-        let prev_bufnr = bufnr('%')
         if b:nm_type == 'search'
                 " TODO: we intend to replace the current buffer,
                 "       ... maybe we could just clear it
+                let prev_bufnr = b:nm_prev_bufnr
                 setlocal bufhidden=delete
         else
+                let prev_bufnr = bufnr('%')
                 setlocal bufhidden=hide
         endif
         call <SID>NM_cmd_search(tags)