-- ┌─────────────────────────┐ -- │ 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" }, "aa", function() require("opencode").ask("@this: ", { submit = true }) end, { desc = "Ask opencode" }) vim.keymap.set({ "n", "x" }, "ap", function() require("opencode").select() end, { desc = "Select opencode" }) vim.keymap.set({ "n", "t" }, "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" }, "co", "ClaudeCode", { desc = "Open Claude Code" }) end) -- conjure ===================================================================== later(function() add({ source = 'Olical/conjure', }) end ) -- Typst ======================================================================== now_if_args(function() vim.keymap.set("n", "tt", "LspTinymistExportPdf", { 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 = { [""] = map("editor.send_line", { "i", "n" }), [""] = { map("editor.send_block", { "i", "n" }), map("editor.send_selection", "x"), }, [""] = map("postwin.toggle"), [""] = map("postwin.toggle", "i"), [""] = map("postwin.clear", { "n", "i" }), [""] = map("signature.show", { "n", "i" }), [""] = map("sclang.hard_stop", { "n", "x", "i" }), ["st"] = map("sclang.start"), ["sk"] = map("sclang.recompile"), [""] = map_expr("s.boot"), [""] = map_expr("s.meter"), }, editor = { highlight = { color = "IncSearch", }, }, postwin = { float = { enabled = true, }, }, }) end)