public
Last active

twitvim: add client name

  • Download Gist
gistfile1.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
Index: twitvim.vim
===================================================================
--- twitvim.vim (revision 253)
+++ twitvim.vim (working copy)
@@ -2584,6 +2584,9 @@
" Twitter user name: from start of line to first colon.
syntax match twitterUser /^.\{-1,}:/
+ " Twitter client: following time next.
+ syntax match twitterClient /\[[^\]]\+\]\ze\|[^|]\+|$/
+
" Use the bars to recognize the time but hide the bars.
syntax match twitterTime /|[^|]\+|$/ contains=twitterTimeBar
syntax match twitterTimeBar /|/ contained
@@ -2605,6 +2608,7 @@
syntax match twitterTitleStar /\*$/ contained
highlight default link twitterUser Identifier
+ highlight default link twitterClient Special
highlight default link twitterTime String
highlight default link twitterTimeBar Ignore
highlight default link twitterTitle Title
@@ -2842,8 +2846,9 @@
let text = s:convert_entity(s:get_status_text(item))
endif
let pubdate = s:time_filter(s:xml_get_element(item, 'created_at'))
+ let source = substitute(s:convert_entity(s:xml_get_element(item, 'source')), '<[^>]\+>', '', 'g')
- return user.': '.text.' |'.pubdate.'|'
+ return user.': '.text.' ['.source.']|'.pubdate.'|'
endfunction
" Get in-reply-to from a status element. If this is a retweet, use the id of
@@ -5182,7 +5187,9 @@
call add(s:curbuffer.statuses, status)
call add(s:curbuffer.inreplyto, get(item, 'in_reply_to_status_id_str', ''))
- call add(text, user.': '.line.' |'.pubdate.'|')
+ let source = substitute(s:convert_entity(s:time_filter(get(item, 'source', ''))), '<[^>]\+>', '', 'g')
+
+ call add(text, user.': '.line.' ['.source.']|'.pubdate.'|')
endfor
call s:twitter_wintext(text, "timeline")

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.