Furkanzmc / zettelkasten.nvim

A Vim Philosophy Oriented Zettelkasten Note Taking Plugin
The Unlicense
223 stars 9 forks source link

keywordprg isn't set, but is empty #15

Closed bagnacauda closed 2 years ago

bagnacauda commented 2 years ago

keywordprg isn't set for some reason. I tried creating a new user with the following minimal init.vim:

syntax on 
filetype plugin on

call plug#begin()
Plug 'Furkanzmc/zettelkasten.nvim'
call plug#end()

Do you have any clues? neovim version NVIM v0.6.1 running on Arch

Furkanzmc commented 2 years ago

First thing that comes to mind is that there's already an existing keywordprg set for the buffer. If you look at here, you can see the condition. I didn't think it'd be right to overwrite an existing keywordprg since zettelkasten.nvim can be mixed with other things.

For example, I use null-ls.nvim to define my own set of functions to call as part of the keywordprg call and I manually add :ZkHover call to there since I may also be looking up a word for example.

Do you see the keywordprg option as empty, or is there another value set for it?

bagnacauda commented 2 years ago

OK I think I figured it out. vim.opt_local.keywordprg:get() returns a value even if the variable isn't set as local but global, which for me is ":Man", the default. I was checking with :setlocal and that was empty, but not with :set. I don't think it's the intended behavior, because that condition would be useless if Neovim has a default value.

Furkanzmc commented 2 years ago

I think that may be a Neovim bug. I'm using my build of the master branch (NVIM v0.7.0-dev+1333-g71b4c30ad), and I cannot reproduce what you are experiencing.

I run :set keywordprg=:Man and then :setlocal keywordprg=. And then when I run :lua print(vim.opt_local.keywordprg:get()), I get an empty string.

bagnacauda commented 2 years ago

You are right, using neovim-git that problem does not occur. I'll stick to that for the time being. Thank you!