diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-08-02 22:19:24 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-08-02 22:19:24 +0530 |
| commit | 0d1258aee3f39c8d5348588a87e804ec8cd27bd5 (patch) | |
| tree | 60b0c15a9f61ab825a1e1d9c6f8388b0aaf03d7c /lua | |
| parent | d37020870600d6c842f9a75ebd3986df6010c25c (diff) | |
| download | null-browser-0d1258aee3f39c8d5348588a87e804ec8cd27bd5.tar.gz null-browser-0d1258aee3f39c8d5348588a87e804ec8cd27bd5.zip | |
Add web.view.reload
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/null-browser/api.lua | 16 | ||||
| -rw-r--r-- | lua/null-browser/defaults/vi.lua | 4 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lua/null-browser/api.lua b/lua/null-browser/api.lua index 5475beb..65a7663 100644 --- a/lua/null-browser/api.lua +++ b/lua/null-browser/api.lua @@ -132,7 +132,7 @@ function web.view.set_html(html, opts) return __internals.view_set_html(html, (o --- @class RunJSOpts --- @field view? number View id ---- Set html in a given view +--- Run js in a given view --- --- @param js string HTML string --- @param opts? RunJSOpts Options @@ -144,6 +144,20 @@ function web.view.set_html(html, opts) return __internals.view_set_html(html, (o --- ``` function web.view.run_js(js, opts) return __internals.view_run_js(js, (opts or {}).view) end +--- @class ReloadOpts +--- @field view? number View id + +--- Relaod a given view +--- +--- @param opts? RunJSOpts Options +--- +--- @example +--- ```lua +--- web.view.reload() +--- web.view.reload({ view = 3 }) -- Reload view with id 3 +--- ``` +function web.view.reload(opts) return __internals.view_reload((opts or {}).view) end + --- @class ExposeOpts --- @field view? number View id diff --git a/lua/null-browser/defaults/vi.lua b/lua/null-browser/defaults/vi.lua index d6193de..ba7eaba 100644 --- a/lua/null-browser/defaults/vi.lua +++ b/lua/null-browser/defaults/vi.lua @@ -26,6 +26,10 @@ function M.initialize() web.keymap.set('n', 'gg', function() web.view.scroll_to_top() end) web.keymap.set('n', '<s-g>', function() web.view.scroll_to_bottom() end) + -- Reload page + web.keymap.set('n', '<c-r>', function() web.view.reload() end) + web.keymap.set('n', 'r', function() web.view.reload() end) + -- Open in new view web.keymap.set('n', 'o', function() config.menu:select(config.history.list(), { prompt = 'Open view:' }, function(err, result) |
