Permalink
Browse files

allow soylink as URI scheme.

- also fix issue in which an empty
  scheme was a valid URI.
- and rename http_link_pattern to uri_link_pattern
  Since the pattern does actually match more than just http-scheme
  URIs it is renamed to reflect the content more precisely.
  • Loading branch information...
1 parent 39a651b commit d8ac29caaf27044d15789d018d7b6efa5bb8c504 @0robustus1 0robustus1 committed Aug 23, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/soywiki.vim
View
@@ -12,7 +12,7 @@ let mapleader = ','
" This regex matches namedspaced WikiWords and unqualified WikiWords
let s:wiki_link_pattern = '\C\m\<\([a-z0-9][[:alnum:]_]\+\.\)\?[A-Z][a-z]\+[A-Z0-9]\w*\>'
-let s:http_link_pattern = '\v(https|http|file|):[^ >)\]]+\V'
+let s:uri_link_pattern = '\v(https|http|file|soyfile):[^ >)\]]+\V'
let s:wiki_or_web_link_pattern = '\C\<\([a-z0-9][[:alnum:]_]\+\.\)\?[A-Z][a-z]\+[A-Z0-9]\w*\>\|https\?:[^ >)\]]\+'
let s:rename_links_command = 'soywiki-rename '
@@ -167,7 +167,7 @@ endfunc
func! s:follow_link_under_cursor(split)
let word = expand("<cWORD>")
- if match(word, s:http_link_pattern) != -1
+ if match(word, s:uri_link_pattern) != -1
call s:open_href_under_cursor()
return
endif
@@ -595,14 +595,14 @@ endfunc
"------------------------------------------------------------------------
func! s:open_href_under_cursor()
let word = expand("<cWORD>")
- let href = matchstr(word, s:http_link_pattern)
+ let href = matchstr(word, s:uri_link_pattern)
let command = g:SoyWiki#browser_command . " '" . href . "' "
call system(command)
echom command
endfunc
func! s:find_next_href_and_open()
- let res = search(s:http_link_pattern, 'cw')
+ let res = search(s:uri_link_pattern, 'cw')
if res != 0
call s:open_href_under_cursor()
endif
@@ -701,7 +701,7 @@ func! s:highlight_wikiwords()
if (s:is_wiki_page())
"syntax clear
exe "syn match Comment /". s:wiki_link_pattern. "/"
- exe "syn match Constant /". s:http_link_pattern . "/"
+ exe "syn match Constant /". s:uri_link_pattern . "/"
endif
endfunc

0 comments on commit d8ac29c

Please sign in to comment.