Files
mvim/plugin/40_plugins.lua
T
marco fabc3362a1 rework keymaps and plugin config
- Change leader from space to comma
- Move opencode keymaps into plugin config
- Move picker keymaps from <leader>p to <leader>f
- Change buffer delete mapping from bd to bk
- Add DAP debugging keymaps and dap-view
- Remove zk-nvim, checkmate plugins
- Add claude-code, conjure, scnvim plugins
- Update LSP servers: replace basedpyright with ty, add gopls/clojure_lsp/harper_ls/tinymist
- Enable inlay hints on LspAttach
- Enable go/sql/typst tree-sitter
- Add htmlhint formatter
- Configure opencode with snacks terminal
2026-08-02 17:09:21 +02:00

291 lines
8.0 KiB
Lua

-- ┌─────────────────────────┐
-- │ Plugins outside of MINI │
-- └─────────────────────────┘
--
-- This file contains installation and configuration of plugins outside of MINI.
-- They significantly improve user experience in a way not yet possible with MINI.
-- These are mostly plugins that provide programming language specific behavior.
--
-- Use this file to install and configure other such plugins.
-- Make concise helpers for installing/adding plugins in two stages
local add, later = MiniDeps.add, MiniDeps.later
local now_if_args = _G.Config.now_if_args
-- Tree-sitter ================================================================
now_if_args(function()
add({
source = 'nvim-treesitter/nvim-treesitter',
-- Update tree-sitter parser after plugin is updated
hooks = { post_checkout = function() vim.cmd('TSUpdate') end },
})
add({
source = 'nvim-treesitter/nvim-treesitter-textobjects',
-- Use `main` branch since `master` branch is frozen, yet still default
-- It is needed for compatibility with 'nvim-treesitter' `main` branch
checkout = 'main',
})
-- Define languages which will have parsers installed and auto enabled
local languages = {
-- These are already pre-installed with Neovim. Used as an example.
'lua',
'html',
'css',
'markdown',
'yaml',
'toml',
'python',
'javascript',
'typst',
'go',
'sql',
'typst',
-- Add here more languages with which you want to use tree-sitter
-- To see available languages:
-- - Execute `:=require('nvim-treesitter').get_available()`
-- - Visit 'SUPPORTED_LANGUAGES.md' file at
-- https://github.com/nvim-treesitter/nvim-treesitter/blob/main
}
local isnt_installed = function(lang)
return #vim.api.nvim_get_runtime_file('parser/' .. lang .. '.*', false) == 0
end
local to_install = vim.tbl_filter(isnt_installed, languages)
if #to_install > 0 then require('nvim-treesitter').install(to_install) end
-- Enable tree-sitter after opening a file for a target language
local filetypes = {}
for _, lang in ipairs(languages) do
for _, ft in ipairs(vim.treesitter.language.get_filetypes(lang)) do
table.insert(filetypes, ft)
end
end
local ts_start = function(ev) vim.treesitter.start(ev.buf) end
_G.Config.new_autocmd('FileType', filetypes, ts_start, 'Start tree-sitter')
end)
-- Language servers ===========================================================
now_if_args(function()
add('neovim/nvim-lspconfig')
vim.lsp.enable({
'lua_ls',
'ty',
'ruff',
'html',
'css',
'toml',
'marksman',
'gopls',
'clojure_lsp',
'harper_ls',
'tinymist'
})
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(true)
end
end,
})
end)
-- Formatting =================================================================
later(function()
add('stevearc/conform.nvim')
require('conform').setup({
-- Map of filetype to formatters
-- Make sure that necessary CLI tool is available
formatters_by_ft = {
lua = { 'stylua' },
python = { 'ruff' },
html = { 'htmlhint' },
},
})
end)
-- Mason ======================================================================
now_if_args(function()
add('mason-org/mason.nvim')
require('mason').setup()
end)
-- Catppuccin =================================================================
now_if_args(function()
add({ source = 'catppuccin/nvim', name = 'catppuccin' })
require('catppuccin').setup({
flavour = 'mocha',
transparent_background = true,
dim_inactive = {
enabled = true,
},
float = {
transparent = true,
},
compile_path = vim.fn.stdpath('cache') .. '/catppuccin',
})
vim.cmd('colorscheme catppuccin')
end)
-- Neogit =====================================================================
later(function()
add({
source = 'NeogitOrg/neogit',
depends = { 'nvim-lua/plenary.nvim' },
})
require('neogit').setup()
end)
-- Gitsigns ===================================================================
later(function()
add({
source = 'lewis6991/gitsigns.nvim',
})
require('gitsigns').setup({})
end)
-- opencode ===================================================================
local opencode_cmd = "opencode --port"
later(function()
add({
source = 'nickjvandyke/opencode.nvim',
depends = { 'folke/snacks.nvim' },
})
require('snacks').setup({ picker = { enabled = true } })
---@type snacks.terminal.Opts
local snacks_terminal_opts = {
win = {
position = "right",
enter = false,
},
}
---@type opencode.Opts
vim.g.opencode_opts = {
server = {
start = function()
require("snacks.terminal").open(opencode_cmd, snacks_terminal_opts)
end,
},
}
vim.keymap.set({ "n", "x" }, "<leader>aa", function()
require("opencode").ask("@this: ", { submit = true })
end, { desc = "Ask opencode" })
vim.keymap.set({ "n", "x" }, "<leader>ap", function()
require("opencode").select()
end, { desc = "Select opencode" })
vim.keymap.set({ "n", "t" }, "<leader>ac", function()
require("snacks.terminal").toggle(opencode_cmd, snacks_terminal_opts)
end, { desc = "Toggle opencode" })
end)
-- render-markdown.nvim ========================================================
now_if_args(function()
add({
source = 'MeanderingProgrammer/render-markdown.nvim',
})
require('render-markdown').setup({
enabled = true,
file_types = { 'markdown', 'vimwiki' },
latex = { enabled = false }
})
end)
-- nvim-dap ====================================================================
--
later(function()
add({
source = 'mfussenegger/nvim-dap',
depends = {
'nvim-neotest/nvim-nio',
'mfussenegger/nvim-dap-python',
'theHamsta/nvim-dap-virtual-text',
},
})
add({
source = 'igorlfs/nvim-dap-view',
})
local dap = require('dap')
local dap_view = require('dap-view')
local dap_python = require('dap-python')
dap_view.setup({})
require('nvim-dap-virtual-text').setup({
commented = true, -- Show virtual text alongside comment
})
dap_python.setup('python3')
end)
-- claude code =================================================================
now_if_args(function()
add({
source = "coder/claudecode.nvim",
depends = { "folke/snacks.nvim" }
})
require("claudecode").setup()
vim.keymap.set({ "n", "x" }, "<leader>co", "<cmd>ClaudeCode<cr>", { desc = "Open Claude Code" })
end)
-- conjure =====================================================================
later(function()
add({
source = 'Olical/conjure',
})
end
)
-- Typst ========================================================================
now_if_args(function()
vim.keymap.set("n", "<leader>tt", "<cmd>LspTinymistExportPdf<cr>", { desc = "Export Typst to PDF" })
end)
-- Supercollider ===============================================================
later(function()
add({
source = 'davidgranstrom/scnvim'
})
local scnvim = require("scnvim")
local map = scnvim.map
local map_expr = scnvim.map_expr
scnvim.setup({
keymaps = {
["<M-e>"] = map("editor.send_line", { "i", "n" }),
["<C-e>"] = {
map("editor.send_block", { "i", "n" }),
map("editor.send_selection", "x"),
},
["<CR>"] = map("postwin.toggle"),
["<M-CR>"] = map("postwin.toggle", "i"),
["<M-L>"] = map("postwin.clear", { "n", "i" }),
["<C-s>"] = map("signature.show", { "n", "i" }),
["<C-.>"] = map("sclang.hard_stop", { "n", "x", "i" }),
["<leader>st"] = map("sclang.start"),
["<leader>sk"] = map("sclang.recompile"),
["<F1>"] = map_expr("s.boot"),
["<F2>"] = map_expr("s.meter"),
},
editor = {
highlight = {
color = "IncSearch",
},
},
postwin = {
float = {
enabled = true,
},
},
})
end)