An open API service indexing awesome lists of open source software.

https://github.com/stuckinsnow/gitty

Interact with GitHub directly from neovim
https://github.com/stuckinsnow/gitty

fzf fzf-lua github github-api github-workflow neovim nvim plugin

Last synced: 5 months ago
JSON representation

Interact with GitHub directly from neovim

Awesome Lists containing this project

README

          

# ✨ Gitty — Beautiful GitHub & Git UI for Neovim

**Gitty** brings a modern, interactive, and beautiful GitHub and Git workflow to Neovim. It provides fuzzy pickers, previews, and side buffers for PRs, issues, branches, workflows, and more — all with color, async loading, and keyboard-driven UX.

https://github.com/user-attachments/assets/d6e57846-59a2-4038-8ad0-8c97ad6f5274

---

## 🚀 Features

- **Fuzzy pickers** for GitHub Pull Requests, Issues, Branches, Commits, and Workflows.
- **Rich previews**: Markdown rendered with color, commit diffs, PR/issue details, and more.
- **Create PRs and Issues** in a side buffer with templates and AI-assisted descriptions.
- **View and review** PR comments, issue comments, and workflow logs in split/floating windows.
- **Inline mini diff**: Compare current buffer or selection with any commit, accept/reject hunks.
- **Compare commits**: Diffview, inline, or file-at-commit with 3-pane layout.
- **Open on GitHub**: Open PRs, issues, commits, and branches in your browser.
- **Async loading** with spinners for a smooth experience.
- **Keymaps** for quick access to all features.

---

## 📦 Installation

### With [lazy.nvim](https://github.com/folke/lazy.nvim)

**Local/dev:**

```lua
{
dir = "/path/to/gitty",
name = "gitty",
dependencies = {
"nvim-lua/plenary.nvim",
"ibhagwan/fzf-lua",
},
config = function()
require("gitty").setup()
end,
dev = true,
},
```

**Remote:**

```lua
{
"stuckinsnow/gitty",
dependencies = {
"nvim-lua/plenary.nvim",
"ibhagwan/fzf-lua",
},
config = function()
require("gitty").setup()
end,
},
```

For AI assistance to work, you will need to create a new prompt in codecompanion, you can find that at the bottom of this README.

---

## ⚡️ Requirements

- [fzf-lua](https://github.com/ibhagwan/fzf-lua)
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim)
- [GitHub CLI (`gh`)](https://cli.github.com/)
- [fzf](https://github.com/junegunn/fzf)
- [git](https://git-scm.com/)
- [bat](https://github.com/sharkdp/bat) (for colored previews)
- [glow](https://github.com/charmbracelet/glow) (for markdown rendering)
- [delta](https://github.com/dandavison/delta) (for diffs)
- [mini.diff](https://github.com/echasnovski/mini.nvim) (for inline diff)

---

## 🗝️ Keymaps

| Keymap | Mode | Action |
| ------------ | ---- | -------------------------------------- |
| `g2` | n | Git Compare (commits, branches, etc.) |
| `g3` | n | Mini Diff (inline diff with commit) |
| `g3` | v | Mini Diff (diff selection with commit) |

**In PR/Issue/Commit/Branch pickers:**

- ``: Default action (diff, open, etc.)
- ``: Open details in right buffer (and show comments/reviews if available)
- ``: Open details in a new buffer
- ``: Diffview for PRs
- ``: Open on GitHub in browser
- ``: Copy PR commands to clipboard

**In PR/Issue creation buffers:**

- ``: Submit PR/Issue
- `q`: Cancel creation
- `` (insert): Submit PR/Issue

**In mini diff:**

- `ga`: Accept current hunk/selection
- `gr`: Reject current hunk/selection
- `gq`: Close mini diff

**In comparison pickers:**

- ``: Open diffview / minidiff comparisons
- ``: Show diff in side buffer
- ``: View file at specific commit (3-pane layout)

**File History picker:**

- ``: Copy commit hash to clipboard
- ``: View file at that commit

You can also add these to your configuration:

```
vim.keymap.set("n", "g1n", "FzfGithubNotifications", { desc = "GitHub Notifications" })
vim.keymap.set("n", "g1p", "FzfGithubPrs", { desc = "GitHub PRs" })
vim.keymap.set("n", "g1w", "FzfGithubWorkflows", { desc = "Github Workflows" })
vim.keymap.set("n", "g1i", "FzfGithubIssues", { desc = "GitHub Issues" })
vim.keymap.set("n", "g1c", "FzfCreateIssue", { desc = "Create GitHub Issue" })
vim.keymap.set("n", "g1C", "FzfCreatePr", { desc = "Create GitHub PR" })
vim.keymap.set("n", "g1B", "FzfGithubBranches", { desc = "List Branch Information" })
```

---

## 🧑‍💻 Commands

| Command | Description |
| ------------------------- | ---------------------------------------- |
| `:FzfGithubPrs` | List and preview GitHub Pull Requests |
| `:FzfGithubNotifications` | List Github Notifications |
| `:FzfGithubIssues` | List and preview GitHub Issues |
| `:FzfGithubBranches` | List and preview GitHub Branches |
| `:FzfGithubWorkflows` | List and preview GitHub Workflows & runs |
| `:FzfCreatePr` | Create a new Pull Request |
| `:FzfCreateIssue` | Create a new Issue |
| `:GittySetup` | (Re)initialize gitty |

---

## 🛠️ Usage

### PRs

- `:FzfGithubPrs` — Fuzzy pick PRs, preview details, diff, open in browser, copy commands, or open reviews.
- `` on a PR — Open PR details in a side buffer and show reviews.
- `` — Diffview for PR branch/files.
- `` — Copy useful PR commands to clipboard.

### Issues

- `:FzfGithubIssues` — Fuzzy pick issues, preview details, open in browser, or open comments.
- `` — Open issue details in a side buffer and show comments.

### Branches & Commits

- `:FzfGithubBranches` — List branches, preview latest commit, open on GitHub, or show commits.
- Selecting a branch — Show recent commits, preview details, open commit on GitHub, or open commit message in buffer.

### Workflows

- `:FzfGithubWorkflows` — List workflows, select to view runs, preview run details, open logs in split/floating window.

### Creating PRs & Issues

- `:FzfCreatePr` — Guided PR creation in a side buffer, with commit summary and AI description (if available).
- `:FzfCreateIssue` — Guided issue creation in a side buffer with template.

### Comparing & Diffing

- `g2` — Compare commits/branches: Diffview, inline, or file-at-commit.
- `g3` — Mini diff: Inline diff of current buffer with any commit.
- Visual `g3` — Mini diff: Inline diff of selection with any commit.

---

## 🧩 Extensibility

- All picker actions are customizable via fzf-lua.
- Utility functions for opening buffers, rendering markdown, and more.
- Async helpers for smooth UX.

---

## ✨ Highlights

You will need to set up the following highlights in your Neovim configuration to ensure gitty looks great:

```markdown
- MiniDiffSign: All diff signs in the buffer.
- MiniDiffSignChange: Changed lines line numbers.
- MiniDiffSignAdd: Added lines line numbers.
- MiniDiffSignDelete: Deleted lines line numbers.
- MiniDiffOverAdd: Highlights added lines.
- MiniDiffOverChange: Highlights changed lines.
- MiniDiffOverDelete: Highlights deleted lines.
- MiniDiffOverContext: Highlights context lines in diffs.
- MiniDiffOverContextBuf: Highlights context buffer for added lines.
```

---

### 🤖 CODECOMPANION

```
["PR Description"] = {
strategy = "inline",
description = "Generate a professional PR description from recent commits",
opts = {
short_name = "pr",
},
prompts = {
{
role = "system",
content = "You are a senior developer with years of experience. Create professional, concise pull request descriptions that clearly explain what the PR does, and key changes made, list what an experienced developer would mention but do not try impress anyone. The point is to convey information. Format responses as markdown.",
},
{
role = "user",
content = function()
-- Get current branch
local current_branch = vim.fn.system("git rev-parse --abbrev-ref HEAD"):gsub("%s+", "")

-- Get recent commits with full details
local commit_details = vim.fn.system("git log --oneline -n 10 --no-merges"):gsub("\r", "")

-- Get diff summary
local diff_summary = vim.fn.system("git diff --stat HEAD~5..HEAD"):gsub("\r", "")

-- Get list of changed files
local changed_files = vim.fn.system("git diff --name-only HEAD~5..HEAD"):gsub("\r", "")

return string.format(
[[
Please create a professional PR description based on the following information:

**Current Branch:** %s

**Recent Commits:**
%s

**Files Changed:**
%s

**Diff Summary:**
%s

Please generate a well-structured PR description that includes:
- A brief summary of what this PR does
- Key changes made
- Any notable implementation details
- Keep it concise but informative

Format the response as markdown.
]],
current_branch,
commit_details,
changed_files,
diff_summary
)
end,
},
},
},

```