Skip to content

Commit

Permalink
Merge pull request #465 from benelan/icon-readme-cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Muñoz authored Dec 16, 2023
2 parents 6825996 + 1dacf1c commit 4a60f50
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 58 deletions.
115 changes: 78 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,38 @@ Edit and review GitHub issues and pull requests from the comfort of your favorit

[<img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="BuyMeACoffee" width="140">](https://www.buymeacoffee.com/pwntester)


# 🌲 Table of Contents
* [✨ Features](#-features)
* [⚡️ Requirements](#-requirements)
* [📦 Installation](#-installation)
* [⚙️ Configuration](#-configuration)
* [🚀 Usage](#-usage)
* [🤖 Commands](#-commands)
* [🔥 Examples](#-examples)
* [📋 PR reviews](#-pr-reviews)
* [🍞 Completion](#-completion)
* [🎨 Colors](#-colors)
* [🏷️ Status Column](#-statuscolumn)
* [🚀 Demos](#-demos)
* [🙋 FAQ](#-faq)
* [✋ Contributing](#-contributing)
* [📜 License](#-license)

## ✨ Features
## 🌲 Table of Contents

<!--toc:start-->
- [:octopus: Octo.nvim](#octopus-octonvim)
- [🌲 Table of Contents](#-table-of-contents)
- [💫 Features](#-features)
- [🎯 Requirements](#-requirements)
- [📦 Installation](#-installation)
- [🔧 Configuration](#-configuration)
- [🚀 Usage](#-usage)
- [🤖 Commands](#-commands)
- [🔥 Examples](#-examples)
- [📋 PR reviews](#-pr-reviews)
- [🍞 Completion](#-completion)
- [🎨 Colors](#-colors)
- [🗿 Status Column](#-status-column)
- [📺 Demos](#-demos)
- [🙋 FAQ](#-faq)
- [🙌 Contributing](#-contributing)
- [🌟 Credits](#-credits)
- [🙏 Say Thanks](#-say-thanks)
- [📜 License](#-license)
<!--toc:end-->

## 💫 Features

- Edit GitHub issues and PRs
- Add/Modify/Delete comments
- Add/Remove label, reactions, assignees, project cards, reviewers, etc.
- Add Review PRs

## ⚡️Requirements
## 🎯 Requirements

- Install [GitHub CLI](https://cli.github.com/)
- Install [plenary.nvim](https://github.com/nvim-lua/plenary.nvim)
Expand All @@ -59,7 +65,7 @@ Edit and review GitHub issues and pull requests from the comfort of your favorit

## 📦 Installation

Use your favourite plugin manager to install it. eg:
Use your favourite plugin manager to install it, e.g.:

```lua
use {
Expand All @@ -75,25 +81,30 @@ use {
}
```

## ⚙️ Configuration
## 🔧 Configuration

```lua
require"octo".setup({
use_local_fs = false, -- use local files on right side of reviews
enable_builtin = false, -- shows a list of builtin actions when no action is provided
default_remote = {"upstream", "origin"}; -- order to try remotes
ssh_aliases = {}, -- SSH aliases. e.g. `ssh_aliases = {["github.com-work"] = "github.com"}`
picker = "telescope", -- or "fzf-lua"
picker_config = {
mappings = {
use_emojis = false, -- only used by "fzf-lua" picker for now
mappings = { -- mappings for the pickers
open_in_browser = { lhs = "<C-b>", desc = "open issue in browser" },
copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
checkout_pr = { lhs = "<C-o>", desc = "checkout pull request" },
merge_pr = { lhs = "<C-r>", desc = "merge pull request" },
},
},
reaction_viewer_hint_icon = ""; -- marker for user reactions
comment_icon = "", -- comment marker
outdated_icon = "󰅒 ", -- outdated indicator
resolved_icon = "", -- resolved indicator
reaction_viewer_hint_icon = ""; -- marker for user reactions
user_icon = ""; -- user icon
timeline_marker = ""; -- timeline marker
timeline_marker = " "; -- timeline marker
timeline_indent = "2"; -- timeline indentation
right_bubble_delimiter = ""; -- bubble delimiter
left_bubble_delimiter = ""; -- bubble delimiter
Expand Down Expand Up @@ -121,6 +132,20 @@ require"octo".setup({
size = 10, -- changed files panel rows
use_icons = true -- use web-devicons in file panel (if false, nvim-web-devicons does not need to be installed)
},
colors = { -- used for highlight groups (see Colors section below)
white = "#ffffff",
grey = "#2A354C",
black = "#000000",
red = "#fdb8c0",
dark_red = "#da3633",
green = "#acf2bd",
dark_green = "#238636",
yellow = "#d3c846",
dark_yellow = "#735c0f",
blue = "#58A6FF",
dark_blue = "#0366d6",
purple = "#6f42c1",
},
mappings = {
issue = {
close_issue = { lhs = "<space>ic", desc = "close issue" },
Expand Down Expand Up @@ -192,6 +217,8 @@ require"octo".setup({
prev_comment = { lhs = "[c", desc = "go to previous comment" },
select_next_entry = { lhs = "]q", desc = "move to previous changed file" },
select_prev_entry = { lhs = "[q", desc = "move to next changed file" },
select_first_entry = { lhs = "[Q", desc = "move to first changed file" },
select_last_entry = { lhs = "]Q", desc = "move to last changed file" },
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
react_hooray = { lhs = "<space>rp", desc = "add/remove 🎉 reaction" },
react_heart = { lhs = "<space>rh", desc = "add/remove ❤️ reaction" },
Expand All @@ -217,6 +244,8 @@ require"octo".setup({
prev_thread = { lhs = "[t", desc = "move to previous thread" },
select_next_entry = { lhs = "]q", desc = "move to previous changed file" },
select_prev_entry = { lhs = "[q", desc = "move to next changed file" },
select_first_entry = { lhs = "[Q", desc = "move to first changed file" },
select_last_entry = { lhs = "]Q", desc = "move to last changed file" },
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
toggle_viewed = { lhs = "<leader><space>", desc = "toggle viewer viewed state" },
goto_file = { lhs = "gf", desc = "go to file" },
Expand All @@ -230,10 +259,12 @@ require"octo".setup({
toggle_files = { lhs = "<leader>b", desc = "hide/show changed files panel" },
select_next_entry = { lhs = "]q", desc = "move to previous changed file" },
select_prev_entry = { lhs = "[q", desc = "move to next changed file" },
select_first_entry = { lhs = "[Q", desc = "move to first changed file" },
select_last_entry = { lhs = "]Q", desc = "move to last changed file" },
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
toggle_viewed = { lhs = "<leader><space>", desc = "toggle viewer viewed state" },
}
}
},
},
})
```

Expand All @@ -244,7 +275,7 @@ Just edit the issue title, body or comments as a regular buffer and use `:w(rite
## 🤖 Commands

There is only an `Octo <object> <action> [arguments]` command:
If no command is passed, the argument to `Octo` is treated as a URL from where an issue or pr repo and number are extracted
If no command is passed, the argument to `Octo` is treated as a URL from where an issue or pr repo and number are extracted.

| Object | Action | Arguments|
|---|---|---|
Expand Down Expand Up @@ -314,11 +345,13 @@ If no command is passed, the argument to `Octo` is treated as a URL from where a
0. `[repo]`: If repo is not provided, it will be derived from `<cwd>/.git/config`.

1. In-menu mappings:

- `<CR>`: Edit Issue
- `<C-b>`: Opens issue in the browser
- `<C-y>`: Copies URL to system clipboard

[Available filter keys](https://docs.github.com/en/free-pro-team@latest/graphql/reference/input-objects#issuefilters)

- since
- createdBy
- assignee
Expand All @@ -327,31 +360,34 @@ If no command is passed, the argument to `Octo` is treated as a URL from where a
- milestone
- states


2. In-menu mappings:

- `<CR>`: Edit PR
- `<C-b>`: Opens PR in the browser
- `<C-o>`: Checkout PR
- `<C-y>`: Copies URL to system clipboard

[Available filter keys](https://github.com/pwntester/octo.nvim/blob/master/lua/octo/pickers/telescope/provider.lua#L34)

- baseRefName
- headRefName
- labels
- states

3. In-menu mappings:

- `<CR>`: View repo
- `<C-b>`: Opens repo in the browser
- `<C-y>`: Copies URL to system clipboard

4. In-menu mappings:

- `<CR>`: Append Gist to buffer
[Available keys](https://cli.github.com/manual/gh_gist_list): `repo`\|`public`\|`secret`
[Available keys](https://cli.github.com/manual/gh_gist_list): `repo`\|`public`\|`secret`

## 🔥 Examples

```
```vim
Octo https://github.com/pwntester/octo.nvim/issues/12
Octo issue create
Octo issue create pwntester/octo.nvim
Expand All @@ -366,7 +402,7 @@ Octo search assignee:pwntester is:pr

## 📋 PR reviews

- Open the PR (eg: `Octo <PR url>` or `Octo pr list` or `Octo pr edit <PR number>`)
- Open the PR (e.g. `Octo <PR url>` or `Octo pr list` or `Octo pr edit <PR number>`)
- Start a review with `Octo review start` or resume a pending review with `Octo review resume`
- A new tab will show a panel with changed files and two windows showing the diff on any of them.
- Change panel entries with `]q` and `[q` or by selecting an entry in the window
Expand All @@ -384,9 +420,11 @@ Octo search assignee:pwntester is:pr
- A new float window will pop up. Enter the top level review comment and exit to normal mode. Then press `<C-m>` to submit a comment, `<C-a>` to approve it or `<C-r>` to request changes

## 🍞 Completion

Octo provides a built-in omnifunc completion for issues, PRs and users that you can trigger using `<C-x><C-o>`. Alternately, if you use [`nvim-cmp`](https://github.com/hrsh7th/nvim-cmp) for completion, you can use the [`cmp-git`](https://github.com/petertriho/cmp-git/) source to provide issues, PRs, commits and users completion.

## 🎨 Colors

| Highlight Group | Defaults to |
| --- | --- |
| *OctoDirty* | ErrorMsg |
Expand Down Expand Up @@ -428,7 +466,8 @@ Octo provides a built-in omnifunc completion for issues, PRs and users that you
The term `GitHub color` refers to the colors used in the WebUI.
The (addition) `viewer` means the user of the plugin or more precisely the user authenticated via the `gh` CLI tool used to retrieve the data from GitHub.

## 🏷️ Status Column
## 🗿 Status Column

If you are using the `vim.opt.statuscolumn` feature, you can disable Octo's comment marks in the `signcolumn` and replace them with any customizations on the `statuscolumn`.

Disable the `signcolumn` with:
Expand Down Expand Up @@ -484,7 +523,7 @@ end
vim.opt.statuscolumn = "%{%v:lua.get_statuscol_octo(bufnr(), v:lnum)%}"
```

## Demos
## 📺 Demos

![issues](https://user-images.githubusercontent.com/125701/124568675-76130600-de45-11eb-9944-2607c5863f37.gif)

Expand All @@ -494,7 +533,7 @@ vim.opt.statuscolumn = "%{%v:lua.get_statuscol_octo(bufnr(), v:lnum)%}"

**How can I disable bubbles for XYZ?**

Each text-object that makes use of a bubble (except labels) do use their own highlight group that linkes per default to the main bubble highlight group. To disable most bubbles at once you can simply link `OctoBubble` to `Normal`. To only disable them for a certain plain do the same for the specific sub-group (e.g. `OctoUser`).
Each text-object that makes use of a bubble (except labels) do use their own highlight group that links per default to the main bubble highlight group. To disable most bubbles at once you can simply link `OctoBubble` to `Normal`. To only disable them for a certain plain do the same for the specific sub-group (e.g. `OctoUser`).

**Why do my issue titles or markdown syntax do not get highlighted properly?**

Expand All @@ -512,7 +551,7 @@ GITHUB_TOKEN= gh auth login

... and choose a method to authorise access for `gh`.

`gh` must store the creds so it can work in a subshell.
`gh` must store the credentials so it can work in a subshell.

**Can I use treesitter markdown parser with octo buffers?**

Expand All @@ -539,10 +578,11 @@ Note: You need to provide the `repo`, otherwise it will search for every PR by t
**How to enable autocompletion for issues/prs (`#`) and users (`@`)?**

Add the following mappings for `octo` file type:

- `vim.keymap.set("i", "@", "@<C-x><C-o>", { silent = true, buffer = true })`
- `vim.keymap.set("i", "#", "#<C-x><C-o>", { silent = true, buffer = true })`

## Contributing
## 🙌 Contributing

Contributions are always welcome!

Expand All @@ -551,6 +591,7 @@ See [`CONTRIBUTING`](/CONTRIBUTING.md) for ways to get started.
Please adhere to this project's [`CODE_OF_CONDUCT`](/CODE_OF_CONDUCT.md).

## 🌟 Credits

The PR review panel is heavily inspired in [diffview.nvim](https://github.com/sindrets/diffview.nvim)

## 🙏 Say Thanks
Expand Down
4 changes: 2 additions & 2 deletions lua/octo/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ M.defaults = {
},
default_remote = { "upstream", "origin" },
ssh_aliases = {},
reaction_viewer_hint_icon = "",
reaction_viewer_hint_icon = " ",
user_icon = "",
comment_icon = "",
outdated_icon = "󰅒 ",
resolved_icon = "",
timeline_marker = "",
timeline_marker = " ",
timeline_indent = "2",
right_bubble_delimiter = "",
left_bubble_delimiter = "",
Expand Down
2 changes: 1 addition & 1 deletion lua/octo/pickers/telescope/entry_maker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function M.gen_from_issue(max_number, print_repo)
},
}
else
local icon = entry.kind == "issue" and "" or ""
local icon = entry.kind == "issue" and " " or " "
columns = {
{ entry.value, "TelescopeResultsNumber" },
{ icon .. " " .. entry.obj.title },
Expand Down
1 change: 0 additions & 1 deletion lua/octo/ui/writers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ function M.write_details(bufnr, issue, update)
local strongest_review = utils.calculate_strongest_review_state(reviewers[name])
local reviewer_vt = {
{ name, "OctoUser" },
{ " " },
{ utils.state_icon_map[strongest_review], utils.state_hl_map[strongest_review] },
{ " " },
}
Expand Down
34 changes: 17 additions & 17 deletions lua/octo/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ M.state_hl_map = {
}

M.state_icon_map = {
MERGED = "",
CLOSED = "",
OPEN = "",
APPROVED = "",
CHANGES_REQUESTED = "±",
COMMENTED = "",
DISMISSED = "",
PENDING = "",
REVIEW_REQUIRED = "",
MERGED = " ",
CLOSED = " ",
OPEN = " ",
APPROVED = " ",
CHANGES_REQUESTED = "± ",
COMMENTED = " ",
DISMISSED = " ",
PENDING = " ",
REVIEW_REQUIRED = " ",
}

M.state_message_map = {
Expand Down Expand Up @@ -96,14 +96,14 @@ function M.calculate_strongest_review_state(states)
end

M.reaction_map = {
["THUMBS_UP"] = "👍",
["THUMBS_DOWN"] = "👎",
["LAUGH"] = "😀",
["HOORAY"] = "🎉",
["CONFUSED"] = "😕",
["HEART"] = "❤️",
["ROCKET"] = "🚀",
["EYES"] = "👀",
["THUMBS_UP"] = "👍 ",
["THUMBS_DOWN"] = "👎 ",
["LAUGH"] = "😀 ",
["HOORAY"] = "🎉 ",
["CONFUSED"] = "😕 ",
["HEART"] = "❤️ ",
["ROCKET"] = "🚀 ",
["EYES"] = "👀 ",
}

function M.tbl_slice(tbl, first, last, step)
Expand Down

0 comments on commit 4a60f50

Please sign in to comment.