aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/config/hlslens.lua16
-rw-r--r--lua/plugins.lua9
2 files changed, 23 insertions, 2 deletions
diff --git a/lua/config/hlslens.lua b/lua/config/hlslens.lua
new file mode 100644
index 0000000..3acc91a
--- /dev/null
+++ b/lua/config/hlslens.lua
@@ -0,0 +1,16 @@
+vim.api.nvim_set_keymap(
+ "n",
+ "n",
+ "<Cmd>execute('normal! ' . v:count1 . 'nzzzv')<CR><Cmd>lua require('hlslens').start()<CR>",
+ { noremap = true, silent = true }
+)
+
+vim.api.nvim_set_keymap(
+ "n",
+ "N",
+ "<Cmd>execute('normal! ' . v:count1 . 'Nzzzv')<CR><Cmd>lua require('hlslens').start()<CR>",
+ { noremap = true, silent = true }
+)
+
+vim.api.nvim_set_keymap("n", "*", "<Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
+vim.api.nvim_set_keymap("n", "#", "<Plug>(asterisk-z#)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
diff --git a/lua/plugins.lua b/lua/plugins.lua
index 179cb1e..4671207 100644
--- a/lua/plugins.lua
+++ b/lua/plugins.lua
@@ -85,8 +85,13 @@ require("packer").startup({
-- Clear highlight search automatically for you
use({"romainl/vim-cool", event = "VimEnter"})
- -- Show match number for search
- use {'kevinhwang91/nvim-hlslens', branch = 'main', event = "VimEnter"}
+ -- Show match number and index for searching
+ use {
+ 'kevinhwang91/nvim-hlslens',
+ branch = 'main',
+ keys = {{'n', '*'}, {'n', '#'}, {'n', 'n'}, {'n', 'N'}},
+ config = [[require('config.hlslens')]]
+ }
-- Stay after pressing * and search selected text
use({"haya14busa/vim-asterisk", event = 'VimEnter'})