-- ┌─────────────────────────┐ -- │ 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 = Config.now_if_args -- Tree-sitter ================================================================ -- Tree-sitter is a tool for fast incremental parsing. It converts text into -- a hierarchical structure (called tree) that can be used to implement advanced -- and/or more precise actions: syntax highlighting, textobjects, indent, etc. -- -- Tree-sitter support is built into Neovim (see `:h treesitter`). However, it -- requires two extra pieces that don't come with Neovim directly: -- - Language parsers: programs that convert text into trees. Some are built-in -- (like for Lua), 'nvim-treesitter' provides many others. -- NOTE: It requires third party software to build and install parsers. -- See the link for more info in "Requirements" section of the MiniMax README. -- - Query files: definitions of how to extract information from trees in -- a useful manner (see `:h treesitter-query`). 'nvim-treesitter' also provides -- these, while 'nvim-treesitter-textobjects' provides the ones for Neovim -- textobjects (see `:h text-objects`, `:h MiniAi.gen_spec.treesitter()`). -- -- Add these plugins now if file (and not 'mini.starter') is shown after startup. -- -- Troubleshooting: -- - Run `:checkhealth vim.treesitter nvim-treesitter` to see potential issues. -- - In case of errors related to queries for Neovim bundled parsers (like `lua`, -- `vimdoc`, `markdown`, etc.), manually install them via 'nvim-treesitter' -- with `:TSInstall `. Be sure to have necessary system dependencies -- (see MiniMax README section for software requirements). 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 }, -- Pin to the commit just before the plugin dropped Neovim=0.10 support checkout = '42fc28ba918343ebfd5565147a42a26580579482', }) add({ source = 'nvim-treesitter/nvim-treesitter-textobjects', -- Pin to the commit corresponding to 'nvim-treesitter' commit checkout = 'b0debd5c424969b4baeabdc8f54db3036c691732', }) -- Define languages which will have parsers installed and auto enabled -- After changing this, restart Neovim once to install necessary parsers. Wait -- for the installation to finish before opening a file for added language(s). local languages = { -- These are already pre-installed with Neovim. Used as an example. 'lua', 'vimdoc', 'markdown', -- Add here more languages with which you want to use tree-sitter -- To see available languages: -- - Execute `:=require('nvim-treesitter.parsers').available_parsers()` } require('nvim-treesitter.configs').setup({ ensure_installed = languages, highlight = { enable = true }, -- Disable incremental selection in favor of 'mini.ai' incremental_selection = { enable = false }, -- Disable custom textobjects mappings in favor of 'mini.ai' textobjects = { enable = false }, -- Disable tree-sitter based indent since it is somewhat unreliable indent = { enable = false }, }) end) -- Language servers =========================================================== -- Language Server Protocol (LSP) is a set of conventions that power creation of -- language specific tools. It requires two parts: -- - Server - program that performs language specific computations. -- - Client - program that asks server for computations and shows results. -- -- Here Neovim itself is a client (see `:h vim.lsp`). Language servers need to -- be installed separately based on your OS, CLI tools, and preferences. -- See note about 'mason.nvim' at the bottom of the file. -- -- Neovim's team collects commonly used configurations for most language servers -- inside 'neovim/nvim-lspconfig' plugin. NOTE: it got significant overhaul -- to use a `vim.lsp.config` approach on Neovim>=0.11. So to use this plugin it -- is highly recommended to update Neovim to at least 0.11 version. -- -- Add it now if file (and not 'mini.starter') is shown after startup. -- -- Troubleshooting: -- - Run `:checkhealth vim.lsp` to see potential issues. now_if_args(function() add({ source = 'neovim/nvim-lspconfig', -- Pin to the commit just before the plugin dropped Neovim=0.10 support -- At this point it is already in the middle of migrating to the -- `vim.lsp.config` approach in Neovim>=0.11, so its help is already ahead. checkout = '5bfcc89fd155b4ffc02d18ab3b7d19c2d4e246a7', }) -- Per server configuration is done by explicitly setting up target servers -- like `require('lspconfig')..setup({ ... })`. Instead of `...`, -- supply per-server configuration. Below is an example of setting up `lua_ls`. -- Uncomment it to enable LSP server (if installed) for Lua files. -- require('lspconfig').lua_ls.setup({ -- on_attach = function(client, bufnr) -- -- Adjust per-client settings and capabilities. For example, trim very long -- -- list of completion triggers for better 'mini.completion' experience -- client.server_capabilities.completionProvider.triggerCharacters = { '.', ':' } -- end, -- settings = { -- Lua = { -- runtime = { version = 'LuaJIT', path = vim.split(package.path, ';') }, -- }, -- }, -- }) end) -- Formatting ================================================================= -- Programs dedicated to text formatting (a.k.a. formatters) are very useful. -- Neovim has built-in tools for text formatting (see `:h gq` and `:h 'formatprg'`). -- They can be used to configure external programs, but it might become tedious. -- -- The 'stevearc/conform.nvim' plugin is a good and maintained solution for easier -- formatting setup. later(function() add('stevearc/conform.nvim') -- See also: -- - `:h Conform` -- - `:h conform-options` -- - `:h conform-formatters` require('conform').setup({ default_format_opts = { -- Allow formatting from LSP server if no dedicated formatter is available lsp_format = 'fallback', }, -- Map of filetype to formatters -- Make sure that necessary CLI tool is available -- formatters_by_ft = { lua = { 'stylua' } }, }) end) -- Snippets =================================================================== -- Although 'mini.snippets' provides functionality to manage snippet files, it -- deliberately doesn't come with those. -- -- The 'rafamadriz/friendly-snippets' is currently the largest collection of -- snippet files. They are organized in 'snippets/' directory (mostly) per language. -- 'mini.snippets' is designed to work with it as seamlessly as possible. -- See `:h MiniSnippets.gen_loader.from_lang()`. later(function() add('rafamadriz/friendly-snippets') end) -- Honorable mentions ========================================================= -- 'mason-org/mason.nvim' (a.k.a. "Mason") is a great tool (package manager) for -- installing external language servers, formatters, and linters. It provides -- a unified interface for installing, updating, and deleting such programs. -- -- The caveat is that these programs will be set up to be mostly used inside Neovim. -- If you need them to work elsewhere, consider using other package managers. -- -- You can use it like so: -- now_if_args(function() -- add('mason-org/mason.nvim') -- require('mason').setup() -- end) -- Beautiful, usable, well maintained color schemes outside of 'mini.nvim' and -- have full support of its highlight groups. Use if you don't like 'miniwinter' -- enabled in 'plugin/30_mini.lua' or other suggested 'mini.hues' based ones. -- MiniDeps.now(function() -- -- Install only those that you need -- add('sainnhe/everforest') -- add('Shatur/neovim-ayu') -- add('ellisonleao/gruvbox.nvim') -- -- -- Enable only one -- vim.cmd('color everforest') -- end)