Closed tynguyen2k1 closed 2 years ago
Can you provide a minimal init.vim, minimal text file, Neovim version.
i removed all my plugins and configs to make sure it didn't work. Is there any precedent with this issue?. This is my previous configuration:
plugins.lua
:
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- Theme
use 'folke/tokyonight.nvim'
-- Status line
use {
'glepnir/galaxyline.nvim',
branch = 'main',
-- some optional icons
requires = {'kyazdani42/nvim-web-devicons', opt = true}
}
-- Buffer
use "romgrk/barbar.nvim"
-- For hex color
use 'norcalli/nvim-colorizer.lua'
-- File explorer
use {
'kyazdani42/nvim-tree.lua',
config = function ()
require('plugins.nvimtree').setup()
end,
requires = 'kyazdani42/nvim-web-devicons'
}
-- find file
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
use 'nvim-lua/popup.nvim'
use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
-- Comment
use 'numToStr/Comment.nvim'
use 'JoosepAlviste/nvim-ts-context-commentstring' -- comment chuan hon
-- Neovim LSP
use 'neovim/nvim-lspconfig'
-- use {
-- 'jose-elias-alvarez/null-ls.nvim',
-- config = function ()
-- require('plugins.null-ls').setup()
-- end,
-- requires = 'nvim-lua/plenary.nvim'
-- }
-- Tab/Auto completion
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
-- use 'hrsh7th/cmp-cmdline'
use 'antoinemadec/FixCursorHold.nvim'
-- snippets
-- use 'hrsh7th/cmp-vsnip'
-- use 'hrsh7th/vim-vsnip'
use 'L3MON4D3/LuaSnip'
use 'saadparwaiz1/cmp_luasnip'
use "rafamadriz/friendly-snippets" -- snippets co san
-- lsp installer
use 'williamboman/nvim-lsp-installer' -- trinh quan ly lsp
-- Auto pairs '', "", [], {}, (), ``
use 'windwp/nvim-autopairs'
-- For indent line
use 'lukas-reineke/indent-blankline.nvim'
-- For nice highlighting
use {
'nvim-treesitter/nvim-treesitter',
-- run = ':TSUpdate'
}
-- matchup
use {
'andymass/vim-matchup',
config = function ()
require("plugins.vim-matchup").config()
end
}
-- Smooth scrolling
use {
'karb94/neoscroll.nvim',
config = function ()
require('neoscroll').setup()
end
}
-- Tmux navigator
use 'christoomey/vim-tmux-navigator'
-- Git
use "lewis6991/gitsigns.nvim"
-- float terminal
use 'akinsho/toggleterm.nvim'
-- Hop, use for easy motion
use {
'phaazon/hop.nvim',
setup = function ()
require("keybinds").hop()
end,
config = function ()
require('hop').setup()
end
}
-- Auto tag
use 'windwp/nvim-ts-autotag'
--change (){}[], tag
use 'tpope/vim-surround'
-- using . repeat surround.vim
use 'tpope/vim-repeat'
-- highlight current word
use {
'RRethy/vim-illuminate',
config = function ()
vim.g.Illuminate_delay = 300
vim.api.nvim_command [[ hi def link LspReferenceText CursorLine ]]
vim.api.nvim_command [[ hi def link LspReferenceWrite CursorLine ]]
vim.api.nvim_command [[ hi def link LspReferenceRead CursorLine ]]
-- vim.api.nvim_set_keymap('n', '<a-n>', '<cmd>lua require"illuminate".next_reference{wrap=true}<cr>', {noremap=true})
-- vim.api.nvim_set_keymap('n', '<a-p>', '<cmd>lua require"illuminate".next_reference{reverse=true,wrap=true}<cr>', {noremap=true})
end,
requires = 'neovim/nvim-lspconfig'
}
-- Live server
use 'turbio/bracey.vim'
end)
setting.lua
O = vim.o
BO = vim.bo
WO = vim.wo
G = vim.g
CMD = vim.cmd
O.backup = false -- creates a backup file
O.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
O.cmdheight = 1 -- more space in the neovim command line for displaying messages
O.colorcolumn = "99999" -- fixes indentline for now
-- O.completeopt = { "menuone", "noselect" }
O.conceallevel = 0 -- so that `` is visible in markdown files
O.fileencoding = "utf-8" -- the encoding written to a file
O.foldmethod = "manual" -- folding, set to "expr" for treesitter based folding
O.foldexpr = "" -- set to "nvim_treesitter#foldexpr()" for treesitter based folding
O.guifont = "monospace:h17" -- the font used in graphical neovim applications
O.hidden = true -- required to keep multiple buffers and open multiple buffers
O.hlsearch = false -- nohighlight all matches on previous search pattern
O.ignorecase = true -- ignore case in search patterns
-- O.mouse = "a" -- allow the mouse to be used in neovim
O.pumheight = 10 -- pop up menu height
O.showmode = true -- false if you don't like -- INSERT -- anymore
O.showtabline = 4 -- always show tabs
O.smartcase = true -- smart case
O.smartindent = true -- make indenting smarter again
O.splitbelow = true -- force all horizontal splits to go below current window
O.splitright = true -- force all vertical splits to go to the right of current window
O.swapfile = false -- creates a swapfile
O.termguicolors = true -- set term gui colors (most terminals support this)
-- O.timeoutlen = 300 -- time to wait for a mapped sequence to complete (in milliseconds)
O.title = true -- set the title of window to the value of the titlestring
-- O.undodir = utils.join_paths(get_cache_dir(), "undo") -- set an undo directory
O.undofile = true -- enable persistent undo
O.updatetime = 300 -- faster completion
O.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
O.expandtab = true -- convert tabs to spaces
O.shiftwidth = 4 -- the number of spaces inserted for each indentation
O.tabstop = 4 -- insert 4 spaces for a tab
O.cursorline = true -- highlight the current line
O.number = true -- set numbered lines
O.relativenumber = false -- set relative numbered lines
O.numberwidth = 4 -- set number column width to 2 {default 4}
O.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time
O.wrap = false -- display lines as one long line
O.spell = false
O.spelllang = "en"
O.scrolloff = 4 -- is one of my fav
O.sidescrolloff = 4
vim.api.nvim_command('set nofoldenable')
vim.api.nvim_command('set nocompatible')
I using NVIM v0.5.1
You can see all my configurations here: https://github.com/tynguyen2k1/nvim.
There isn't a precendent for this, it's working for me locally and no other issues have been raised that match yours.
That is not a minimal init.vim/init.lua (it's also missing things like LSP configuration) nor have you provided a minimal text file, please provide these things.
You can also try :lua print(vim.inspect(require("illuminate").get_document_highlights(<bufnr>)))
to see what references show up for the current file. Pasting that here will also be useful, but only do it for a minimal text file.
minimal text file:
abc
def
█abc
def
abc
def
:lua print(vim.inspect(require("illuminate").get_document_highlights("abc")))
return nil
lsp-config
file:
local nvim_lsp = require('lspconfig')
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
-- highlight current word
require 'illuminate'.on_attach(client)
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', '<space>fo', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" }
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.preselectSupport = true
capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
capabilities.textDocument.completion.completionItem.deprecatedSupport = true
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
}
-- replace the default lsp diagnostic symbols
local function lspSymbol(name, icon)
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefault" .. name })
end
lspSymbol("Error", "")
lspSymbol("Information", "")
lspSymbol("Hint", "")
lspSymbol("Warning", "")
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics,{
virtual_text = {
prefix = "",
spacing = 0,
},
signs = true,
underline = true,
update_in_insert = false, -- update diagnostics insert mode
})
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "single",
})
-- suppress error messages from lang servers
vim.notify = function(msg, log_level, _opts)
if msg:match "exit code" then
return
end
if log_level == vim.log.levels.ERROR then
vim.api.nvim_err_writeln(msg)
else
vim.api.nvim_echo({ { msg } }, true, {})
end
end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = {
'pyright',
'rust_analyzer',
'tsserver',
'html',
'cssls',
'intelephense',
'clangd'
}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
root_dir = vim.loop.cwd,
capabilities = capabilities,
}
end
My init.lua
only requires configuration of other plugins, I don't know how to describe it, you can see about it here. And as shown above, I removed everything except vim-illuminate
to test it.
For future, please provide a minimal init.lua or init.vim or the issue will be closed, I'm not going to read through your entire 1k+ lines config.
That being said, this text you provide looks plaintext and probably doesn't have an LSP server,the next_reference
only works for LSP highlighting, not the adhoc highlighting for when the LSP isn't active. The README only has next_reference
listed in the LSP section, https://github.com/RRethy/vim-illuminate#lsp-configuration, although it can be clearer. I'll improve the README when I get a chance.
I am very sorry for this inconvenience. I found my problem was in nvim-lsp-installer. I misconfigured it so it ignored my lsp-config
. Once again very sorry to you.
@tynguyen2k1 how did you solve this? I havent got next_reference to work at all, also using nvim-lsp-installer. thanks!
Describe the bug Can't cycle through the document highlights. This is so weird
To Reproduce ...
Expected behavior cycle through the document highlights
Screenshots
https://user-images.githubusercontent.com/64082226/142463547-d1863e62-8c98-43f8-bbc7-b16620a39c60.mp4
Additional context I using NVIM v0.5.1 I removed all other plugins and my
~/.config/nvim
folder just to be more sure.