mini.files

repository·main·Indexed 20 days ago

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

A Neovim module for navigating and manipulating the file system using a Miller columns interface. It allows users to create, delete, rename, copy, and move files and directories by directly editing the text in the explorer buffer.

Tokens
1.1K
Snippets
3
Records
4
Agent score
20%

What's inside mini.files

  1. Install mini.files

    main

    You can install mini.files as part of the mini.nvim library (recommended) or as a standalone plugin. After installation, you must call require('mini.files').setup() to enable its functionality.

    Installation Methods

    Using vim.pack (Neovim 0.12+)

    Main branch (latest development):

    vim.pack.add({ 'https://github.com/nvim-mini/mini.files' })

    Stable branch:

    vim.pack.add({
      { src = 'https://github.com/nvim-mini/mini.files', version = 'stable' },
    })

    Using mini.deps (Neovim < 0.12)

    Main branch:

    add('nvim-mini/mini.files')

    Stable branch:

    add({ source = 'nvim-mini/mini.files', checkout = 'stable' })

    Using lazy.nvim

    Main branch:

    { 'nvim-mini/mini.files', version = false },

    Stable branch:

    { 'nvim-mini/mini.files', version = '*' },

    Windows Compatibility

    If you encounter Filename too long errors on Windows, either:

    1. Enable long paths in git: git config --system core.longpaths true.
    2. Install the plugin in a directory with a shorter path.
    require('mini.files').setup()
  2. Manipulate files and directories via buffer editing

    main

    In mini.files, file system actions are performed by editing the text in the explorer buffer. Once you have finished editing, press = to trigger the changes.

    Supported Actions

    • Create file/directory: Create a new line like file or dir/.
    • Create in descendant directory: Create a new line like dir/file or dir/nested/.
    • Delete: Delete the entire line representing the entry.
    • Rename: Change the text to the right of the entry's icon.
    • Copy: Copy a whole line and paste it into a target directory.
    • Move: Cut a whole line and paste it into a target directory.

    Confirming Changes

    After pressing =, a confirmation dialog will appear. Confirm with y or <CR>, or cancel with n or <Esc>.

  3. Navigate the file system with mini.files

    main

    Use :lua MiniFiles.open() to start the explorer. The interface uses Miller columns to display nested directories.

    • j/k: Move down/up.
    • l: Expand entry under cursor (show directory or open file in the most recent window).
    • h: Go to parent directory.
    • m<char>: Set the current directory path as a bookmark <char>.
    • '<char>: Jump to bookmark <char>.
    • '': Go back to the directory before the latest jump.
    • g?: Show help for available mappings and bookmarks.
    • Standard buffer motions (e.g., $, G, f, t) are supported.

    Dependencies

    For icons, it is recommended to have mini.icons enabled. It can also fall back to nvim-web-devicons.

    :lua MiniFiles.open()
  4. Configure mini.files

    main

    The setup() function accepts a configuration object. Below is the default configuration structure which you can override.

    Configuration Schema

    content

    Controls how file system entries are displayed.

    • filter: Predicate for which entries to show.
    • highlight: Highlight group for entries.
    • prefix: Prefix text/highlight to the left of entries.
    • sort: Order of entries.

    mappings

    Customizes explorer-specific keybindings. Use '' to disable a mapping.

    • close: 'q'
    • go_in: 'l'
    • go_in_plus: 'L'
    • go_out: 'h'
    • go_out_plus: 'H'
    • mark_goto: ''
    • mark_set: 'm'
    • reset: '<BS>'
    • reveal_cwd: '@'
    • show_help: 'g?'
    • synchronize: '='
    • trim_left: '<'
    • trim_right: '>'

    options

    • permanent_delete: Boolean. If true, deletes permanently; if false, moves to module-specific trash.
    • use_as_default_explorer: Boolean. If true, uses mini.files as the default file explorer.
    • lsp_timeout: Integer. Timeout for synchronous LSP integration requests.

    windows

    • max_number: Max side-by-side windows.
    • preview: Boolean. Whether to show a preview of the file/directory under cursor.
    • width_focus: Width of the focused window.
    • width_nofocus: Width of non-focused windows.
    • width_preview: Width of the preview window.
    require('mini.files').setup({
      -- Example: enable preview
      windows = {
        preview = true,
      },
      -- Example: use as default explorer
      options = {
        use_as_default_explorer = true,
      }
    })