« Back to Index

[Vim open current line in GitHub UI]

View original Gist on GitHub

Tags: #github #git #vim

Vim open current line in GitHub UI.md

~/.gitconfig

url =! bash -c 'git config --get remote.origin.url | sed -E "s/.+:\\(.+\\)\\.git$/https:\\\\/\\\\/github\\\\.com\\\\/\\\\1/g"'

~/.vimrc

" Use git alias inside ~/.gitconfig to open current file line in GitHub
nnoremap <leader>f :!echo `git url`/blob/`git rev-parse --abbrev-ref HEAD`/%\#L<C-R>=line('.')<CR> \| xargs open<CR><CR>