Giter Club home page Giter Club logo

octo.nvim's Introduction

GitHub repository size Issues License Say thanks Latest commit Repository's starts

๐Ÿ™ Octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor.

BuyMeACoffee

๐ŸŒฒ Table of Contents

๐Ÿ’ซ Features

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

๐ŸŽฏ Requirements

  • Install GitHub CLI
    • If you'd like to use Projects v2 you will need to add the read:project scope to your gh token. You can do so by running gh auth refresh -s read:project.
    • If you'd like to actually modify projects you can instead add the project scope to your token instead.
  • Install plenary.nvim
  • Install one of:
  • Install nvim-web-devicons

๐Ÿ“ฆ Installation

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

use {
  'pwntester/octo.nvim',
  requires = {
    'nvim-lua/plenary.nvim',
    'nvim-telescope/telescope.nvim',
    -- OR 'ibhagwan/fzf-lua',
    'nvim-tree/nvim-web-devicons',
  },
  config = function ()
    require"octo".setup()
  end
}

๐Ÿ”ง Configuration

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
  default_merge_method = "commit",         -- default merge method which should be used when calling `Octo pr merge`, could be `commit`, `rebase` or `squash`
  ssh_aliases = {},                        -- SSH aliases. e.g. `ssh_aliases = {["github.com-work"] = "github.com"}`
  picker = "telescope",                    -- or "fzf-lua"
  picker_config = {
    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" },
    },
  },
  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_indent = "2";                   -- timeline indentation
  right_bubble_delimiter = "๎‚ด";            -- bubble delimiter
  left_bubble_delimiter = "๎‚ถ";             -- bubble delimiter
  github_hostname = "";                    -- GitHub Enterprise host
  snippet_context_lines = 4;               -- number or lines around commented lines
  gh_cmd = "gh",                           -- Command to use when calling Github CLI
  gh_env = {},                             -- extra environment variables to pass on to GitHub CLI, can be a table or function returning a table
  timeout = 5000,                          -- timeout for requests between the remote server
  default_to_projects_v2 = false,          -- use projects v2 for the `Octo card ...` command by default. Both legacy and v2 commands are available under `Octo cardlegacy ...` and `Octo cardv2 ...` respectively.
  ui = {
    use_signcolumn = true,                 -- show "modified" marks on the sign column
  },
  issues = {
    order_by = {                           -- criteria to sort results of `Octo issue list`
      field = "CREATED_AT",                -- either COMMENTS, CREATED_AT or UPDATED_AT (https://docs.github.com/en/graphql/reference/enums#issueorderfield)
      direction = "DESC"                   -- either DESC or ASC (https://docs.github.com/en/graphql/reference/enums#orderdirection)
    }
  },
  pull_requests = {
    order_by = {                           -- criteria to sort the results of `Octo pr list`
      field = "CREATED_AT",                -- either COMMENTS, CREATED_AT or UPDATED_AT (https://docs.github.com/en/graphql/reference/enums#issueorderfield)
      direction = "DESC"                   -- either DESC or ASC (https://docs.github.com/en/graphql/reference/enums#orderdirection)
    },
    always_select_remote_on_create = false -- always give prompt to select base remote repo when creating PRs
  },
  file_panel = {
    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_disable_default = false,        -- disable default mappings if true, but will still adapt user mappings
  mappings = {
    issue = {
      close_issue = { lhs = "<space>ic", desc = "close issue" },
      reopen_issue = { lhs = "<space>io", desc = "reopen issue" },
      list_issues = { lhs = "<space>il", desc = "list open issues on same repo" },
      reload = { lhs = "<C-r>", desc = "reload issue" },
      open_in_browser = { lhs = "<C-b>", desc = "open issue in browser" },
      copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
      add_assignee = { lhs = "<space>aa", desc = "add assignee" },
      remove_assignee = { lhs = "<space>ad", desc = "remove assignee" },
      create_label = { lhs = "<space>lc", desc = "create label" },
      add_label = { lhs = "<space>la", desc = "add label" },
      remove_label = { lhs = "<space>ld", desc = "remove label" },
      goto_issue = { lhs = "<space>gi", desc = "navigate to a local repo issue" },
      add_comment = { lhs = "<space>ca", desc = "add comment" },
      delete_comment = { lhs = "<space>cd", desc = "delete comment" },
      next_comment = { lhs = "]c", desc = "go to next comment" },
      prev_comment = { lhs = "[c", desc = "go to previous comment" },
      react_hooray = { lhs = "<space>rp", desc = "add/remove ๐ŸŽ‰ reaction" },
      react_heart = { lhs = "<space>rh", desc = "add/remove โค๏ธ reaction" },
      react_eyes = { lhs = "<space>re", desc = "add/remove ๐Ÿ‘€ reaction" },
      react_thumbs_up = { lhs = "<space>r+", desc = "add/remove ๐Ÿ‘ reaction" },
      react_thumbs_down = { lhs = "<space>r-", desc = "add/remove ๐Ÿ‘Ž reaction" },
      react_rocket = { lhs = "<space>rr", desc = "add/remove ๐Ÿš€ reaction" },
      react_laugh = { lhs = "<space>rl", desc = "add/remove ๐Ÿ˜„ reaction" },
      react_confused = { lhs = "<space>rc", desc = "add/remove ๐Ÿ˜• reaction" },
    },
    pull_request = {
      checkout_pr = { lhs = "<space>po", desc = "checkout PR" },
      merge_pr = { lhs = "<space>pm", desc = "merge commit PR" },
      squash_and_merge_pr = { lhs = "<space>psm", desc = "squash and merge PR" },
      rebase_and_merge_pr = { lhs = "<space>prm", desc = "rebase and merge PR" },
      list_commits = { lhs = "<space>pc", desc = "list PR commits" },
      list_changed_files = { lhs = "<space>pf", desc = "list PR changed files" },
      show_pr_diff = { lhs = "<space>pd", desc = "show PR diff" },
      add_reviewer = { lhs = "<space>va", desc = "add reviewer" },
      remove_reviewer = { lhs = "<space>vd", desc = "remove reviewer request" },
      close_issue = { lhs = "<space>ic", desc = "close PR" },
      reopen_issue = { lhs = "<space>io", desc = "reopen PR" },
      list_issues = { lhs = "<space>il", desc = "list open issues on same repo" },
      reload = { lhs = "<C-r>", desc = "reload PR" },
      open_in_browser = { lhs = "<C-b>", desc = "open PR in browser" },
      copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
      goto_file = { lhs = "gf", desc = "go to file" },
      add_assignee = { lhs = "<space>aa", desc = "add assignee" },
      remove_assignee = { lhs = "<space>ad", desc = "remove assignee" },
      create_label = { lhs = "<space>lc", desc = "create label" },
      add_label = { lhs = "<space>la", desc = "add label" },
      remove_label = { lhs = "<space>ld", desc = "remove label" },
      goto_issue = { lhs = "<space>gi", desc = "navigate to a local repo issue" },
      add_comment = { lhs = "<space>ca", desc = "add comment" },
      delete_comment = { lhs = "<space>cd", desc = "delete comment" },
      next_comment = { lhs = "]c", desc = "go to next comment" },
      prev_comment = { lhs = "[c", desc = "go to previous comment" },
      react_hooray = { lhs = "<space>rp", desc = "add/remove ๐ŸŽ‰ reaction" },
      react_heart = { lhs = "<space>rh", desc = "add/remove โค๏ธ reaction" },
      react_eyes = { lhs = "<space>re", desc = "add/remove ๐Ÿ‘€ reaction" },
      react_thumbs_up = { lhs = "<space>r+", desc = "add/remove ๐Ÿ‘ reaction" },
      react_thumbs_down = { lhs = "<space>r-", desc = "add/remove ๐Ÿ‘Ž reaction" },
      react_rocket = { lhs = "<space>rr", desc = "add/remove ๐Ÿš€ reaction" },
      react_laugh = { lhs = "<space>rl", desc = "add/remove ๐Ÿ˜„ reaction" },
      react_confused = { lhs = "<space>rc", desc = "add/remove ๐Ÿ˜• reaction" },
      review_start = { lhs = "<space>vs", desc = "start a review for the current PR" },
      review_resume = { lhs = "<space>vr", desc = "resume a pending review for the current PR" },
    },
    review_thread = {
      goto_issue = { lhs = "<space>gi", desc = "navigate to a local repo issue" },
      add_comment = { lhs = "<space>ca", desc = "add comment" },
      add_suggestion = { lhs = "<space>sa", desc = "add suggestion" },
      delete_comment = { lhs = "<space>cd", desc = "delete comment" },
      next_comment = { lhs = "]c", desc = "go to next comment" },
      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" },
      react_eyes = { lhs = "<space>re", desc = "add/remove ๐Ÿ‘€ reaction" },
      react_thumbs_up = { lhs = "<space>r+", desc = "add/remove ๐Ÿ‘ reaction" },
      react_thumbs_down = { lhs = "<space>r-", desc = "add/remove ๐Ÿ‘Ž reaction" },
      react_rocket = { lhs = "<space>rr", desc = "add/remove ๐Ÿš€ reaction" },
      react_laugh = { lhs = "<space>rl", desc = "add/remove ๐Ÿ˜„ reaction" },
      react_confused = { lhs = "<space>rc", desc = "add/remove ๐Ÿ˜• reaction" },
    },
    submit_win = {
      approve_review = { lhs = "<C-a>", desc = "approve review" },
      comment_review = { lhs = "<C-m>", desc = "comment review" },
      request_changes = { lhs = "<C-r>", desc = "request changes review" },
      close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
    },
    review_diff = {
      submit_review = { lhs = "<leader>vs", desc = "submit review" },
      discard_review = { lhs = "<leader>vd", desc = "discard review" },
      add_review_comment = { lhs = "<space>ca", desc = "add a new review comment" },
      add_review_suggestion = { lhs = "<space>sa", desc = "add a new review suggestion" },
      focus_files = { lhs = "<leader>e", desc = "move focus to changed file panel" },
      toggle_files = { lhs = "<leader>b", desc = "hide/show changed files panel" },
      next_thread = { lhs = "]t", desc = "move to next thread" },
      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" },
    },
    file_panel = {
      submit_review = { lhs = "<leader>vs", desc = "submit review" },
      discard_review = { lhs = "<leader>vd", desc = "discard review" },
      next_entry = { lhs = "j", desc = "move to next changed file" },
      prev_entry = { lhs = "k", desc = "move to previous changed file" },
      select_entry = { lhs = "<cr>", desc = "show selected changed file diffs" },
      refresh_files = { lhs = "R", desc = "refresh changed files panel" },
      focus_files = { lhs = "<leader>e", desc = "move focus to changed file panel" },
      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" },
    },
  },
})

๐Ÿš€ Usage

Just edit the issue title, body or comments as a regular buffer and use :w(rite) to sync the issue with GitHub.

๐Ÿค– 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.

Object Action Arguments
issue close Close the current issue
reopen Reopen the current issue
create [repo] Creates a new issue in the current or specified repo
edit [repo] Edit issue <number> in current or specified repo
list [repo] [key=value] (1) List all issues satisfying given filter
search Live issue search
reload Reload issue. Same as doing e!
browser Open current issue in the browser
url Copies the URL of the current issue to the system clipboard
pr list [repo] [key=value] (2) List all PRs satisfying given filter
search Live issue search
edit [repo] Edit PR <number> in current or specified repo
reopen Reopen the current PR
create Creates a new PR for the current branch
close Close the current PR
checkout Checkout PR
commits List all PR commits
changes Show all PR changes (diff hunks)
diff Show PR diff
merge [commit|rebase|squash] [delete] Merge current PR using the specified method
ready Mark a draft PR as ready for review
draft Send a ready PR back to draft
checks Show the status of all checks run on the PR
reload Reload PR. Same as doing e!
browser Open current PR in the browser
url Copies the URL of the current PR to the system clipboard
repo list (3) List repos user owns, contributes or belong to
fork Fork repo
browser Open current repo in the browser
url Copies the URL of the current repo to the system clipboard
view Open a repo by path ({organization}/{name})
gist list [repo] [key=value] (4) List user gists
comment add Add a new comment
delete Delete a comment
thread resolve Mark a review thread as resolved
unresolve Mark a review thread as unresolved
label add [label] Add a label from available label menu
remove [label] Remove a label
create [label] Create a new label
assignee add [login] Assign a user
remove [login] Unassign a user
reviewer add [login] Assign a PR reviewer
reaction thumbs_up | +1 Add ๐Ÿ‘ reaction
thumbs_down | -1 Add ๐Ÿ‘Ž reaction
eyes Add ๐Ÿ‘€ reaction
laugh Add ๐Ÿ˜„ reaction
confused Add ๐Ÿ˜• reaction
rocket Add ๐Ÿš€ reaction
heart Add โค๏ธ reaction
hooray | party | tada Add ๐ŸŽ‰ reaction
card add Assign issue/PR to a project new card
remove Delete project card
move Move project card to different project/column
review start Start a new review
submit Submit the review
resume Edit a pending review for current PR
discard Deletes a pending review for current PR if any
comments View pending review comments
commit Pick a specific commit to review
close Close the review window and return to the PR
actions Lists all available Octo actions
search Search GitHub for issues and PRs matching the query
  1. [repo]: If repo is not provided, it will be derived from <cwd>/.git/config.

  2. In-menu mappings:

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

Available filter keys

  • since
  • createdBy
  • assignee
  • mentioned
  • labels
  • milestone
  • states
  1. 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

  • baseRefName
  • headRefName
  • labels
  • states
  1. In-menu mappings:
  • <CR>: View repo
  • <C-b>: Opens repo in the browser
  • <C-y>: Copies URL to system clipboard
  1. In-menu mappings:

๐Ÿ”ฅ Examples

Octo https://github.com/pwntester/octo.nvim/issues/12
Octo issue create
Octo issue create pwntester/octo.nvim
Octo comment add
Octo reaction add hooray
Octo issue edit pwntester/octo.nvim 1
Octo issue edit 1
Octo issue list createdBy=pwntester
Octo issue list neovim/neovim labels=bug,help\ wanted states=OPEN
Octo search assignee:pwntester is:pr

๐Ÿ“‹ PR reviews

  • 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
  • Add comments with <space>ca or suggestions with <space>sa on single or multiple visual-selected lines
    • A new buffer will appear in the alternate diff window. The cursor will be positioned in the new buffer
    • When ready, save the buffer to commit changes to GitHub
    • Move back to the diff window and move the cursor, the thread buffer will hide
  • Hold the cursor on a line with a comment to show a thread buffer with all the thread comments
    • To modify, delete, react or reply to a comment, move to the window containing the thread buffer
    • Perform any operations as if you were in a regular issue buffer
  • Review pending comments with Octo review comments
    • Use to jump to the selected pending comment
  • If you want to review a specific commit, use Octo review commit to pick a commit. The file panel will get filtered to show only files changed by that commit. Any comments placed on these files will be applied at that specific commit level and will be added to the pending review.
  • When ready, submit the review with Octo review submit
  • 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 for completion, you can use the cmp-git source to provide issues, PRs, commits and users completion.

๐ŸŽจ Colors

Highlight Group Defaults to
OctoDirty ErrorMsg
OctoIssueTitle PreProc
OctoIssueId Question
OctoEmpty Comment
OctoFloat NormalNC
OctoDate Comment
OctoSymbol Comment
OctoTimelineItemHeading Comment
OctoDetailsLabel Title
OctoMissingDetails Comment
OctoDetailsValue Identifier
OctoDiffHunkPosition NormalFloat
OctoCommentLine TabLineSel
OctoEditable NormalFloat bg
OctoViewer GitHub color
OctoBubble NormalFloat
OctoBubbleGreen GitHub color
OctoBubbleRed GitHub color
OctoUser OctoBubble
OctoUserViewer OctoViewer
OctoReaction OctoBubble
OctoReactionViewer OctoViewer
OctoPassingTest GitHub color
OctoFailingTest GitHub color
OctoPullAdditions GitHub color
OctoPullDeletions GitHub color
OctoPullModifications GitHub color
OctoStateOpen GitHub color
OctoStateClosed GitHub color
OctoStateMerge GitHub color
OctoStatePending GitHub color
OctoStateApproved OctoStateOpen
OctoStateChangesRequested OctoStateClosed
OctoStateCommented Normal
OctoStateDismissed OctoStateClosed

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

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:

ui = {
    use_signcolumn = false
}

Then, provide a statuscolumn replacement such as:

local function mk_hl(group, sym)
  return table.concat({ "%#", group, "#", sym, "%*" })
end

_G.get_statuscol_octo = function(bufnum, lnum)
  if vim.api.nvim_buf_get_option(bufnum, "filetype") == "octo" then
    if type(octo_buffers) == "table" then
      local buffer = octo_buffers[bufnum]
      if buffer then
        buffer:update_metadata()
        local hl = "OctoSignColumn"
        local metadatas = {buffer.titleMetadata, buffer.bodyMetadata}
        for _, comment_metadata in ipairs(buffer.commentsMetadata) do
          table.insert(metadatas, comment_metadata)
        end
        for _, metadata in ipairs(metadatas) do
          if metadata and metadata.startLine and metadata.endLine then
            if metadata.dirty then
              hl = "OctoDirty"
            else
              hl = "OctoSignColumn"
            end
            if lnum - 1 == metadata.startLine and lnum - 1 == metadata.endLine then
              return mk_hl(hl, "[ ")
            elseif lnum - 1 == metadata.startLine then
              return mk_hl(hl, "โ”Œ ")
            elseif lnum - 1 == metadata.endLine then
              return mk_hl(hl, "โ”” ")
            elseif metadata.startLine < lnum - 1 and lnum - 1 < metadata.endLine then
              return mk_hl(hl, "โ”‚ ")
            end
          end
        end
      end
    end
  end
  return "  "
end

vim.opt.statuscolumn = "%{%v:lua.get_statuscol_octo(bufnr(), v:lnum)%}"

๐Ÿ“บ Demos

issues

prs

๐Ÿ™‹ FAQ

I get a warning saying Cannot request projects v2, missing scope 'read:project'

That's expected. The new support for projects v2 support requires the read:project scope on your GitHub token.

You add the scope by using gh auth refresh -s read:project or you can suppress this warning by setting the following in your config

{
  suppress_missing_scope = {
    projects_v2 = true,
  }
}

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 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?

The title, body and comments of an issue or PR are special as they get special highlighting applied and is an editable section. Due to the latter property it gets the OctoEditable highlighting via a special signs linehl setting. This takes precedence over the buffer internal highlights. To only get the background highlighted by the editable section, set OctoEditable to a highlight with a background color definition only.

Why am I getting authentication error from gh?

This means that are either using a GITHUB_TOKEN to authenticate or gh is not authenticated.

In case of the former, run:

GITHUB_TOKEN= gh auth login

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

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

Can I use treesitter markdown parser with octo buffers?

Just add the following lines to your TreeSitter config:

vim.treesitter.language.register('markdown', 'octo')

How can I filter PRs by filter keys that aren't available?

You can use the search command :Octo search [query]. The search syntax and available search terms are available in GitHub documentation.

For example to search for PRs with author you can use this command:

:Octo search is:pr author:pwntester repo:github/codeql

Note: You need to provide the repo, otherwise it will search for every PR by that user.

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 })

How can I disable default key mappings?

Set mappings_disable_default = true in user config.

๐Ÿ™Œ Contributing

Contributions are always welcome!

See CONTRIBUTING for ways to get started.

Please adhere to this project's CODE_OF_CONDUCT.

๐ŸŒŸ Credits

The PR review panel is heavily inspired in diffview.nvim

๐Ÿ™ Say Thanks

If you like this plugin and would like to buy me a coffee, you can!

BuyMeACoffee

GitHub Sponsors

๐Ÿ“œ License

MIT

octo.nvim's People

Contributors

aaronhallaert avatar antosha417 avatar ben-davis avatar benelan avatar bzub avatar daniel1854 avatar delphinus avatar farbodsz avatar jarviliam avatar jemag avatar jorgectf avatar joshmedeski avatar jpribyl avatar kezhenxu94 avatar kkharji avatar loipesmas avatar lpwisniewski avatar lukas-reineke avatar milogert avatar mrjones2014 avatar nwvi avatar ocaballeror avatar patoconnor43 avatar pgherveou avatar pwntester avatar quitlox avatar samjwillis97 avatar skrobul avatar tami5 avatar weilbith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

octo.nvim's Issues

Error when selecting issue from list

My Telescope issue picker config based on the example in the README now generates an error when selecting an issue:

Error executing vim.schedule lua callback: ...share/nvim/site/pack/packer/start/octo.nvim/lua/octo
.lua:427: Vim(lua):E5108: Error executing lua ...share/nvim/site/pack/packer/start/octo.nvim/lua/o
cto.lua:136: Key not found: labels                                                                
Press ENTER or type command to continue   

split/vsplit doesn't work

<c-v>/<c-s> doesn't work for me. <cr> seems to be the only one working

Also, trying to open in the browser <c-b> for prs results in

E5108: Error executing lua vim/shared.lua:64: s: expected string, got number
stack traceback:
        vim/shared.lua:64: in function 'gsplit'
        vim/shared.lua:111: in function 'split'
        ...re/nvim/site/pack/packer/opt/octo.nvim/lua/octo/menu.lua:134: in function 'key_func'
        ...ack/packer/opt/telescope.nvim/lua/telescope/mappings.lua:204: in function 'executeP

title

No description provided.

title

No description provided.

Add support for PR reviews

This is already started in Octo review start which will currently:

  • create new tab
  • open qf with all changed files and a special handler so selecting a qf entry will split the main window in two showing the fugitive diffs for the selected file.

Work to do:

  • new range command (eg: OctoReviewComment) to add a new comment on either side of the diff.
    • shows a new buffer where the user can enter the new comment. On :w:
      • maps the fugitive buffer lines with the diff hunk lines
      • the buffer content and the lines it correspond to are added to a list of pending comments
      • lines are marked with some special highlight/signs
  • new Octo review comments command will show a telescope menu that let you review update and delete review comments.
    • delete the comment
    • goes to the file/line
    • open comment in buffer and allow user to modify it
  • new Octo review submit command will show a new buffer to enter review body. On :w:
    • a menu is shown to choose between: Comment, Request Changes or Approve.
    • the GH api to create the new review
    • the review tab and buffers are closed
  • all comment buffer are opened in an horizontal split from qf (whole screen width) rather than any sort of float since reviewers may want to move between buffers/wins to copy/paste code into the new comment.

@lukas-reineke @PatOConnor43 @tami5 any feedback is welcome!

vertical/horizontal splits

Hey @pwntester, I was trying to open an issue in vertical split and I got the following error:

E5108: Error executing lua vim/shared.lua:64: s: expected string, got number
stack traceback:
        vim/shared.lua:64: in function 'gsplit'
        vim/shared.lua:111: in function 'split'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:96: in function 'func'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:14: in function '_goto_file_se`

Other:

  • PREVIEW number printed in the command.
  • is there away to switch gh to use upstream instead of origin which is currently a fork

Thanks

title

No description provided.

question: how to change diff number colour

Hi there! I love this plugin so far, though I have one little question. How do I change the diff number colour? I can change it from Diff{Add,Delete,Change} highlight group but if I do that, it would affect the diffmode highlights as well. I've tried changing OctoNvimBubble{Red,Green} but I don't think that's the one because it doesn't have any effect. Thanks in advance!

image

-- this issue was made using octo.nvim ๐Ÿ˜†

test

No description provided.

title

No description provided.

title

No description provided.

title

No description provided.

title

No description provided.

title

No description provided.

Add @people completion

https://github.com/suggestions/issue/710584628?repository=telescope.nvim&user_id=nvim-lua&mention_suggester=1
- repository contributors
- issue author
- comment authors
- users already mentioned in comments or description

Open in popus

Hey @pwntester I'm just getting started with octo and seems amazing. I wonder if its possible to have things open as popup as obsessed to opning in main window, also toggles. I think it makes sense, since users would open issues in split of second and don't missup their layout, or they'd like to have it temp hidden for looking up stuff in the code base.

Thanks again @pwntester

Add code formatting

Are you open to format the code with luafmt?
The code is a bit messy, with mixed 2 and 4 space indentation etc.

No judgment what so ever, I'm just super excited about this and want to help out.
And consistent code would help make contributions easier.

Support for lua-date

I think you saw how I used lua-date in my plugin.
I would be happy to add this here.
It would format all dates to be more human-readable, or fallback silently to how it is now if lua-date is not installed.

[WIP] Improve PR workflow

title

No description provided.

Error starting review

Kudos on the app, it looks like it will help me out a ton ๐Ÿ˜„

I'm trying to figure out how it works and running into a few issues.

Issue 1

Ran

:Octo pr list <ORG>/<REPO> states=OPEN
" Selected a PR
:Octo pr checkout
:Octo review start

image

Issue 2

:Octo pr list <ORG>/<REPO> states=OPEN
" Selected a PR
:Octo pr checkout
:Octo pr files 
" After i select one I get...

image

vimrc

" ...
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'pwntester/octo.nvim'
"...
lua require('telescope').load_extension('octo')

Any ideas would be most appreciated

info

image

image

offline-first strategies?

I work mostly offline, and when I'm online, I don't have much time. I never used octo.nvim or github-cli. Could it be made possible to sync issues and PR comments with git hooks and this plugin?

Add in-issue mappings

For example:

  • ca: add comment
  • cd: delete comment
  • rt: add :hooray: reaction (t for tada)
  • rh: add โค๏ธ reaction
  • re: add ๐Ÿ‘€ reaction
  • r+: add ๐Ÿ‘ reaction
  • r-: add ๐Ÿ‘Ž reaction
  • rr: add ๐Ÿš€ reaction
  • rl: add :laugh: reaction
  • rc: add ๐Ÿ˜• reaction

Errors on install

Hey All ๐Ÿ‘‹
Getting the following errors when trying to install using dein on nvim on macOS:

Error detected while processing /Users/chocrates/.cache/dein/.cache/init.vim/.dein/plugin/octo.vim:
line   72:
E5105: Error while calling lua chunk: ...tes/.cache/dein/.cache/init.vim/.dein/lua/octo/signs.lua:10: attempt to call field 'cmd' (a nil value)
line   77:
E5105: Error while calling lua chunk: ...ates/.cache/dein/.cache/init.vim/.dein/lua/octo/init.lua:12: attempt to index field 'fn' (a nil value)

These are the plugins I added in my config:

  call dein#add('nvim-lua/popup.nvim')
  call dein#add('nvim-lua/plenary.nvim')
  call dein#add('nvim-telescope/telescope.nvim')
  call dein#add('pwntester/octo.nvim')

I don't know lua or vim plugins enough to know how to start debugging.

error with review start

Hey @pwntester, I'm trying to do review on a pr, not sure if this error is because the feature is still under progress.

Error executing vim.schedule lua callback: ...nvim/site/pack/packer/opt/octo.nvim/lua/octo/reviews.lua:89: Vim(cc):E42: No Errors

title

No description provided.

title

No description provided.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.