mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 09:24:54 +01:00
pretty colouring and folding for message show
This commit is contained in:
parent
8a31802b94
commit
010eac8b43
2 changed files with 32 additions and 14 deletions
|
@ -301,6 +301,21 @@ function! s:NM_cmd_show_mkfolds()
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:NM_cmd_show_mksyntax()
|
||||||
|
let info = b:nm_raw_info
|
||||||
|
let cnt = 0
|
||||||
|
for msg in info['msgs']
|
||||||
|
let cnt = cnt + 1
|
||||||
|
let start = msg['start']
|
||||||
|
let hdr_start = msg['hdr_start']
|
||||||
|
let body_start = msg['body_start']
|
||||||
|
let end = msg['end']
|
||||||
|
exec printf('syntax region nmShowMsg%dDesc start=''\%%%dl'' end=''\%%%dl'' contains=@nmShowMsgDesc', cnt, start, start+1)
|
||||||
|
exec printf('syntax region nmShowMsg%dHead start=''\%%%dl'' end=''\%%%dl'' contains=@nmShowMsgHead', cnt, hdr_start, body_start)
|
||||||
|
exec printf('syntax region nmShowMsg%dBody start=''\%%%dl'' end=''\%%%dl'' contains=@nmShowMsgBody', cnt, body_start, end)
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! NM_cmd_show_foldtext()
|
function! NM_cmd_show_foldtext()
|
||||||
let foldtext = b:nm_raw_info['foldtext']
|
let foldtext = b:nm_raw_info['foldtext']
|
||||||
return foldtext[v:foldstart]
|
return foldtext[v:foldstart]
|
||||||
|
|
|
@ -1,20 +1,23 @@
|
||||||
" notmuch show mode syntax file
|
" notmuch show mode syntax file
|
||||||
|
|
||||||
syntax region nmShowMessage start='message{' end='message}' contains=nmBlockStart,nmShowHeader,nmShowBody,nmShowAttachment,nmShowPart,nmBlockEnd
|
syntax cluster nmShowMsgDesc contains=nmShowMsgDescWho,nmShowMsgDescDate,nmShowMsgDescTags
|
||||||
syntax region nmShowHeader start='header{' end='header}' contained contains=nmBlockStart,nmBlockEnd
|
syntax match nmShowMsgDescWho /[^)]\+)/ contained
|
||||||
syntax region nmShowBody start='body{' end='body}' contained contains=nmBlockStart,nmShowAttachment,nmShowPart,nmBlockEnd
|
syntax match nmShowMsgDescDate / ([^)]\+[0-9]) / contained
|
||||||
syntax region nmShowAttachment start='attachment{' end='attachment}' contained contains=nmBlockStart,nmBlockEnd
|
syntax match nmShowMsgDescTags /([^)]\+)$/ contained
|
||||||
syntax region nmShowPart start='part{' end='part}' contained contains=nmBlockStart,nmBlockEnd
|
|
||||||
|
|
||||||
syntax region nmBlockStart start='^[a-z]\+{' end='$' oneline
|
syntax cluster nmShowMsgHead contains=nmShowMsgHeadKey,nmShowMsgHeadVal
|
||||||
syntax region nmBlockEnd start='^[a-z]\+}' end='$' oneline
|
syntax match nmShowMsgHeadKey /^[^:]\+: / contained
|
||||||
|
syntax match nmShowMsgHeadVal /^\([^:]\+: \)\@<=.*/ contained
|
||||||
|
|
||||||
highlight link nmShowMessage Error
|
syntax cluster nmShowMsgBody contains=@nmShowMsgBodyMail,@nmShowMsgBodyGit
|
||||||
highlight link nmShowHeader Type
|
syntax include @nmShowMsgBodyMail syntax/mail.vim
|
||||||
highlight link nmShowBody Statement
|
syntax include @nmShowMsgBodyGit syntax/git-diff.vim
|
||||||
highlight link nmShowAttachment Statement
|
|
||||||
highlight link nmShowPart String
|
highlight nmShowMsgDescWho term=reverse cterm=reverse gui=reverse
|
||||||
highlight link nmBlockStart Ignore
|
highlight link nmShowMsgDescDate Type
|
||||||
highlight link nmBlockEnd Ignore
|
highlight link nmShowMsgDescTags String
|
||||||
|
|
||||||
|
highlight link nmShowMsgHeadKey Macro
|
||||||
|
"highlight link nmShowMsgHeadVal NONE
|
||||||
|
|
||||||
highlight Folded term=reverse ctermfg=LightGrey ctermbg=Black guifg=LightGray guibg=Black
|
highlight Folded term=reverse ctermfg=LightGrey ctermbg=Black guifg=LightGray guibg=Black
|
||||||
|
|
Loading…
Reference in a new issue