" 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.init_options.statusBarProvider = "on" metals_config.settings = { showImplicitArguments = true, excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" } } EOF " nvim-lsp mappings for metals " function! MetalsMapKeys() abort 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 gsh lua vim.lsp.buf.signature_help() 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 vim.diagnostic.setqflist({severity = "W"}) nnoremap a lua vim.diagnostic.setqflist() " diagnostic navigation nnoremap d lua vim.diagnostic.open_float(0, {scope = "line"}) nnoremap da lua vim.diagnostic.setloclist() nnoremap dn lua vim.diagnostic.goto_next() nnoremap dp lua vim.diagnostic.goto_prev() endfunction if has('nvim-0.5') augroup lsp au! au FileType scala,sbt lua require('metals').initialize_or_attach(metals_config) augroup end " virtual text is not too useful :lua vim.diagnostic.config({ virtual_text = false }) endif " Helpful general settings " autocmd FileType scala setlocal omnifunc=v:lua.vim.lsp.omnifunc autocmd FileType scala call MetalsMapKeys() autocmd BufWritePre *.scala,*.sc,*.sbt :lua vim.lsp.buf.formatting_seq_sync() autocmd BufNewFile,BufRead *.sc set filetype=scala