diff --git a/lua/config/hlslens.lua b/lua/config/hlslens.lua index 59ce9a3..f5c76ad 100644 --- a/lua/config/hlslens.lua +++ b/lua/config/hlslens.lua @@ -1,35 +1,34 @@ local api = vim.api local keymap = vim.keymap -require('hlslens').setup({ - calm_down = true, - nearest_only = true, +local hlslens = require('hlslens') + +hlslens.setup({ + calm_down = true, + nearest_only = true, }) local activate_hlslens = function(direction) local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction) - local status, msg = pcall(vim.fn.execute, cmd) - -- 13 is the index where real error message starts - msg = msg:sub(13) + local status, msg = pcall(vim.cmd, cmd) if not status then + -- 13 is the index where real error message starts + msg = msg:sub(13) api.nvim_err_writeln(msg) return end - require('hlslens').start() + + hlslens.start() end -keymap.set('n', 'n', '', -{ - silent = true, +keymap.set('n', 'n', '', { callback = function() activate_hlslens('n') end }) -keymap.set('n', 'N', '', -{ - silent = true, +keymap.set('n', 'N', '', { callback = function() activate_hlslens('N') end }) -keymap.set('n', '*', "(asterisk-z*)lua require('hlslens').start()", { silent = true }) -keymap.set('n', '#', "(asterisk-z#)lua require('hlslens').start()", { silent = true }) +keymap.set('n', '*', "(asterisk-z*)lua require('hlslens').start()") +keymap.set('n', '#', "(asterisk-z#)lua require('hlslens').start()")