nvim-hlslens icon indicating copy to clipboard operation
nvim-hlslens copied to clipboard

Add doc about usage with vim-plug

Open edi9999 opened this issue 2 years ago • 4 comments

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)

edi9999 avatar Nov 10 '22 08:11 edi9999

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.

kevinhwang91 avatar Nov 10 '22 08:11 kevinhwang91

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!

ngdangdat avatar May 04 '23 04:05 ngdangdat

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

kevinhwang91 avatar May 04 '23 04:05 kevinhwang91

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

ngdangdat avatar May 04 '23 08:05 ngdangdat