Comments (5)
You should try patches/restorepreview/mainline.diff. It fixed the issue for me, at least.
from nnn.
Looks like it does nothing in my case.
from nnn.
Maybe related: #1809
from nnn.
I'm pretty sure restorepreview only applies to the internal editor, pressing e, enter handles it with your opener, nuke etc.
# Description: Adds preview pipe to enable closing and re-opening the preview pane when running an undetached editor.
I just copied the toggle_preview from preview_tui in a wrapper that kills the preview and uses tmux to reenable it
#!/usr/bin/env bash
TMPDIR=${TMPDIR:-/tmp} # location of temporary files
PLUG_KEY=$(echo "$NNN_PLUG" | sed 's/.*\(.\):preview-tui.*$/\1/')
NNN_PARENT=${NNN_FIFO#*.}
FIFOPID="$TMPDIR/nnn-preview-tui-fifopid.$NNN_PARENT"
#PREVIEWPID="$TMPDIR/nnn-preview-tui-previewpid.$NNN_PARENT"
#FIFO_UEBERZUG="$TMPDIR/nnn-preview-tui-ueberzug-fifo.$NNN_PARENT"
pkill() { command pkill "$@" >/dev/null 2>&1 ;}
pidkill() {
if [ -f "$1" ]; then
PID="$(cat "$1" 2>/dev/null)" || return 1
kill "$PID" >/dev/null 2>&1
RET=$?
wait "$PID" 2>/dev/null
return $RET
fi
return 1
}
run_cmd() {
if [ -n "$TMUX" ]; then
if pidkill "$FIFOPID"; then
"$@"
tmux send-keys "M-$PLUG_KEY"
else
"$@"
fi
else
"$@"
fi
return 1
}
then all you have to do to toggle it for any plugin is
source toggle_prev
run_cmd do stuff here
If you wanted it to toggle on file open you'd have to make a custom opener or edit nuke to do something similar, I just open vim in a new tmux window
from nnn.
Correct, the restorepreview patch hides and restores preview-tui when opening and closing an attached editor. I guess I didn't consider the case for forked programs since we don't know when it closes, or when it makes sense to restore preview-tui.
Despite that, I suppose closing preview-tui unconditionally when a file is opened can make sense as well. Not sure if it makes sense to change the restorepreview patch at this point, although I wouldn't mind it.
from nnn.
Related Issues (20)
- mv: unrecognized option '--cp' HOT 2
- Icons does not work when NNN is opened with -C option HOT 5
- preview-tui: mpv HOT 11
- Syntax error with prescribed split-pane script HOT 7
- tabs content colorization is not working (zsh+tmux) HOT 3
- preview-tui does not work with tmux 3.4 HOT 1
- Wrong position of previews in 4K monitor with fractional scaling of 1.5
- Files created with `n`, `f` have incorrect permissions HOT 5
- sort order.... whatever it means.. HOT 2
- preview-tui with wezterm: No FIFO available! ($NNN_FIFO='') HOT 2
- Respect keys regardless of kb language input HOT 4
- Visual Glitch, visual bug, the whole screen breaks, resize does something, redraw does not
- Sorting bug, different behavior for t and ^T HOT 2
- Misleading typo in the wiki HOT 1
- [plugin] file preview panel get stuck when use plugin preview-tui with tmux and bat HOT 1
- Keybind collision when using the colemak patch HOT 5
- malloc: error pointer being freed was not allocated HOT 9
- The first letter of the file is not correct after change dir HOT 1
- mess with shell colors HOT 8
- [bash] nnn can't return after executing command (] key) if invoked from a `bind -x` keybinding. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nnn.