lib/vmail.vim in vmail-0.9.0 vs lib/vmail.vim in vmail-0.9.1
- old
+ new
@@ -684,37 +684,38 @@
endfunc
" maybe not DRY enough, but fix that later
" also, come up with a more precise regex pattern for matching hyperlinks
func! s:open_href(all) range
+ let pattern = 'https\?:[^\s>)\]]\+'
let n = 0
" range version
if a:firstline < a:lastline
let lnum = a:firstline
while lnum <= a:lastline
- let href = matchstr(getline(lnum), 'https\?:\S\+')
+ let href = matchstr(getline(lnum), pattern)
if href != ""
let command = s:browser_command . " '" . href . "' &"
call system(command)
let n += 1
endif
let lnum += 1
endwhile
echom 'opened '.n.' links'
return
end
- let line = search('https\?:', 'cw')
+ let line = search(pattern, 'cw')
if line && a:all
while line
- let href = matchstr(getline(line('.')), 'https\?:\S\+')
+ let href = matchstr(getline(line('.')), pattern)
let command = s:browser_command . " '" . href . "' &"
call system(command)
let n += 1
let line = search('https\?:', 'W')
endwhile
echom 'opened '.n.' links'
else
- let href = matchstr(getline(line('.')), 'https\?:\S\+')
+ let href = matchstr(getline(line('.')), pattern)
let command = s:browser_command . " '" . href . "' &"
call system(command)
echom 'opened '.href
endif
endfunc