Docs for `click` somewhat confusing
sullyj3 opened this issue · comments
Hi, I wasn't quite sure how to get click
working.
From reading the readme, it wasn't clear to me
- Whether
click
can work with the "Native method" listed in examples, using winbar, or else installing other plugins are required. - If it is possible without plugins, how to do that.
I experimented with enabling click
in setup, and using the native method:
use {
'SmiteshP/nvim-navic',
requires = "neovim/nvim-lspconfig",
config = function()
require 'nvim-navic'.setup {
click = true,
}
end
}
-- ...
local on_attach = function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then
require('nvim-navic').attach(client, bufnr)
vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}"
end
-- ...
But clicking didn't seem to work.
If you could clear these questions up for me, I'd be happy to submit a docs PR.
Make sure that the terminal emulator you are using supports click
Or if there is a option to enable clicks in it
I had the same issue and it looks like the value of click is only being used when it is passed to get_location()
. So instead of passing click = true
in the setup()
function you can set your winbar like this and it should work: vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location({'click': v:true})%}"
.
To fix this, the code for applying the click option in the format_data()
function, which gets called by the get_location()
function, just needs to be added to the setup()
function. Or better yet, have a central function that both setup()
and get_location()
can call to apply options so the two are always in sync
Fixed in latest commit