XPM.xplr

· Tom van Dijk's blog

Plugin manager for the XPLR file manager

xplr plugin manager #

Requirements #

Installation #

 1local home = os.getenv("HOME")
 2local xpm_path = home .. "/.local/share/xplr/dtomvan/xpm.xplr"
 3local xpm_url = "https://github.com/dtomvan/xpm.xplr"
 4
 5package.path = package.path
 6  .. ";"
 7  .. xpm_path
 8  .. "/?.lua;"
 9  .. xpm_path
10  .. "/?/init.lua"
11
12os.execute(
13  string.format(
14    "[ -e '%s' ] || git clone '%s' '%s'",
15    xpm_path,
16    xpm_url,
17    xpm_path
18  )
19)
 1
 2require("xpm").setup({
 3
 4    -- This works
 5    'dtomvan/xpm.xplr',
 6
 7    -- Or this
 8    'github:dtomvan/xpm.xplr',
 9
10    -- Or this
11    'https://github.com/dtomvan/xpm.xplr',
12
13    -- You can also use a field
14    { name = "dtomvan/xpm.xplr" },
15})
16
17-- Or
18
19require("xpm").setup({
20  plugins = {
21    -- Let xpm manage itself
22    'dtomvan/xpm.xplr',
23    { name = 'sayanarijit/fzf.xplr' },
24  },
25  auto_install = true,
26  auto_cleanup = true,
27})
1xplr.config.modes.builtin.default.key_bindings.on_key.x = {
2  help = "xpm",
3  messages = {
4    "PopMode",
5    { SwitchModeCustom = "xpm" },
6  },
7}

WARNING: a current limitation is that any repo not ending in .xplr isn't picked up correctly, but by convention the repo's name should end in .xplr

Features #

Setup arguments #

 1{
 2  -- Default: {}
 3  plugins = { "dtomvan/xpm.xplr" },
 4
 5  -- Default: true
 6  auto_install = true
 7
 8  -- Default: false
 9  auto_cleanup = false
10}

Plugin arguments #

All available arguments for a plugin are:

 1-- <in xpm.setup>
 2{
 3    -- Default: Skip if empty
 4    "<name>",
 5
 6    -- Default: Skip if empty
 7    name = "<name>",
 8
 9    -- Branch, commit or tag to pin
10    -- Default: "origin"
11    rev = "<revision>"
12
13    -- Default: empty
14    after = function() end,
15
16    -- Default: empty
17    before = function() end,
18
19    -- Default: require("<name>").setup()
20    setup = function() end,
21
22    -- Default: empty
23    -- WARNING: if any of the dependencies fail to download, the plugin won't
24    -- load to prevent from any damage being done
25    deps = { "dtomvan/xpm.xplr" }
26}