Skip to content

how can I get the git url with lua? #249

Answered by mosheavni
mosheavni asked this question in Q&A
Discussion options

You must be logged in to vote

managed to figure it out:

  vim.api.nvim_buf_set_keymap(0, 'n', '<leader>gh', '', {
    noremap = true,
    silent = true,
    desc = 'Open commit hash in browser',
    callback = function()
      local commit_hash = get_commit_hash()
      vim.cmd 'wincmd p'
      require('gitlinker').link {
        action = function(url)
          vim.ui.open(url)
        end,
        router = function(lk)
          print(vim.inspect(lk))
          local builder = 'https://'
          -- host
          builder = builder .. lk.host .. '/'
          -- org
          builder = builder .. lk.org .. '/'
          -- repo
          builder = builder .. (string_endswith(lk.repo, '.git') and lk.repo:sub(1, #lk.r…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mosheavni
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant