diff options
| -rw-r--r-- | init.lua | 8 | ||||
| -rw-r--r-- | lua/null-browser/extras/hints.lua | 5 |
2 files changed, 13 insertions, 0 deletions
@@ -78,5 +78,13 @@ hints.init() web.keymap.set('n', 'f', function() hints.start('a[href], button', hints.action.open_in_view) end) web.keymap.set('n', '<s-f>', function() hints.start('a[href], button', hints.action.open_in_new_view) end) web.keymap.set('n', 'yl', function() hints.start('a[href]', hints.action.copy_link) end) +web.keymap.set('n', 'gi', function() + local input_selectors = { + 'input:not([type="hidden"])', + 'textarea', + '[contenteditable]' + } + hints.start(table.concat(input_selectors, ', '), hints.action.focus) +end) print('ending...') diff --git a/lua/null-browser/extras/hints.lua b/lua/null-browser/extras/hints.lua index d6e32c7..d708d69 100644 --- a/lua/null-browser/extras/hints.lua +++ b/lua/null-browser/extras/hints.lua @@ -90,6 +90,11 @@ function hints.action.open_in_view() ]] end +function hints.action.focus() + web.keymap.set_mode 'i' + web.view.run_js([[ _nullbrowser.hints.currentMatch?.elem?.focus?.(); ]]) +end + function hints.action.copy_link() web.view.run_js([[_nullbrowser.hints.currentMatch.elem?.href]], { on_result = function(url) |
