nvim-metals
is a Lua plugin built to provide a better experience while using
Metals, the Scala Language Server, with Neovim's built-in LSP
support.1 You can see all
the available features
here.
- Before you get started you need to ensure that you are using nvim v.0.7.0 or newer.
- Ensure Coursier is installed locally.2
- Remove
F
fromshortmess
3 - Ensure that you have all the LSP mappings for the core functionality you want setup.4
- Ensure plenary.nvim is installed.5
- Subscribe to this discussion which will notify you of any breaking changes.
- Unfamiliar with Lua and Neovim? Check out the great
nanotee/nvim-lua-guide
.
NOTE: This plugin works without needing to install
neovim/nvim-lspconfig. If you have
it installed for other languages, that's not a problem, but make sure you do not
have Metals configured through nvim-lspconfig
while using this plugin.1
Example if using packer
:
use({'scalameta/nvim-metals', requires = { "nvim-lua/plenary.nvim" }})
- You can find a full minimal example configuration here.
- You can find the full documentation with
:help vim-metals
. - You can find a full list of features here.
To view all of the available commands, check out :help metals-commands
in the
help docs. Similarly, to see the available configuration settings check out
:help metals-settings
.
To see the full details on the available configurations, checkout out :help metals-integrations
. The currently available integrations are:
Footnotes
-
If you're familiar with nvim and LSP you'll probably know of
nvim-lspconfig
which also has a Metals configuration. Note that this is a very minimal version with no specific Metals commands and no Metals extensions. You can see more info on this here. DO NOT try to use Metals both withnvim-lspconfig
and withnvim-metals
as stuff will not work right. ↩ ↩2 -
nvim-metals
uses Coursier to download and update Metals. NOTE: On Windows, you should runcoursier
orcs.exe
once from the command line as this is how it will install itself. Once this is done you should addC:\Users\YOURNAME\AppData\Coursier\data\bin
to your path. To verify that it is properly installed you can runcs --help
from a new shell. ↩ -
vim.opt_global.shortmess:remove("F")
will do what you need. If you don't know what shortmess is, check out:h shortmess
. Without doing this, autocommands that deal with filetypes prohibit messages from being shown, so some of the messages we show to help users get started may not be shown. If you're confident you don't need help setting up, then just remove this, andnvim-metals
will work fine, but any log messages won't actually be shown to you if something goes wrong withnvim-metals
. ↩ -
By default methods for things like goto definition, find references, etc are there, but not automatically mapped. You can find a minimal example configuration here. ↩
-
You're more than likely already relying on for other plugins. However, make sure to also have this installed as Metals uses it for things like Jobs, popups, and paths. ↩