tamton-aquib / flirt.nvim

A neovim plugin to work with floating windows.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flirt.nvim

Animations for floating windows in neovim.
Was about to name this float.nvim but god said "no".

TLDR: Animations + Resizing + Moving floating windows.

Warning Highly experimental. Overrides the default nvim_open_win to achieve the open animation effect.

Showcase

flirt_demo.mp4

Installation

use { 'tamton-aquib/flirt.nvim' }

Usage

require("flirt").setup()
Click here to see default configuration
require("flirt").setup {
    override_open = true, -- experimental
    close_command = 'Q',
    default_move_mappings = true,   -- <C-arrows> to move floats
    default_resize_mappings = true, -- <A-arrows> to resize floats
    default_mouse_mappings = true,  -- Drag floats with mouse
    exclude_fts = {'notify', 'cmp_menu'},
    speed = 95, -- Can vary from 1 to 100 (100 is fast)
    custom_filter = function(buffer, win_config)
        return vim.bo[buffer].filetype == 'cmp_menu' -- avoids animation
    end
    -- more options on the way.
}

If you want to map to different keys:

local f = require("flirt")

vim.keymap.set('n', '<leader><left>', function() f.move("left") end, {})
vim.keymap.set('n', '<leader><up>', function() f.move("up") end, {}) -- etc

NOTES

  • Its a single file with approximately 200LOC
  • Contributions are welcome for improvement.
  • Extracted from stuff.nvim
  • Might work well with hydra.nvim, haven't checked.

Credits

About

A neovim plugin to work with floating windows.


Languages

Language:Lua 100.0%