Last active
December 14, 2015 01:18
-
-
Save mattn/5004875 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
Index: twitvim.vim | |
=================================================================== | |
--- twitvim.vim (revision 339) | |
+++ twitvim.vim (working copy) | |
@@ -2696,18 +2696,13 @@ | |
let s:URL_PROTOCOL_HTTPS = '\%([Hh][Tt][Tt][Pp][Ss]\)://' | |
let s:URL_PROTOCOL_NON_HTTPS = '\%([Hh][Tt][Tt][Pp]\|[Ff][Tt][Pp]\)://' | |
-let s:URL_DOMAIN = '[^[:space:])/]\+' | |
-let s:URL_PATH_CHARS = '[^[:space:]()]' | |
+let s:URL_DOMAIN = '\a[a-zA-Z0-9_-]*\(\.[a-zA-Z0-9][a-zA-Z0-9_-]*\)*\(:\d+\)\{0,1}' | |
+let s:URL_PATH_CHARS = '[a-zA-Z0-9_/.\-+%#?&=;@$,!''*~]' | |
" URL paths may contain balanced parentheses. | |
let s:URL_PARENS = '('.s:URL_PATH_CHARS.'*)' | |
+let s:URL_PATH = '\%('.s:URL_PATH_CHARS.'*\%('.s:URL_PARENS.s:URL_PATH_CHARS.'*\)*\)\|\%('.s:URL_PATH_CHARS.'\+\)' | |
-" Avoid swallowing up certain punctuation characters after a URL but allow a | |
-" URL to end with a balanced parenthesis. | |
-let s:URL_PATH_END = '\%([^[:space:]\.,;:()]\|'.s:URL_PARENS.'\)' | |
- | |
-let s:URL_PATH = '\%('.s:URL_PATH_CHARS.'*\%('.s:URL_PARENS.s:URL_PATH_CHARS.'*\)*'.s:URL_PATH_END.'\)\|\%('.s:URL_PATH_CHARS.'\+\)' | |
- | |
" Bring it all together. Use this regex to match a URL. | |
let s:URLMATCH = s:URL_PROTOCOL.s:URL_DOMAIN.'\%(/\%('.s:URL_PATH.'\)\=\)\=' | |
let s:URLMATCH_HTTPS = s:URL_PROTOCOL_HTTPS.s:URL_DOMAIN.'\%(/\%('.s:URL_PATH.'\)\=\)\=' | |
@@ -2724,7 +2719,7 @@ | |
" Handle @-replies by showing that user's timeline. | |
" An @-reply must be preceded by a non-word character and ends at a | |
" non-word character. | |
- let matchres = matchlist(s, '\w\@<!@\(\w\+\)') | |
+ let matchres = matchlist(s, '[\w]\@<!@\(\w\+\)') | |
if matchres != [] | |
call s:get_timeline("user", matchres[1], 1, 0) | |
return | |
@@ -2985,7 +2980,7 @@ | |
" An @-reply must be preceded by a non-word character and ends at a | |
" non-word character. | |
- syntax match twitterReply "\w\@<!@\w\+" | |
+ syntax match twitterReply "[\w]\@<!@\w\+" | |
" A #-hashtag must be preceded by a non-word character and ends at a | |
" non-word character. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, This all of issue causes vim's bug. Below is a patch. I'll send this patch to vim-dev after some checking.