Skip to content

tylerbrazier/nvim-gx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Hook into gx with custom functions, including:

  • open packages in npm
  • open commit hashes in github (requires nvim-gh)
  • any custom hook

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.

About

Hook into gx with custom functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages