From 4e79d031a77a172be45f901db9b42ed2454d3a9b Mon Sep 17 00:00:00 2001 From: Kitso Gidion Namane Date: Sat, 6 Jul 2024 16:35:53 +0200 Subject: [PATCH] feat: add nvim-metals --- init.lua | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 89c58e50..4d54d45d 100644 --- a/init.lua +++ b/init.lua @@ -155,7 +155,7 @@ vim.opt.cursorline = true vim.opt.scrolloff = 10 -- fix indentation -vim.o.tab = 4 +-- vim.o.tab = 4 vim.o.softtabstop = 4 vim.o.shiftwidth = 4 @@ -755,6 +755,32 @@ require('lazy').setup({ -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, + { + 'scalameta/nvim-metals', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + ft = { 'scala', 'sbt', 'java' }, + opts = function() + local metals_config = require('metals').bare_config() + metals_config.on_attach = function(client, bufnr) + -- your on_attach function + end + + return metals_config + end, + config = function(self, metals_config) + local nvim_metals_group = vim.api.nvim_create_augroup('nvim-metals', { clear = true }) + vim.api.nvim_create_autocmd('FileType', { + pattern = self.ft, + callback = function() + require('metals').initialize_or_attach(metals_config) + end, + group = nvim_metals_group, + }) + end, + }, + { -- Collection of various small independent plugins/modules 'echasnovski/mini.nvim', config = function()