pgr0ss / vim-github-url

Vim plugin to show GitHub URLs in source files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vim plugin to show GitHub (and now GitLab) URLs in source files.

The generated URLs reference the current commit and not the current branch, so it will not be affected by later commits (e.g. you send someone the URL for a branch and by the time they click the link it's pointing to the wrong line in the file).

Usage

In Vim, run:

  • :GitHubURLRepo to view the repo on GitHub
  • :GitHubURLBlob to view the file under cursor on GitHub
  • :GitHubURLBlame to view the file under cursor in a git blame on GitHub

And it will use echomsg to print the URL to the screen, such as:

function! GitHubURL() range

You can also visually select several lines and the URL will include the range.

If you want to see previous URLs, you can use :messages.

The URL will also be stored to the clipboard if it is available.

Setup

Using vim-plug:

Plug 'pgr0ss/vim-github-url'

Using Vim 8+ packages

$ mkdir -p ~/.vim/pack/git-plugins/start
$ git clone https://github.com/pgr0ss/vim-github-url.git --depth=1 ~/.vim/pack/git-plugins/start/vim-github-url

About

Vim plugin to show GitHub URLs in source files

License:MIT License


Languages

Language:Vim Script 100.0%