Hook into gx with custom functions, including:
No setup required; by default this will make gx work on node package names
and git commit hashes. Example custom setup (in ~/.config/nvim/init.lua):
local gx = require('gx')
gx.setup{
gh = { remote = 'upstream' }, -- default is 'origin'
npm = { url = 'https://npmx.dev/package/' }, -- default is npmjs.com
hooks = {
-- included hooks
gx.gh,
gx.npm,
-- custom hook: gx on file.md creates file.md.html and opens it
function(path)
if not vim.endswith(path, '.md') then
return false -- don't handle in this hook
end
vim.system({'sh', '-c',
'markdown '..path..' > '..path..'.html'
}):wait()
return vim.ui.open(path..'.html')
end,
},
}
Custom hooks should either return the vim.ui.open() call, or false to skip.