mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
commit
e209ef686a
@ -1,35 +1,34 @@
|
|||||||
local api = vim.api
|
local api = vim.api
|
||||||
local keymap = vim.keymap
|
local keymap = vim.keymap
|
||||||
|
|
||||||
require('hlslens').setup({
|
local hlslens = require('hlslens')
|
||||||
|
|
||||||
|
hlslens.setup({
|
||||||
calm_down = true,
|
calm_down = true,
|
||||||
nearest_only = true,
|
nearest_only = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
local activate_hlslens = function(direction)
|
local activate_hlslens = function(direction)
|
||||||
local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction)
|
local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction)
|
||||||
local status, msg = pcall(vim.fn.execute, cmd)
|
local status, msg = pcall(vim.cmd, cmd)
|
||||||
-- 13 is the index where real error message starts
|
|
||||||
msg = msg:sub(13)
|
|
||||||
|
|
||||||
if not status then
|
if not status then
|
||||||
|
-- 13 is the index where real error message starts
|
||||||
|
msg = msg:sub(13)
|
||||||
api.nvim_err_writeln(msg)
|
api.nvim_err_writeln(msg)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
require('hlslens').start()
|
|
||||||
|
hlslens.start()
|
||||||
end
|
end
|
||||||
|
|
||||||
keymap.set('n', 'n', '',
|
keymap.set('n', 'n', '', {
|
||||||
{
|
|
||||||
silent = true,
|
|
||||||
callback = function() activate_hlslens('n') end
|
callback = function() activate_hlslens('n') end
|
||||||
})
|
})
|
||||||
|
|
||||||
keymap.set('n', 'N', '',
|
keymap.set('n', 'N', '', {
|
||||||
{
|
|
||||||
silent = true,
|
|
||||||
callback = function() activate_hlslens('N') end
|
callback = function() activate_hlslens('N') end
|
||||||
})
|
})
|
||||||
|
|
||||||
keymap.set('n', '*', "<Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
|
keymap.set('n', '*', "<Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>")
|
||||||
keymap.set('n', '#', "<Plug>(asterisk-z#)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
|
keymap.set('n', '#', "<Plug>(asterisk-z#)<Cmd>lua require('hlslens').start()<CR>")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user