utl.vim - Univeral Text Linking - Execute URLs in plain text, e.g. call browser, MS Word : vim online
Keywords: Vim, Vi IMproved, text editor, home, documentation, tips, scripts, news

utl.vim : Univeral Text Linking - Execute URLs in plain text, e.g. call browser, MS Word
script karma | Rating 2361/711, Downloaded by 3242
created by
Stefan Bittner
script type
utility
description
Utl.vim is the successor of the thlnk.vim plugin. WHAT IS UTL.VIM ? * It brings the benefits of URL-based hyperlinking to the realm of plain text, extending the URL syntax for plain text needs, in accordance with the RFC 2396 URI specification. * It's a handy utility for you right away. See examples below. * It's fun :-) surfing text files, executing text ... WHAT IS IT GOOD FOR ? * Enables Vim to be your central desktop application, for instance: - Easily navigate in collections of related text files via hyperlinks - Call web browser and email client on URLs (configurable protocol handlers) - Call MS-Word on .doc files, Acrobat Reader on .pdf, Windows Explorer on directories, IrfanView on .jpg etc. (configurable media type handlers) - Maintain pictures from your digicam based on a text file - Maintain a personal info file containing hotlinks * Use it for project management, software development, report preparation and technical writings. For instance: - Reference emails from text files - Reference bug tracker database from a text file * Smart usages. For instance: - Embed vim commands in text files and source code. - Use it as light weight spell checker, - or for dictionary lookups. - Start programs using Utl. - Use it for relative editing and - for navigating HTML source code. * Use it for quality commenting of source code. For instance: - Reference related code with hot links, e.g. reference the definition of a struct in C/C++ - Reference design papers, UML diagrams, man pages etc from source code - Turn references like "see below" and "type zR to open the folds" into hotlinks UTL.VIM IS EASY * You only need to know one single command to get started: \gu = Go URL 1. Type :help utl-start 2. Hit \gu on the live examples given there As a reader of texts containing URLs that's all! As an author you have to know how to write URLs. But utl.vim gives you a training. And what you will learn is 90% general knowlegde about URLs that you can use elsewhere. * Utl.vim is friendly: No side effects, fits seamlessly into your Vim Session, well documented. EXAMPLES Here are some simplistic examples. Assume you have the following stuff in a file and execute the URL under the cursor with command \gu (all URLs can be with or without <URL:...> embedding): * Call your web browser (setup with a smart utility) and display www.vim.org URL with embedding (and syntax highlighting)... <URL:http://www.vim.org>; ...or without embedding... http://www.vim.org ...or rudimentary URL www.vim.org * Call your mailer mailto:stb@bf-consulting.de stb@bf-consulting.de stb@bf-consulting.de?Subject=UTL&Cc=bram@moolenaar.net * Link to a local file to be displayed in a Vim window... (This is a bit like Vim's gf command, but portable and indepent of 'path' setting and cwd) ///file:/home/stb/.vimrc or /home/stb/.vimrc foo.txt in same directory as file containing this link foo.txt or ./foo.txt bar.txt in sibbling directory of file containing this link ../sib/bar.txt * ...with fragment (This is a bit like tags, but theres is no tags file) jump to specific position in target file foo.txt by searching searchString (use this to turn phrases like "see in file foo.txt and search for searchString" into hotlinks) ... foo.txt#searchString ...or direct addressing of a line... foo.txt#line=123 ...or refer to the anchor `id=myIdentifier' foo.txt#r=myIdentifier ...or without a file, i.e. refers to current document (use this to turn phrases like "see below" into hotlinks) #searchString * Link to a local file displayed by a handler application hand over to MS Word (or Open Office, depending on the media type handler you setup in UTL) foo.doc typically call Acrobat Reader foo.pdf typically call IrfanView or XnView foo.jpg * Link to a directory call Vim-Explorer or call Windows Explorer or DOS box or Unix shell (with directory properly set) dir/ or dir * Embed Vim commands in text switch colorscheme (perhaps maintain an annotated file with all Vim schemes available?) <URL:vimscript:colors peachpuff> open all folds (perhaps into your plugin for users who don't know how to use folds) <URL:vimscript:normal zR> reference the Vim help (perhaps into the source code of your own plugins to explain certain constructs)... <URL:vimhelp:expr-==> ...again combined with a fragment to precisely address the exact position <URL:vimhelp:expr-==#^since a string> * Command line command :Gu to execute URLs: same as first example ( or may I already speak UTL to you: `same as #tp=browser ' :-) :Gu www.vim.org Open Windows Explorer (or whatever) displaying the directory where the current file is in (on Windows very convenient in your daily click click struggle) :Gu . The UTL documentation contains lots of practical examples and usage patterns. [keywords: hypertext, hyperlink]
install details
1. Unzip to your plugin directory 2. Start a new Vim Note: If you have installed UTLs predecessor "Thlnk" messages like "E227: mapping already exists for ..." will appear. Just ignore these. 3. Execute the Vim command :call Utl_finish_installation() This does the following: - If you have installed UTLs predecessor "Thlnk" it will carefully rename thlnk*.vim/doc files to files to .ori names. Thlnk and UTL cannot live together. - Generate the help tags file 4. Restart Vim and execute: :help utl-start and dive into the live examples...
rate this script | Life Changing Helpful Unfulfilling
script versions (upload new version) Click on the package to download.
package | script version | date | Vim version | user | release notes
--- | --- | --- | --- | --- | ---
utl-2_0_0.zip | 2.0 | 2005-03-27 | 6.0 | Stefan Bittner | Successor of Thlnk.vim with many new features: * Call web browser and email client on URLs (configurable scheme handlers), * Call MS-Word on .doc files, Acrobat Reader on .pdf, IrfanView on .jpg etc. (configurable media type handlers) * New vimscript: protocol for embedding vim commands into text files and source code. * Syntax highlighting of URLs * Support for URL heuristics, e.g. allow www.vim.org, not only http://www.vim.org * Support exeuction of URLs without <URL:...> embedding, e.g. "see www.vim.org" * Support multiline URLs, Smart setup and customization facility, bugs fixed.
thlnk-1.2.1.zip | 1.2.1 | 2002-06-15 | 6.0 | Stefan Bittner | Please see release notes for version 1.2. The reason for this version 1.2.1 is, that I packed the .vim files with the wrong 'fileformats' setting into the .zip file. Sorry!
thlnk-1.2.zip | 1.2 | 2002-06-15 | 6.0 | Stefan Bittner | - New section "Tips and Common Pitfails" added to the docs. Enhanced Documentation. - Enhanced warning and error messages. - Bug fixes: * {Visual}\gu didn't work on Windows gVim without guioptions+=a set. * Klaus Horsten <horsten@gmx.at>: With 'wrapscan' unset, fragment addressing could fail. * Patrik Nyman <patrik.nyman@orient.su.se>: Non existing http: or rcp: URLs made thlnk list the current buffer.

| If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly. Questions about Vim should go to the maillist. Help Bram help Uganda. |  |