Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A minimal, extensible minibuffer interface for Neovim. Provides an interactive input area for commands, prompts, and UI interactions, fully scriptable in Lua.

License

Notifications You must be signed in to change notification settings

simifalaye/minibuffer.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minibuffer

Lua

A highly experimental general purpose interactive interface for neovim.

Demo.mp4

NOTE:

  • This plugin is still under development
  • It depends on an experimental feature in neovim nightly (vim._extui)

This plugin provides an api for an optional unified interactive buffer interface. Instead of having one plugin open a floating popup for fuzzy file search, another showing a completion menu at the bottom, another drawing commandline completions above the status bar and yet another drawing a general purpose picker in a different location, you can choose to have one place where interactive input can be shown that feels native to the editor and is predictable. This includes:

  • Running commands with completion.
  • Fuzzy finding files or buffers.
  • Searching text across a project.
  • Input prompts for LSP or Git actions.
  • Even interactive plugin UIs (think Telescope, fzf, etc).
  • Display timely content (think which-key.nvim or mini.pick)

For Neovim, something like this could replace the ad-hoc popup/floating windows many plugins use, giving us a consistent workflow: a single expandable buffer for all kinds of input and interactive tasks.

Goal

The goal of this plugin is to eventually put some form of lua/minibuffer/core.lua into neovim core if desired by the maintainers.

Since this interface exists as plugin for now, it will require an integration layer with other plugins to use their backend. I have integration implementations in lua/minibuffer/integrations.

Prerequisites

  • neovim >= 0.12 (currently on nightly)
  • Extui enable somewhere early in your init.lua:
require("vim._extui").enable({ enable = true, msg = { target = "msg" } })

Installation

MAKE SURE YOU HAVE ENABLED vim._extui (See prerequisites)

MiniDeps.now(function()
  MiniDeps.add({
    source = "simifalaye/minibuffer.nvim",
  })

  local minibuffer = require("minibuffer")

  vim.ui.select = require("minibuffer.builtin.ui_select")
  vim.ui.input = require("minibuffer.builtin.ui_input")

  vim.keymap.set("n", "<M-;>", require("minibuffer.builtin.cmdline"))
  vim.keymap.set("n", "<M-.>", function()
    minibuffer.resume(true)
  end)
end)
{
  "simifalaye/minibuffer.nvim",
  init = function()
    local minibuffer = require("minibuffer")

    vim.ui.select = require("minibuffer.builtin.ui_select")
    vim.ui.input = require("minibuffer.builtin.ui_input")

    vim.keymap.set("n", "<M-;>", require("minibuffer.builtin.cmdline"))
    vim.keymap.set("n", "<M-.>", function()
      minibuffer.resume(true)
    end)
  end,
}

Examples

I have written a few usable examples for this interface for demonstration.

Custom Pickers

vim.keymap.set("n", "<leader>.", require("minibuffer.examples.files"))
vim.keymap.set("n", "<leader>,", require("minibuffer.examples.buffers"))
vim.keymap.set("n", "<leader>/", require("minibuffer.examples.live-grep"))
vim.keymap.set("n", "<leader>o", function()
  require("minibuffer.examples.oldfiles")({ cwd = vim.fn.getcwd() })
end)
vim.keymap.set("n", "<leader>O", require("minibuffer.examples.oldfiles"))

Integrations with existing plugins

These integrations are mostly for demonstration purposes as proper support will best happen inside each plugin themselves. Changes to each plugin repo could break the integration.

Which-key.nvim

which-key-integration
-- NOTE: after loading plugin
local wk_mb = require("minibuffer.integrations.which-key")
local wk_view = require("which-key.view")
wk_view.show = wk_mb.show
wk_view.hide = wk_mb.hide

FFF.nvim

fff-integration
-- NOTE: after loading plugin
local picker_ui = require("fff.picker_ui")
picker_ui.open = require("minibuffer.integrations.fff")

mini-pick.nvim

mini-pick-integration

NOTE:

  • Not tested with extra pickers found in mini-extra
  • live-grep does not work yet, feel free to use the live-grep picker from the examples
-- NOTE: after loading plugin
local pick_mb = require("minibuffer.integrations.mini-pick")
pick.is_picker_active = pick_mb.is_picker_active
pick.set_picker_items = pick_mb.set_picker_items
pick.start = pick_mb.start

About

A minimal, extensible minibuffer interface for Neovim. Provides an interactive input area for commands, prompts, and UI interactions, fully scriptable in Lua.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages