/suit.nvim

A neovim plugin that replaces default input and select text prompts with nice floating windows

Primary LanguageLua

suit.nvim

A neovim plugin that replaces the default vim.ui.input and vim.ui.select implementations with floating windows.

Install

Use your plugin manager

require('paq')({
  -- ...
  'doums/suit.nvim',
})

Configuration

require('suit').setup({
  input = {
    -- default prompt value
    default_prompt = 'Input: ',
    -- border of the window (see `:h nvim_open_win`)
    border = 'single',
    -- highlight group for the input UI window
    -- links to NormalFloat
    hl_win = 'suitWin',
    -- highlight group for the prompt text
    -- links to NormalFloat
    hl_prompt = 'suitPrompt',
    -- highlight group for the window border
    -- links to FloatBorder
    hl_border = 'suitBorder',
    -- input width (in addition to the default value)
    width = 20,
    -- override arguments passed to `nvim_open_win` (see `:h nvim_open_win`)
    nvim_float_api = nil,
  },
  select = {
    -- default prompt value
    default_prompt = 'Select one of: ',
    -- border of the window (see `:h nvim_open_win`)
    border = 'single',
    -- highlight group for the select UI window
    -- links to NormalFloat
    hl_win = 'suitWin',
    -- highlight group for the prompt text
    -- links to NormalFloat
    hl_prompt = 'suitPrompt',
    -- highlight group for the selected item
    -- links to PmenuSel
    hl_sel = 'suitSel',
    -- highlight group for the window border
    -- links to FloatBorder
    hl_border = 'suitBorder',
    -- override arguments passed to `nvim_open_win` (see `:h nvim_open_win`)
    nvim_float_api = nil,
  },
})

All default configuration values are listed here.

Usage

Keymaps should be intuitive.

For input:

<cr> to confirm
<esc> to cancel

For select:

<cr> and left mouse double click to confirm the selected item
<esc>, q to cancel
j, k, <up>, <down> to navigate

License

Mozilla Public License 2.0