diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-04-19 21:29:38 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-04-19 22:17:39 +0530 |
| commit | 208202db9cba6ddf0713a70e7122c69a53b1f2aa (patch) | |
| tree | 747f8ad71c19f239e545d13579ccfa86c8fefe5e /config.lua | |
| parent | a9d767b209c503ac7b5dff5132aa213d47dcb608 (diff) | |
| download | null-browser-208202db9cba6ddf0713a70e7122c69a53b1f2aa.tar.gz null-browser-208202db9cba6ddf0713a70e7122c69a53b1f2aa.zip | |
Add web.search.get_text and prefill current search text
Diffstat (limited to '')
| -rw-r--r-- | config.lua | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1,5 +1,8 @@ print('hello starting up...') +local dmenu = require 'null-browser.extras.dmenu' +local history = require 'null-browser.extras.history' + --- @type table web = web --- @type table @@ -19,9 +22,6 @@ web.set('close_window_when_no_views', true) web.set('user_agent', 'MacOS | Safari - $500 edition') web.set('downloads_dir', os.getenv('HOME') .. '/Downloads/firefox') -local dmenu = require 'null-browser.extras.dmenu' -local history = require 'null-browser.extras.history' - web.event.add_listener('UrlChanged', { callback = function(opts) print('url change', web.inspect(opts)); @@ -41,12 +41,13 @@ local function to_url(url) return "https://" .. trim(url) end -web.keymap.set('n', '<esc>', function() web.search.set_text('') end) +-- Search +web.keymap.set('n', '<esc>', function() web.search.reset() end) web.keymap.set('n', 'n', function() web.search.next() end) web.keymap.set('n', '<s-n>', function() web.search.previous() end) web.keymap.set('n', '<c-f>', function() - dmenu.input({ prompt = 'Search:' }, function(err, input) - if err or not input then return end + dmenu.input({ prompt = 'Search:', input = web.search.get_text() }, function(err, input) + if err then return end web.search.set_text(input) end) end) |
