Skip to content

MrDwarf7/lazyjui.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lazyjui.nvim

A Neovim plugin that provides a beautiful floating window interface for jj, leveraging the jjui TUI for functionality.

Features

  • Floating Window Interface - Clean, distraction-free jjui experience
  • Fast Integration - Seamless integration with your Neovim workflow
  • Customizable - Configurable window size, borders, and behavior
  • Smart Window Management - Auto-resize, focus handling, and proper cleanup
  • Health Checks - Built-in dependency validation

Prerequisites

  • Neovim >=0.7.0
  • plenary.nvim - Required dependency
  • jj - The VCS used with the plugin
  • jjui - The TUI/tool that's spawned inside the floating window

Installation & Configuration

Using lazy.nvim

{
  "mrdwarf7/lazyjui.nvim",
  dependencies = {
    "nvim-lua/plenary.nvim"
  },
  keys = {
    {
      -- Default is <Leader>jj
      -- An example of a custom mapping to open the interface
      "<Leader>gj",
      function()
        require("lazyjui").open()
      end,
    },
  },
  -- You can also simply pass `opts = true` or `opts = {}` and the default options will be used
  ---@type lazyjui.Opts
  opts =  {
    -- Optionally (default):
    border = {
      chars = { "", "", "", "", "", "", "", "" }, -- either set all to empty to remove the entire outer border (or nil/{})
      -- Use custom set of border chars (must be 8 long)
      -- border_chars = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }
      thickness = 0, -- This handles the border of the 'outer' window it's nested inside, generally this is invisible
      -- See `:h nvim_win_set_hl_ns()` and associated docs for more details
      -- previous option was: "FloatBorder:LazyJuiBorder,NormalFloat:LazyJuiFloat", -- up to you how to set
      winhl_str = "",
    },

    -- The below options will now produce a warning advising to use the above syntax instead.
    -- they'll work for a while; but note that the internal mapping will be removed in the future.
    ---@deprecated use 'opts.border.chars' instead
    -- border_chars = {},
    ---@deprecated use 'opts.border.thickness' instead
    -- border_thickness = 0,
    ---@deprecated use 'opts.border.winhl_str' instead
    -- border_winhl_str = "FloatBorder:LazyJuiBorder,NormalFloat:LazyJuiFloat",

    -- Support for custom command pass-through
    -- In this example, we use the revset `all()` command
    --
    -- Will default to just `jjui`
    cmd = { "jjui" },
    height = 0.8, -- default is 0.8,
    width = 0.9, -- default is 0.9,
    winblend = 0, -- default is 0 (fully opaque). Set to 100 for fully transparent (not recommended though).
    -- hide_only = false, -- This is **experimental** and is subject to changing, currently not available
    use_default_keymaps = true, -- setting this to false will result in no default mappings at all
  }
}

Usage

Commands

  • :LazyJui - Open the LazyJui floating window

API

local lazyjui = require("lazyjui")

-- Open the interface
lazyjui.open()

-- Close the interface
lazyjui.close()

Health Check

Verify your installation and dependencies:

:checkhealth lazyjui

Keymaps

The plugin sets a default keymap to open the interface. You can customize it in your Neovim configuration:

vim.api.nvim_set_keymap('n', '<Leader>gj', ':lua require("lazyjui").open()<CR>', { noremap = true, silent = true })

Or the recommended way is to use the keys table in the plugin spec/configuration:

{
  "mrdwarf7/lazyjui.nvim",
  keys = {
    {
      "<Leader>gj",
      function()
        require("lazyjui").open()
      end,
    },
  }
}

How It Works

LazyJui creates a floating window and spawns the jjui command inside it as a terminal job. The window:

  • Automatically resizes when you resize Neovim
  • Closes when you lose focus
  • Properly cleans up resources to prevent memory leaks
  • Integrates with plenary.nvim for enhanced window positioning when available

Troubleshooting

"jjui executable not found" error

Make sure you have the jjui command available & installed. It must be available on your PATH:

# Check if jjui is installed
which jjui

# Oh no!
# Follow the instructions on the official jjui repository

# If using Arch for instance:
paru -S jjui-bin # or yay

Window positioning issues

If you're experiencing window positioning problems, make sure you have plenary.nvim installed. LazyJui uses plenary's advanced window positioning when available. If you're still having problems with it, please open an issue with details about your Neovim version, OS, and any relevant configuration.

Health check fails

Run :checkhealth lazyjui to diagnose issues. Common problems:

  • Missing plenary.nvim dependency
  • jjui not in PATH
  • Neovim version too old

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE for details.

Related Projects

  • plenary.nvim - Window management and other utilities
  • jj - The new-fangled VCS system that's all the rage with the cool kids
  • jjui - A TUI tool for jj that makes it a lil bit easier to understand what is going on

About

Small plugin to pull up jj/jujutsu using the jjtui Go project.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages