AutoYADM commit: 2025-02-12 12:05:05
This commit is contained in:
parent
02c7130b8d
commit
263cb2c1c0
6 changed files with 70 additions and 3 deletions
19
.config/yazi/plugins/open-with-cmd.yazi/LICENSE
Normal file
19
.config/yazi/plugins/open-with-cmd.yazi/LICENSE
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2024 Lauri Niskanen
|
||||
|
||||
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.
|
25
.config/yazi/plugins/open-with-cmd.yazi/README.md
Normal file
25
.config/yazi/plugins/open-with-cmd.yazi/README.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# open-with-cmd.yazi
|
||||
|
||||
This is a Yazi plugin for opening files with a prompted command.
|
||||
|
||||
## Installation
|
||||
|
||||
Install the plugin:
|
||||
|
||||
```
|
||||
ya pack -a Ape/open-with-cmd
|
||||
```
|
||||
|
||||
Create `~/.config/yazi/keymap.toml` and add:
|
||||
|
||||
```
|
||||
[[manager.prepend_keymap]]
|
||||
on = "o"
|
||||
run = "plugin open-with-cmd --args=block"
|
||||
desc = "Open with command in the terminal"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
on = "O"
|
||||
run = "plugin open-with-cmd"
|
||||
desc = "Open with command"
|
||||
```
|
20
.config/yazi/plugins/open-with-cmd.yazi/main.lua
Normal file
20
.config/yazi/plugins/open-with-cmd.yazi/main.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
entry = function(_, job)
|
||||
local block = job.args[1] and job.args[1] == "block"
|
||||
|
||||
local value, event = ya.input({
|
||||
title = block and "Open with (block):" or "Open with:",
|
||||
position = { "hovered", y = 1, w = 50 },
|
||||
})
|
||||
|
||||
if event == 1 then
|
||||
local s = ya.target_family() == "windows" and " %*" or ' "$@"'
|
||||
ya.manager_emit("shell", {
|
||||
value .. s,
|
||||
block = block,
|
||||
orphan = true,
|
||||
confirm = true,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue