Honestly I don't even know where to ask this, but I want to get a plugin in order to get this inside my nvim, but I don't even know what it is called to search for it

So, what do you call the thing on the right, the one that shows an error? (this is a screenshot from KDevelop)

enter image description here

  • 2
    Welcome to Vi and Vim! I believe NeoVim calls this "virtual text"; it appears to come from a linter/compiler/LSP/etc.
    – D. Ben Knoble
    Apr 28, 2022 at 21:00
  • 3
    There are several plugins that connect Vim to a LSP server. Coc.nvim is one. Apr 29, 2022 at 2:47
  • 1
    @Andy3153 I've rolled back your edit; edits are not for answers to the question. Please post an answer below if you have a solution, and include any necessary code directly.
    – D. Ben Knoble
    May 3, 2022 at 20:17
  • 1
    @D.BenKnoble Okay, I will do that. But, in case I change the code where I maintain it, is it fine to place a link to where the code will possibly be more up to date?
    – Andy3153
    May 3, 2022 at 20:38
  • 1
    @Andy3153 yea that’s totally fine
    – D. Ben Knoble
    May 3, 2022 at 20:51

1 Answer 1


I actually got it working now, and, because I really wanted this when I was trying to get it working, here is a minimal working init.lua configuration file to get it up and running, for anyone else that might need it.

Due to the current way I configured it for now, it'll quit once by itself, then you should re-run it three times. Why?

  • Once, so that plug.vim installs the plugins needed
  • A second time, so that nvim-lsp-installer installs the LSP servers (check installation progress by using :LspInstallInfo)
  • And then, if you run it a third time, the LSP servers will load

I am extremely open to suggestions for this, I know the plugin automation and plug.vim bootstrapping is basically held together by electrical tape, if there's anyone who knows how to do any of this better, please inform me.

For a potentially more up-to-date version of this config, click here.

-- vim:fileencoding=utf-8:foldmethod=marker
-- Minimal working configuration to get working inline errors/LSP virtual text in Neovim
-- by Andy3153

-- Add here all the LSPs you want, see :LspInstallInfo or github.com/williamboman/nvim-lsp-installer#available-lsps
lspservers_to_install =
  -- Examples:
  'clangd',     -- C/C++
  'pylsp',      -- Python
  'sumneko_lua' -- Lua

-- {{{ Setting the environment up
vim.fn.setenv("NVIM_DATA_FOLDER", vim.fn.stdpath('data'))
vim.fn.setenv("AUTOLOAD_FOLDER",  vim.fn.getenv('NVIM_DATA_FOLDER') .. "/site/autoload/")
vim.fn.setenv("PLUG_FOLDER",      vim.fn.getenv('AUTOLOAD_FOLDER')  .. "/plugged/")

-- {{{ Installing plugins
-- Feel free to do this however you please, with whatever package manager you like
vim.cmd [[
  " Bootstraps plug.vim
  if empty(glob('$AUTOLOAD_FOLDER/plug.vim'))
    silent !curl -fLo $AUTOLOAD_FOLDER/plug.vim --create-dirs
      \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    silent !touch $AUTOLOAD_FOLDER/.setup-needed
    autocmd VimEnter * q

  " Plugin list
  call plug#begin('$PLUG_FOLDER')
    Plug 'neovim/nvim-lspconfig'
    Plug 'williamboman/nvim-lsp-installer'
  call plug#end()

  " Installs plugins after plug.vim was downloaded
  if empty(glob('$AUTOLOAD_FOLDER/.setup-needed'))
    autocmd VimEnter * PlugInstall
    silent !rm $AUTOLOAD_FOLDER/.setup-needed
-- }}}
-- }}}

-- {{{ Setting up plugins
require("nvim-lsp-installer").setup({ ensure_installed = lspservers_to_install })

-- Forloop that enables all LSPs mentioned in the lspservers_to_install array
for _, lsp in ipairs(lspservers_to_install) do
  require('lspconfig')[lsp].setup{sdf="sdf"} -- don't even ask me why anything is required in there, it won't work without it
-- }}}

EDIT: How does it look? Not good, it's a barebones config. Here's some code with mistakes in it to showcase it:

enter image description here

  • 1
    RE: duct tape, downloading a file into autoload doesn't require a restart if all you do is call it's autoload functions; it will be found by the autoload mechanism. So that can be removed. For installing the servers, that should be something you only need to do occasionally, so I would recommend dropping the auto-:PlugInstall and either run it as needed interactively or from the command-line with +PlugInstall
    – D. Ben Knoble
    May 4, 2022 at 14:10
  • @D.BenKnoble If I remove the quitting (ln.29: "autocmd VimEnter * q), on first launch, nvim is going to complain about it: Vim(call):E117: Unknown function: plug#begin. Also, :PlugInstall gets ran only once, when downloading plug.vim, it creates a file. If that file exists, it runs PlugInstall and then deletes the file. And, the LSP servers only get installed once (when on ln.49, nvim-lsp-installer is being told that it has to make sure that all the LSPs inside the lspservers_to_install array are installed), not everytime nvim starts.
    – Andy3153
    May 4, 2022 at 15:15
  • 1
    The error surprises me; that’s not how autoload is supposed to work. It should search for the autoload file when the function is first called.
    – D. Ben Knoble
    May 4, 2022 at 15:51
  • Wait, what autoload function?
    – Andy3153
    May 4, 2022 at 16:24
  • 1
    plug#begin is autoloaded from the plug.vim that you download
    – D. Ben Knoble
    May 4, 2022 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.