Skip to content

How to get 'gx' to do xdg-open while ntree-vim disables netrw #2714

Answered by ikke-t
ikke-t asked this question in Q&A
Discussion options

You must be logged in to vote

This is the simplest I get it into, and I link the xdg-open to flatpak-xdg-open in my .local/bin:

  { -- nvim-tree.lua adds the file browser
    'nvim-tree/nvim-tree.lua',
    opts = {
      system_open = { cmd = 'xdg-open', args = {} },
    },
    keys = {
      {
        -- as we don't have netrw, we loose gx. Add it back:
        -- https://www.reddit.com/r/neovim/comments/11zgf64/gxnvim_open_links_and_more_without_netrw/
        -- will change in nvim 0.10.0 to vim.ui.open
        'gx',
        mode = { 'n' },
        function()
          vim.fn.system { 'xdg-open', vim.fn.expand '<cfile>' }
        end,
        desc = '[X]dg Open current url',
      },
    },
  },

Replies: 5 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@alex-courtis
Comment options

@ikke-t
Comment options

@gegoune
Comment options

@ikke-t
Comment options

@gegoune
Comment options

Answer selected by ikke-t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants