mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
refactor: simplify hlslens conf
This commit is contained in:
parent
aaafaf58d6
commit
4b4331d394
@ -3,34 +3,29 @@ require('hlslens').setup({
|
|||||||
nearest_only = true,
|
nearest_only = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set('n', 'n', '',
|
local activate_hlslens = function(d)
|
||||||
{
|
local cmd = "normal! " .. vim.v.count1 .. d .. "zzzv"
|
||||||
noremap = true,
|
local status, msg = pcall(vim.fn.execute, cmd)
|
||||||
silent = true,
|
|
||||||
callback = function()
|
|
||||||
local status, msg = pcall(vim.fn.execute, "normal! " .. vim.v.count1 .. "nzzzv")
|
|
||||||
|
|
||||||
if not status then
|
if not status then
|
||||||
vim.api.nvim_echo({{msg, "ErrorMsg"}}, false, {})
|
vim.api.nvim_echo({{msg, "ErrorMsg"}}, false, {})
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
require('hlslens').start()
|
require('hlslens').start()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'n', '',
|
||||||
|
{
|
||||||
|
noremap = true,
|
||||||
|
silent = true,
|
||||||
|
callback = function() activate_hlslens('n') end
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set('n', 'N', '',
|
vim.keymap.set('n', 'N', '',
|
||||||
{
|
{
|
||||||
noremap = true,
|
noremap = true,
|
||||||
silent = true,
|
silent = true,
|
||||||
callback = function()
|
callback = function() activate_hlslens('N') end
|
||||||
local status, msg = pcall(vim.fn.execute, "normal! " .. vim.v.count1 .. "Nzzzv")
|
|
||||||
|
|
||||||
if not status then
|
|
||||||
vim.api.nvim_echo({{msg, "ErrorMsg"}}, false, {})
|
|
||||||
return
|
|
||||||
end
|
|
||||||
require('hlslens').start()
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set('n', '*', "<Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
|
vim.keymap.set('n', '*', "<Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user