initial commit

This commit is contained in:
2024-12-23 01:46:04 +01:00
commit c408cd3d24
7 changed files with 886 additions and 0 deletions

72
README.md Normal file
View File

@@ -0,0 +1,72 @@
# gitea.nvim
A Neovim plugin to manage [Gitea](https://gitea.io) issues and pull requests right from your editor, inspired by [octo.nvim](https://github.com/pwntester/octo.nvim).
## Features
- Browse, open, and edit issues
- Create new issues (including adding labels, assignees, etc.)
- Browse, open, and edit pull requests
- Merge, squash, or rebase pull requests
- Add/modify/delete comments on issues and PRs
- Inline PR reviews and comments
- Add/remove labels, reviewers, assignees, etc.
- And more (mirroring much of octo.nvims functionality)
## Requirements
- **Neovim 0.10+**
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) for async utilities
- A running Gitea server
- A Personal Access Token (PAT) for Gitea
## Installation
Install using your favorite plugin manager, for example with **packer**:
```lua
use {
"your-username/gitea.nvim",
requires = {"nvim-lua/plenary.nvim"}
}
```
## Setup & First Run
There's no need to store your Gitea server or token directly in your `init.lua`.
The plugin will:
1. Parse your `.git/config` to attempt to detect your Gitea server URL (e.g. from `git config remote.origin.url`).
2. Check for a local token file (by default `.gitea_nvim_token`) in your repo directory.
3. If no token file is found, `gitea.nvim` will prompt you for one. The plugin will then offer to add that token file to your `.gitignore` (highly recommended).
Example usage in your config:
```lua
require("gitea").setup({
-- No need to provide a hostname or token here;
-- but you can override defaults if needed:
-- e.g. config_file = ".my_custom_token_file"
-- or ignore_file = ".my_custom_gitignore"
})
```
## Usage
Once installed and configured, you can use the `:Gitea` command with subcommands:
- `:Gitea issue list` — Lists issues for the current repo.
- `:Gitea issue create` — Opens a scratch buffer to create a new issue.
- `:Gitea issue edit <number>` — Opens an issue buffer for `<number>`.
- `:Gitea pr list` — Lists pull requests for the current repo.
- `:Gitea pr edit <number>` — Opens a PR buffer for `<number>`.
- `:Gitea pr merge [commit|rebase|squash] [delete|nodelete]` — Merges a PR with the selected method.
- `:Gitea pr create` — Creates a new pull request from your current branch to the base branch.
- More subcommands (close, reopen, comment, reaction, etc.) will be added similarly to octo.nvim.
When you open an issue or PR buffer, simply edit the title, body, or add new comments. When you save (`:w`), changes are pushed to Gitea.
## Roadmap
- Inline PR reviews (open diff views, comment on lines, etc.)
- Advanced searching and filtering (like `:Gitea issue search <query>`)
- Further config options (like picking a fuzzy-finder: telescope or fzf-lua)
## Contributing
Pull requests and issue reports are welcome! The goal is to replicate and adapt the core [octo.nvim](https://github.com/pwntester/octo.nvim) workflow for Gitea.
## License
[MIT](https://choosealicense.com/licenses/mit/)