Git Product home page Git Product logo

Comments (5)

Oxore avatar Oxore commented on May 24, 2024

You should try patches/restorepreview/mainline.diff. It fixed the issue for me, at least.

from nnn.

AinTEAsports avatar AinTEAsports commented on May 24, 2024

Looks like it does nothing in my case.

from nnn.

N-R-K avatar N-R-K commented on May 24, 2024

Maybe related: #1809

from nnn.

CityofSirtel avatar CityofSirtel commented on May 24, 2024

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.

luukvbaal avatar luukvbaal commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.