sponsor Vim development Vim logo Vim Book Ad

webBrowser : Use vim as a web browser

 script karma  Rating 13/6, Downloaded by 802    Comments, bugs, improvements  Vim wiki

created by
Alexandre Viau
 
script type
utility
 
description
Name: webBrowser.vim
Version: 1.6
Description: Uses the lynx text browser to browse websites and local files and return the rendered web pages inside vim. The links in the web pages may be "clicked" to follow them, so it turns vim into a simple web text based web browser. This plugin is based on the "browser.vim" plugin.
Author: Alexandre Viau (alexandreviau@gmail.com)
Website: The latest version is found on "vim.org"

Installation:  
Copy the plugin to the vim plugin directory.
In the lynx.cfg file, set the following parameters:
ACCEPT_ALL_COOKIES:TRUE
MAKE_LINKS_FOR_ALL_IMAGES:TRUE
Change the following paths to your lynx files:
let s:lynxPath = 'c:\lynx'
let s:lynxExe = s:lynxPath . 'lynx.exe'
let s:lynxCfg = '-cfg=' . s:lynxPath . 'lynx.cfg'
let s:lynxLss = '-lss=' . s:lynxPath . 'lynx.lss'
let s:lynxCmd = s:lynxExe . ' ' . s:lynxCfg . ' ' . s:lynxLss
let s:lynxDumpPath = 'c:\lynx\dump'
let s:lynxToolsPath = 'c:\lynx\tools'

Usage:
<leader>wb :WebBrowser (Open a new web browser tab with the address specified)
<leader>wc :exe 'WebBrowser "' . @* . '"'<cr> (Open a new web browser tab with the address in the clipboard)
<leader>wg :exe 'WebBrowser www.google.com/search?q="' . input("Google ") . '"'<cr> (Do a google search using the specified search keywords and open the results in a new tab)
<leader>wp :exe 'WebBrowser www.wikipedia.com/wiki/"' . input("Wikipedia ") . '"'<cr> (Do a wikipedia search using the specified search keywords and open the results in a new tab)
<leader>wd :WebDump (Downloads the specified webpage without opening it in vim)
<space>l (Open link)
<space>h (Previous page ("back button"))
<space>j (Highlight links and go to next link)
<space>k (Highlight links and go to previous link)

Todo:
- Redo the code that gets the link number and search for it at the end of the file (no need to move cursor) and to do it in a mapping, it may be done in a function
- I added basicXmlParser in the plugin, add a webBrowser.xml file and in it, have 2 keys: history and favorites, which will be string of utl links
- Add links bar like vimExplorer (favorites & history) with links not from utl but with brackets [http://yahoo.com] thus no need for utl
- Use image_links and accept_all_cookies options in the command run from the plugin instead of having to modify the .cfg file

History
1.1
- Changed the file format to unix
1.2
- Changed the mappings
1.3
- Now the lynx command and others are ran using a call to the system() function so that the dos prompt window is not displayed on the screen
- Added suggested mappings in comments (<insert>, <delete>, etc)
- Added folds
1.4
- Changed mappings \wb etc to <leader>wb because it was causing my "w" key in normal mode to wait for another key
1.5
- Added the webdump command and function to download in batch
1.6
- Added documentation and usage
 
install details
Copy the file in the plugin directory.

Change the paths to your lynx files:

let s:lynxPath = 'c:\lynx'
let s:lynxExe = s:lynxPath . 'lynx.exe'
let s:lynxCfg = '-cfg=' . s:lynxPath . 'lynx.cfg'
let s:lynxLss = '-lss=' . s:lynxPath . 'lynx.lss'
let s:lynxCmd = s:lynxExe . ' ' . s:lynxCfg . ' ' . s:lynxLss

let s:lynxDumpPath = 'c:\lynx\dump'
let s:lynxToolsPath = 'c:\lynx\tools'
 

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
webBrowser.vim 1.6 2013-06-04 7.0 Alexandre Viau - Added documentation and usage
webBrowser.vim 1.5 2013-06-04 7.0 Alexandre Viau Added the webdump command and function to download in batch
webBrowser.vim 1.1 2012-11-19 7.0 Alexandre Viau Changed the file format to unix
webBrowser.vim 1.0 2012-11-17 7.0 Alexandre Viau Initial upload
ip used for rating: 54.166.111.111

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.
   
SourceForge.net Logo