kevinhwang91 / nvim-hlslens

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

Add doc about usage with vim-plug #52

Open edi9999 opened 2 years ago

edi9999 commented 2 years ago

When I try the following :

call plug#begin('~/.config/nvim/plugged')
Plug 'kevinhwang91/nvim-hlslens'
call plug#end()
lua require('hlslens').setup()

I get following error :

line  260:
E5108: Error executing lua [string ":lua"]:1: module 'hlslens' not found:
        no field package.preload['hlslens']
        no file './hlslens.lua'
        no file '/usr/share/luajit-2.1.0-beta3/hlslens.lua'
        no file '/usr/local/share/lua/5.1/hlslens.lua'
        no file '/usr/local/share/lua/5.1/hlslens/init.lua'
        no file '/usr/share/lua/5.1/hlslens.lua'
        no file '/usr/share/lua/5.1/hlslens/init.lua'
        no file './hlslens.so'
        no file '/usr/local/lib/lua/5.1/hlslens.so'
        no file '/usr/lib/x86_64-linux-gnu/lua/5.1/hlslens.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        [string ":lua"]:1: in main chunk

It worked well a few months ago (can't tell when exactly it stopped working).

It would be great to add installation instruction for vim-plug.

Also, I'm not much used to using lua in my .vimrc, it would be great to tell more about where you are putting the following :

require('hlslens').setup()
local kopts = {noremap = true, silent = true}
....
...

(source : https://github.com/kevinhwang91/nvim-hlslens#minimal-configuration)

kevinhwang91 commented 2 years ago

I haven't used vim-plug for a long time. It will hack rtp. I think we should make hlslens work fine with built-in package, h 'packpath'. packer.nvim is a wrapper for built-in package. If you want hlslens work with vim-plug, PR is welcome.

ngdangdat commented 1 year ago

Hi @kevinhwang91,

I'm currently working on this issue. May I know why we have to use vim.schedule in this case to call the setup function?

I can see the function called in setup file but in the guideline, we have to call it again (with different parameters though).

Thanks in advance!

kevinhwang91 commented 1 year ago

May I know why we have to use vim.schedule in this case to call the setup function?

Because the initial sequence of plugins may make nvim abnormal. User should initialize hlslens explicitly.

I can see the function called in setup file but in the guideline, we have to call it again (with different parameters though).

Just to warn user invoke setup

ngdangdat commented 1 year ago

I've created the PR: https://github.com/kevinhwang91/nvim-hlslens/pull/62. Kindly help to check. Thanks!