71 lines
2 KiB
Markdown
71 lines
2 KiB
Markdown
# openingh.nvim
|
|
Opens the current file or project page in GitHub.
|
|
|
|

|
|

|
|
[](https://github.com/Almo7aya/openingh.nvim/actions/workflows/lint.yml)
|
|

|
|
|
|
|
|
- Features
|
|
- Supports macOS, Linux, Windows and WSL
|
|
- Works with detached HEAD and supports checked out branches or forks
|
|
- Automatically selects the correct line number on the file page
|
|
- Supports GitHub, GitHub Enterprise, GitLab, and Bitbucket
|
|
|
|
- Demo
|
|
|
|

|
|
|
|
## Requirements
|
|
|
|
- Neovim 0.7.2+
|
|
|
|
## Installation
|
|
|
|
#### Example with Packer
|
|
|
|
[wbthomason/packer.nvim](https://github.com/wbthomason/packer.nvim)
|
|
|
|
```lua
|
|
-- init.lua
|
|
require("packer").startup(function()
|
|
use "almo7aya/openingh.nvim"
|
|
end)
|
|
```
|
|
|
|
## Commands
|
|
|
|
- `:OpenInGHRepo`
|
|
- Opens the project's git repository page in GitHub.
|
|
|
|
- `:OpenInGHFile`
|
|
- Opens the current file page in GitHub. This command supports ranges.
|
|
|
|
## Usage
|
|
|
|
You can call the commands directly or define mappings them:
|
|
|
|
```lua
|
|
-- for repository page
|
|
vim.api.nvim_set_keymap("n", "<Leader>gr", ":OpenInGHRepo <CR>", { silent = true, noremap = true })
|
|
|
|
-- for current file page
|
|
vim.api.nvim_set_keymap("n", "<Leader>gf", ":OpenInGHFile <CR>", { silent = true, noremap = true })
|
|
vim.api.nvim_set_keymap("v", "<Leader>gf", ":OpenInGHFile <CR>", { silent = true, noremap = true })
|
|
```
|
|
|
|
## TODO
|
|
|
|
- [x] Support the current file cursor position
|
|
- [x] Support visual mode to open a file in range selection
|
|
- [x] Support other version control websites
|
|
|
|
## Contribution
|
|
|
|
Feel free to open an issue or a pull request if you have any suggestions or improvements
|
|
|
|
## License
|
|
|
|
[MIT](./LICENSE)
|
|
|