From c3e9eb7e419400f301f33ba913e5eb55f046122c Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 6 Dec 2021 15:31:35 +0000 Subject: Only LSP mappings for Scala --- metals.vim | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/metals.vim b/metals.vim index 435ed40..253e351 100644 --- a/metals.vim +++ b/metals.vim @@ -1,23 +1,3 @@ -" 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 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 require'metals'.worksheet_hover() -nnoremap a lua require'metals'.open_all_diagnostics() - -" diagnostic navigation -nnoremap d lua vim.diagnostic.open_float(0, {scope = "line"}) -nnoremap dn lua vim.diagnostic.goto_next() -nnoremap dp lua vim.diagnostic.goto_next() - " nvim-lsp Settings " " using latest stable @@ -37,6 +17,28 @@ nnoremap dp lua vim.diagnostic.goto_next() } 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 require'metals'.worksheet_hover() + nnoremap a lua require'metals'.open_all_diagnostics() + + " diagnostic navigation + nnoremap d lua vim.diagnostic.open_float(0, {scope = "line"}) + nnoremap dn lua vim.diagnostic.goto_next() + nnoremap dp lua vim.diagnostic.goto_next() +endfunction + if has('nvim-0.5') augroup lsp au! @@ -49,4 +51,5 @@ endif " Helpful general settings " autocmd FileType scala setlocal omnifunc=v:lua.vim.lsp.omnifunc +autocmd FileType scala call MetalsMapKeys() -- cgit v1.2.3