New project: opengitfile
I was inspired by Opening a file from a git repository in the browser [ Hannes Leutloff - yeldiRium ] to write my own version of a script that lists the git forge URL for a given file. If I need to share a link with a colleague, of the open file, I can do that much more easily now.
My project lives at /cgit/opengitfile. I reimplemented all the code to match my own style, and because it's more fun to write than to read code.
To use this script, point it to a file.
opengitfile.sh ~/dev/serverlist/README.md https://github.com/luanti-org/serverlist/blob/boost-domains/README.md
To use it in vim, put this in your .vimrc.
function! OpenGitFile() let a = system("opengitfile.sh " . bufname("%") . " " . line('.')) let b = system("dragon-drag-and-drop " . shellescape(a)) endfun nmap <F7> :call OpenGitFile()<CR> vmap <F7> <Esc>:call OpenGitFile()<CR> imap <F7> <Esc>:call OpenGitFile()<CR>
And now F7 will run the script and open a dialog box with the url.

Comments