{"id":13412355,"url":"https://github.com/sontungexpt/url-open","last_synced_at":"2025-08-01T18:14:23.782Z","repository":{"id":189361619,"uuid":"680524350","full_name":"sontungexpt/url-open","owner":"sontungexpt","description":"Minimal plugin allow you to open url under cursor in neovim without netrw with default browser of your system and highlight url","archived":false,"fork":false,"pushed_at":"2024-08-16T06:10:22.000Z","size":3477,"stargazers_count":92,"open_issues_count":11,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-29T12:08:16.686Z","etag":null,"topics":["gx","link","link-highlighting","lua","neovim","neovim-plugin","nvim","open-url","plugin","url"],"latest_commit_sha":null,"homepage":"https://sontungexpt.github.io/url-open/","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sontungexpt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-19T14:23:58.000Z","updated_at":"2025-01-12T11:32:48.000Z","dependencies_parsed_at":"2023-08-19T16:46:03.169Z","dependency_job_id":"665624ce-b1e4-4753-b5de-56c3f6e9c380","html_url":"https://github.com/sontungexpt/url-open","commit_stats":null,"previous_names":["sontungexpt/url-open"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sontungexpt%2Furl-open","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sontungexpt%2Furl-open/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sontungexpt%2Furl-open/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sontungexpt%2Furl-open/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sontungexpt","download_url":"https://codeload.github.com/sontungexpt/url-open/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237403362,"owners_count":19304416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gx","link","link-highlighting","lua","neovim","neovim-plugin","nvim","open-url","plugin","url"],"created_at":"2024-07-30T20:01:23.783Z","updated_at":"2025-02-06T01:58:09.298Z","avatar_url":"https://github.com/sontungexpt.png","language":"Lua","readme":"## Introduction\n\nThis plugin enables you to effortlessly open the URL under the cursor in Neovim, bypassing the need for netrw, and instead utilizing the default browser of your system.\nIt provides the convenience of automatically detecting and highlighting all URLs within the text content.\n\n**NOTE:** Since I am the linux user so i only test this plugin on linux, if you\nare using macos or windows and you have any problem with this plugin, please\nopen an issue or create a pull request to fix it\n\n- 🚀 [Features](#features)\n- 👀 [Installation](#installation)\n- 💻 [Configuration](#configuration)\n- 😆 [Usage](#usage)\n- 😁 [Contributing](#contributing)\n- ✌️ [License](#license)\n\n\u003c!--toc:end--\u003e\n\n## Features\n\n- 🎨 Automatically detect and highlight all URLs within the text content and\n  provide visual cues when hovering over clickable URLs.\n- 🛠️ Allow for opening URLs from anywhere on a line, as long as the line contains only one URL.\n  If one line has multiple URLs, the first URLs in the right side of cursor will be opened.\n- 🎉 Open the URLs under the cursor, including the Markdown link (e.g. `https://github.com/sontungexpt/url-open`).\n- ✈️ Open the GitHub page for the Neovim plugin mentioned under the cursor\n  (e.g. `Plug 'nvim-lua/plenary.nvim'`, `\"sontungexpt/url-open\"`).\n- 🍨 Easily open the npm package specified in the package.json file. (e.g. `\"lodash\": \"^4.17.21\",`).\n- 🍻 Open the Homebrew formula or cask specified in the Brewfile.\n- 🍕 Open the cargo package specified in the Cargo.toml file.\n- 🚀 Provide an optional deep pattern matching feature,\n  which can be enabled, to accurately identify and handle various URL formats, such as:\n  - http://example.com\n  - https://www.example.com\n  - ftp://ftp.example.com\n  - file:///path/to/file.txt\n  - ssh://user@hostname\n  - git://github.com/user/repo\n  - http://example.com/path?param=value\n  - https://www.example.com/another/path#section\n  - http://example.com:8080\n  - https://www.example.com:8443\n  - ftp://ftp.example.com:2121\n\n## Preview\n\n![highlight-url](./docs/readme/preview1.png)\n\n![highlight-all-url](./docs/readme/preview2.png)\n\nhttps://github.com/sontungexpt/url-open/assets/92097639/9b4fe61a-b948-470c-a1df-cd16dea706e7\n\nhttps://github.com/sontungexpt/url-open/assets/92097639/c51b3e1c-8eae-48f0-a542-e16205fd00f9\n\n## Installation\n\n```lua\n-- lazy.nvim\n{\n    \"sontungexpt/url-open\",\n    event = \"VeryLazy\",\n    cmd = \"URLOpenUnderCursor\",\n    config = function()\n        local status_ok, url_open = pcall(require, \"url-open\")\n        if not status_ok then\n            return\n        end\n        url_open.setup ({})\n    end,\n},\n```\n\n- NOTE: If you want to use minimal source with no comments, no validate configs, no documents,\n  you can use branch `mini` instead of `main` branch. Make sure you know that your config is valid\n\n```lua\n-- lazy.nvim\n{\n    \"sontungexpt/url-open\",\n    branch = \"mini\",\n    event = \"VeryLazy\",\n    cmd = \"URLOpenUnderCursor\",\n    config = function()\n        local status_ok, url_open = pcall(require, \"url-open\")\n        if not status_ok then\n            return\n        end\n        url_open.setup ({})\n    end,\n},\n```\n\n## Configuration\n\nYou can easily add more patterns to open url under cursor by adding more patterns to `extra_patterns` config\n\n```lua\n-- default values\nrequire(\"url-open\").setup({\n    -- default will open url with default browser of your system or you can choose your browser like this\n    -- open_app = \"micorsoft-edge-stable\",\n    -- google-chrome, firefox, micorsoft-edge-stable, opera, brave, vivaldi\n    open_app = \"default\",\n    -- If true, only open the URL when the cursor is in the middle of the URL.\n    -- If false, open the next URL found from the cursor position,\n    -- which means you can open a URL even when the cursor is in front of the URL or in the middle of the URL.\n    open_only_when_cursor_on_url = false,\n    highlight_url = {\n        all_urls = {\n            enabled = false,\n            fg = \"#21d5ff\", -- \"text\" or \"#rrggbb\"\n            -- fg = \"text\", -- text will set underline same color with text\n            bg = nil, -- nil or \"#rrggbb\"\n            underline = true,\n        },\n        cursor_move = {\n            enabled = true,\n            fg = \"#199eff\", -- \"text\" or \"#rrggbb\"\n            -- fg = \"text\", -- text will set underline same color with text\n            bg = nil, -- nil or \"#rrggbb\"\n            underline = true,\n        },\n    },\n    deep_pattern = false,\n    -- a list of patterns to open url under cursor\n    extra_patterns = {\n        -- {\n        -- \t  pattern = '[\"]([^%s]*)[\"]:%s*\"[^\"]*%d[%d%.]*\"',\n        -- \t  prefix = \"https://www.npmjs.com/package/\",\n        -- \t  suffix = \"\",\n        -- \t  file_patterns = { \"package%.json\" },\n        -- \t  excluded_file_patterns = nil,\n        -- \t  extra_condition = function(pattern_found)\n        -- \t    return not vim.tbl_contains({ \"version\", \"proxy\" }, pattern_found)\n        -- \t  end,\n        -- },\n\t\t-- so the url will be https://www.npmjs.com/package/[pattern_found]\n\n\n        -- {\n        -- \t  pattern = '[\"]([^%s]*)[\"]:%s*\"[^\"]*%d[%d%.]*\"',\n        -- \t  prefix = \"https://www.npmjs.com/package/\",\n        -- \t  suffix = \"/issues\",\n        -- \t  file_patterns = { \"package%.json\" },\n        -- \t  excluded_file_patterns = nil,\n        -- \t  extra_condition = function(pattern_found)\n        -- \t    return not vim.tbl_contains({ \"version\", \"proxy\" }, pattern_found)\n        -- \t  end,\n        -- },\n\t\t--\n\t\t-- so the url will be https://www.npmjs.com/package/[pattern_found]/issues\n    },\n})\n```\n\n## Usage\n\n| **Command**                 | **Description**                           |\n| --------------------------- | ----------------------------------------- |\n| `:URLOpenUnderCursor`       | Open url under cursor                     |\n| `:URLOpenHighlightAll`      | Highlight all url in current buffer       |\n| `:URLOpenHighlightAllClear` | Clear all highlight url in current buffer |\n\n- This plugin will not map any key by default, you can map it by yourself\n\n```lua\nvim.keymap.set(\"n\", \"gx\", \"\u003cesc\u003e:URLOpenUnderCursor\u003ccr\u003e\")\n```\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","funding_links":[],"categories":["Utility","Lua"],"sub_categories":["Cursorline"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsontungexpt%2Furl-open","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsontungexpt%2Furl-open","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsontungexpt%2Furl-open/lists"}