Skip to content

Commit 472fbdf

Browse files
committed
add readme and vim help docks
1 parent 7f009f7 commit 472fbdf

2 files changed

Lines changed: 201 additions & 0 deletions

File tree

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# 🐰 coderabbit.nvim
2+
3+
[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/smnatale/coderabbit.nvim?utm_source=oss&utm_medium=github&utm_campaign=smnatale%2Fcoderabbit.nvim&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews)](https://coderabbit.ai) [![CI](https://github.com/smnatale/coderabbit.nvim/actions/workflows/ci.yml/badge.svg)](https://github.com/smnatale/coderabbit.nvim/actions/workflows/ci.yml) [![Neovim](https://img.shields.io/badge/Neovim-0.10%2B-green?logo=neovim&logoColor=white)](https://neovim.io)
4+
5+
The first Neovim integration for [CodeRabbit](https://coderabbit.link/sam-natale) — bringing the AI code reviewing assistant to your favorite editor!
6+
7+
> Not affiliated with CodeRabbit — just a fan. If you sign up, using the [link above](https://coderabbit.link/sam-natale) helps me out.
8+
9+
## Getting Started
10+
11+
Requires Neovim >= 0.10 and the [CodeRabbit CLI](https://cli.coderabbit.ai):
12+
13+
```sh
14+
curl -fsSL https://cli.coderabbit.ai/install.sh | sh
15+
cr auth login
16+
```
17+
18+
Install the plugin and call setup:
19+
20+
```lua
21+
-- vim.pack (nvim 0.12)
22+
vim.pack.add({"https://github.com/smnatale/coderabbit.nvim"})
23+
require("coderabbit").setup()
24+
25+
-- lazy.nvim
26+
{ "coderabbitai/coderabbit.nvim", opts = {} }
27+
```
28+
29+
Run `:checkhealth coderabbit` to verify everything is wired up.
30+
31+
## Usage
32+
33+
`:CodeRabbitReview` to kick off a review. Findings show up as diagnostics with virtual text, signs, and code actions (`vim.lsp.buf.code_action()`).
34+
35+
| Command | |
36+
| --- | --- |
37+
| `:CodeRabbitReview [type]` | Run a review. Defaults to `all`, or pass `committed`/`uncommitted` |
38+
| `:CodeRabbitStop` | Cancel a running review |
39+
| `:CodeRabbitClear` | Clear diagnostics |
40+
| `:CodeRabbitShow [id]` | View results in a split. Defaults to the latest review |
41+
| `:CodeRabbitHistory` | Browse past reviews |
42+
43+
For your statusline:
44+
45+
```lua
46+
require("coderabbit").status() -- spinner while reviewing, nil when idle
47+
```
48+
49+
## Config
50+
51+
Defaults — everything is optional:
52+
53+
```lua
54+
require("coderabbit").setup({
55+
cli = {
56+
binary = "cr",
57+
timeout = 0,
58+
extra_args = {},
59+
},
60+
review = {
61+
type = "all", -- "all", "committed", or "uncommitted"
62+
base = nil,
63+
base_commit = nil,
64+
},
65+
diagnostics = {
66+
enabled = true,
67+
severity_map = {
68+
critical = vim.diagnostic.severity.ERROR,
69+
major = vim.diagnostic.severity.WARN,
70+
minor = vim.diagnostic.severity.INFO,
71+
},
72+
virtual_text = true,
73+
signs = true,
74+
underline = true,
75+
},
76+
on_review_complete = nil,
77+
})
78+
```

doc/coderabbit.txt

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
*coderabbit.txt* Neovim plugin for CodeRabbit AI code reviews
2+
3+
==============================================================================
4+
CONTENTS *coderabbit-contents*
5+
6+
1. Introduction ............................ |coderabbit-introduction|
7+
2. Setup ................................... |coderabbit-setup|
8+
3. Configuration ........................... |coderabbit-configuration|
9+
4. Commands ................................ |coderabbit-commands|
10+
5. Lua API ................................. |coderabbit-api|
11+
12+
==============================================================================
13+
INTRODUCTION *coderabbit-introduction*
14+
15+
Run CodeRabbit AI code reviews from Neovim. Findings appear as native
16+
|vim.diagnostic| entries with virtual text, signs, and code actions.
17+
18+
Requirements:
19+
- Neovim >= 0.10
20+
- CodeRabbit CLI (`cr`): https://cli.coderabbit.ai
21+
22+
==============================================================================
23+
SETUP *coderabbit-setup*
24+
25+
>lua
26+
require("coderabbit").setup({})
27+
<
28+
29+
Run `:checkhealth coderabbit` to verify CLI installation and auth.
30+
31+
==============================================================================
32+
CONFIGURATION *coderabbit-configuration*
33+
34+
All options are optional. Defaults: >lua
35+
require("coderabbit").setup({
36+
cli = {
37+
binary = "cr",
38+
timeout = 0,
39+
extra_args = {},
40+
},
41+
review = {
42+
type = "all",
43+
base = nil,
44+
base_commit = nil,
45+
},
46+
diagnostics = {
47+
enabled = true,
48+
severity_map = {
49+
critical = vim.diagnostic.severity.ERROR,
50+
major = vim.diagnostic.severity.WARN,
51+
minor = vim.diagnostic.severity.INFO,
52+
},
53+
virtual_text = true,
54+
signs = true,
55+
underline = true,
56+
},
57+
on_review_complete = nil,
58+
})
59+
<
60+
61+
cli.binary Path to the CodeRabbit CLI. Default: `"cr"`
62+
cli.timeout Timeout in ms. `0` = no timeout.
63+
cli.extra_args Extra arguments for `cr review`.
64+
65+
review.type `"all"`, `"committed"`, or `"uncommitted"`.
66+
review.base Base branch for comparison.
67+
review.base_commit Base commit SHA for comparison.
68+
69+
diagnostics.enabled Populate |vim.diagnostic| with findings.
70+
diagnostics.severity_map Map CodeRabbit severities to |vim.diagnostic.severity|.
71+
diagnostics.virtual_text Show inline virtual text.
72+
diagnostics.signs Show sign column indicators.
73+
diagnostics.underline Underline diagnostic ranges.
74+
75+
on_review_complete Callback receiving the findings table when a review
76+
finishes.
77+
78+
==============================================================================
79+
COMMANDS *coderabbit-commands*
80+
81+
:CodeRabbitReview [type] *:CodeRabbitReview*
82+
Start a review. Optional: `all`, `committed`, `uncommitted`.
83+
84+
:CodeRabbitStop *:CodeRabbitStop*
85+
Cancel a running review.
86+
87+
:CodeRabbitClear *:CodeRabbitClear*
88+
Clear all CodeRabbit diagnostics.
89+
90+
:CodeRabbitShow [id] *:CodeRabbitShow*
91+
Open review results in a vertical split. Pass an `id` from
92+
`:CodeRabbitHistory` to view a saved review. Press `q` to close.
93+
94+
:CodeRabbitHistory *:CodeRabbitHistory*
95+
Browse saved reviews via |vim.ui.select|.
96+
97+
==============================================================================
98+
LUA API *coderabbit-api*
99+
100+
require("coderabbit").setup({opts}) *coderabbit.setup()*
101+
Configure the plugin.
102+
103+
require("coderabbit").review({opts}) *coderabbit.review()*
104+
Start a review. Accepts `{ type, base, base_commit }`.
105+
106+
require("coderabbit").stop() *coderabbit.stop()*
107+
Cancel the running review.
108+
109+
require("coderabbit").clear() *coderabbit.clear()*
110+
Clear diagnostics and reset state.
111+
112+
require("coderabbit").show({id}) *coderabbit.show()*
113+
Open the review buffer. `nil` = current, number = saved.
114+
115+
require("coderabbit").history() *coderabbit.history()*
116+
Open the review history picker.
117+
118+
require("coderabbit").status() *coderabbit.status()*
119+
Returns `"⠋ CodeRabbit (12s)"` while reviewing, `nil` when idle.
120+
Designed for statusline use.
121+
122+
==============================================================================
123+
vim:tw=78:ts=8:ft=help:norl:

0 commit comments

Comments
 (0)