diff options
Diffstat (limited to 'xplr/plugins/dragon')
-rw-r--r-- | xplr/plugins/dragon/LICENSE | 21 | ||||
-rw-r--r-- | xplr/plugins/dragon/README.md | 49 | ||||
-rw-r--r-- | xplr/plugins/dragon/src/init.lua | 62 |
3 files changed, 0 insertions, 132 deletions
diff --git a/xplr/plugins/dragon/LICENSE b/xplr/plugins/dragon/LICENSE deleted file mode 100644 index 03b3d59..0000000 --- a/xplr/plugins/dragon/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 Arijit Basu - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/xplr/plugins/dragon/README.md b/xplr/plugins/dragon/README.md deleted file mode 100644 index 8a74a12..0000000 --- a/xplr/plugins/dragon/README.md +++ /dev/null @@ -1,49 +0,0 @@ -[![xplr-dragon.gif](https://s6.gifyu.com/images/xplr-dragon.gif)](https://gifyu.com/image/A8N1) - -Drag and drop files using [dragon](https://github.com/mwh/dragon). - - -Requirements ------------- - -- [dragon](https://github.com/mwh/dragon) -- [curl](https://github.com/curl/curl) - - -Installation ------------- - -### Install manually - -- Add the following line in `~/.config/xplr/init.lua` - - ```lua - package.path = os.getenv("HOME") .. '/.config/xplr/plugins/?/src/init.lua' - ``` - -- Clone the plugin - - ```bash - mkdir -p ~/.config/xplr/plugins - - git clone https://github.com/sayanarijit/dragon.xplr ~/.config/xplr/plugins/dragon - ``` - -- Require the module in `~/.config/xplr/init.lua` - - ```lua - require("dragon").setup() - - -- Or - - require("dragon").setup{ - mode = "selection_ops", - key = "D", - drag_args = "", - drop_args = "", - keep_selection = false, - } - - -- Select files and type `:sD` to drag - -- Type `:sD` without selecting anything to drop - ``` diff --git a/xplr/plugins/dragon/src/init.lua b/xplr/plugins/dragon/src/init.lua deleted file mode 100644 index f0fdc9f..0000000 --- a/xplr/plugins/dragon/src/init.lua +++ /dev/null @@ -1,62 +0,0 @@ -local function setup(args) - local xplr = xplr - - if args == nil then - args = {} - end - - if args.mode == nil then - args.mode = "selection_ops" - end - - if args.key == nil then - args.key = "D" - end - - if args.keep_selection == nil then - args.keep_selection = false - end - - if args.drag_args == nil then - args.drag_args = "" - end - - if args.drop_args == nil then - args.drop_args = "" - end - - xplr.fn.custom.dragon_drag_n_drop = function(app) - local files = {} - local count = 0 - local cmd = nil - - for i, node in ipairs(app.selection) do - table.insert(files, node.absolute_path) - count = i - end - - if count == 0 then - cmd = "(dragon --target " .. args.drop_args .. " 2> /dev/null | xargs -rl curl -sLO) &\ntrue" - elseif count == 1 then - cmd = "dragon --and-exit " .. args.drag_args .. " '" .. files[1] .. "' > /dev/null 2>&1 &\ntrue" - else - cmd = "dragon " .. args.drag_args .. " '" .. table.concat(files, "' '") .. "' > /dev/null 2>&1 &\ntrue" - end - - os.execute(cmd) - - if not args.keep_selection then - return { "ClearSelection" } - end - end - - xplr.config.modes.builtin[args.mode].key_bindings.on_key[args.key] = { - help = "drag & drop", - messages = { - { CallLuaSilently = "custom.dragon_drag_n_drop" }, - "PopMode", - }, - } -end - -return { setup = setup } |