diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2010-06-05 14:12:36 +0300 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-11-08 10:00:17 -0800 |
commit | 75633b32209c20f35cb5aa5a19d233450c5b115c (patch) | |
tree | 4d36c8cac6a49b3a8d08b9e50b133a308d542de5 /vim/plugin | |
parent | 087e292d1198b16e35fe705c85a355e48b033cf2 (diff) |
vim: cleanup search buffer
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Diffstat (limited to 'vim/plugin')
-rw-r--r-- | vim/plugin/notmuch.vim | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 3a196160..b8c98581 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -243,26 +243,23 @@ function! s:NM_cmd_search(words) let b:nm_raw_lines = lines let b:nm_search_words = a:words - call <SID>NM_cmd_search_mksyntax() call <SID>NM_set_map('n', g:notmuch_search_maps) setlocal cursorline setlocal nowrap endfunction function! s:NM_cmd_search_fmtline(line) - let m = matchlist(a:line, '^\(thread:\S\+\)\s\([^]]\+\]\) \([^;]\+\); \(.*\) (\([^(]*\))$') + let m = matchlist(a:line, '^\(thread:\S\+\)\s\(.\{12\}\) \[\(\d\+\)/\d\+\] \([^;]\+\); \%(\[[^\[]\+\] \)*\(.*\) (\([^(]*\))$') if !len(m) return 'ERROR PARSING: ' . a:line endif let max = g:notmuch_search_from_column_width - let from = m[3] - if strlen(from) >= max - let from = substitute(m[3][0:max-4], '[^A-Za-z1-9_]*$', '', '') . '...' - endif - return printf('%-20s %-20s | %s (%s)', m[2], from, m[4], m[5]) -endfunction -function! s:NM_cmd_search_mksyntax() - syntax clear nmSearchFrom - exec printf('syntax match nmSearchFrom /\(\] \)\@<=.\{%d\}/ oneline contained', g:notmuch_search_from_column_width) + let flist = [] + for at in split(m[4], ", ") + let p = min([stridx(at, "."), stridx(at, "@")]) + call insert(flist, tolower(at[0:p - 1])) + endfor + let from = join(flist, ", ") + return printf("%-12s %3s %-20.20s | %s (%s)", m[2], m[3], from, m[5], m[6]) endfunction " --- --- search screen action functions {{{2 |