diff options
author | jgmdev <jgmdev@gmail.com> | 2022-05-24 19:29:50 -0400 |
---|---|---|
committer | jgmdev <jgmdev@gmail.com> | 2022-05-24 19:29:50 -0400 |
commit | 35e947d1933613bb0b5a1488bf0fa4587f98ef7d (patch) | |
tree | 07d2515f44db03b1e865f6aef6adfd12b118890b /plugins/openfilelocation.lua | |
parent | c1f3671e2a8defbc67d1e77c72d5866f2825cdb5 (diff) | |
download | lite-xl-plugins-35e947d1933613bb0b5a1488bf0fa4587f98ef7d.tar.gz lite-xl-plugins-35e947d1933613bb0b5a1488bf0fa4587f98ef7d.zip |
added config_spec and other plugin compatibility fixes.
Diffstat (limited to 'plugins/openfilelocation.lua')
-rw-r--r-- | plugins/openfilelocation.lua | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/plugins/openfilelocation.lua b/plugins/openfilelocation.lua index 0328142..8e225cd 100644 --- a/plugins/openfilelocation.lua +++ b/plugins/openfilelocation.lua @@ -1,20 +1,33 @@ -- mod-version:3 --lite-xl 2.1 local core = require "core" +local common = require "core.common" local command = require "core.command" local config = require "core.config" - -config.plugins.openfilelocation = {} -if not config.plugins.openfilelocation.filemanager then - if PLATFORM == "Windows" then - config.plugins.openfilelocation.filemanager = "explorer" - elseif PLATFORM == "Mac OS X" then - config.plugins.openfilelocation.filemanager = "open" - else - config.plugins.openfilelocation.filemanager = "xdg-open" - end +local platform_filemanager +if PLATFORM == "Windows" then + platform_filemanager = "explorer" +elseif PLATFORM == "Mac OS X" then + platform_filemanager = "open" +else + platform_filemanager = "xdg-open" end +config.plugins.openfilelocation = common.merge({ + filemanager = platform_filemanager, + -- The config specification used by the settings gui + config_spec = { + name = "Open File Location", + { + label = "File Manager", + description = "Command of the file browser.", + path = "filemanager", + type = "string", + default = platform_filemanager + } + } +}, config.plugins.openfilelocation) + command.add("core.docview", { ["open-file-location:open-file-location"] = function() local doc = core.active_view.doc |