aboutsummaryrefslogtreecommitdiff
path: root/plugins/openselected.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-05-24 19:29:50 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-24 19:29:50 -0400
commit35e947d1933613bb0b5a1488bf0fa4587f98ef7d (patch)
tree07d2515f44db03b1e865f6aef6adfd12b118890b /plugins/openselected.lua
parentc1f3671e2a8defbc67d1e77c72d5866f2825cdb5 (diff)
downloadlite-xl-plugins-35e947d1933613bb0b5a1488bf0fa4587f98ef7d.tar.gz
lite-xl-plugins-35e947d1933613bb0b5a1488bf0fa4587f98ef7d.zip
added config_spec and other plugin compatibility fixes.
Diffstat (limited to 'plugins/openselected.lua')
-rw-r--r--plugins/openselected.lua33
1 files changed, 23 insertions, 10 deletions
diff --git a/plugins/openselected.lua b/plugins/openselected.lua
index c2cb3a4..7df4dba 100644
--- a/plugins/openselected.lua
+++ b/plugins/openselected.lua
@@ -7,17 +7,30 @@ local config = require "core.config"
local contextmenu = require "plugins.contextmenu"
-config.plugins.openselected = {}
-if not config.plugins.openselected.filemanager then
- if PLATFORM == "Windows" then
- config.plugins.openselected.filemanager = "start"
- elseif PLATFORM == "Mac OS X" then
- config.plugins.openselected.filemanager = "open"
- else
- config.plugins.openselected.filemanager = "xdg-open"
- end
+local platform_filelauncher
+if PLATFORM == "Windows" then
+ platform_filelauncher = "start"
+elseif PLATFORM == "Mac OS X" then
+ platform_filelauncher = "open"
+else
+ platform_filelauncher = "xdg-open"
end
+config.plugins.openselected = common.merge({
+ filelauncher = platform_filelauncher,
+ -- The config specification used by the settings gui
+ config_spec = {
+ name = "Open Selected Text",
+ {
+ label = "File Launcher",
+ description = "Command used to open the selected path or link externally.",
+ path = "filelauncher",
+ type = "string",
+ default = platform_filelauncher
+ }
+ }
+}, config.plugins.openselected)
+
command.add("core.docview", {
["open-selected:open-selected"] = function()
local doc = core.active_view.doc
@@ -38,7 +51,7 @@ command.add("core.docview", {
core.log("Opening %s...", text)
- system.exec(config.plugins.openselected.filemanager .. " " .. text)
+ system.exec(config.plugins.openselected.filelauncher .. " " .. text)
end,
})