[elinks-dev] Re: Doing Crazy stuff.
myself at ligesh.com
Fri Jun 23 23:41:14 PDT 2006
On Sat, Jun 24, 2006 at 11:42:29AM +0530, Ligesh wrote:
> On Fri, Jun 23, 2006 at 08:53:42PM +0000, Miciah Dashiel Butler Masters wrote:
> > 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)
Sorry, there is a small problem the above solution. It doesn't seem to show the current history, but rather I can only access my history before elinks was killed. So we have to first save the history before vim is called on the file. Actually the solution would be to allow Lua to call C functions inside the elinks. You can have a function called as 'library_call', and this would actually enable you to access a function directly. The function that saves global history is called "write_global_history". Is there some way I can access that function through lua?
More information about the elinks-dev