Skip to content

Open file or project in GitHub for neovim written in lua

License

Notifications You must be signed in to change notification settings

fearphage/openingh.nvim

 
 

Repository files navigation

openingh.nvim

Opens the current file or project page in GitHub.

Lua GitHub release (latest by date) lint with luacheck GitHub Workflow Status

  • 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

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

Usage

You can call the commands directly or define mappings them:

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

TODO

  • Support the current file cursor position
  • Support visual mode to open a file in range selection
  • 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

About

Open file or project in GitHub for neovim written in lua

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Lua 93.2%
  • Vim Script 3.5%
  • Makefile 3.3%