Coder Social home page Coder Social logo

gx-extended.nvim's People

Contributors

bennypowers avatar mosheavni avatar rmagatti avatar srikarg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gx-extended.nvim's Issues

Support visual selections

The built-in gx supports navigating to a portion of the text that got selected in visual mode, gx-extended lacks that feature for passing on selected portion of the text extensions, it is currently only capable of sending the extensions the full line.

Eg. for the original gx if I have a URL in a line:

test url: https://github.com/rmagatti/gx-extended.nvim whatever trailing text

If I place the cursor on the URL and hit gx it opens the full URL.
If I do a visual selection for only github.com it will open github.com

Would be cool to allow gx-ing with a visual selection, like performing a google search on it.
Eg. I do a visual selection, then have extensions that are registered as being able to work in visual mode.
Then have a google extension and a duckduckgo extension.
When I select text, and hit gx, it would execute only the extensions supporting visual mode, then show me which URL I want to open (like it does in normal mode).

I'm open to contributing this feature as a PR.

Bug: `%` breaks URLs

Awesome plugin, thanks so much :)

Bug description:
A percent character (%) breaks URL recognition with this plugin.

Environment:
Windows 10, Neovim 0.9.1, running in nvim-qt 0.2.17.0, plugin installed with lazy.nvim and up to date, using the configuration suggested in the readme (using netrw open handler).

Expected behavior:
For example if you place your cursor on https://www.duckduckgo.com/?q=site%3Agithub.com+gx-extended&hps=1&ia=web and press gx, without this plugin installed it opens the correct URL in the browser.

Actual behavior:
With this plugin installed instead it opens https://www.duckduckgo.com/?q=site and if the www. is missing, it doesn’t open anything.

Register user plugins for specific filetypes

Besides regex, the original gx-extended plugin allowed for an additional filetype-based filtering, so that the regex matching was only happening in a specific filetype. The filetype detection itself is then handled by vim instead of the plugin.
Only workaround today is defining your own filename pattern, but then you start reimplementing an inferior version of the ftdetect functionality which is already part of vim.

[BUG] Fails to cycle through multiple glob matches

Since the merge of #4, when multiple globs should match for a file, it fails to cycle through the multiple matches resulting in a random failure or success open depending on the order in which the matches were loaded.

Add a license

Please add a FLOSS license to the repo (eg. MIT, BSD, Apache, whatever).

match on dir, not just pattern

consider this config:

return { 'rmagatti/gx-extended.nvim',
  keys = { 'gx' },
  opts = {
    extensions = {
      patterns = { '*/plugins/**/*.lua' },
      match_to_url = function(line_string)
        local line = string.match(line_string, "[\"|'].*/.*[\"|']")
        local repo = vim.split(line, ':')[1]:gsub('"', '')
        local url = 'https://github.com/' .. repo

        if not line or not repo then
          return nil
        end

        return url
      end,
    }
  }
}

given that

local current_file = vim.fn.expand("%:t")

print(vim.fn.expand('%')) -- /home/bennyp/.config/nvim/lua/plugins/ui/gx-extended.lua
print(vim.fn.expand('%:t')) -- gx-extended.lua

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.