mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
vim: cleanup search buffer
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
parent
087e292d11
commit
75633b3220
1 changed files with 8 additions and 11 deletions
|
@ -243,26 +243,23 @@ function! s:NM_cmd_search(words)
|
||||||
let b:nm_raw_lines = lines
|
let b:nm_raw_lines = lines
|
||||||
let b:nm_search_words = a:words
|
let b:nm_search_words = a:words
|
||||||
|
|
||||||
call <SID>NM_cmd_search_mksyntax()
|
|
||||||
call <SID>NM_set_map('n', g:notmuch_search_maps)
|
call <SID>NM_set_map('n', g:notmuch_search_maps)
|
||||||
setlocal cursorline
|
setlocal cursorline
|
||||||
setlocal nowrap
|
setlocal nowrap
|
||||||
endfunction
|
endfunction
|
||||||
function! s:NM_cmd_search_fmtline(line)
|
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)
|
if !len(m)
|
||||||
return 'ERROR PARSING: ' . a:line
|
return 'ERROR PARSING: ' . a:line
|
||||||
endif
|
endif
|
||||||
let max = g:notmuch_search_from_column_width
|
let max = g:notmuch_search_from_column_width
|
||||||
let from = m[3]
|
let flist = []
|
||||||
if strlen(from) >= max
|
for at in split(m[4], ", ")
|
||||||
let from = substitute(m[3][0:max-4], '[^A-Za-z1-9_]*$', '', '') . '...'
|
let p = min([stridx(at, "."), stridx(at, "@")])
|
||||||
endif
|
call insert(flist, tolower(at[0:p - 1]))
|
||||||
return printf('%-20s %-20s | %s (%s)', m[2], from, m[4], m[5])
|
endfor
|
||||||
endfunction
|
let from = join(flist, ", ")
|
||||||
function! s:NM_cmd_search_mksyntax()
|
return printf("%-12s %3s %-20.20s | %s (%s)", m[2], m[3], from, m[5], m[6])
|
||||||
syntax clear nmSearchFrom
|
|
||||||
exec printf('syntax match nmSearchFrom /\(\] \)\@<=.\{%d\}/ oneline contained', g:notmuch_search_from_column_width)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" --- --- search screen action functions {{{2
|
" --- --- search screen action functions {{{2
|
||||||
|
|
Loading…
Reference in a new issue