Vim Tips Wiki
No edit summary
(Format.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  +
{{ScriptComments|vutl.vim: Univeral Text Linking - Execute URLs, footnotes, open emails, organize ideas }}
[[File:Placeholder|video|right|300px]] [[File:Placeholder|right|300px]]
 
   
 
==Improvements==
 
==Improvements==
   
  +
===Braces around URLs===
Often I got urls in the format <code>(http://www.vim.org)</code> or <code>(see http://www.vim.org)</code>. Urls with braces around or a brace at the end are not correctly recognized.
+
Often I got urls in the format <code>(http://www.vim.org)</code> or <code>(see http://www.vim.org)</code>. 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:
 
Therefore I added following lines to utl.vim around line 407:
  +
<pre>
 
 
call Utl_trace("- end getting URL under cursor.",1,-1)
<code>
 
call Utl_trace("- end getting URL under cursor.",1,-1)
 
 
let tmpurl = matchstr(url, '^[(]\?.*[)]\+$')
 
let tmpurl = matchstr(url, '^[(]\?.*[)]\+$')
 
if empty(tmpurl)
 
if empty(tmpurl)
 
return url
 
return url
 
else
 
else
call Utl_trace("- found braces around url, removing.",1,-1)
+
call Utl_trace("- found braces around url, removing.",1,-1)
 
return substitute(url, '^[(]\?\(.*\)[)]\+$', '\1', 'g')
 
return substitute(url, '^[(]\?\(.*\)[)]\+$', '\1', 'g')
 
endif
 
endif
</code>
+
</pre>
  +
  +
===Windows 8 upper case drive letters not recognized===
  +
Utl throws an <code>E303: Unable to open swap file for "\\D:\..."</code> 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:
  +
<pre>
  +
--- 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
  +
</pre>

Latest revision as of 06:39, 11 July 2014

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