lib/vmail.vim in vmail-2.3.3 vs lib/vmail.vim in vmail-2.3.4
- old
+ new
@@ -172,30 +172,21 @@
normal 1G
setlocal nomodifiable
endfunction
function! s:focus_list_window()
- if bufwinnr(s:listbufnr) == winnr() && exists("s:syntax_coloring_set")
+ if bufwinnr(s:listbufnr) == winnr()
return
end
let winnr = bufwinnr(s:listbufnr)
if winnr == -1
" create window
split
exec "buffer" . s:listbufnr
else
exec winnr . "wincmd w"
endif
- " set up syntax highlighting
- if has("syntax")
- syn clear
- " colorize whole line
- syn match VmailBufferFlagged /^*.*/hs=s
- exec "hi def VmailBufferFlagged " . g:vmail_flagged_color
- let s:syntax_coloring_set = 1
- endif
- "
" call feedkeys("\<c-l>") " prevents screen artifacts when user presses return too fast
" turn this off though, because it causes an annoying flash
endfunction
@@ -828,10 +819,11 @@
noremap <silent> <buffer> <Leader>f :call <SID>show_message(0)<cr>:call <SID>compose_forward()<CR><cr>
noremap <silent> <buffer> <c-j> :call <SID>show_next_message_in_list()<cr>
noremap <silent> <buffer> <c-k> :call <SID>show_previous_message_in_list()<cr>
nnoremap <silent> <buffer> <Space> :call <SID>toggle_maximize_window()<cr>
autocmd CursorMoved <buffer> :redraw
+ autocmd BufEnter,BufWinEnter <buffer> :call <SID>set_list_colors()
endfunc
func! s:compose_window_mappings()
noremap <silent> <buffer> <leader>q :call <SID>close_and_focus_list_window()<cr>
setlocal ai
@@ -846,9 +838,42 @@
nnoremap <silent> <leader>vs :call <SID>send_message()<CR>
noremap <silent> <leader>o :call <SID>open_href(0)<cr>
noremap <silent> <leader>O :call <SID>open_href(1)<cr>
noremap <silent> <leader>? :call <SID>show_help()<cr>
noremap <silent> <leader>qq :qal!<cr>
+endfunc
+
+func! s:set_list_colors()
+ syn clear
+ syn match vmailSizeCol /|\s\+\(< 1k\|\d*\(b\|k\|M\|G\)\)\s\+|/ contains=vmailSeperator contained
+ syn match vmailFirstCol /^.\{-}|/ nextgroup=vmailDateCol
+ syn match vmailFirstColAnswered /An/ contained containedin=vmailFirstCol
+ syn match vmailFirstColForward /\$F/ contained containedin=vmailFirstCol
+ syn match vmailFirstColNotJunk /No/ contained containedin=vmailFirstCol
+ syn match vmailDateCol /\s\+... \d\d \(\(\d\d:\d\d..\)\|\(\d\{4}\)\)\s\+|/ nextgroup=vmailFromCol contains=vmailSeperator
+ syn match vmailFromCol /\s.\{-}|\@=/ contained nextgroup=vmailFromSeperator
+ syn match vmailFromColEmail /<[^ ]*/ contained containedin=vmailFromCol
+ syn match vmailFromSeperator /|/ contained nextgroup=vmailSubject
+ syn match vmailSubject /.*\s\+/ contained contains=vmailSizeCol
+ syn match vmailSubjectRe /\cre:\|fwd\?:/ contained containedin=vmailSubject
+ syn match vmailSeperator /|/ contained
+ syn match vmailNewMessage /^\s*+.*/
+ syn match vmailStarredMessage /^\s*\*.*/
+ hi def link vmailFirstCol Comment
+ hi def link vmailDateCol Statement
+ hi def link vmailFromCol Identifier
+ hi def link vmailSizeCol Constant
+ hi def link vmailSeperator Comment
+ hi def link vmailFromSeperator vmailSeperator
+ hi def link vmailFromColEmail Comment
+ hi def link vmailSubjectRe Type
+ hi def link vmailFirstColSpec Number
+ hi def link vmailFirstColAnswered vmailFirstColSpec
+ hi def link vmailFirstColForward vmailFirstColSpec
+ hi def link vmailFirstColNotJunk vmailFirstColSpec
+ hi def link vmailSpecialMsg Special
+ hi def link vmailNewMessage vmailSpecialMsg
+ hi def link vmailStarredMessage vmailSpecialMsg
endfunc
"TODO see if using LocalLeader and maplocalleader makes more sense
let mapleader = ","