Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

3 Commits

Repository files navigation

gitui.nvim

Gitui in your Neovim as terminal window.

How it's different from the original?

Original aspeddro/gitui.nvim plugin had .open() method which would open gitui interface as terminal window, but would not provide a simple way to toggle it's visibility and switch between nvim and gitui back & forth.

This implementation deprecates.open() method and replaces it with .toggle() which hides current gitui window and reuses created buffer between invocations, instead of re-creating it every time from scratch (this let's preserve gitui interface state between toggles) and .terminate() method which would gracefully remove reusable buffer and window.

Because of it, all previosly selected items in different tabs, collapsed/expanded folders, searches, etc. keep their state.

gitui_toggle_demo.mov

Prerequisites

Installation

Using packer.nvim:

use'dev99problems/gitui.nvim'

Setup

require("gitui").setup()

Configuration (optional)

Following are the default config for the setup(). If you want to override, just modify the option that you want then it will be merged with the default config, like

require('gitui').setup({
window= {
options= {
width=95,
height=100,
border='rounded'
}
},
})

Default config

{
-- Command Optionscommand= {
-- Enable :Gitui command-- @type: boolenable=true,
},
-- Path to binary-- @type: stringbinary="gitui",
-- Argumens to gitui-- @type: table of stringargs= {},
-- WIndow Optionswindow= {
options= {
-- Width window in %-- @type: numberwidth=90,
-- Height window in %-- @type: numberheight=80,
-- Border Style-- Enum: "none", "single", "rounded", "solid" or "shadow"-- @type: stringborder="rounded",
},
},
}

Lua API

require("gitui").toggle() -- toggles gitui window-- andrequire("gitui").terminate() -- removes cached buffer & window objects, usually should not be used manually

Hotkeys

If you're using .lua files for nvim configurations, the possible hotkeys can be set like

-- ## gituikeymap("n", "gui", ":lua require('gitui').toggle()<CR>", opts)
keymap("t", "gui", "<C-\\><C-n>:lua require('gitui').toggle()<CR>", opts)

Important this plugin does not set any hotkeys by default, so you can use provided example or set your own instead of gui, but please keep in mind setting hotkey for at least normal and terminal modes to be able to show & hide gitui properly.

About

Gitui in your Neovim, which keeps interface state between the toggles.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages