2022-09-27 02:23:14 +03:00
# openingh.nvim
2022-09-27 02:24:25 +03:00
Opens the current file or project page in GitHub.
2022-10-03 23:04:03 +03:00
2022-10-30 02:13:08 +03:00


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

2022-10-03 23:04:03 +03:00
2022-09-27 02:22:34 +03:00
- Features
2022-10-10 01:15:43 +03:00
- Supports macOS, Linux, Windows and WSL
2022-09-27 03:36:44 +03:00
- Works with detached HEAD and supports checked out branches or forks
2022-10-10 01:15:43 +03:00
- Automatically selects the correct line number on the file page
- Supports GitHub, GitHub Enterprise, GitLab, and Bitbucket
2022-09-25 23:30:27 +03:00
2022-09-27 03:32:08 +03:00
- Demo
2022-09-27 03:29:50 +03:00

2022-09-27 02:22:34 +03:00
## Requirements
- Neovim 0.7.2+
## Installation
2022-09-27 03:01:13 +03:00
#### Example with Packer
[wbthomason/packer.nvim ](https://github.com/wbthomason/packer.nvim )
2022-09-27 02:22:34 +03:00
```lua
2022-09-27 03:40:51 +03:00
-- init.lua
require("packer").startup(function()
use "almo7aya/openingh.nvim"
end)
2022-09-27 02:22:34 +03:00
```
2022-09-25 23:30:27 +03:00
## Commands
2022-09-27 02:22:34 +03:00
2022-09-26 02:16:54 +03:00
- `:OpenInGHRepo`
2022-09-27 02:22:34 +03:00
- Opens the project's git repository page in GitHub.
2022-09-26 02:16:54 +03:00
- `:OpenInGHFile`
2023-03-21 12:56:14 -04:00
- Opens the current file page in GitHub. This command supports ranges.
2022-09-27 02:22:34 +03:00
## 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 > ", { expr = true, noremap = true })
-- for current file page
vim.api.nvim_set_keymap("n", "< Leader > gf", ":OpenInGHFile < CR > ", { expr = true, noremap = true })
2023-03-21 12:56:14 -04:00
vim.api.nvim_set_keymap("v", "< Leader > gf", "< esc > < cmd > '< ,'>OpenInGHFile < CR > ", { expr = true, noremap = true })
2022-09-27 02:22:34 +03:00
```
2022-09-25 23:30:27 +03:00
2022-09-27 02:22:34 +03:00
## TODO
2022-09-27 02:30:10 +03:00
2022-09-27 02:22:34 +03:00
- [x] Support the current file cursor position
- [ ] Support visual mode to open a file in range selection
2022-10-10 01:15:43 +03:00
- [x] Support other version control websites
2022-09-25 23:30:27 +03:00
2022-09-27 02:30:10 +03:00
## Contribution
2022-10-10 01:15:43 +03:00
Feel free to open an issue or a pull request if you have any suggestions or improvements
2022-09-27 02:30:10 +03:00
2022-09-27 02:22:34 +03:00
## License
2022-09-27 02:30:10 +03:00
2022-09-27 02:22:34 +03:00
[MIT ](./LICENSE )
2022-09-25 23:30:27 +03:00