Re: Doing Crazy stuff.
Miciah Dashiel Butler Masters <[email protected]>
| Newsgroups | gmane.comp.web.links |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jun 23, 2006 at 04:30:00PM +0530, Ligesh wrote:
> a) Ok, now for some crazy stuff. I want to view my history in vim, and select the link to go, and when I exit from vim, it should Go to that particular page. I can make vim do absolutely anything. Is there something in Lua using which I can accomplish this?
Add this to hooks.lua:
function select_history_item_in_vim()
local url
local f
local fn = elinks_home.."goto_url"
os.execute("vim "..elinks_home.."globhist")
f = io.open(fn, "r")
if f then url = f:read() f:close() os.remove(fn) end
if url then return "goto_url", url end
end
Then add something like
vimhist = select_history_item_in_vim,
to console_hook_functions (and make sure that you define
select_history_item_in_vim above that!) so that you enter 'vimhist' in
the Lua console, or add:
bind_key("main", "Ctrl-v", select_history_item_in_vim)
to hooks.lua. Then you need to make VIM save the URL (and only the URL)
of the history item that you would like ELinks to load to
~/.elinks/goto_url. The above code automatically reads this file
and deletes it.
> b) I want to have key to do goole search. That is, when you press this key, you will be presented with an input box. Whatever you enter will be automatically searched in google, and you will be put into the search results page.
Add this to hooks.lua:
bind_key ("main", "Ctrl-g",
function ()
xdialog("",
function (url)
return "goto_url",
"http://google.com/search?q="..url
end)
end)
--
Miciah Masters <[email protected]> / <[email protected]>
_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev