kevinhwang91 / nvim-hlslens

Hlsearch Lens for Neovim
BSD 3-Clause "New" or "Revised" License
748 stars 10 forks source link

[Question]How to config map both `'normal! ' . v:count1 . 'n'` and nvim-ufo #66

Closed jqhr closed 10 months ago

jqhr commented 10 months ago

I want to map 'normal! ' . v:count1 . 'n' and nvim-ufo, but I cannot find how to map 'normal! ' . v:count1 . 'n' and function nN 图片

kevinhwang91 commented 10 months ago

Follow the code snippet should work.

jqhr commented 10 months ago

Oh, sorry.I make a mistack here. I want to map n act as v:searchforward. it means whatever I use "" or "#", the n* key was always search down.

nnoremap <expr> n  'nN'[v:searchforward]
xnoremap <expr> n  'nN'[v:searchforward]
onoremap <expr> n  'nN'[v:searchforward]

I want to map n both nN[v:searchforward] and lua function nN.

jqhr commented 10 months ago

@kevinhwang91

kevinhwang91 commented 10 months ago
diff --git a/README.md b/README.md
index a9e9a9d..df24efe 100644
--- a/README.md
+++ b/README.md
@@ -270,6 +270,7 @@ use {'kevinhwang91/nvim-ufo', requires = 'kevinhwang91/promise-async'}

 -- if Neovim is 0.8.0 before, remap yourself.
 local function nN(char)
+    vim.v.searchforward=1
     local ok, winid = hlslens.nNPeekWithUFO(char)
     if ok and winid then
         -- Safe to override buffer scope keymaps remapped by ufo,
jqhr commented 10 months ago

Thank you very much. But it dones't work. here is my config. 图片

kevinhwang91 commented 10 months ago

Enjoy yourself, can't help anymore.

jqhr commented 10 months ago

Thank you, I have find out how to get it. Add those code 图片