Vim Tips Wiki
Register
Advertisement

Use this page to discuss script 293 vutl.vim: Univeral Text Linking - Execute URLs, footnotes, open emails, organize ideas

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Improvements[]

Braces around URLs[]

Often I got urls in the format (http://www.vim.org) or (see http://www.vim.org). Urls with braces around or a brace at the end are not correctly recognized.

Therefore I added following lines to utl.vim around line 407:

    call Utl_trace("- end getting URL under cursor.",1,-1)
    let tmpurl = matchstr(url, '^[(]\?.*[)]\+$')
    if empty(tmpurl)
      return url
    else
      call Utl_trace("- found braces around url, removing.",1,-1)
      return substitute(url, '^[(]\?\(.*\)[)]\+$', '\1', 'g')
    endif

Windows 8 upper case drive letters not recognized[]

Utl throws an E303: Unable to open swap file for "\\D:\..." error on Windows 8 (and maybe 7) in Utl_displayFile. These OSes deliver Upper Case drive letters instead of Lower Case (as in XP), so a small change needs to be made to the utl_scm.vim file around line 146 in Utl_AddressScheme_file(), as per this unified context patch:

--- utl_scm.vim~	2014-07-09 22:51:08.878648600 -0600
+++ utl_scm.vim	2014-07-09 23:48:28.155056000 -0600
@@ -143,7 +143,7 @@
     " - server name - interpret URL as a network share
     let authority = UtlUri_authority(a:auri)
     let path = ''
-    if authority =~? '^[a-z]:$'
+    if authority =~? '^[A-Za-z]:$'
         if has("win32") || has("win16") || has("win64") || has("dos32") || has("dos16")
 	    call Utl_trace("- Am under Windows. Server part denotes a Windows drive: `".authority."'")
 	    let path = authority
Advertisement