ggandor / lightspeed.nvim

deprecated in favor of leap.nvim
MIT License
1.56k stars 28 forks source link

Update configuration in init.vim #148

Closed Muzzamil1 closed 2 years ago

Muzzamil1 commented 2 years ago

Hi @ggandor thanks for this amazing plugin.

I wanted to use case-insensitive. I am using init.vim instead of lua. Can you please tell me how to set ignore_case = true in init.vim?

ggandor commented 2 years ago
lua require('lightspeed').opts.ignore_case = true

or, if you want to set multiple options, the simplest thing to do is:

lua << EOF
  -- you can write any Lua code here, just as you would in init.lua  
  require('lightspeed').setup {
    ignore_case = true,
    etc...    
  }
EOF

See e.g.: https://github.com/nanotee/nvim-lua-guide#using-lua-from-vimscript

Muzzamil1 commented 2 years ago

Hi, thanks for your response. I am using vscode-neovim

I am actually using init.vim for configuration, not init.lua. I tried the configuration that you send but that gives error

E5108: Error executing lua [string ":lua"]:1: module 'lightspeed' not found:
    no field package.preload['lightspeed']
    no file '.\lightspeed.lua'
    no file 'C:\Neovim\bin\lua\lightspeed.lua'
    no file 'C:\Neovim\bin\lua\lightspeed\init.lua'
    no file '.\lightspeed.dll'
    no file 'C:\Neovim\bin\lightspeed.dll'

I also tried some settings that I know of but nothing worked (please check the green box in the screenshot). Sorry I don't have experience with lua. I really appreciate your helping me here

image

ggandor commented 2 years ago

That should work, the problem is that lightspeed (the module) itself is not found. How did you install it (e.g. using vim-plug)? At that point in init.vim, lightspeed should already be available (i.e., on the runtimepath), if you want to require it.

Muzzamil1 commented 2 years ago

I have installed it using Plug (vim-plug) - plugin manager

image

It is working fine when I press "s" not sure why it says module 'lightspeed' not found: when I try to change the setting.

image

ggandor commented 2 years ago

And are you sure that the plug#begin() ... plug#end() section has already run when you try change the setting in the line lua require('lightspeed').opts.ignore_case = true? (I.e., is the Plug stuff in the same init.vim file, above the latter, or in a file that is sourced before reaching that ignore_case = ... line?)

Muzzamil1 commented 2 years ago

Oh sorry, my bad. plug#begin() ... plug#end() was after that setting. Putting it before worked perfectly. Thank you so much for your help.