├── logo.png ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE │ ├── config.yml │ ├── documentation.yml │ └── bug-report.yml ├── configs ├── nvim-0.11 │ ├── after │ │ ├── snippets │ │ │ └── lua.json │ │ ├── lsp │ │ │ └── lua_ls.lua │ │ └── ftplugin │ │ │ └── markdown.lua │ ├── snippets │ │ └── global.json │ ├── init.lua │ └── plugin │ │ ├── 10_options.lua │ │ ├── 40_plugins.lua │ │ ├── 20_keymaps.lua │ │ └── 30_mini.lua └── README.md ├── .stylua.toml ├── CHANGELOG.md ├── LICENSE ├── setup.lua └── README.md /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nvim-mini/MiniMax/HEAD/logo.png -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | - [ ] This PR does not suggest changes based on personal taste (enabling new or changing value of existing option, install new plugin) 2 | -------------------------------------------------------------------------------- /configs/nvim-0.11/after/snippets/lua.json: -------------------------------------------------------------------------------- 1 | { 2 | "local": { "prefix": "l", "body": "local $1 = $0" }, 3 | "Remove prefixes": { "prefix": ["lfu", "ll", "lpca"] } 4 | } 5 | -------------------------------------------------------------------------------- /.stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 85 2 | line_endings = "Unix" 3 | indent_type = "Spaces" 4 | indent_width = 2 5 | quote_style = "AutoPreferSingle" 6 | call_parentheses = "Always" 7 | collapse_simple_statement = "Always" 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Question 4 | url: https://github.com/nvim-mini/MiniMax/discussions/new?category=q-a 5 | about: Ask about tweaking and usage of MiniMax 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.yml: -------------------------------------------------------------------------------- 1 | name: Documentation issue 2 | description: Report a documentation issue 3 | labels: [documentation] 4 | body: 5 | - type: textarea 6 | id: problem-description 7 | attributes: 8 | label: "Problem description" 9 | description: "Link to the problematic documentation and provide suggestion of you think it can be improved." 10 | validations: 11 | required: true 12 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2025-11-22 2 | 3 | - Update `fs` mapping to use `"workspace_symbol_live"` scope for `:Pick lsp` instead of `"workspace_symbol"` 4 | 5 | ## 2025-10-16 6 | 7 | - Move `now_if_args` startup helper to 'init.lua' as `_G.Config.now_if_args` to be directly usable from other config files. 8 | 9 | - Enable 'mini.misc' behind `now_if_args` instead of `now`. Otherwise `setup_auto_root()` and `setup_restore_cursor()` don't work on initial file(s) if Neovim is started as `nvim -- path/to/file`. 10 | 11 | ## 2025-10-13 12 | 13 | - Initial release. 14 | -------------------------------------------------------------------------------- /configs/nvim-0.11/snippets/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "Current datetime": { 3 | "prefix": "cdtm", 4 | "body": "$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND", 5 | "description": "Insert current datetime (YYYY-mm-dd HH:MM:SS)" 6 | }, 7 | "Current date": { 8 | "prefix": "cdate", 9 | "body": "$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE", 10 | "description": "Insert current date (YYYY-mm-dd)" 11 | }, 12 | "Current time": { 13 | "prefix": "ctime", 14 | "body": "$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND", 15 | "description": "Insert current time (HH:MM:SS)" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Evgeni Chasnovski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.yml: -------------------------------------------------------------------------------- 1 | name: Bug report 2 | description: Report an unexpected behavior of existing configs 3 | labels: [bug] 4 | body: 5 | - type: checkboxes 6 | id: guidelines 7 | attributes: 8 | label: Contributing guidelines 9 | options: 10 | - label: I reproduced this on latest version of the `main` branch 11 | required: true 12 | - type: dropdown 13 | id: nvim-version 14 | attributes: 15 | label: "Neovim version" 16 | description: "Choose the latest Neovim version on which you can reproduce the problem" 17 | multiple: false 18 | options: 19 | - 0.9.x 20 | - 0.10.x 21 | - 0.11.x 22 | - 0.12 (!at least latest Nightly build!) 23 | default: 2 24 | validations: 25 | required: true 26 | - type: textarea 27 | id: description 28 | attributes: 29 | label: "Description" 30 | description: "A short description of a problem; include expected behavior" 31 | validations: 32 | required: true 33 | - type: textarea 34 | id: reproduction 35 | attributes: 36 | label: "Reproduction" 37 | description: "Steps to reproduce the issue. Steps should assume that only clean set up was just done." 38 | validations: 39 | required: true 40 | -------------------------------------------------------------------------------- /configs/nvim-0.11/after/lsp/lua_ls.lua: -------------------------------------------------------------------------------- 1 | -- ┌────────────────────┐ 2 | -- │ LSP config example │ 3 | -- └────────────────────┘ 4 | -- 5 | -- This file contains configuration of 'lua_ls' language server. 6 | -- Source: https://github.com/LuaLS/lua-language-server 7 | -- 8 | -- It is used by `:h vim.lsp.enable()` and `:h vim.lsp.config()`. 9 | -- See `:h vim.lsp.Config` and `:h vim.lsp.ClientConfig` for all available fields. 10 | -- 11 | -- This config is designed for Lua's activity around Neovim. It provides only 12 | -- basic config and can be further improved. 13 | return { 14 | on_attach = function(client, buf_id) 15 | -- Reduce very long list of triggers for better 'mini.completion' experience 16 | client.server_capabilities.completionProvider.triggerCharacters = 17 | { '.', ':', '#', '(' } 18 | 19 | -- Use this function to define buffer-local mappings and behavior that depend 20 | -- on attached client or only makes sense if there is language server attached. 21 | end, 22 | -- LuaLS Structure of these settings comes from LuaLS, not Neovim 23 | settings = { 24 | Lua = { 25 | -- Define runtime properties. Use 'LuaJIT', as it is built into Neovim. 26 | runtime = { version = 'LuaJIT', path = vim.split(package.path, ';') }, 27 | workspace = { 28 | -- Don't analyze code from submodules 29 | ignoreSubmodules = true, 30 | -- Add Neovim's methods for easier code writing 31 | library = { vim.env.VIMRUNTIME }, 32 | }, 33 | }, 34 | }, 35 | } 36 | -------------------------------------------------------------------------------- /configs/nvim-0.11/after/ftplugin/markdown.lua: -------------------------------------------------------------------------------- 1 | -- ┌─────────────────────────┐ 2 | -- │ Filetype config example │ 3 | -- └─────────────────────────┘ 4 | -- 5 | -- This is an example of a configuration that will apply only to a particular 6 | -- filetype, which is the same as file's basename ('markdown' in this example; 7 | -- which is for '*.md' files). 8 | -- 9 | -- It can contain any code which will be usually executed when the file is opened 10 | -- (strictly speaking, on every 'filetype' option value change to target value). 11 | -- Usually it needs to define buffer/window local options and variables. 12 | -- So instead of `vim.o` to set options, use `vim.bo` for buffer-local options and 13 | -- `vim.cmd('setlocal ...')` for window-local options (currently more robust). 14 | -- 15 | -- This is also a good place to set buffer-local 'mini.nvim' variables. 16 | -- See `:h mini.nvim-buffer-local-config` and `:h mini.nvim-disabling-recipes`. 17 | 18 | -- Enable spelling and wrap for window 19 | vim.cmd('setlocal spell wrap') 20 | 21 | -- Fold with tree-sitter 22 | vim.cmd('setlocal foldmethod=expr foldexpr=v:lua.vim.treesitter.foldexpr()') 23 | 24 | -- Disable built-in `gO` mapping in favor of 'mini.basics' 25 | vim.keymap.del('n', 'gO', { buffer = 0 }) 26 | 27 | -- Set markdown-specific surrounding in 'mini.surround' 28 | vim.b.minisurround_config = { 29 | custom_surroundings = { 30 | -- Markdown link. Common usage: 31 | -- `saiwL` + [type/paste link] + - add link 32 | -- `sdL` - delete link 33 | -- `srLL` + [type/paste link] + - replace link 34 | L = { 35 | input = { '%[().-()%]%(.-%)' }, 36 | output = function() 37 | local link = require('mini.surround').user_input('Link: ') 38 | return { left = '[', right = '](' .. link .. ')' } 39 | end, 40 | }, 41 | }, 42 | } 43 | -------------------------------------------------------------------------------- /setup.lua: -------------------------------------------------------------------------------- 1 | -- Determine the correct MiniMax version (if any) 2 | local version 3 | if vim.fn.has('nvim-0.11') == 1 then version = 'nvim-0.11' end 4 | if version == nil then 5 | print('There is no available MiniMax version. Try updating Neovim.\n') 6 | return 7 | end 8 | 9 | local script_dir = vim.fs.dirname((_G.arg or {})[0]) or vim.fn.getcwd() 10 | local version_dir = script_dir .. '/configs/' .. version 11 | 12 | -- Ensure proper config directory 13 | local config_dir = 14 | vim.fn.fnamemodify(vim.fn.stdpath('config'), ':p'):gsub('[\\/]+$', '') 15 | vim.fn.mkdir(config_dir, 'p') 16 | 17 | local backup_dir = config_dir .. '/MiniMax-backup' 18 | if vim.loop.fs_stat(backup_dir) ~= nil then 19 | print( 20 | 'MiniMax backup directory is already present: ' 21 | .. backup_dir 22 | .. '\nManage it first (go through it; preserve what is needed; delete it),' 23 | .. 'before attempting another installation\n' 24 | ) 25 | return 26 | end 27 | 28 | -- Safely (no delete) copy to config directory. Backup conflicting files. 29 | local backup 30 | backup = function(rel_path) 31 | local from = config_dir .. '/' .. rel_path 32 | local to = backup_dir .. '/' .. rel_path 33 | if vim.loop.fs_stat(from) == nil then return end 34 | 35 | vim.fn.mkdir(vim.fs.dirname(to), 'p') 36 | if vim.fn.isdirectory(from) == 0 then 37 | vim.loop.fs_rename(from, to) 38 | print('Backed up:\n ' .. from) 39 | return 40 | end 41 | 42 | for f, _ in vim.fs.dir(from) do 43 | backup(rel_path .. '/' .. f) 44 | end 45 | vim.loop.fs_rmdir(from) -- Remove already empty directory 46 | end 47 | 48 | local safely_copy 49 | safely_copy = function(rel_path, skip_if_present) 50 | local from = version_dir .. '/' .. rel_path 51 | local to = config_dir .. '/' .. rel_path 52 | if skip_if_present and vim.loop.fs_stat(to) ~= nil then 53 | print('Skipped copy:\n ' .. rel_path) 54 | return 55 | end 56 | 57 | backup(rel_path) 58 | 59 | vim.fn.mkdir(vim.fs.dirname(to), 'p') 60 | if vim.fn.isdirectory(from) == 0 then 61 | vim.loop.fs_copyfile(from, to) 62 | return 63 | end 64 | 65 | for f, _ in vim.fs.dir(from) do 66 | safely_copy(rel_path .. '/' .. f) 67 | end 68 | end 69 | 70 | safely_copy('init.lua') 71 | safely_copy('plugin') -- Back up whole 'plugin/' directory to avoid config conflicts 72 | safely_copy('after/ftplugin/markdown.lua', true) -- Prefer user's existing files 73 | safely_copy('after/lsp/lua_ls.lua', true) 74 | safely_copy('after/snippets/lua.json', true) 75 | safely_copy('snippets/global.json', true) 76 | 77 | -- Possibly Git init. It is a good practice and helps with root detection. 78 | if vim.loop.fs_stat(config_dir .. '/.git') == nil then 79 | vim.fn.system({ 'git', '-C', config_dir, 'init' }) 80 | vim.fn.system({ 'git', '-C', config_dir, 'add', '*' }) 81 | vim.fn.system({ 'git', '-C', config_dir, 'commit', '-m', 'feat: set up MiniMax' }) 82 | end 83 | 84 | print('Set up MiniMax config at ' .. config_dir) 85 | -------------------------------------------------------------------------------- /configs/README.md: -------------------------------------------------------------------------------- 1 | ## MiniMax configs 2 | 3 | Available: 4 | 5 | - [`nvim-0.11`](nvim-0.11) - for Neovim>=0.11 6 | 7 | Planned (after small time of 'nvim-0.11' public testing): 8 | 9 | - [`nvim-0.9`](nvim-0.9) - for Neovim>=0.9 10 | - [`nvim-0.10`](nvim-0.10) - for Neovim>=0.10 11 | - [`nvim-0.12`](nvim-0.12) - for Neovim>=0.12 12 | 13 | ### Structure 14 | 15 | #### `init.lua` 16 | 17 | Initial file executed first during startup. 18 | 19 | #### `plugin/` 20 | 21 | Files automatically executed in alphabetical order during startup: 22 | 23 | - `10_options.lua` - built-in Neovim behavior. 24 | - `20_keymaps.lua` - custom mappings, mostly for the [`:h `](https://neovim.io/doc/user/helptag.html?tag=) key. 25 | - `30_mini.lua` - MINI configuration. 26 | - `40_plugins.lua` - plugins outside of MINI. 27 | 28 | > [!NOTE] 29 | > Many configurations prefer to use the 'lua/' directory with explicit `require()` calls to modularize their config. It is okay to use, but has a drawback that it occupies 'lua' namespace. As it is shared across all plugins, it might lead to conflicts during `require()`. Usually solved by having config files inside a dedicated "user" directory like 'lua/username'. 30 | > 31 | > The 'plugin/' approach doesn't have this issue. It also doesn't need explicit `require()` calls inside 'init.lua' for files to be executed. 32 | 33 | > [!TIP] 34 | > For more details about this approach, see [`:h load-plugins`](https://neovim.io/doc/user/helptag.html?tag=load-plugins). In particular: 35 | > - Subdirectories are allowed. Their files are also sourced in alphabetical order. 36 | > - 'plugin/' files still get executed if Neovim is started with `nvim -u path/to/file`. Make sure to also pass `--noplugin` or use [`:h $NVIM_APPNAME`](https://neovim.io/doc/user/helptag.html?tag=$NVIM_APPNAME) approach. 37 | 38 | #### `snippets/` 39 | 40 | User defined snippets. Contains a single 'global.json' file as a demo (used in the 'mini.snippets' setup). 41 | 42 | #### `after/` 43 | 44 | Files for overriding behavior added by plugins. Usually located inside special subdirectories like 'ftplugin/' (see [`:h 'runtimepath'`](https://neovim.io/doc/user/helptag.html?tag='runtimepath')). Files from this directory take effect after similar files provided by plugins. 45 | 46 | For demonstration purposes, it contains examples of common ways to use 'after/'. 47 | 48 | ##### `after/ftplugin/` 49 | 50 | Filetype plugins. Contains files that are sourced when [`:h 'filetype'`](https://neovim.io/doc/user/helptag.html?tag='filetype') option is set. 51 | 52 | For example, '\*.txt' files have `text` filetype, so 'ftplugin/text.lua' is sourced when '\*.txt' file is opened. It defines behavior that should exist only in `text` files. 53 | 54 | ##### `after/lsp/` (for Neovim>=0.11) 55 | 56 | Files that configure LSP servers. These are used by Neovim's built-in [`:h vim.lsp.config()`](https://neovim.io/doc/user/helptag.html?tag=vim.lsp.config()) and [`:h vim.lsp.enable()`](https://neovim.io/doc/user/helptag.html?tag=vim.lsp.enable()). See also [`:h lsp-quickstart`](https://neovim.io/doc/user/helptag.html?tag=lsp-quickstart) for more details. 57 | 58 | For example, the 'lsp/lua_ls.lua' file defines part of configuration that will be used during `vim.lsp.enable({ 'lua_ls' })` (i.e. with the same name). 59 | 60 | ##### `after/snippets/` 61 | 62 | Files containing snippet definition per language. Used by ['mini.snippets'](https://nvim-mini.org/mini.nvim/doc/mini-snippets.html). As they are located in 'after/', they override any snippets provided by plugins (like 'rafamadriz/friendly-snippets'). 63 | 64 | For example, based on 'snippets/lua.json', typing `l` + `` in Insert mode inside Lua files will always insert `local $1 = $0` snippet. No matter if any other snippet provider contains this or conflicting snippet. 65 | -------------------------------------------------------------------------------- /configs/nvim-0.11/init.lua: -------------------------------------------------------------------------------- 1 | -- ┌────────────────────┐ 2 | -- │ Welcome to MiniMax │ 3 | -- └────────────────────┘ 4 | -- 5 | -- This is a config designed to mostly use MINI. It provides out of the box 6 | -- a stable, polished, and feature rich Neovim experience. Its structure: 7 | -- 8 | -- ├ init.lua Initial (this) file executed during startup 9 | -- ├ plugin/ Files automatically sourced during startup 10 | -- ├── 10_options.lua Built-in Neovim behavior 11 | -- ├── 20_keymaps.lua Custom mappings 12 | -- ├── 30_mini.lua MINI configuration 13 | -- ├── 40_plugins.lua Plugins outside of MINI 14 | -- ├ snippets/ User defined snippets (has demo file) 15 | -- ├ after/ Files to override behavior added by plugins 16 | -- ├── ftplugin/ Files for filetype behavior (has demo file) 17 | -- ├── lsp/ Language server configurations (has demo file) 18 | -- ├── snippets/ Higher priority snippet files (has demo file) 19 | -- 20 | -- Config files are meant to be read, preferably inside a Neovim instance running 21 | -- this config and opened at its root. This will help you better understand your 22 | -- setup. Start with this file. Any order is possible, prefer the one listed above. 23 | -- Ways of navigating your config: 24 | -- - `` + `e` + (one of) `iokmp` - edit 'init.lua' or 'plugin/' files. 25 | -- - Inside config directory: `ff` (picker) or `ed` (explorer) 26 | -- - Navigate existing buffers with `[b`, `]b`, or `fb`. 27 | -- 28 | -- Config files are also meant to be customized. Initially it is a baseline of 29 | -- a working config based on MINI. Modify it to make it yours. Some approaches: 30 | -- - Modify already existing files in a way that keeps them consistent. 31 | -- - Add new files in a way that keeps config consistent. 32 | -- Usually inside 'plugin/' or 'after/'. 33 | -- 34 | -- Documentation comments like this can be found throughout the config. 35 | -- Common conventions: 36 | -- 37 | -- - See `:h key-notation` for key notation used. 38 | -- - `:h xxx` means "documentation of helptag xxx". Either type text directly 39 | -- followed by Enter or type `fh` to open a helptag fuzzy picker. 40 | -- - "Type `fh`" means "press , followed by f, followed by h". 41 | -- Unless said otherwise, it assumes that Normal mode is current. 42 | -- - "See 'path/to/file'" means see open file at described path and read it. 43 | -- - `:SomeCommand ...` or `:lua ...` means execute mentioned command. 44 | 45 | -- Bootstrap 'mini.nvim' manually in a way that it gets managed by 'mini.deps' 46 | local mini_path = vim.fn.stdpath('data') .. '/site/pack/deps/start/mini.nvim' 47 | if not vim.loop.fs_stat(mini_path) then 48 | vim.cmd('echo "Installing `mini.nvim`" | redraw') 49 | local origin = 'https://github.com/nvim-mini/mini.nvim' 50 | local clone_cmd = { 'git', 'clone', '--filter=blob:none', origin, mini_path } 51 | vim.fn.system(clone_cmd) 52 | vim.cmd('packadd mini.nvim | helptags ALL') 53 | vim.cmd('echo "Installed `mini.nvim`" | redraw') 54 | end 55 | 56 | -- Plugin manager. Set up immediately for `now()`/`later()` helpers. 57 | -- Example usage: 58 | -- - `MiniDeps.add('...')` - use inside config to add a plugin 59 | -- - `:DepsUpdate` - update all plugins 60 | -- - `:DepsSnapSave` - save a snapshot of currently active plugins 61 | -- 62 | -- See also: 63 | -- - `:h MiniDeps-overview` - how to use it 64 | -- - `:h MiniDeps-commands` - all available commands 65 | -- - 'plugin/30_mini.lua' - more details about 'mini.nvim' in general 66 | require('mini.deps').setup() 67 | 68 | -- Define config table to be able to pass data between scripts 69 | _G.Config = {} 70 | 71 | -- Define custom autocommand group and helper to create an autocommand. 72 | -- Autocommands are Neovim's way to define actions that are executed on events 73 | -- (like creating a buffer, setting an option, etc.). 74 | -- 75 | -- See also: 76 | -- - `:h autocommand` 77 | -- - `:h nvim_create_augroup()` 78 | -- - `:h nvim_create_autocmd()` 79 | local gr = vim.api.nvim_create_augroup('custom-config', {}) 80 | _G.Config.new_autocmd = function(event, pattern, callback, desc) 81 | local opts = { group = gr, pattern = pattern, callback = callback, desc = desc } 82 | vim.api.nvim_create_autocmd(event, opts) 83 | end 84 | 85 | -- Some plugins and 'mini.nvim' modules only need setup during startup if Neovim 86 | -- is started like `nvim -- path/to/file`, otherwise delaying setup is fine 87 | _G.Config.now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later 88 | -------------------------------------------------------------------------------- /configs/nvim-0.11/plugin/10_options.lua: -------------------------------------------------------------------------------- 1 | -- ┌──────────────────────────┐ 2 | -- │ Built-in Neovim behavior │ 3 | -- └──────────────────────────┘ 4 | -- 5 | -- This file defines Neovim's built-in behavior. The goal is to improve overall 6 | -- usability in a way that works best with MINI. 7 | -- 8 | -- Here `vim.o.xxx = value` sets default value of option `xxx` to `value`. 9 | -- See `:h 'xxx'` (replace `xxx` with actual option name). 10 | -- 11 | -- Option values can be customized on per buffer or window basis. 12 | -- See 'after/ftplugin/' for common example. 13 | 14 | -- stylua: ignore start 15 | -- The next part (until `-- stylua: ignore end`) is aligned manually for easier 16 | -- reading. Consider preserving this or remove `-- stylua` lines to autoformat. 17 | 18 | -- General ==================================================================== 19 | vim.g.mapleader = ' ' -- Use `` as key 20 | 21 | vim.o.mouse = 'a' -- Enable mouse 22 | vim.o.mousescroll = 'ver:25,hor:6' -- Customize mouse scroll 23 | vim.o.switchbuf = 'usetab' -- Use already opened buffers when switching 24 | vim.o.undofile = true -- Enable persistent undo 25 | 26 | vim.o.shada = "'100,<50,s10,:1000,/100,@100,h" -- Limit ShaDa file (for startup) 27 | 28 | -- Enable all filetype plugins and syntax (if not enabled, for better startup) 29 | vim.cmd('filetype plugin indent on') 30 | if vim.fn.exists('syntax_on') ~= 1 then vim.cmd('syntax enable') end 31 | 32 | -- UI ========================================================================= 33 | vim.o.breakindent = true -- Indent wrapped lines to match line start 34 | vim.o.breakindentopt = 'list:-1' -- Add padding for lists (if 'wrap' is set) 35 | vim.o.colorcolumn = '+1' -- Draw column on the right of maximum width 36 | vim.o.cursorline = true -- Enable current line highlighting 37 | vim.o.linebreak = true -- Wrap lines at 'breakat' (if 'wrap' is set) 38 | vim.o.list = true -- Show helpful text indicators 39 | vim.o.number = true -- Show line numbers 40 | vim.o.pumheight = 10 -- Make popup menu smaller 41 | vim.o.ruler = false -- Don't show cursor coordinates 42 | vim.o.shortmess = 'CFOSWaco' -- Disable some built-in completion messages 43 | vim.o.showmode = false -- Don't show mode in command line 44 | vim.o.signcolumn = 'yes' -- Always show signcolumn (less flicker) 45 | vim.o.splitbelow = true -- Horizontal splits will be below 46 | vim.o.splitkeep = 'screen' -- Reduce scroll during window split 47 | vim.o.splitright = true -- Vertical splits will be to the right 48 | vim.o.winborder = 'single' -- Use border in floating windows 49 | vim.o.wrap = false -- Don't visually wrap lines (toggle with \w) 50 | 51 | vim.o.cursorlineopt = 'screenline,number' -- Show cursor line per screen line 52 | 53 | -- Special UI symbols. More is set via 'mini.basics' later. 54 | vim.o.fillchars = 'eob: ,fold:╌' 55 | vim.o.listchars = 'extends:…,nbsp:␣,precedes:…,tab:> ' 56 | 57 | -- Folds (see `:h fold-commands`, `:h zM`, `:h zR`, `:h zA`, `:h zj`) 58 | vim.o.foldlevel = 10 -- Fold nothing by default; set to 0 or 1 to fold 59 | vim.o.foldmethod = 'indent' -- Fold based on indent level 60 | vim.o.foldnestmax = 10 -- Limit number of fold levels 61 | vim.o.foldtext = '' -- Show text under fold with its highlighting 62 | 63 | -- Editing ==================================================================== 64 | vim.o.autoindent = true -- Use auto indent 65 | vim.o.expandtab = true -- Convert tabs to spaces 66 | vim.o.formatoptions = 'rqnl1j'-- Improve comment editing 67 | vim.o.ignorecase = true -- Ignore case during search 68 | vim.o.incsearch = true -- Show search matches while typing 69 | vim.o.infercase = true -- Infer case in built-in completion 70 | vim.o.shiftwidth = 2 -- Use this number of spaces for indentation 71 | vim.o.smartcase = true -- Respect case if search pattern has upper case 72 | vim.o.smartindent = true -- Make indenting smart 73 | vim.o.spelloptions = 'camel' -- Treat camelCase word parts as separate words 74 | vim.o.tabstop = 2 -- Show tab as this number of spaces 75 | vim.o.virtualedit = 'block' -- Allow going past end of line in blockwise mode 76 | 77 | vim.o.iskeyword = '@,48-57,_,192-255,-' -- Treat dash as `word` textobject part 78 | 79 | -- Pattern for a start of numbered list (used in `gw`). This reads as 80 | -- "Start of list item is: at least one special character (digit, -, +, *) 81 | -- possibly followed by punctuation (. or `)`) followed by at least one space". 82 | vim.o.formatlistpat = [[^\s*[0-9\-\+\*]\+[\.\)]*\s\+]] 83 | 84 | -- Built-in completion 85 | vim.o.complete = '.,w,b,kspell' -- Use less sources 86 | vim.o.completeopt = 'menuone,noselect,fuzzy,nosort' -- Use custom behavior 87 | 88 | -- Autocommands =============================================================== 89 | 90 | -- Don't auto-wrap comments and don't insert comment leader after hitting 'o'. 91 | -- Do on `FileType` to always override these changes from filetype plugins. 92 | local f = function() vim.cmd('setlocal formatoptions-=c formatoptions-=o') end 93 | _G.Config.new_autocmd('FileType', nil, f, "Proper 'formatoptions'") 94 | 95 | -- There are other autocommands created by 'mini.basics'. See 'plugin/30_mini.lua'. 96 | 97 | -- Diagnostics ================================================================ 98 | 99 | -- Neovim has built-in support for showing diagnostic messages. This configures 100 | -- a more conservative display while still being useful. 101 | -- See `:h vim.diagnostic` and `:h vim.diagnostic.config()`. 102 | local diagnostic_opts = { 103 | -- Show signs on top of any other sign, but only for warnings and errors 104 | signs = { priority = 9999, severity = { min = 'WARN', max = 'ERROR' } }, 105 | 106 | -- Show all diagnostics as underline (for their messages type `ld`) 107 | underline = { severity = { min = 'HINT', max = 'ERROR' } }, 108 | 109 | -- Show more details immediately for errors on the current line 110 | virtual_lines = false, 111 | virtual_text = { 112 | current_line = true, 113 | severity = { min = 'ERROR', max = 'ERROR' }, 114 | }, 115 | 116 | -- Don't update diagnostics when typing 117 | update_in_insert = false, 118 | } 119 | 120 | -- Use `later()` to avoid sourcing `vim.diagnostic` on startup 121 | MiniDeps.later(function() vim.diagnostic.config(diagnostic_opts) end) 122 | -- stylua: ignore end 123 | -------------------------------------------------------------------------------- /configs/nvim-0.11/plugin/40_plugins.lua: -------------------------------------------------------------------------------- 1 | -- ┌─────────────────────────┐ 2 | -- │ Plugins outside of MINI │ 3 | -- └─────────────────────────┘ 4 | -- 5 | -- This file contains installation and configuration of plugins outside of MINI. 6 | -- They significantly improve user experience in a way not yet possible with MINI. 7 | -- These are mostly plugins that provide programming language specific behavior. 8 | -- 9 | -- Use this file to install and configure other such plugins. 10 | 11 | -- Make concise helpers for installing/adding plugins in two stages 12 | local add, later = MiniDeps.add, MiniDeps.later 13 | local now_if_args = _G.Config.now_if_args 14 | 15 | -- Tree-sitter ================================================================ 16 | 17 | -- Tree-sitter is a tool for fast incremental parsing. It converts text into 18 | -- a hierarchical structure (called tree) that can be used to implement advanced 19 | -- and/or more precise actions: syntax highlighting, textobjects, indent, etc. 20 | -- 21 | -- Tree-sitter support is built into Neovim (see `:h treesitter`). However, it 22 | -- requires two extra pieces that don't come with Neovim directly: 23 | -- - Language parsers: programs that convert text into trees. Some are built-in 24 | -- (like for Lua), 'nvim-treesitter' provides many others. 25 | -- NOTE: It requires third party software to build and install parsers. 26 | -- See the link for more info in "Requirements" section of the MiniMax README. 27 | -- - Query files: definitions of how to extract information from trees in 28 | -- a useful manner (see `:h treesitter-query`). 'nvim-treesitter' also provides 29 | -- these, while 'nvim-treesitter-textobjects' provides the ones for Neovim 30 | -- textobjects (see `:h text-objects`, `:h MiniAi.gen_spec.treesitter()`). 31 | -- 32 | -- Add these plugins now if file (and not 'mini.starter') is shown after startup. 33 | now_if_args(function() 34 | add({ 35 | source = 'nvim-treesitter/nvim-treesitter', 36 | -- Use `main` branch since `master` branch is frozen, yet still default 37 | checkout = 'main', 38 | -- Update tree-sitter parser after plugin is updated 39 | hooks = { post_checkout = function() vim.cmd('TSUpdate') end }, 40 | }) 41 | add({ 42 | source = 'nvim-treesitter/nvim-treesitter-textobjects', 43 | -- Same logic as for 'nvim-treesitter' 44 | checkout = 'main', 45 | }) 46 | 47 | -- Define languages which will have parsers installed and auto enabled 48 | local languages = { 49 | -- These are already pre-installed with Neovim. Used as an example. 50 | 'lua', 51 | 'vimdoc', 52 | 'markdown', 53 | -- Add here more languages with which you want to use tree-sitter 54 | -- To see available languages: 55 | -- - Execute `:=require('nvim-treesitter').get_available()` 56 | -- - Visit 'SUPPORTED_LANGUAGES.md' file at 57 | -- https://github.com/nvim-treesitter/nvim-treesitter/blob/main 58 | } 59 | local isnt_installed = function(lang) 60 | return #vim.api.nvim_get_runtime_file('parser/' .. lang .. '.*', false) == 0 61 | end 62 | local to_install = vim.tbl_filter(isnt_installed, languages) 63 | if #to_install > 0 then require('nvim-treesitter').install(to_install) end 64 | 65 | -- Enable tree-sitter after opening a file for a target language 66 | local filetypes = {} 67 | for _, lang in ipairs(languages) do 68 | for _, ft in ipairs(vim.treesitter.language.get_filetypes(lang)) do 69 | table.insert(filetypes, ft) 70 | end 71 | end 72 | local ts_start = function(ev) vim.treesitter.start(ev.buf) end 73 | _G.Config.new_autocmd('FileType', filetypes, ts_start, 'Start tree-sitter') 74 | end) 75 | 76 | -- Language servers =========================================================== 77 | 78 | -- Language Server Protocol (LSP) is a set of conventions that power creation of 79 | -- language specific tools. It requires two parts: 80 | -- - Server - program that performs language specific computations. 81 | -- - Client - program that asks server for computations and shows results. 82 | -- 83 | -- Here Neovim itself is a client (see `:h vim.lsp`). Language servers need to 84 | -- be installed separately based on your OS, CLI tools, and preferences. 85 | -- See note about 'mason.nvim' at the bottom of the file. 86 | -- 87 | -- Neovim's team collects commonly used configurations for most language servers 88 | -- inside 'neovim/nvim-lspconfig' plugin. 89 | -- 90 | -- Add it now if file (and not 'mini.starter') is shown after startup. 91 | now_if_args(function() 92 | add('neovim/nvim-lspconfig') 93 | 94 | -- Use `:h vim.lsp.enable()` to automatically enable language server based on 95 | -- the rules provided by 'nvim-lspconfig'. 96 | -- Use `:h vim.lsp.config()` or 'after/lsp/' directory to configure servers. 97 | -- Uncomment and tweak the following `vim.lsp.enable()` call to enable servers. 98 | -- vim.lsp.enable({ 99 | -- -- For example, if `lua-language-server` is installed, use `'lua_ls'` entry 100 | -- }) 101 | end) 102 | 103 | -- Formatting ================================================================= 104 | 105 | -- Programs dedicated to text formatting (a.k.a. formatters) are very useful. 106 | -- Neovim has built-in tools for text formatting (see `:h gq` and `:h 'formatprg'`). 107 | -- They can be used to configure external programs, but it might become tedious. 108 | -- 109 | -- The 'stevearc/conform.nvim' plugin is a good and maintained solution for easier 110 | -- formatting setup. 111 | later(function() 112 | add('stevearc/conform.nvim') 113 | 114 | -- See also: 115 | -- - `:h Conform` 116 | -- - `:h conform-options` 117 | -- - `:h conform-formatters` 118 | require('conform').setup({ 119 | -- Map of filetype to formatters 120 | -- Make sure that necessary CLI tool is available 121 | -- formatters_by_ft = { lua = { 'stylua' } }, 122 | }) 123 | end) 124 | 125 | -- Snippets =================================================================== 126 | 127 | -- Although 'mini.snippets' provides functionality to manage snippet files, it 128 | -- deliberately doesn't come with those. 129 | -- 130 | -- The 'rafamadriz/friendly-snippets' is currently the largest collection of 131 | -- snippet files. They are organized in 'snippets/' directory (mostly) per language. 132 | -- 'mini.snippets' is designed to work with it as seamlessly as possible. 133 | -- See `:h MiniSnippets.gen_loader.from_lang()`. 134 | later(function() add('rafamadriz/friendly-snippets') end) 135 | 136 | -- Honorable mentions ========================================================= 137 | 138 | -- 'mason-org/mason.nvim' (a.k.a. "Mason") is a great tool (package manager) for 139 | -- installing external language servers, formatters, and linters. It provides 140 | -- a unified interface for installing, updating, and deleting such programs. 141 | -- 142 | -- The caveat is that these programs will be set up to be mostly used inside Neovim. 143 | -- If you need them to work elsewhere, consider using other package managers. 144 | -- 145 | -- You can use it like so: 146 | -- later(function() 147 | -- add('mason-org/mason.nvim') 148 | -- require('mason').setup() 149 | -- end) 150 | 151 | -- Beautiful, usable, well maintained color schemes outside of 'mini.nvim' and 152 | -- have full support of its highlight groups. Use if you don't like 'miniwinter' 153 | -- enabled in 'plugin/30_mini.lua' or other suggested 'mini.hues' based ones. 154 | -- MiniDeps.now(function() 155 | -- -- Install only those that you need 156 | -- add('sainnhe/everforest') 157 | -- add('Shatur/neovim-ayu') 158 | -- add('ellisonleao/gruvbox.nvim') 159 | -- 160 | -- -- Enable only one 161 | -- vim.cmd('color everforest') 162 | -- end) 163 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

MiniMax

2 | 3 | ## Neovim with maximum MINI 4 | 5 | MiniMax is a collection of fully working self-contained Neovim configs. All of the them: 6 | 7 | - Use mostly MINI to showcase its capabilities. 8 | - Provide out of the box a stable, polished, and feature rich Neovim experience. 9 | - Share minimal structure with potential to build upon. 10 | - Contain extensively commented config files meant to be read. 11 | 12 | It can be automatically [set up](#setting-up), which uses the best suited config from [available ones](configs). 13 | 14 | See [change log](CHANGELOG.md) for a history of changes. 15 | 16 | If you find this project useful, please consider leaving a Github star. 17 | 18 | ### How it looks 19 | 20 | During setup 21 | Picker 22 | 23 | Clues 24 | File explorer 25 | 26 | ### What it is not 27 | 28 | It is not a "Neovim distribution", i.e. there are no automatic config updates. After your config is set up, it is yours to improve and update (which makes this approach more stable). You can still see how MiniMax itself gets updated (see [Updating](#updating) and [Change log](CHANGELOG.md)) and adjust the config accordingly. 29 | 30 | It is not a comprehensive guide on how to set up and use every Neovim feature and plugin. Most of the config parts are carefully chosen in order to reach a balance between stability and features. 31 | 32 | ### Requirements 33 | 34 | #### Software 35 | 36 | - [Neovim](https://neovim.io/) executable. Assumed to be named `nvim`. 37 | - [Git](https://git-scm.com/) executable. Assumed to be named `git`. 38 | - Operating system: any OS supported by Neovim. 39 | - Internet connection for downloading plugins. 40 | - (Optional, but recommended) [`ripgrep`](https://github.com/BurntSushi/ripgrep#installation). 41 | - (Optional, but recommended) Terminal emulator (or GUI) with [true colors](https://github.com/termstandard/colors#truecolor-support-in-output-devices) and [Nerd Font icons](https://www.nerdfonts.com/) support. No need for a full Nerd font, using [`NerdFontsSymbolsOnly`](https://github.com/ryanoasis/nerd-fonts/releases/latest) as a fallback is usually enough. 42 | - (Optional, but recommended) System requirements for [`main` branch of 'nvim-treesitter/nvim-treesitter' plugin](https://github.com/nvim-treesitter/nvim-treesitter/tree/main?tab=readme-ov-file#requirements). 43 | 44 | #### Knowledge 45 | 46 | Basic level of understanding of how to: 47 | 48 | - Use CLI (command line): open, navigate file system, execute commands, close. 49 | 50 | - Use Neovim: open, modal editing, reading help, close. If inside Neovim, type [`:h help.txt`](https://neovim.io/doc/user/helptag.html?tag=help.txt) (or click it if it is a link) followed by `` and it should guide you through understanding basics. 51 | 52 | Several personal recommendations (no need to read in full; be aware of their content): [`:h notation`](https://neovim.io/doc/user/helptag.html?tag=notation), [`:h key-notation`](https://neovim.io/doc/user/helptag.html?tag=key-notation), [`:h vim-modes`](https://neovim.io/doc/user/helptag.html?tag=vim-modes), [`:h mode-switching`](https://neovim.io/doc/user/helptag.html?tag=mode-switching), [`:h windows-intro`](https://neovim.io/doc/user/helptag.html?tag=windows-intro), [`:h vimtutor`](https://neovim.io/doc/user/helptag.html?tag=vimtutor) 53 | 54 | - Read help files from inside Neovim: notion of help tags, key notations, navigation. 55 | 56 | > [!TIP] 57 | > If already inside MiniMax config, press `` + `f` + `h` to fuzzy search across all help tags. 58 | 59 | - Read [Lua language](https://learnxinyminutes.com/lua/): variables, tables, function calls, iterations. See also [`:h lua-concepts`](https://neovim.io/doc/user/helptag.html?tag=lua-concepts) and [`:h lua-guide`](https://neovim.io/doc/user/helptag.html?tag=lua-guide). 60 | 61 | #### Motivation 62 | 63 | - It will be really helpful if you are mentally ready to read documentation and practice. If you are new to Neovim and/or MINI, it might feel like a lot. It gets easier the more you learn and practice. Without this you likely won't enjoy Neovim and MiniMax as much. 64 | 65 | ### Setting up 66 | 67 | This sets up temporary 'nvim-minimax' config and doesn't affect your regular config. To set up a full time config, remove all instances of `NVIM_APPNAME=nvim-minimax`. 68 | 69 | ```bash 70 | # Download 71 | git clone --filter=blob:none https://github.com/nvim-mini/MiniMax ./MiniMax 72 | 73 | # Set up config (copies config files and possibly initiates Git repository) 74 | NVIM_APPNAME=nvim-minimax nvim -l ./MiniMax/setup.lua 75 | 76 | # Start Neovim 77 | NVIM_APPNAME=nvim-minimax nvim 78 | 79 | # Wait for plugins to install (there should be no new notifications) 80 | 81 | # Enjoy your new config! 82 | # Start with reading its files. Type ``+`e`+`i` to open 'init.lua'. 83 | ``` 84 | 85 | Notes: 86 | 87 | - MiniMax project can be downloaded manually (like via GitHub UI). 88 | 89 | - With `NVIM_APPNAME=nvim-minimax` config directory is '\~/.config/nvim-minimax' on Unix and '\~/AppData/Local/nvim-minimax' on Windows. 90 | 91 | A full-time config directory is '\~/.config/nvim' on Unix and '\~/AppData/Local/nvim' on Windows. 92 | 93 | - If there are messages about backed up files during setup, it means the target config directory already contained files that are meant to come from MiniMax. Previous files were moved to `MiniMax-backup` directory. Review/restore them and delete the whole backup directory. 94 | 95 | - You can explore [MiniMax](configs) manually to find which (parts of) config examples suit you best. Read through the relevant config example (starting at 'init.lua') and use interesting parts in your already existing config. 96 | 97 | ### Updating 98 | 99 | MiniMax doesn't provide fully automatic updates of an already set up config. The recommended approach is to manually explore [configs](configs) and [change log](CHANGELOG.md) to see the changes. 100 | 101 | The closest approach to automatic updating is: 102 | 103 | ```bash 104 | # Pull updates of MiniMax itself 105 | git -C ./MiniMax pull 106 | 107 | # Run setup script again. Remove `NVIM_APPNAME=nvim-minimax` for full-time config 108 | NVIM_APPNAME=nvim-minimax nvim -l ./MiniMax/setup.lua 109 | 110 | # There probably be messages about backed up files: 111 | # 1. Examine 'MiniMax-backup' directory with conflicting files. 112 | # 2. Recover the ones you need. 113 | # 3. Delete the backup directory. 114 | ``` 115 | 116 | ### Similar projects 117 | 118 | - [nvim-lua/kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) 119 | 120 | - More automated approaches ("Neovim distributions"): 121 | - [LazyVim/LazyVim](https://github.com/LazyVim/LazyVim) 122 | - [NvChad/NvChad](https://github.com/NvChad/NvChad) 123 | - [AstroNvim/AstroNvim](https://github.com/AstroNvim/AstroNvim) 124 | -------------------------------------------------------------------------------- /configs/nvim-0.11/plugin/20_keymaps.lua: -------------------------------------------------------------------------------- 1 | -- ┌─────────────────┐ 2 | -- │ Custom mappings │ 3 | -- └─────────────────┘ 4 | -- 5 | -- This file contains definitions of custom general and Leader mappings. 6 | 7 | -- General mappings =========================================================== 8 | 9 | -- Use this section to add custom general mappings. See `:h vim.keymap.set()`. 10 | 11 | -- An example helper to create a Normal mode mapping 12 | local nmap = function(lhs, rhs, desc) 13 | -- See `:h vim.keymap.set()` 14 | vim.keymap.set('n', lhs, rhs, { desc = desc }) 15 | end 16 | 17 | -- Paste linewise before/after current line 18 | -- Usage: `yiw` to yank a word and `]p` to put it on the next line. 19 | nmap('[p', 'exe "put! " . v:register', 'Paste Above') 20 | nmap(']p', 'exe "put " . v:register', 'Paste Below') 21 | 22 | -- Many general mappings are created by 'mini.basics'. See 'plugin/30_mini.lua' 23 | 24 | -- stylua: ignore start 25 | -- The next part (until `-- stylua: ignore end`) is aligned manually for easier 26 | -- reading. Consider preserving this or remove `-- stylua` lines to autoformat. 27 | 28 | -- Leader mappings ============================================================ 29 | 30 | -- Neovim has the concept of a Leader key (see `:h `). It is a configurable 31 | -- key that is primarily used for "workflow" mappings (opposed to text editing). 32 | -- Like "open file explorer", "create scratch buffer", "pick from buffers". 33 | -- 34 | -- In 'plugin/10_options.lua' is set to , i.e. press 35 | -- whenever there is a suggestion to press . 36 | -- 37 | -- This config uses a "two key Leader mappings" approach: first key describes 38 | -- semantic group, second key executes an action. Both keys are usually chosen 39 | -- to create some kind of mnemonic. 40 | -- Example: `f` groups "find" type of actions; `ff` - find files. 41 | -- Use this section to add Leader mappings in a structural manner. 42 | -- 43 | -- Usually if there are global and local kinds of actions, lowercase second key 44 | -- denotes global and uppercase - local. 45 | -- Example: `fs` / `fS` - find workspace/document LSP symbols. 46 | -- 47 | -- Many of the mappings use 'mini.nvim' modules set up in 'plugin/30_mini.lua'. 48 | 49 | -- Create a global table with information about Leader groups in certain modes. 50 | -- This is used to provide 'mini.clue' with extra clues. 51 | -- Add an entry if you create a new group. 52 | _G.Config.leader_group_clues = { 53 | { mode = 'n', keys = 'b', desc = '+Buffer' }, 54 | { mode = 'n', keys = 'e', desc = '+Explore/Edit' }, 55 | { mode = 'n', keys = 'f', desc = '+Find' }, 56 | { mode = 'n', keys = 'g', desc = '+Git' }, 57 | { mode = 'n', keys = 'l', desc = '+Language' }, 58 | { mode = 'n', keys = 'm', desc = '+Map' }, 59 | { mode = 'n', keys = 'o', desc = '+Other' }, 60 | { mode = 'n', keys = 's', desc = '+Session' }, 61 | { mode = 'n', keys = 't', desc = '+Terminal' }, 62 | { mode = 'n', keys = 'v', desc = '+Visits' }, 63 | 64 | { mode = 'x', keys = 'g', desc = '+Git' }, 65 | { mode = 'x', keys = 'l', desc = '+Language' }, 66 | } 67 | 68 | -- Helpers for a more concise `` mappings. 69 | -- Most of the mappings use `...` string as a right hand side (RHS) in 70 | -- an attempt to be more concise yet descriptive. See `:h `. 71 | -- This approach also doesn't require the underlying commands/functions to exist 72 | -- during mapping creation: a "lazy loading" approach to improve startup time. 73 | local nmap_leader = function(suffix, rhs, desc) 74 | vim.keymap.set('n', '' .. suffix, rhs, { desc = desc }) 75 | end 76 | local xmap_leader = function(suffix, rhs, desc) 77 | vim.keymap.set('x', '' .. suffix, rhs, { desc = desc }) 78 | end 79 | 80 | -- b is for 'Buffer'. Common usage: 81 | -- - `bs` - create scratch (temporary) buffer 82 | -- - `ba` - navigate to the alternative buffer 83 | -- - `bw` - wipeout (fully delete) current buffer 84 | local new_scratch_buffer = function() 85 | vim.api.nvim_win_set_buf(0, vim.api.nvim_create_buf(true, true)) 86 | end 87 | 88 | nmap_leader('ba', 'b#', 'Alternate') 89 | nmap_leader('bd', 'lua MiniBufremove.delete()', 'Delete') 90 | nmap_leader('bD', 'lua MiniBufremove.delete(0, true)', 'Delete!') 91 | nmap_leader('bs', new_scratch_buffer, 'Scratch') 92 | nmap_leader('bw', 'lua MiniBufremove.wipeout()', 'Wipeout') 93 | nmap_leader('bW', 'lua MiniBufremove.wipeout(0, true)', 'Wipeout!') 94 | 95 | -- e is for 'Explore' and 'Edit'. Common usage: 96 | -- - `ed` - open explorer at current working directory 97 | -- - `ef` - open directory of current file (needs to be present on disk) 98 | -- - `ei` - edit 'init.lua' 99 | -- - All mappings that use `edit_plugin_file` - edit 'plugin/' config files 100 | local edit_plugin_file = function(filename) 101 | return string.format('edit %s/plugin/%s', vim.fn.stdpath('config'), filename) 102 | end 103 | local explore_at_file = 'lua MiniFiles.open(vim.api.nvim_buf_get_name(0))' 104 | local explore_quickfix = function() 105 | for _, win_id in ipairs(vim.api.nvim_tabpage_list_wins(0)) do 106 | if vim.fn.getwininfo(win_id)[1].quickfix == 1 then return vim.cmd('cclose') end 107 | end 108 | vim.cmd('copen') 109 | end 110 | 111 | nmap_leader('ed', 'lua MiniFiles.open()', 'Directory') 112 | nmap_leader('ef', explore_at_file, 'File directory') 113 | nmap_leader('ei', 'edit $MYVIMRC', 'init.lua') 114 | nmap_leader('ek', edit_plugin_file('20_keymaps.lua'), 'Keymaps config') 115 | nmap_leader('em', edit_plugin_file('30_mini.lua'), 'MINI config') 116 | nmap_leader('en', 'lua MiniNotify.show_history()', 'Notifications') 117 | nmap_leader('eo', edit_plugin_file('10_options.lua'), 'Options config') 118 | nmap_leader('ep', edit_plugin_file('40_plugins.lua'), 'Plugins config') 119 | nmap_leader('eq', explore_quickfix, 'Quickfix') 120 | 121 | -- f is for 'Fuzzy Find'. Common usage: 122 | -- - `ff` - find files; for best performance requires `ripgrep` 123 | -- - `fg` - find inside files; requires `ripgrep` 124 | -- - `fh` - find help tag 125 | -- - `fr` - resume latest picker 126 | -- - `fv` - all visited paths; requires 'mini.visits' 127 | -- 128 | -- All these use 'mini.pick'. See `:h MiniPick-overview` for an overview. 129 | local pick_added_hunks_buf = 'Pick git_hunks path="%" scope="staged"' 130 | local pick_workspace_symbols_live = 'Pick lsp scope="workspace_symbol_live"' 131 | 132 | nmap_leader('f/', 'Pick history scope="/"', '"/" history') 133 | nmap_leader('f:', 'Pick history scope=":"', '":" history') 134 | nmap_leader('fa', 'Pick git_hunks scope="staged"', 'Added hunks (all)') 135 | nmap_leader('fA', pick_added_hunks_buf, 'Added hunks (buf)') 136 | nmap_leader('fb', 'Pick buffers', 'Buffers') 137 | nmap_leader('fc', 'Pick git_commits', 'Commits (all)') 138 | nmap_leader('fC', 'Pick git_commits path="%"', 'Commits (buf)') 139 | nmap_leader('fd', 'Pick diagnostic scope="all"', 'Diagnostic workspace') 140 | nmap_leader('fD', 'Pick diagnostic scope="current"', 'Diagnostic buffer') 141 | nmap_leader('ff', 'Pick files', 'Files') 142 | nmap_leader('fg', 'Pick grep_live', 'Grep live') 143 | nmap_leader('fG', 'Pick grep pattern=""', 'Grep current word') 144 | nmap_leader('fh', 'Pick help', 'Help tags') 145 | nmap_leader('fH', 'Pick hl_groups', 'Highlight groups') 146 | nmap_leader('fl', 'Pick buf_lines scope="all"', 'Lines (all)') 147 | nmap_leader('fL', 'Pick buf_lines scope="current"', 'Lines (buf)') 148 | nmap_leader('fm', 'Pick git_hunks', 'Modified hunks (all)') 149 | nmap_leader('fM', 'Pick git_hunks path="%"', 'Modified hunks (buf)') 150 | nmap_leader('fr', 'Pick resume', 'Resume') 151 | nmap_leader('fR', 'Pick lsp scope="references"', 'References (LSP)') 152 | nmap_leader('fs', pick_workspace_symbols_live, 'Symbols workspace (live)') 153 | nmap_leader('fS', 'Pick lsp scope="document_symbol"', 'Symbols document') 154 | nmap_leader('fv', 'Pick visit_paths cwd=""', 'Visit paths (all)') 155 | nmap_leader('fV', 'Pick visit_paths', 'Visit paths (cwd)') 156 | 157 | -- g is for 'Git'. Common usage: 158 | -- - `gs` - show information at cursor 159 | -- - `go` - toggle 'mini.diff' overlay to show in-buffer unstaged changes 160 | -- - `gd` - show unstaged changes as a patch in separate tabpage 161 | -- - `gL` - show Git log of current file 162 | local git_log_cmd = [[Git log --pretty=format:\%h\ \%as\ │\ \%s --topo-order]] 163 | local git_log_buf_cmd = git_log_cmd .. ' --follow -- %' 164 | 165 | nmap_leader('ga', 'Git diff --cached', 'Added diff') 166 | nmap_leader('gA', 'Git diff --cached -- %', 'Added diff buffer') 167 | nmap_leader('gc', 'Git commit', 'Commit') 168 | nmap_leader('gC', 'Git commit --amend', 'Commit amend') 169 | nmap_leader('gd', 'Git diff', 'Diff') 170 | nmap_leader('gD', 'Git diff -- %', 'Diff buffer') 171 | nmap_leader('gl', '' .. git_log_cmd .. '', 'Log') 172 | nmap_leader('gL', '' .. git_log_buf_cmd .. '', 'Log buffer') 173 | nmap_leader('go', 'lua MiniDiff.toggle_overlay()', 'Toggle overlay') 174 | nmap_leader('gs', 'lua MiniGit.show_at_cursor()', 'Show at cursor') 175 | 176 | xmap_leader('gs', 'lua MiniGit.show_at_cursor()', 'Show at selection') 177 | 178 | -- l is for 'Language'. Common usage: 179 | -- - `ld` - show more diagnostic details in a floating window 180 | -- - `lr` - perform rename via LSP 181 | -- - `ls` - navigate to source definition of symbol under cursor 182 | -- 183 | -- NOTE: most LSP mappings represent a more structured way of replacing built-in 184 | -- LSP mappings (like `:h gra` and others). This is needed because `gr` is mapped 185 | -- by an "replace" operator in 'mini.operators' (which is more commonly used). 186 | local formatting_cmd = 'lua require("conform").format({lsp_fallback=true})' 187 | 188 | nmap_leader('la', 'lua vim.lsp.buf.code_action()', 'Actions') 189 | nmap_leader('ld', 'lua vim.diagnostic.open_float()', 'Diagnostic popup') 190 | nmap_leader('lf', formatting_cmd, 'Format') 191 | nmap_leader('li', 'lua vim.lsp.buf.implementation()', 'Implementation') 192 | nmap_leader('lh', 'lua vim.lsp.buf.hover()', 'Hover') 193 | nmap_leader('lr', 'lua vim.lsp.buf.rename()', 'Rename') 194 | nmap_leader('lR', 'lua vim.lsp.buf.references()', 'References') 195 | nmap_leader('ls', 'lua vim.lsp.buf.definition()', 'Source definition') 196 | nmap_leader('lt', 'lua vim.lsp.buf.type_definition()', 'Type definition') 197 | 198 | xmap_leader('lf', formatting_cmd, 'Format selection') 199 | 200 | -- m is for 'Map'. Common usage: 201 | -- - `mt` - toggle map from 'mini.map' (closed by default) 202 | -- - `mf` - focus on the map for fast navigation 203 | -- - `ms` - change map's side (if it covers something underneath) 204 | nmap_leader('mf', 'lua MiniMap.toggle_focus()', 'Focus (toggle)') 205 | nmap_leader('mr', 'lua MiniMap.refresh()', 'Refresh') 206 | nmap_leader('ms', 'lua MiniMap.toggle_side()', 'Side (toggle)') 207 | nmap_leader('mt', 'lua MiniMap.toggle()', 'Toggle') 208 | 209 | -- o is for 'Other'. Common usage: 210 | -- - `oz` - toggle between "zoomed" and regular view of current buffer 211 | nmap_leader('or', 'lua MiniMisc.resize_window()', 'Resize to default width') 212 | nmap_leader('ot', 'lua MiniTrailspace.trim()', 'Trim trailspace') 213 | nmap_leader('oz', 'lua MiniMisc.zoom()', 'Zoom toggle') 214 | 215 | -- s is for 'Session'. Common usage: 216 | -- - `sn` - start new session 217 | -- - `sr` - read previously started session 218 | -- - `sd` - delete previously started session 219 | local session_new = 'MiniSessions.write(vim.fn.input("Session name: "))' 220 | 221 | nmap_leader('sd', 'lua MiniSessions.select("delete")', 'Delete') 222 | nmap_leader('sn', 'lua ' .. session_new .. '', 'New') 223 | nmap_leader('sr', 'lua MiniSessions.select("read")', 'Read') 224 | nmap_leader('sw', 'lua MiniSessions.write()', 'Write current') 225 | 226 | -- t is for 'Terminal' 227 | nmap_leader('tT', 'horizontal term', 'Terminal (horizontal)') 228 | nmap_leader('tt', 'vertical term', 'Terminal (vertical)') 229 | 230 | -- v is for 'Visits'. Common usage: 231 | -- - `vv` - add "core" label to current file. 232 | -- - `vV` - remove "core" label to current file. 233 | -- - `vc` - pick among all files with "core" label. 234 | local make_pick_core = function(cwd, desc) 235 | return function() 236 | local sort_latest = MiniVisits.gen_sort.default({ recency_weight = 1 }) 237 | local local_opts = { cwd = cwd, filter = 'core', sort = sort_latest } 238 | MiniExtra.pickers.visit_paths(local_opts, { source = { name = desc } }) 239 | end 240 | end 241 | 242 | nmap_leader('vc', make_pick_core('', 'Core visits (all)'), 'Core visits (all)') 243 | nmap_leader('vC', make_pick_core(nil, 'Core visits (cwd)'), 'Core visits (cwd)') 244 | nmap_leader('vv', 'lua MiniVisits.add_label("core")', 'Add "core" label') 245 | nmap_leader('vV', 'lua MiniVisits.remove_label("core")', 'Remove "core" label') 246 | nmap_leader('vl', 'lua MiniVisits.add_label()', 'Add label') 247 | nmap_leader('vL', 'lua MiniVisits.remove_label()', 'Remove label') 248 | -- stylua: ignore end 249 | -------------------------------------------------------------------------------- /configs/nvim-0.11/plugin/30_mini.lua: -------------------------------------------------------------------------------- 1 | -- ┌────────────────────┐ 2 | -- │ MINI configuration │ 3 | -- └────────────────────┘ 4 | -- 5 | -- This file contains configuration of the MINI parts of the config. 6 | -- It contains only configs for the 'mini.nvim' plugin (installed in 'init.lua'). 7 | -- 8 | -- 'mini.nvim' is a library of modules. Each is enabled independently via 9 | -- `require('mini.xxx').setup()` convention. It creates all intended side effects: 10 | -- mappings, autocommands, highlight groups, etc. It also creates a global 11 | -- `MiniXxx` table that can be later used to access module's features. 12 | -- 13 | -- Every module's `setup()` function accepts an optional `config` table to 14 | -- adjust its behavior. See the structure of this table at `:h MiniXxx.config`. 15 | -- 16 | -- See `:h mini.nvim-general-principles` for more general principles. 17 | -- 18 | -- Here each module's `setup()` has a brief explanation of what the module is for, 19 | -- its usage examples (uses Leader mappings from 'plugin/20_keymaps.lua'), and 20 | -- possible directions for more info. 21 | -- For more info about a module see its help page (`:h mini.xxx` for 'mini.xxx'). 22 | 23 | -- To minimize the time until first screen draw, modules are enabled in two steps: 24 | -- - Step one enables everything that is needed for first draw with `now()`. 25 | -- Sometimes is needed only if Neovim is started as `nvim -- path/to/file`. 26 | -- - Everything else is delayed until the first draw with `later()`. 27 | local now, later = MiniDeps.now, MiniDeps.later 28 | local now_if_args = _G.Config.now_if_args 29 | 30 | -- Step one =================================================================== 31 | -- Enable 'miniwinter' color scheme. It comes with 'mini.nvim' and uses 'mini.hues'. 32 | -- 33 | -- See also: 34 | -- - `:h mini.nvim-color-schemes` - list of other color schemes 35 | -- - `:h MiniHues-examples` - how to define highlighting with 'mini.hues' 36 | -- - 'plugin/40_plugins.lua' honorable mentions - other good color schemes 37 | now(function() vim.cmd('colorscheme miniwinter') end) 38 | 39 | -- You can try these other 'mini.hues'-based color schemes (uncomment with `gcc`): 40 | -- now(function() vim.cmd('colorscheme minispring') end) 41 | -- now(function() vim.cmd('colorscheme minisummer') end) 42 | -- now(function() vim.cmd('colorscheme miniautumn') end) 43 | -- now(function() vim.cmd('colorscheme randomhue') end) 44 | 45 | -- Common configuration presets. Example usage: 46 | -- - `` in Insert mode - save and go to Normal mode 47 | -- - `go` / `gO` - insert empty line before/after in Normal mode 48 | -- - `gy` / `gp` - copy / paste from system clipboard 49 | -- - `\` + key - toggle common options. Like `\h` toggles highlighting search. 50 | -- - `` (four combos) - navigate between windows. 51 | -- - `` in Insert/Command mode - navigate in that mode. 52 | -- 53 | -- See also: 54 | -- - `:h MiniBasics.config.options` - list of adjusted options 55 | -- - `:h MiniBasics.config.mappings` - list of created mappings 56 | -- - `:h MiniBasics.config.autocommands` - list of created autocommands 57 | now(function() 58 | require('mini.basics').setup({ 59 | -- Manage options in 'plugin/10_options.lua' for didactic purposes 60 | options = { basic = false }, 61 | mappings = { 62 | -- Create `` mappings for window navigation 63 | windows = true, 64 | -- Create `` mappings for navigation in Insert and Command modes 65 | move_with_alt = true, 66 | }, 67 | }) 68 | end) 69 | 70 | -- Icon provider. Usually no need to use manually. It is used by plugins like 71 | -- 'mini.pick', 'mini.files', 'mini.statusline', and others. 72 | now(function() 73 | -- Set up to not prefer extension-based icon for some extensions 74 | local ext3_blocklist = { scm = true, txt = true, yml = true } 75 | local ext4_blocklist = { json = true, yaml = true } 76 | require('mini.icons').setup({ 77 | use_file_extension = function(ext, _) 78 | return not (ext3_blocklist[ext:sub(-3)] or ext4_blocklist[ext:sub(-4)]) 79 | end, 80 | }) 81 | 82 | -- Mock 'nvim-tree/nvim-web-devicons' for plugins without 'mini.icons' support. 83 | -- Not needed for 'mini.nvim' or MiniMax, but might be useful for others. 84 | later(MiniIcons.mock_nvim_web_devicons) 85 | 86 | -- Add LSP kind icons. Useful for 'mini.completion'. 87 | later(MiniIcons.tweak_lsp_kind) 88 | end) 89 | 90 | -- Miscellaneous small but useful functions. Example usage: 91 | -- - `oz` - toggle between "zoomed" and regular view of current buffer 92 | -- - `or` - resize window to its "editable width" 93 | -- - `:lua put_text(vim.lsp.get_clients())` - put output of a function below 94 | -- cursor in current buffer. Useful for a detailed exploration. 95 | -- - `:lua put(MiniMisc.stat_summary(MiniMisc.bench_time(f, 100)))` - run 96 | -- function `f` 100 times and report statistical summary of execution times 97 | -- 98 | -- Uses `now()` for `setup_xxx()` to work when started like `nvim -- path/to/file` 99 | now_if_args(function() 100 | -- Makes `:h MiniMisc.put()` and `:h MiniMisc.put_text()` public 101 | require('mini.misc').setup() 102 | 103 | -- Change current working directory based on the current file path. It 104 | -- searches up the file tree until the first root marker ('.git' or 'Makefile') 105 | -- and sets their parent directory as a current directory. 106 | -- This is helpful when simultaneously dealing with files from several projects. 107 | MiniMisc.setup_auto_root() 108 | 109 | -- Restore latest cursor position on file open 110 | MiniMisc.setup_restore_cursor() 111 | 112 | -- Synchronize terminal emulator background with Neovim's background to remove 113 | -- possibly different color padding around Neovim instance 114 | MiniMisc.setup_termbg_sync() 115 | end) 116 | 117 | -- Notifications provider. Shows all kinds of notifications in the upper right 118 | -- corner (by default). Example usage: 119 | -- - `:h vim.notify()` - show notification (hides automatically) 120 | -- - `en` - show notification history 121 | -- 122 | -- See also: 123 | -- - `:h MiniNotify.config` for some of common configuration examples. 124 | now(function() require('mini.notify').setup() end) 125 | 126 | -- Session management. A thin wrapper around `:h mksession` that consistently 127 | -- manages session files. Example usage: 128 | -- - `sn` - start new session 129 | -- - `sr` - read previously started session 130 | -- - `sd` - delete previously started session 131 | now(function() require('mini.sessions').setup() end) 132 | 133 | -- Start screen. This is what is shown when you open Neovim like `nvim`. 134 | -- Example usage: 135 | -- - Type prefix keys to limit available candidates 136 | -- - Navigate down/up with `` and `` 137 | -- - Press `` to select an entry 138 | -- 139 | -- See also: 140 | -- - `:h MiniStarter-example-config` - non-default config examples 141 | -- - `:h MiniStarter-lifecycle` - how to work with Starter buffer 142 | now(function() require('mini.starter').setup() end) 143 | 144 | -- Statusline. Sets `:h 'statusline'` to show more info in a line below window. 145 | -- Example usage: 146 | -- - Left most section indicates current mode (text + highlighting). 147 | -- - Second from left section shows "developer info": Git, diff, diagnostics, LSP. 148 | -- - Center section shows the name of displayed buffer. 149 | -- - Second to right section shows more buffer info. 150 | -- - Right most section shows current cursor coordinates and search results. 151 | -- 152 | -- See also: 153 | -- - `:h MiniStatusline-example-content` - example of default content. Use it to 154 | -- configure a custom statusline by setting `config.content.active` function. 155 | now(function() require('mini.statusline').setup() end) 156 | 157 | -- Tabline. Sets `:h 'tabline'` to show all listed buffers in a line at the top. 158 | -- Buffers are ordered as they were created. Navigate with `[b` and `]b`. 159 | now(function() require('mini.tabline').setup() end) 160 | 161 | -- Step two =================================================================== 162 | 163 | -- Extra 'mini.nvim' functionality. 164 | -- 165 | -- See also: 166 | -- - `:h MiniExtra.pickers` - pickers. Most are mapped in `f` group. 167 | -- Calling `setup()` makes 'mini.pick' respect 'mini.extra' pickers. 168 | -- - `:h MiniExtra.gen_ai_spec` - 'mini.ai' textobject specifications 169 | -- - `:h MiniExtra.gen_highlighter` - 'mini.hipatterns' highlighters 170 | later(function() require('mini.extra').setup() end) 171 | 172 | -- Extend and create a/i textobjects, like `:h a(`, `:h a'`, and more). 173 | -- Contains not only `a` and `i` type of textobjects, but also their "next" and 174 | -- "last" variants that will explicitly search for textobjects after and before 175 | -- cursor. Example usage: 176 | -- - `ci)` - *c*hange *i*inside parenthesis (`)`) 177 | -- - `di(` - *d*elete *i*inside padded parenthesis (`(`) 178 | -- - `yaq` - *y*ank *a*round *q*uote (any of "", '', or ``) 179 | -- - `vif` - *v*isually select *i*inside *f*unction call 180 | -- - `cina` - *c*hange *i*nside *n*ext *a*rgument 181 | -- - `valaala` - *v*isually select *a*round *l*ast (i.e. previous) *a*rgument 182 | -- and then again reselect *a*round new *l*ast *a*rgument 183 | -- 184 | -- See also: 185 | -- - `:h text-objects` - general info about what textobjects are 186 | -- - `:h MiniAi-builtin-textobjects` - list of all supported textobjects 187 | -- - `:h MiniAi-textobject-specification` - examples of custom textobjects 188 | later(function() 189 | local ai = require('mini.ai') 190 | ai.setup({ 191 | -- 'mini.ai' can be extended with custom textobjects 192 | custom_textobjects = { 193 | -- Make `aB` / `iB` act on around/inside whole *b*uffer 194 | B = MiniExtra.gen_ai_spec.buffer(), 195 | -- For more complicated textobjects that require structural awareness, 196 | -- use tree-sitter. This example makes `aF`/`iF` mean around/inside function 197 | -- definition (not call). See `:h MiniAi.gen_spec.treesitter()` for details. 198 | F = ai.gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }), 199 | }, 200 | 201 | -- 'mini.ai' by default mostly mimics built-in search behavior: first try 202 | -- to find textobject covering cursor, then try to find to the right. 203 | -- Although this works in most cases, some are confusing. It is more robust to 204 | -- always try to search only covering textobject and explicitly ask to search 205 | -- for next (`an`/`in`) or last (`al`/`il`). 206 | -- Try this. If you don't like it - delete next line and this comment. 207 | search_method = 'cover', 208 | }) 209 | end) 210 | 211 | -- Align text interactively. Example usage: 212 | -- - `gaip,` - `ga` (align operator) *i*nside *p*aragraph by comma 213 | -- - `gAip` - start interactive alignment on the paragraph. Choose how to 214 | -- split, justify, and merge string parts. Press `` to make it permanent, 215 | -- press `` to go back to initial state. 216 | -- 217 | -- See also: 218 | -- - `:h MiniAlign-example` - hands-on list of examples to practice aligning 219 | -- - `:h MiniAlign.gen_step` - list of support step customizations 220 | -- - `:h MiniAlign-algorithm` - how alignment is done on algorithmic level 221 | later(function() require('mini.align').setup() end) 222 | 223 | -- Animate common Neovim actions. Like cursor movement, scroll, window resize, 224 | -- window open, window close. Animations are done based on Neovim events and 225 | -- don't require custom mappings. 226 | -- 227 | -- It is not enabled by default because its effects are a matter of taste. 228 | -- Also scroll and resize have some unwanted side effects (see `:h mini.animate`). 229 | -- Uncomment next line (use `gcc`) to enable. 230 | -- later(function() require('mini.animate').setup() end) 231 | 232 | -- Go forward/backward with square brackets. Implements consistent sets of mappings 233 | -- for selected targets (like buffers, diagnostic, quickfix list entries, etc.). 234 | -- Example usage: 235 | -- - `]b` - go to next buffer 236 | -- - `[j` - go to previous jump inside current buffer 237 | -- - `[Q` - go to first entry of quickfix list 238 | -- - `]X` - go to last conflict marker in a buffer 239 | -- 240 | -- See also: 241 | -- - `:h MiniBracketed` - overall mapping design and list of targets 242 | later(function() require('mini.bracketed').setup() end) 243 | 244 | -- Remove buffers. Opened files occupy space in tabline and buffer picker. 245 | -- When not needed, they can be removed. Example usage: 246 | -- - `bw` - completely wipeout current buffer (see `:h :bwipeout`) 247 | -- - `bW` - completely wipeout current buffer even if it has changes 248 | -- - `bd` - delete current buffer (see `:h :bdelete`) 249 | later(function() require('mini.bufremove').setup() end) 250 | 251 | -- Show next key clues in a bottom right window. Requires explicit opt-in for 252 | -- keys that act as clue trigger. Example usage: 253 | -- - Press `` and wait for 1 second. A window with information about 254 | -- next available keys should appear. 255 | -- - Press one of the listed keys. Window updates immediately to show information 256 | -- about new next available keys. You can press `` to go back in key sequence. 257 | -- - Press keys until they resolve into some mapping. 258 | -- 259 | -- Note: it is designed to work in buffers for normal files. It doesn't work in 260 | -- special buffers (like for 'mini.starter' or 'mini.files') to not conflict 261 | -- with its local mappings. 262 | -- 263 | -- See also: 264 | -- - `:h MiniClue-examples` - examples of common setups 265 | -- - `:h MiniClue.ensure_buf_triggers()` - use it to enable triggers in buffer 266 | -- - `:h MiniClue.set_mapping_desc()` - change mapping description not from config 267 | later(function() 268 | local miniclue = require('mini.clue') 269 | -- stylua: ignore 270 | miniclue.setup({ 271 | -- Define which clues to show. By default shows only clues for custom mappings 272 | -- (uses `desc` field from the mapping; takes precedence over custom clue). 273 | clues = { 274 | -- This is defined in 'plugin/20_keymaps.lua' with Leader group descriptions 275 | Config.leader_group_clues, 276 | miniclue.gen_clues.builtin_completion(), 277 | miniclue.gen_clues.g(), 278 | miniclue.gen_clues.marks(), 279 | miniclue.gen_clues.registers(), 280 | -- This creates a submode for window resize mappings. Try the following: 281 | -- - Press `s` to make a window split. 282 | -- - Press `+` to increase height. Clue window still shows clues as if 283 | -- `` is pressed again. Keep pressing just `+` to increase height. 284 | -- Try pressing `-` to decrease height. 285 | -- - Stop submode either by `` or by any key that is not in submode. 286 | miniclue.gen_clues.windows({ submode_resize = true }), 287 | miniclue.gen_clues.z(), 288 | }, 289 | -- Explicitly opt-in for set of common keys to trigger clue window 290 | triggers = { 291 | { mode = 'n', keys = '' }, -- Leader triggers 292 | { mode = 'x', keys = '' }, 293 | { mode = 'n', keys = '\\' }, -- mini.basics 294 | { mode = 'n', keys = '[' }, -- mini.bracketed 295 | { mode = 'n', keys = ']' }, 296 | { mode = 'x', keys = '[' }, 297 | { mode = 'x', keys = ']' }, 298 | { mode = 'i', keys = '' }, -- Built-in completion 299 | { mode = 'n', keys = 'g' }, -- `g` key 300 | { mode = 'x', keys = 'g' }, 301 | { mode = 'n', keys = "'" }, -- Marks 302 | { mode = 'n', keys = '`' }, 303 | { mode = 'x', keys = "'" }, 304 | { mode = 'x', keys = '`' }, 305 | { mode = 'n', keys = '"' }, -- Registers 306 | { mode = 'x', keys = '"' }, 307 | { mode = 'i', keys = '' }, 308 | { mode = 'c', keys = '' }, 309 | { mode = 'n', keys = '' }, -- Window commands 310 | { mode = 'n', keys = 'z' }, -- `z` key 311 | { mode = 'x', keys = 'z' }, 312 | }, 313 | }) 314 | end) 315 | 316 | -- Tweak and save any color scheme. Contains utility functions to work with 317 | -- color spaces and color schemes. Example usage: 318 | -- - `:Colorscheme default` - switch with animation to the default color scheme 319 | -- 320 | -- See also: 321 | -- - `:h MiniColors.interactive()` - interactively tweak color scheme 322 | -- - `:h MiniColors-recipes` - common recipes to use during interactive tweaking 323 | -- - `:h MiniColors.convert()` - convert between color spaces 324 | -- - `:h MiniColors-color-spaces` - list of supported color sapces 325 | -- 326 | -- It is not enabled by default because it is not really needed on a daily basis. 327 | -- Uncomment next line (use `gcc`) to enable. 328 | -- later(function() require('mini.colors').setup() end) 329 | 330 | -- Comment lines. Provides functionality to work with commented lines. 331 | -- Uses `:h 'commentstring'` option to infer comment structure. 332 | -- Example usage: 333 | -- - `gcip` - toggle comment (`gc`) *i*inside *p*aragraph 334 | -- - `vapgc` - *v*isually select *a*round *p*aragraph and toggle comment (`gc`) 335 | -- - `gcgc` - uncomment (`gc`, operator) comment block at cursor (`gc`, textobject) 336 | -- 337 | -- The built-in `:h commenting` is based on 'mini.comment'. Yet this module is 338 | -- still enabled as it provides more customization opportunities. 339 | later(function() require('mini.comment').setup() end) 340 | 341 | -- Completion and signature help. Implements async "two stage" autocompletion: 342 | -- - Based on attached LSP servers that support completion. 343 | -- - Fallback (based on built-in keyword completion) if there is no LSP candidates. 344 | -- 345 | -- Example usage in Insert mode with attached LSP: 346 | -- - Start typing text that should be recognized by LSP (like variable name). 347 | -- - After 100ms a popup menu with candidates appears. 348 | -- - Press `` / `` to navigate down/up the list. These are set up 349 | -- in 'mini.keymap'. You can also use `` / ``. 350 | -- - During navigation there is an info window to the right showing extra info 351 | -- that the LSP server can provide about the candidate. It appears after the 352 | -- candidate stays selected for 100ms. Use `` / `` to scroll it. 353 | -- - Navigating to an entry also changes buffer text. If you are happy with it, 354 | -- keep typing after it. To discard completion completely, press ``. 355 | -- - After pressing special trigger(s), usually `(`, a window appears that shows 356 | -- the signature of the current function/method. It gets updated as you type 357 | -- showing the currently active parameter. 358 | -- 359 | -- Example usage in Insert mode without an attached LSP or in places not 360 | -- supported by the LSP (like comments): 361 | -- - Start typing a word that is present in current or opened buffers. 362 | -- - After 100ms popup menu with candidates appears. 363 | -- - Navigate with `` / `` or `` / ``. This also updates 364 | -- buffer text. If happy with choice, keep typing. Stop with ``. 365 | -- 366 | -- It also works with snippet candidates provided by LSP server. Best experience 367 | -- when paired with 'mini.snippets' (which is set up in this file). 368 | later(function() 369 | -- Customize post-processing of LSP responses for a better user experience. 370 | -- Don't show 'Text' suggestions (usually noisy) and show snippets last. 371 | local process_items_opts = { kind_priority = { Text = -1, Snippet = 99 } } 372 | local process_items = function(items, base) 373 | return MiniCompletion.default_process_items(items, base, process_items_opts) 374 | end 375 | require('mini.completion').setup({ 376 | lsp_completion = { 377 | -- Without this config autocompletion is set up through `:h 'completefunc'`. 378 | -- Although not needed, setting up through `:h 'omnifunc'` is cleaner 379 | -- (sets up only when needed) and makes it possible to use ``. 380 | source_func = 'omnifunc', 381 | auto_setup = false, 382 | process_items = process_items, 383 | }, 384 | }) 385 | 386 | -- Set 'omnifunc' for LSP completion only when needed. 387 | local on_attach = function(ev) 388 | vim.bo[ev.buf].omnifunc = 'v:lua.MiniCompletion.completefunc_lsp' 389 | end 390 | _G.Config.new_autocmd('LspAttach', nil, on_attach, "Set 'omnifunc'") 391 | 392 | -- Advertise to servers that Neovim now supports certain set of completion and 393 | -- signature features through 'mini.completion'. 394 | vim.lsp.config('*', { capabilities = MiniCompletion.get_lsp_capabilities() }) 395 | end) 396 | 397 | -- Autohighlight word under cursor with a customizable delay. 398 | -- Word boundaries are defined based on `:h 'iskeyword'` option. 399 | -- 400 | -- It is not enabled by default because its effects are a matter of taste. 401 | -- Uncomment next line (use `gcc`) to enable. 402 | -- later(function() require('mini.cursorword').setup() end) 403 | 404 | -- Work with diff hunks that represent the difference between the buffer text and 405 | -- some reference text set by a source. Default source uses text from Git index. 406 | -- Also provides summary info used in developer section of 'mini.statusline'. 407 | -- Example usage: 408 | -- - `ghip` - apply hunks (`gh`) within *i*nside *p*aragraph 409 | -- - `gHG` - reset hunks (`gH`) from cursor until end of buffer (`G`) 410 | -- - `ghgh` - apply (`gh`) hunk at cursor (`gh`) 411 | -- - `gHgh` - reset (`gH`) hunk at cursor (`gh`) 412 | -- - `go` - toggle overlay 413 | -- 414 | -- See also: 415 | -- - `:h MiniDiff-overview` - overview of how module works 416 | -- - `:h MiniDiff-diff-summary` - available summary information 417 | -- - `:h MiniDiff.gen_source` - available built-in sources 418 | later(function() require('mini.diff').setup() end) 419 | 420 | -- Navigate and manipulate file system 421 | -- 422 | -- Navigation is done using column view (Miller columns) to display nested 423 | -- directories, they are displayed in floating windows in top left corner. 424 | -- 425 | -- Manipulate files and directories by editing text as regular buffers. 426 | -- 427 | -- Example usage: 428 | -- - `ed` - open current working directory 429 | -- - `ef` - open directory of current file (needs to be present on disk) 430 | -- 431 | -- Basic navigation: 432 | -- - `l` - go in entry at cursor: navigate into directory or open file 433 | -- - `h` - go out of focused directory 434 | -- - Navigate window as any regular buffer 435 | -- - Press `g?` inside explorer to see more mappings 436 | -- 437 | -- Basic manipulation: 438 | -- - After any following action, press `=` in Normal mode to synchronize, read 439 | -- carefully about actions, press `y` or `` to confirm 440 | -- - New entry: press `o` and type its name; end with `/` to create directory 441 | -- - Rename: press `C` and type new name 442 | -- - Delete: type `dd` 443 | -- - Move/copy: type `dd`/`yy`, navigate to target directory, press `p` 444 | -- 445 | -- See also: 446 | -- - `:h MiniFiles-navigation` - more details about how to navigate 447 | -- - `:h MiniFiles-manipulation` - more details about how to manipulate 448 | -- - `:h MiniFiles-examples` - examples of common setups 449 | later(function() 450 | -- Enable directory/file preview 451 | require('mini.files').setup({ windows = { preview = true } }) 452 | 453 | -- Add common bookmarks for every explorer. Example usage inside explorer: 454 | -- - `'c` to navigate into your config directory 455 | -- - `g?` to see available bookmarks 456 | local add_marks = function() 457 | MiniFiles.set_bookmark('c', vim.fn.stdpath('config'), { desc = 'Config' }) 458 | local minideps_plugins = vim.fn.stdpath('data') .. '/site/pack/deps/opt' 459 | MiniFiles.set_bookmark('p', minideps_plugins, { desc = 'Plugins' }) 460 | MiniFiles.set_bookmark('w', vim.fn.getcwd, { desc = 'Working directory' }) 461 | end 462 | _G.Config.new_autocmd('User', 'MiniFilesExplorerOpen', add_marks, 'Add bookmarks') 463 | end) 464 | 465 | -- Git integration for more straightforward Git actions based on Neovim's state. 466 | -- It is not meant as a fully featured Git client, only to provide helpers that 467 | -- integrate better with Neovim. Example usage: 468 | -- - `gs` - show information at cursor 469 | -- - `gd` - show unstaged changes as a patch in separate tabpage 470 | -- - `gL` - show Git log of current file 471 | -- - `:Git help git` - show output of `git help git` inside Neovim 472 | -- 473 | -- See also: 474 | -- - `:h MiniGit-examples` - examples of common setups 475 | -- - `:h :Git` - more details about `:Git` user command 476 | -- - `:h MiniGit.show_at_cursor()` - what information at cursor is shown 477 | later(function() require('mini.git').setup() end) 478 | 479 | -- Highlight patterns in text. Like `TODO`/`NOTE` or color hex codes. 480 | -- Example usage: 481 | -- - `:Pick hipatterns` - pick among all highlighted patterns 482 | -- 483 | -- See also: 484 | -- - `:h MiniHipatterns-examples` - examples of common setups 485 | later(function() 486 | local hipatterns = require('mini.hipatterns') 487 | local hi_words = MiniExtra.gen_highlighter.words 488 | hipatterns.setup({ 489 | highlighters = { 490 | -- Highlight a fixed set of common words. Will be highlighted in any place, 491 | -- not like "only in comments". 492 | fixme = hi_words({ 'FIXME', 'Fixme', 'fixme' }, 'MiniHipatternsFixme'), 493 | hack = hi_words({ 'HACK', 'Hack', 'hack' }, 'MiniHipatternsHack'), 494 | todo = hi_words({ 'TODO', 'Todo', 'todo' }, 'MiniHipatternsTodo'), 495 | note = hi_words({ 'NOTE', 'Note', 'note' }, 'MiniHipatternsNote'), 496 | 497 | -- Highlight hex color string (#aabbcc) with that color as a background 498 | hex_color = hipatterns.gen_highlighter.hex_color(), 499 | }, 500 | }) 501 | end) 502 | 503 | -- Visualize and work with indent scope. It visualizes indent scope "at cursor" 504 | -- with animated vertical line. Provides relevant motions and textobjects. 505 | -- Example usage: 506 | -- - `cii` - *c*hange *i*nside *i*ndent scope 507 | -- - `Vaiai` - *V*isually select *a*round *i*ndent scope and then again 508 | -- reselect *a*round new *i*indent scope 509 | -- - `[i` / `]i` - navigate to scope's top / bottom 510 | -- 511 | -- See also: 512 | -- - `:h MiniIndentscope.gen_animation` - available animation rules 513 | later(function() require('mini.indentscope').setup() end) 514 | 515 | -- Jump to next/previous single character. It implements "smarter `fFtT` keys" 516 | -- (see `:h f`) that work across multiple lines, start "jumping mode", and 517 | -- highlight all target matches. Example usage: 518 | -- - `fxff` - move *f*orward onto next character "x", then next, and next again 519 | -- - `dt)` - *d*elete *t*ill next closing parenthesis (`)`) 520 | later(function() require('mini.jump').setup() end) 521 | 522 | -- Jump within visible lines to pre-defined spots via iterative label filtering. 523 | -- Spots are computed by a configurable spotter function. Example usage: 524 | -- - Lock eyes on desired location to jump 525 | -- - `` - start jumping; this shows character labels over target spots 526 | -- - Type character that appears over desired location; number of target spots 527 | -- should be reduced 528 | -- - Keep typing labels until target spot is unique to perform the jump 529 | -- 530 | -- See also: 531 | -- - `:h MiniJump2d.gen_spotter` - list of available spotters 532 | later(function() require('mini.jump2d').setup() end) 533 | 534 | -- Special key mappings. Provides helpers to map: 535 | -- - Multi-step actions. Apply action 1 if condition is met; else apply 536 | -- action 2 if condition is met; etc. 537 | -- - Combos. Sequence of keys where each acts immediately plus execute extra 538 | -- action if all are typed fast enough. Useful for Insert mode mappings to not 539 | -- introduce delay when typing mapping keys without intention to execute action. 540 | -- 541 | -- See also: 542 | -- - `:h MiniKeymap-examples` - examples of common setups 543 | -- - `:h MiniKeymap.map_multistep()` - map multi-step action 544 | -- - `:h MiniKeymap.map_combo()` - map combo 545 | later(function() 546 | require('mini.keymap').setup() 547 | -- Navigate 'mini.completion' menu with `` / `` 548 | MiniKeymap.map_multistep('i', '', { 'pmenu_next' }) 549 | MiniKeymap.map_multistep('i', '', { 'pmenu_prev' }) 550 | -- On `` try to accept current completion item, fall back to accounting 551 | -- for pairs from 'mini.pairs' 552 | MiniKeymap.map_multistep('i', '', { 'pmenu_accept', 'minipairs_cr' }) 553 | -- On `` just try to account for pairs from 'mini.pairs' 554 | MiniKeymap.map_multistep('i', '', { 'minipairs_bs' }) 555 | end) 556 | 557 | -- Window with text overview. It is displayed on the right hand side. Can be used 558 | -- for quick overview and navigation. Hidden by default. Example usage: 559 | -- - `mt` - toggle map window 560 | -- - `mf` - focus on the map for fast navigation 561 | -- - `ms` - change map's side (if it covers something underneath) 562 | -- 563 | -- See also: 564 | -- - `:h MiniMap.gen_encode_symbols` - list of symbols to use for text encoding 565 | -- - `:h MiniMap.gen_integration` - list of integrations to show in the map 566 | -- 567 | -- NOTE: Might introduce lag on very big buffers (10000+ lines) 568 | later(function() 569 | local map = require('mini.map') 570 | map.setup({ 571 | -- Use Braille dots to encode text 572 | symbols = { encode = map.gen_encode_symbols.dot('4x2') }, 573 | -- Show built-in search matches, 'mini.diff' hunks, and diagnostic entries 574 | integrations = { 575 | map.gen_integration.builtin_search(), 576 | map.gen_integration.diff(), 577 | map.gen_integration.diagnostic(), 578 | }, 579 | }) 580 | 581 | -- Map built-in navigation characters to force map refresh 582 | for _, key in ipairs({ 'n', 'N', '*', '#' }) do 583 | local rhs = key 584 | -- Also open enough folds when jumping to the next match 585 | .. 'zv' 586 | .. 'lua MiniMap.refresh({}, { lines = false, scrollbar = false })' 587 | vim.keymap.set('n', key, rhs) 588 | end 589 | end) 590 | 591 | -- Move any selection in any direction. Example usage in Normal mode: 592 | -- - ``/`` - move current line down / up 593 | -- - ``/`` - decrease / increase indent of current line 594 | -- 595 | -- Example usage in Visual mode: 596 | -- - ``/``/``/`` - move selection left/down/up/right 597 | later(function() require('mini.move').setup() end) 598 | 599 | -- Text edit operators. All operators have mappings for: 600 | -- - Regular operator (waits for motion/textobject to use) 601 | -- - Current line action (repeat second character of operator to activate) 602 | -- - Act on visual selection (type operator in Visual mode) 603 | -- 604 | -- Example usage: 605 | -- - `griw` - replace (`gr`) *i*inside *w*ord 606 | -- - `gmm` - multiple/duplicate (`gm`) current line (extra `m`) 607 | -- - `vipgs` - *v*isually select *i*nside *p*aragraph and sort it (`gs`) 608 | -- - `gxiww.` - exchange (`gx`) *i*nside *w*ord with next word (`w` to navigate 609 | -- to it and `.` to repeat exchange operator) 610 | -- - `g==` - execute current line as Lua code and replace with its output. 611 | -- For example, typing `g==` over line `vim.lsp.get_clients()` shows 612 | -- information about all available LSP clients. 613 | -- 614 | -- See also: 615 | -- - `:h MiniOperators-mappings` - overview of how mappings are created 616 | -- - `:h MiniOperators-overview` - overview of present operators 617 | later(function() 618 | require('mini.operators').setup() 619 | 620 | -- Create mappings for swapping adjacent arguments. Notes: 621 | -- - Relies on `a` argument textobject from 'mini.ai'. 622 | -- - It is not 100% reliable, but mostly works. 623 | -- - It overrides `:h (` and `:h )`. 624 | -- Explanation: `gx`-`ia`-`gx`-`ila` <=> exchange current and last argument 625 | -- Usage: when on `a` in `(aa, bb)` press `)` followed by `(`. 626 | vim.keymap.set('n', '(', 'gxiagxila', { remap = true, desc = 'Swap arg left' }) 627 | vim.keymap.set('n', ')', 'gxiagxina', { remap = true, desc = 'Swap arg right' }) 628 | end) 629 | 630 | -- Autopairs functionality. Insert pair when typing opening character and go over 631 | -- right character if it is already to cursor's right. Also provides mappings for 632 | -- `` and `` to perform extra actions when inside pair. 633 | -- Example usage in Insert mode: 634 | -- - `(` - insert "()" and put cursor between them 635 | -- - `)` when there is ")" to the right - jump over ")" without inserting new one 636 | -- - `(` - always insert a single "(" literally. This is useful since 637 | -- 'mini.pairs' doesn't provide particularly smart behavior, like auto balancing 638 | later(function() 639 | -- Create pairs not only in Insert, but also in Command line mode 640 | require('mini.pairs').setup({ modes = { command = true } }) 641 | end) 642 | 643 | -- Pick anything with single window layout and fast matching. This is one of 644 | -- the main usability improvements as it powers a lot of "find things quickly" 645 | -- workflows. How to use a picker: 646 | -- - Start picker, usually with `:Pick ` command. Like `:Pick files`. 647 | -- It shows a single window in the bottom left corner filled with possible items 648 | -- to choose from. Current item has special full line highlighting. 649 | -- At the top there is a current query used to filter+sort items. 650 | -- - Type characters (appear at top) to narrow down items. There is fuzzy matching: 651 | -- characters may not match one-by-one, but they should be in correct order. 652 | -- - Navigate down/up with ``/``. 653 | -- - Press `` to show item's preview. `` again goes back to items. 654 | -- - Press `` to show picker's info. `` again goes back to items. 655 | -- - Press `` to choose an item. The exact action depends on the picker: `files` 656 | -- picker opens a selected file, `help` picker opens help page on selected tag. 657 | -- To close picker without choosing an item, press ``. 658 | -- 659 | -- Example usage: 660 | -- - `ff` - *f*ind *f*iles; for best performance requires `ripgrep` 661 | -- - `fg` - *f*ind inside files (a.k.a. "to *g*rep"); requires `ripgrep` 662 | -- - `fh` - *f*ind *h*elp tag 663 | -- - `fr` - *r*esume latest picker 664 | -- - `:h vim.ui.select()` - implemented with 'mini.pick' 665 | -- 666 | -- See also: 667 | -- - `:h MiniPick-overview` - overview of picker functionality 668 | -- - `:h MiniPick-examples` - examples of common setups 669 | -- - `:h MiniPick.builtin` and `:h MiniExtra.pickers` - available pickers; 670 | -- Execute one either with Lua function, `:Pick ` command, or 671 | -- one of `f` mappings defined in 'plugin/20_keymaps.lua' 672 | later(function() require('mini.pick').setup() end) 673 | 674 | -- Manage and expand snippets (templates for a frequently used text). 675 | -- Typical workflow is to type snippet's (configurable) prefix and expand it 676 | -- into a snippet session. 677 | -- 678 | -- How to manage snippets: 679 | -- - 'mini.snippets' itself doesn't come with preconfigured snippets. Instead there 680 | -- is a flexible system of how snippets are prepared before expanding. 681 | -- They can come from pre-defined path on disk, 'snippets/' directories inside 682 | -- config or plugins, defined inside `setup()` call directly. 683 | -- - This config, however, does come with snippet configuration: 684 | -- - 'snippets/global.json' is a file with global snippets that will be 685 | -- available in any buffer 686 | -- - 'after/snippets/lua.json' defines personal snippets for Lua language 687 | -- - 'friendly-snippets' plugin configured in 'plugin/40_plugins.lua' provides 688 | -- a collection of language snippets 689 | -- 690 | -- How to expand a snippet in Insert mode: 691 | -- - If you know snippet's prefix, type it as a word and press ``. Snippet's 692 | -- body should be inserted instead of the prefix. 693 | -- - If you don't remember snippet's prefix, type only part of it (or none at all) 694 | -- and press ``. It should show picker with all snippets that have prefixes 695 | -- matching typed characters (or all snippets if none was typed). 696 | -- Choose one and its body should be inserted instead of previously typed text. 697 | -- 698 | -- How to navigate during snippet session: 699 | -- - Snippets can contain tabstops - places for user to interactively adjust text. 700 | -- Each tabstop is highlighted depending on session progression - whether tabstop 701 | -- is current, was or was not visited. If tabstop doesn't yet have text, it is 702 | -- visualized with special "ghost" inline text: • and ∎ by default. 703 | -- - Type necessary text at current tabstop and navigate to next/previous one 704 | -- by pressing `` / ``. 705 | -- - Repeat previous step until you reach special final tabstop, usually denoted 706 | -- by ∎ symbol. If you spotted a mistake in an earlier tabstop, navigate to it 707 | -- and return back to the final tabstop. 708 | -- - To end a snippet session when at final tabstop, keep typing or go into 709 | -- Normal mode. To force end snippet session, press ``. 710 | -- 711 | -- See also: 712 | -- - `:h MiniSnippets-overview` - overview of how module works 713 | -- - `:h MiniSnippets-examples` - examples of common setups 714 | -- - `:h MiniSnippets-session` - details about snippet session 715 | -- - `:h MiniSnippets.gen_loader` - list of available loaders 716 | later(function() 717 | -- Define language patterns to work better with 'friendly-snippets' 718 | local latex_patterns = { 'latex/**/*.json', '**/latex.json' } 719 | local lang_patterns = { 720 | tex = latex_patterns, 721 | plaintex = latex_patterns, 722 | -- Recognize special injected language of markdown tree-sitter parser 723 | markdown_inline = { 'markdown.json' }, 724 | } 725 | 726 | local snippets = require('mini.snippets') 727 | local config_path = vim.fn.stdpath('config') 728 | snippets.setup({ 729 | snippets = { 730 | -- Always load 'snippets/global.json' from config directory 731 | snippets.gen_loader.from_file(config_path .. '/snippets/global.json'), 732 | -- Load from 'snippets/' directory of plugins, like 'friendly-snippets' 733 | snippets.gen_loader.from_lang({ lang_patterns = lang_patterns }), 734 | }, 735 | }) 736 | 737 | -- By default snippets available at cursor are not shown as candidates in 738 | -- 'mini.completion' menu. This requires a dedicated in-process LSP server 739 | -- that will provide them. To have that, uncomment next line (use `gcc`). 740 | -- MiniSnippets.start_lsp_server() 741 | end) 742 | 743 | -- Split and join arguments (regions inside brackets between allowed separators). 744 | -- It uses Lua patterns to find arguments, which means it works in comments and 745 | -- strings but can be not as accurate as tree-sitter based solutions. 746 | -- Each action can be configured with hooks (like add/remove trailing comma). 747 | -- Example usage: 748 | -- - `gS` - toggle between joined (all in one line) and split (each on a separate 749 | -- line and indented) arguments. It is dot-repeatable (see `:h .`). 750 | -- 751 | -- See also: 752 | -- - `:h MiniSplitjoin.gen_hook` - list of available hooks 753 | later(function() require('mini.splitjoin').setup() end) 754 | 755 | -- Surround actions: add/delete/replace/find/highlight. Working with surroundings 756 | -- is surprisingly common: surround word with quotes, replace `)` with `]`, etc. 757 | -- This module comes with many built-in surroundings, each identified by a single 758 | -- character. It searches only for surrounding that covers cursor and comes with 759 | -- a special "next" / "last" versions of actions to search forward or backward 760 | -- (just like 'mini.ai'). All text editing actions are dot-repeatable (see `:h .`). 761 | -- 762 | -- Example usage (this may feel intimidating at first, but after practice it 763 | -- becomes second nature during text editing): 764 | -- - `saiw)` - *s*urround *a*dd for *i*nside *w*ord parenthesis (`)`) 765 | -- - `sdf` - *s*urround *d*elete *f*unction call (like `f(var)` -> `var`) 766 | -- - `srb[` - *s*urround *r*eplace *b*racket (any of [], (), {}) with padded `[` 767 | -- - `sf*` - *s*urround *f*ind right part of `*` pair (like bold in markdown) 768 | -- - `shf` - *s*urround *h*ighlight current *f*unction call 769 | -- - `srn{{` - *s*urround *r*eplace *n*ext curly bracket `{` with padded `{` 770 | -- - `sdl'` - *s*urround *d*elete *l*ast quote pair (`'`) 771 | -- - `vaWsa` - *v*isually select *a*round *W*ORD and *s*urround *a*dd 772 | -- spaces (``) 773 | -- 774 | -- See also: 775 | -- - `:h MiniSurround-builtin-surroundings` - list of all supported surroundings 776 | -- - `:h MiniSurround-surrounding-specification` - examples of custom surroundings 777 | -- - `:h MiniSurround-vim-surround-config` - alternative set of action mappings 778 | later(function() require('mini.surround').setup() end) 779 | 780 | -- Highlight and remove trailspace. Temporarily stops highlighting in Insert mode 781 | -- to reduce noise when typing. Example usage: 782 | -- - `ot` - trim all trailing whitespace in a buffer 783 | later(function() require('mini.trailspace').setup() end) 784 | 785 | -- Track and reuse file system visits. Every file/directory visit is persistently 786 | -- tracked on disk to later reuse: show in special frecency order, etc. It also 787 | -- supports adding labels to visited paths to quickly navigate between them. 788 | -- Example usage: 789 | -- - `fv` - find across all visits 790 | -- - `vv` / `vV` - add/remove special "core" label to current file 791 | -- - `vc` / `vC` - show files with "core" label; all or added within 792 | -- current working directory 793 | -- 794 | -- See also: 795 | -- - `:h MiniVisits-overview` - overview of how module works 796 | -- - `:h MiniVisits-examples` - examples of common setups 797 | later(function() require('mini.visits').setup() end) 798 | 799 | -- Not mentioned here, but can be useful: 800 | -- - 'mini.doc' - needed only for plugin developers. 801 | -- - 'mini.fuzzy' - not really needed on a daily basis. 802 | -- - 'mini.test' - needed only for plugin developers. 803 | --------------------------------------------------------------------------------