" nvim-lsp Mappings " nnoremap lua vim.lsp.buf.definition() nnoremap K lua vim.lsp.buf.hover() nnoremap gi lua vim.lsp.buf.implementation() nnoremap gr lua vim.lsp.buf.references() nnoremap gds lua vim.lsp.buf.document_symbol() nnoremap gws lua vim.lsp.buf.workspace_symbol() nnoremap rn lua vim.lsp.buf.rename() nnoremap F lua vim.lsp.buf.formatting() nnoremap ca lua vim.lsp.buf.code_action() nnoremap ws lua require'metals'.worksheet_hover() nnoremap a lua require'metals'.open_all_diagnostics() nnoremap d lua vim.lsp.diagnostic.set_loclist() nnoremap [c lua vim.lsp.diagnostic.goto_prev { wrap = false } nnoremap ]c lua vim.lsp.diagnostic.goto_next { wrap = false } " nvim-lsp Settings " " using latest stable " let g:metals_server_version = '0.9.8+10-334e402e-SNAPSHOT' " nvim-metals " :lua << EOF metals_config = require'metals'.bare_config() metals_config.settings = { showImplicitArguments = true, excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" } } metals_config.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = { prefix = '', } } ) EOF if has('nvim-0.5') augroup lsp au! au FileType scala,sbt lua require('metals').initialize_or_attach(metals_config) augroup end endif " Helpful general settings " autocmd FileType scala setlocal omnifunc=v:lua.vim.lsp.omnifunc " Set completeopt to have a better completion experience set completeopt=menuone,noinsert,noselect