Module url-open.modules.handlers

Handlers for opening urls

Functions

find_first_matching_url (text, patterns, start_pos, found_url_smaller_pos) Find the first url in the text that matches any of the patterns
find_first_url_in_line (user_opts, text, start_pos) Find the first url in the line
foreach_url_in_line (user_opts, line, callback) Iterate through all urls in the line
matches_condition_pattern (pattern_found, condition) Check if the pattern found matches the condition
matches_file_patterns (file_patterns, is_excluded) Check if the file path matches any of the patterns
open_url (user_opts) Open the url under the cursor If there is only one url in the line, then open it anywhere in the line.
open_url_with_app (apps, url) Open the url with the specified app
system_open_url (user_opts, url) Open the url relying on the operating system


Functions

find_first_matching_url (text, patterns, start_pos, found_url_smaller_pos)
Find the first url in the text that matches any of the patterns

Parameters:

  • text string : Text to search for patterns
  • patterns table : Patterns to search for urls in the text
  • start_pos number : Start position to search from (optional) (default: 0)
  • found_url_smaller_pos number : The position of the found url must be smaller than this number (optional) (default: string.len(text))

See also:

find_first_url_in_line (user_opts, text, start_pos)
Find the first url in the line

Parameters:

  • user_opts table : User options
  • text string : Text to search for urls
  • start_pos number : Start position to search from (optional) (default: 1)

Returns:

    number startpos, number endpos, string url: Start position, end position, and url of the first url found (all nil if not found)

See also:

foreach_url_in_line (user_opts, line, callback)
Iterate through all urls in the line

Parameters:

  • user_opts table : User options
  • line string : The line to iterate through
  • callback function : The callback function to call for each url

See also:

matches_condition_pattern (pattern_found, condition)
Check if the pattern found matches the condition

Parameters:

  • pattern_found string : The url to check
  • condition function or boolean : The condition to check (function(pattern_found))

Returns:

    boolean : True if the pattern found matches the condition, otherwise false

See also:

matches_file_patterns (file_patterns, is_excluded)
Check if the file path matches any of the patterns

Parameters:

  • file_patterns table : Patterns to match the file path
  • is_excluded boolean : If the file path is excluded (optional) (default: false)

Returns:

    boolean : True if the file path matches any of the patterns, otherwise false
open_url (user_opts)
Open the url under the cursor If there is only one url in the line, then open it anywhere in the line.

Parameters:

  • user_opts table : User options

See also:

open_url_with_app (apps, url)
Open the url with the specified app

Parameters:

  • apps table : The table of apps to open the url
  • url string : The url to open
system_open_url (user_opts, url)
Open the url relying on the operating system

Parameters:

  • user_opts table : User options
  • url string : The url to open

See also:

generated by LDoc 1.5.0 Last updated 2023-11-17 07:26:28