Skip to content

vim-scripts/webBrowser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

This is a mirror of http://www.vim.org/scripts/script.php?script_id=4315

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