Skip to content

Latest commit

 

History

History
70 lines (56 loc) · 1.98 KB

README.md

File metadata and controls

70 lines (56 loc) · 1.98 KB

nvim-git-link

Easily open remote repository links from your local buffer files

Roadmap

  • Add support for GitLab and Bitbucket
  • Add flag to specify if url should open with blame
  • Add function to open url of commit history of a given file
  • Add function top open url of all PR's for a given file
  • Add ability to open url of dependency files e.g. a node_modules file (not tracked in git)

Disclaimer

I'm not a lua developer, so feel free to open a PR to improve / extend the plugin code 😅. See the Development section for further info.

Installation

Requirements: Neovim >= 0.5.

For vim-plug:

Plug 'jltwheeler/nvim-git-link'

For packer:

use 'jltwheeler/nvim-git-link'

Usage

Get link to remote repo at current cursor line

:lua require"nvim-git-link".get_remote_link()

This is equivalent to

:lua require"nvim-git-link".get_remote_link{ open_browser = true }

You can also copy the URL to the clipboard, on top of opening the browser, with:

:lua require"nvim-git-link".get_remote_link{ open_browser = true, copy = true }

and to avoid opening the browser at all:

:lua require"nvim-git-link".get_remote_link{ copy = true }

Development

If you are keen to contribute to the plugin, please follow these steps to get setup locally:

  1. cd ~ to your desired root project directory
  2. mkdir -r lua-plugins/lua
  3. cd lua-plugins/lua
  4. git clone [email protected]:jltwheeler/nvim-git-link.git
  5. To test this, go to any other project directory and open vim with the following command:
vim --cmd "set rtp+=./path/to/lua-plugin/"

This will load the nvim-git-link plugin into the nvim run time path, and load the locally cloned plugin. 6. Start adding your code and testing in the other vim session.

NB: every time you save new code to the plugin, you will need to re-load nvim with the command in step 5.