diff options
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 |