mini.nvim

repository·main·Indexed 26 days ago

https://github.com/nvim-mini/mini.nvim

An all-in-one library of over 45 independent Lua modules designed to improve the Neovim experience. It functions as a 'Swiss Army knife' where each module can be used separately without incurring startup or usage overhead. Modules cover text editing (e.g., mini.ai, mini.surround), general workflow (e.g., mini.files, mini.pick), and appearance (e.g., mini.statusline, mini.icons).

Tokens
50.7K
Snippets
115
Records
212
Agent score
92%

What's inside mini.nvim

  1. Explore mini.nvim Appearance modules

    main

    The following modules improve the visual appearance of Neovim. Recommended starting points are mini.hues, mini.icons, and mini.statusline.

    ModuleDescription
    mini.animateAnimate common Neovim actions
    mini.base16Base16 colorscheme creation
    mini.colorsTweak and save any color scheme
    mini.cursorwordAutohighlight word under cursor
    mini.hipatternsHighlight patterns in text
    mini.huesGenerate configurable color scheme
    mini.iconsIcon provider
    mini.indentscopeVisualize and work with indent scope
    mini.mapWindow with buffer text overview
    mini.notifyShow notifications
    mini.starterStart screen
    mini.statuslineStatusline
    mini.tablineTabline
    mini.trailspaceTrailspace (highlight and remove)
  2. Use MiniOperators features

    main

    Mini.operators provides several text editing capabilities:

    • Evaluate: Replace text with the result of a function (e.g., mathematical expressions).
    • Exchange: Swap two text regions.
    • Multiply: Duplicate a text region.
    • Replace: Replace a text region with the contents of a register.
    • Sort: Sort the selected text or lines.

    If you want manual control over mappings instead of the automated ones provided by setup(), use MiniOperators.make_mappings().

  3. Explore mini.misc features

    main

    The mini.misc module provides various utility functions for Neovim and Lua development:

    • Performance & Debugging:

      • bench_time(): Executes a function multiple times and measures the duration.
      • log_add() / log_show(): Manages an in-memory log array (useful for debugging Lua instead of using print()).
      • put(): Prints Lua objects to the command line.
      • put_text(): Prints Lua objects to the current buffer.
    • Window & UI Management:

      • resize_window(): Resizes the current window to its editable width.
      • zoom(): Makes the current buffer full screen in a floating window.
      • setup_termbg_sync(): Synchronizes terminal background to remove
  4. Key features of mini.snippets

    main

    Snippet Management

    • Flexible Loaders: Use MiniSnippets.gen_loader to manage collections.
    • Context-Aware Resolution: Snippets are resolved based on local context (e.g., different snippets for different tree-sitter languages).
    • Matching: Supports exact and fuzzy matching of prefixes.
    • Selection: If multiple snippets match, you can select one via vim.ui.select().

    Expansion and Session

    • Expansion: Use MiniSnippets.default_insert() to handle the expansion session.
    • Navigation: Configurable mappings for jumping between tabstops; jumping wraps around.
    • Visualization: Supports dynamic tabstop state visualization and inline visualization of empty tabstops.
    • LSP Integration: Start an in-process LSP server via MiniSnippets.start_lsp_server() to show snippets in completion engines like mini.completion.

    API

    • MiniSnippets.parse(): Parses a snippet body into a data structure.
  5. Use and extend mini.ai textobjects

    main

    mini.ai enhances and creates a/i textobjects. It supports dot-repeat, v:count, and consecutive application in Visual mode.

    Built-in Textobjects

    • Balanced brackets (with/without whitespace) and aliases.
    • Balanced quotes and aliases.
    • Function calls.
    • Arguments.
    • Tags.
    • User prompts.
    • Fallback for anything except Latin letters (using standard text-objects).

    Features

    • Motions: Jump to the left or right edge of a textobject using goto_left and goto_right mappings.
    • Customization: Create textobjects using Lua patterns or functions.
    • Treesitter: Generate Treesitter-based textobjects using the MiniAi.gen_spec.treesitter() helper.
    • Specification Generators: Use MiniAi.gen_spec to tweak built-in textobjects.
  6. Explore mini.nvim Text Editing modules

    main

    The following modules are designed to improve text editing experiences. Recommended starting points are mini.ai, mini.operators, and mini.surround.

    ModuleDescription
    mini.aiExtend and create a/i textobjects
    mini.alignAlign text interactively
    mini.commentComment lines
    mini.completionCompletion and signature help
    mini.keymapSpecial key mappings
    mini.moveMove any selection in any direction
    mini.operatorsText edit operators
    mini.pairsAutopairs
    mini.snippetsManage and expand snippets
    mini.splitjoinSplit and join arguments
    mini.surroundSurround actions
  7. Explore mini.nvim General Workflow modules

    main

    The following modules improve general Neovim workflows. Recommended starting points are mini.bracketed, mini.files, and mini.pick.

    ModuleDescription
    mini.basicsCommon configuration presets
    mini.bracketedGo forward/backward with square brackets
    mini.bufremoveRemove buffers
    mini.clueShow next key clues
    mini.cmdlineCommand line tweaks
    mini.depsPlugin manager
    mini.diffWork with diff hunks
    mini.extraExtra 'mini.nvim' functionality
    mini.filesNavigate and manipulate file system
    mini.gitGit integration
    mini.inputGet user input
    mini.jumpJump to next/previous single character
    mini.jump2dJump within visible lines
    mini.miscMiscellaneous functions
    mini.pickPick anything
    mini.sessionsSession management
    mini.visitsTrack and reuse file system visits
  8. Buffer removal behavior and window layout preservation

    main

    When a buffer is removed (unshow, delete, or wipeout), mini.bufremove uses an algorithm to decide which buffer to show in the window(s) to preserve the layout:

    1. If the alternate buffer is listed, it uses that.
    2. If the previous listed buffer is different, it uses that.
    3. Otherwise, it creates a new scratch buffer using nvim_create_buf(true, true) and uses it.
  9. Use mini.input for user input

    main

    Use mini.input to get user input with customizable views (floating window, statusline, virtual line, etc.). It is non-blocking but waits to return the input and works in any mode without requiring a mode change.

    It also provides an implementation for vim.ui.input(). To adjust this behavior, you can use MiniInput.ui_input() or manually save/restore vim.ui.input after calling MiniInput.setup().

    For detailed API usage, refer to the following help tags in Neovim:

    • :h MiniInput.get()
    • :h MiniInput.default_key()
    • :h MiniInput-state
    • :h MiniInput-examples
  10. Features of mini.tabline

    main

    Core Functionality

    • Buffer Listing: Buffers are listed in the order of their identifier.
    • Visual States: Uses different highlight groups for different buffer states.
    • Unique Naming: Buffer names are made unique by extending paths or appending unique identifiers to unnamed buffers.
    • Optimal Centering: The current buffer is centered in the screen while maximizing the total number of visible buffers.
    • Interactivity: Buffer tabs are clickable if supported by your Neovim configuration.
    • Multi-tabpage Support: Includes an extra information section for multiple Neovim tabpages.
    • Truncation: Uses listchars (precedes and extends fields) to show truncation symbols if the list option is enabled.
  11. Features of mini.move

    main

    Movement Modes

    • Visual mode: Select text (charwise v, linewise V, or blockwise CTRL-V) and use mappings to move in four directions. The plugin maintains Visual mode.
    • Normal mode: Use mappings to move the current line in four directions.

    Key Capabilities

    • Linewise Movement:
      • Vertical movement triggers reindentation (=).
      • Horizontal movement triggers improved indent/dedent (> / <).
      • The cursor moves along with the selection.
    • Undo Support: All consecutive moves (regardless of direction) can be undone with a single u command.
    • Count Support: Respects v:count. Preceding a mapping with a number multiplies the effect.
    • Column Awareness: Respects the preferred column for vertical movement, moving the selection as the cursor moves (not strictly vertical if the target column is unavailable in the target line).