Last active
September 28, 2017 08:48
-
-
Save ohga/765b829ac8f6dfc57969c94248532b6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/autoload/twitvim.vim b/autoload/twitvim.vim | |
index 90b4a85..096d0eb 100644 | |
--- a/autoload/twitvim.vim | |
+++ b/autoload/twitvim.vim | |
@@ -2479,7 +2479,7 @@ function! s:launch_browser(url) | |
" an existing browser window. | |
" Firefox appears to output to stderr as well, so the '2&>1' redirect is | |
" needed. | |
- let endcmd = has('unix') ? '> /dev/null 2&>1 &' : '' | |
+ let endcmd = '' | |
" Escape characters that have special meaning in the :! command. | |
let url = substitute(a:url, '!\|#\|%', '\\&', 'g') | |
@@ -2799,6 +2799,13 @@ function! s:twitter_win_syntax(wintype) | |
syntax match twitterTitle /^\%(\w\+:\)\@!.\+\*$/ contains=twitterTitleStar | |
syntax match twitterTitleStar /\*$/ contained | |
+ syntax match twitterSource /|>.\{-1,}<|/ | |
+ | |
+ syntax match twitterReTweetFrom / RT .\{-1,}: / | |
+ | |
+ syntax match twitterExtra / %[^%]\+% / contains=twitterExtraBar | |
+ syntax match twitterExtraBar /%/ contained | |
+ | |
highlight default link twitterUser Identifier | |
highlight default link twitterTime String | |
highlight default link twitterTimeBar Ignore | |
@@ -2806,6 +2813,10 @@ function! s:twitter_win_syntax(wintype) | |
highlight default link twitterTitleStar Ignore | |
highlight default link twitterLink Underlined | |
highlight default link twitterReply Label | |
+ highlight default link twitterReTweetFrom Statement | |
+ highlight default link twitterSource Identifier | |
+ highlight default link twitterExtra Type | |
+ highlight default link twitterExtraBar Ignore | |
endif | |
endfunction | |
@@ -4806,6 +4817,10 @@ endfunction | |
" Get status text with t.co URL expansion. (JSON version) | |
function! s:get_status_text_json(item) | |
let text = get(a:item, 'text', '') | |
+ let tmp = get(a:item, 'source', '') | |
+ let sourcestr = matchstr(tmp, '>\(.*\)<') | |
+ let retweet_count = get(a:item, 'retweet_count', '0') | |
+ let favorite_count = get(a:item, 'favorite_count', '0') | |
" Remove nul characters. | |
let text = substitute(text, '[\x0]', ' ', 'g') | |
@@ -4821,7 +4836,11 @@ function! s:get_status_text_json(item) | |
endif | |
endfor | |
- return text | |
+ if retweet_count != '0' || favorite_count != '0' | |
+ return text . ' %' . retweet_count . ','. favorite_count . '% |' . sourcestr . '|' | |
+ else | |
+ return text . ' |' . sourcestr . '|' | |
+ endif | |
endfunction | |
" Parse and format search results from Twitter Search API. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment