Merged
Conversation
0aa064f to
3c74d89
Compare
Owner
Author
d6851d1 to
a1358c7
Compare
Adds basic support for nnn-like FIFO based previewer.
The FIFO can be manager with the following messages:
- StartFifo: /path/to/fifo
- StopFifo
- ToggleFifo: /path/to/fifo
A basic nnn plugin wrapper example:
```lua
-- Usage Example:
--
-- require("nnn_preview_wrapper").setup{
-- plugin_path = os.getenv("HOME") .. "/.config/nnn/plugins/preview-tabbed",
-- fifo_path = "/tmp/xplr.fifo",
-- mode = "action",
-- key = "p",
-- }
--
-- Press `:p` to toggle preview mode.
local function setup(o)
if o.fifo_path == nil then
o.fifo_path = os.getenv("NNN_FIFO")
end
if o.mode == nil then
o.mode = "action"
end
if o.key == nil then
o.key = "p"
end
local enabled = false
local message = nil
os.execute('[ ! -p "' .. o.fifo_path ..'" ] && mkfifo "' .. o.fifo_path .. '"')
xplr.fn.custom.preview_toggle = function(app)
if enabled then
enabled = false
message = "StopFifo"
else
os.execute('NNN_FIFO="' .. o.fifo_path .. '" "'.. o.plugin_path .. '" & ')
enabled = true
message = { StartFifo = o.fifo_path }
end
return { message }
end
xplr.config.modes.builtin[o.mode].key_bindings.on_key[o.key] = {
help = "search with preview",
messages = {
"PopMode",
{ CallLuaSilently = "custom.preview_toggle" },
},
}
end
return { setup = setup }
```
Press `:p` to toggle preview mode.
Closes: #205
f4ae9e9 to
63ded74
Compare
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds basic support for FIFO based previewer.
The FIFO can be managed with the following messages:
A basic nnn plugin wrapper example:
Press
:pto toggle preview mode.Closes: #205