mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
fix: error when pressing n/N if pattern not present in buffer
This commit is contained in:
parent
1b9bd9ceef
commit
aaafaf58d6
@ -8,7 +8,12 @@ vim.keymap.set('n', 'n', '',
|
|||||||
noremap = true,
|
noremap = true,
|
||||||
silent = true,
|
silent = true,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.fn.execute("normal! " .. vim.v.count1 .. "nzzzv")
|
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()
|
require('hlslens').start()
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -18,7 +23,12 @@ vim.keymap.set('n', 'N', '',
|
|||||||
noremap = true,
|
noremap = true,
|
||||||
silent = true,
|
silent = true,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.fn.execute("normal! " .. vim.v.count1 .. "Nzzzv")
|
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()
|
require('hlslens').start()
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user