From 5dc215a9372a3b129a891621c181b57500468535 Mon Sep 17 00:00:00 2001
From: Tran Vo Son Tung
Date: Sat, 23 Sep 2023 12:16:11 +0700
Subject: [PATCH] docs: update README, auto generate docs
---
README.md | 46 ++--
docs/index.html | 7 +-
docs/modules/url-open.html | 3 +-
docs/modules/url-open.modules.autocmd.html | 21 +-
docs/modules/url-open.modules.commands.html | 11 +-
docs/modules/url-open.modules.handlers.html | 139 ++++++------
docs/modules/url-open.modules.highlight.html | 216 +++++++++++++++++++
docs/modules/url-open.modules.logger.html | 3 +-
docs/modules/url-open.modules.options.html | 5 +-
docs/modules/url-open.modules.patterns.html | 167 ++++++++++----
docs/topics/README.md.html | 74 ++++---
lua/url-open/modules/commands.lua | 4 +-
lua/url-open/modules/highlight.lua | 2 +
lua/url-open/modules/patterns.lua | 10 +-
14 files changed, 509 insertions(+), 199 deletions(-)
create mode 100644 docs/modules/url-open.modules.highlight.html
diff --git a/README.md b/README.md
index f27ad00..0517239 100644
--- a/README.md
+++ b/README.md
@@ -7,25 +7,27 @@ It provides the convenience of automatically detecting and highlighting all URLs
are using macos or windows and you have any problem with this plugin, please
open an issue or create a pull request to fix it
-- [Features](#features)
-- [Installation](#installation)
-- [Configuration](#configuration)
-- [Usage](#usage)
-- [Contributing](#contributing)
-- [License](#license)
+- 🚀 [Features](#features)
+- 👀 [Installation](#installation)
+- 💻 [Configuration](#configuration)
+- 😆 [Usage](#usage)
+- 😁 [Contributing](#contributing)
+- ✌️ [License](#license)
## Features
-- Automatically detect and highlight all URLs within the text content and
+- 🎨 Automatically detect and highlight all URLs within the text content and
provide visual cues when hovering over clickable URLs.
-- Open the URLs under the cursor, including the Markdown link (e.g. `https://github.com/sontungexpt/url-open`).
-- Open the GitHub page for the Neovim plugin mentioned under the cursor
+- 🛠️ Allow for opening URLs from anywhere on a line, as long as the line contains only one URL.
+ If one line has multiple URLs, the first URLs in the right side of cursor will be opened.
+- 🎉 Open the URLs under the cursor, including the Markdown link (e.g. `https://github.com/sontungexpt/url-open`).
+- ✈️ Open the GitHub page for the Neovim plugin mentioned under the cursor
(e.g. `Plug 'nvim-lua/plenary.nvim'`, "sontungexpt/url-open").
-- Easily open the npm package specified in the package.json file. (e.g. `"lodash": "^4.17.21",`).
+- 🍨 Easily open the npm package specified in the package.json file. (e.g. `"lodash": "^4.17.21",`).
- Extend support for recognized formats, including brew formulas and casks.
-- Provide an optional deep pattern matching feature,
+- 🚀 Provide an optional deep pattern matching feature,
which can be enabled, to accurately identify and handle various URL formats, such as:
- http://example.com
- https://www.example.com
@@ -38,13 +40,9 @@ open an issue or create a pull request to fix it
- http://example.com:8080
- https://www.example.com:8443
- ftp://ftp.example.com:2121
-- Allow for opening URLs from anywhere on a line, as long as the line contains only one URL.
- If one line has multiple URLs, the first URLs in the right side of cursor will be opened.
## Preview
-- Highlight url which can be opened then you can open it by `:OpenUrlUnderCursor`
-
![highlight-url](./docs/readme/preview1.png)
![highlight-all-url](./docs/readme/preview2.png)
@@ -60,7 +58,7 @@ https://github.com/sontungexpt/url-open/assets/92097639/c51b3e1c-8eae-48f0-a542-
{
"sontungexpt/url-open",
event = "VeryLazy"
- cmd = "OpenUrlUnderCursor",
+ cmd = "URLOpenUnderCursor",
config = function()
local status_ok, url_open = pcall(require, "url-open")
if not status_ok then
@@ -80,7 +78,7 @@ https://github.com/sontungexpt/url-open/assets/92097639/c51b3e1c-8eae-48f0-a542-
"sontungexpt/url-open",
branch = "mini",
event = "VeryLazy"
- cmd = "OpenUrlUnderCursor",
+ cmd = "URLOpenUnderCursor",
config = function()
local status_ok, url_open = pcall(require, "url-open")
if not status_ok then
@@ -130,7 +128,9 @@ require("url_open").setup({
-- suffix = ""
-- file_patterns = { "package%.json" }, -- support for only specific file match with pattern
-- excluded_file_patterns = {}, -- exclude file match with pattern
- -- extra_condition = function() return true end, -- need to return boolean
+ -- extra_condition = function(pattern_found) -- the function will be called when pattern found and return boolean
+ -- return pattern_found ~= "version" and pattern_found ~= "proxy"
+ -- end,
-- },
-- Ex: ['["]([^%s]*)["]:'] = "https://www.npmjs.com/package/",
@@ -153,16 +153,18 @@ require("url_open").setup({
## Usage
-- This plugin provide a command `:OpenUrlUnderCursor` to open url under cursor
+| **Command** | **Description** |
+| --------------------------- | ----------------------------------------- |
+| `:URLOpenUnderCursor` | Open url under cursor |
+| `:URLOpenHighlightAll` | Highlight all url in current buffer |
+| `:URLOpenHighlightAllClear` | Clear all highlight url in current buffer |
- This plugin will not map any key by default, you can map it by yourself
```lua
-vim.keymap.set("n", "gx", ":OpenUrlUnderCursor")
+vim.keymap.set("n", "gx", ":URLOpenUnderCursor")
```
-- You can also use command `:HighlightAllUrls` to highlight all urls in the buffer manually
-
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
diff --git a/docs/index.html b/docs/index.html
index ac21a5f..5ad5509 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -36,6 +36,7 @@
Http(s) URL pattern
+ Matches URLs starting with "http://" or "https://"
+ Example: "http://example.com", "https://www.example.com"
+ Pattern: "(https?://[%w-%.]+%.%w[%w-%.%%%?%.:/+=&%%[%]#<>]*)"
+ Prefix: ""
+ Suffix: ""
+ Filepatterns: All files
+ Extracondition: None
+ Excludedfilepatterns: None
+ Note: This pattern is used to match urls in all files
+
+
+
Npm Package pattern
+ Matches npm package names
+ Example: "react", "react-dom"
+ Pattern: '"["]:%s"[^"]%d[%d%.]*"'
+ Prefix: "https://www.npmjs.com/package/"
+ Suffix: ""
+ Filepatterns: "package%.json"
+ Extracondition: patternfound ~= "version" and patternfound ~= "proxy"
+ Excludedfilepatterns: None
+ Note: This pattern is used to match npm packages in package.json files
+
+
Git Plugin pattern
+ Matches git plugin names
+ Example: "airblade/vim-gitgutter", "tpope/vim-fugitive"
+ Pattern: "\"'[\"']"
+ Prefix: "https://github.com/"
+ Suffix: ""
+ Filepatterns: All files except package.json and package-lock.json
+ Extracondition: None
+ Excludedfilepatterns: "package%.json", "package%-lock%.json"
+ Note: This pattern is used to match git plugins in all files except package.json and package-lock.json
+
+
+
Brew Formula pattern
+ Matches brew formula names
+ Example: "bat", "exa"
+ Pattern: 'brew "["]'
+ Prefix: "https://formulae.brew.sh/formula/"
+ Suffix: ""
+ Filepatterns: All files
+ Extracondition: None
+ Excludedfilepatterns: None
+ Note: This pattern is used to match brew formulas in all files
+
+
Cask Formula pattern
+ Matches cask formula names
+ Example: "firefox", "google-chrome"
+ Pattern: 'cask "["]'
+ Prefix: "https://formulae.brew.sh/cask/"
+ Suffix: ""
+ Filepatterns: All files
+ Extracondition: None
+ Excludedfilepatterns: None
+ Note: This pattern is used to match cask formulas in all files
+
+
Cargo Package pattern
+ Matches cargo package names
+ Example: "serde", "serdejson"
+ Pattern: "^%s*([%w]+)%s*="
+ Prefix: "https://crates.io/crates/"
+ Suffix: ""
+ Filepatterns: "Cargo%.toml"
+ Extracondition: not vim.tblcontains({
+ "name",
+ "version",
+ "edition",
+ "authors",
+ "description",
+ "license",
+ "repository",
+ "homepage",
+ "documentation",
+ "keywords",
+ }, patternfound)
+ Excludedfilepatterns: None
+ Note: This pattern is used to match cargo packages in Cargo.toml files
+
+
+
Fields:
+
+
suffix
+
+
+
+
+
file_patterns
+
+
+
+
+
+
+
+
+
+
+
+
Fields
@@ -84,43 +203,19 @@
Fields
Deep Pattern to match urls from text. This pattern will find urls in the following formats:
+ http://example.com
+ https://www.example.com
+ ftp://ftp.example.com
+ file:///path/to/file.txt
+ ssh://user@hostname
+ git://github.com/user/repo
+ http://example.com/path?param=value
+ https://www.example.com/another/path#section
+ http://example.com:8080
+ https://www.example.com:8443
+ ftp://ftp.example.com:2121
-
This plugin allow you to open url under cursor in neovim without netrw with
-default browser of your system.
+
This 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.
+It provides the convenience of automatically detecting and highlighting all URLs within the text content.
-
NOTE: Since I am the linux user so i only test this plugin on linux, if you
+
NOTE: Since I am the linux user so i only test this plugin on linux, if you
are using macos or windows and you have any problem with this plugin, please
open an issue or create a pull request to fix it
Highlight all urls in the buffer and highlight url that can be opened when cursor move over it
-
Open the url under cursor include markdown link (e.g. https://github.com/sontungexpt/url-open)
-
Open the github page of neovim plugin name under cursor (e.g. Plug 'nvim-lua/plenary.nvim', "sontungexpt/url-open")
-
Open the npm package in package.json (e.g. "lodash": "^4.17.21",)
-
Support brew formula, and cask
-
Support deep pattern (disabled by default) to match with url below
+
🎨 Automatically detect and highlight all URLs within the text content and
+ provide visual cues when hovering over clickable URLs.
+
🛠️ Allow for opening URLs from anywhere on a line, as long as the line contains only one URL.
+ If one line has multiple URLs, the first URLs in the right side of cursor will be opened.
+
🎉 Open the URLs under the cursor, including the Markdown link (e.g. https://github.com/sontungexpt/url-open).
+
✈️ Open the GitHub page for the Neovim plugin mentioned under the cursor
+ (e.g. Plug 'nvim-lua/plenary.nvim', "sontungexpt/url-open").
+
🍨 Easily open the npm package specified in the package.json file. (e.g. "lodash": "^4.17.21",).
+
Extend support for recognized formats, including brew formulas and casks.
+
🚀 Provide an optional deep pattern matching feature,
+ which can be enabled, to accurately identify and handle various URL formats, such as:
http://example.com
https://www.example.com
ftp://ftp.example.com
@@ -95,15 +101,10 @@
Features
http://example.com:8080
https://www.example.com:8443
ftp://ftp.example.com:2121
-
Allow you to open url from anywhere in the line if it only contains 1 url
Preview
-
-
Highlight url which can be opened then you can open it by :OpenUrlUnderCursor
-- default values
require("url_open").setup({
- -- if true, only open url when cursor in the middle of url
--- if false, open next url found from cursor position it means you can open
--- url even when the cursor is in front of url or in the middle of url
- open_app = "default",
-- default will open url with default browser of your system or you can choose your browser like this
-- open_app = "micorsoft-edge-stable",
-- google-chrome, firefox, micorsoft-edge-stable, opera, brave, vivaldi
+ open_app = "default",
+ -- If true, only open the URL when the cursor is in the middle of the URL.
+-- If false, open the next URL found from the cursor position,
+-- which means you can open a URL even when the cursor is in front of the URL or in the middle of the URL.
open_only_when_cursor_on_url = false,
highlight_url = {
all_urls = {
@@ -196,7 +197,9 @@
Configuration
-- suffix = ""
-- file_patterns = { "package%.json" }, -- support for only specific file match with pattern
-- excluded_file_patterns = {}, -- exclude file match with pattern
--- extra_condition = function() return true end, -- need to return boolean
+-- extra_condition = function(pattern_found) -- the function will be called when pattern found and return boolean
+-- return pattern_found ~= "version" and pattern_found ~= "proxy"
+-- end,
-- },
-- Ex: ['["]([^%s]*)["]:'] = "https://www.npmjs.com/package/",
@@ -220,21 +223,22 @@
Configuration
Usage
+
| Command | Description |
+| --------------------------- | ----------------------------------------- |
+| :URLOpenUnderCursor | Open url under cursor |
+| :URLOpenHighlightAll | Highlight all url in current buffer |
+| :URLOpenHighlightAllClear | Clear all highlight url in current buffer |
+
-
This plugin provide a command :OpenUrlUnderCursor to open url under cursor
-
This plugin will not map any key by default, you can map it by yourself
+
This plugin will not map any key by default, you can map it by yourself