From ea85eed50e4f19a8de2fca93ea9ebbd1b1391c3f Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 12 Mar 2023 20:03:26 +0300 Subject: [PATCH] Quick file display --- cmd/catfile | 6 ++++++ cmd/newwin | 2 +- cmd/start | 2 +- cmd/tmux.conf | 1 + doc/arch.texi | 2 ++ doc/usage.texi | 3 +++ 6 files changed, 14 insertions(+), 2 deletions(-) create mode 100755 cmd/catfile diff --git a/cmd/catfile b/cmd/catfile new file mode 100755 index 0000000..19c89c8 --- /dev/null +++ b/cmd/catfile @@ -0,0 +1,6 @@ +#!/bin/sh -e + +sel=`find . -not -type d | fzf` +[ -n "$sel" ] +if [ -p $sel ]; then fmt < $sel ; else cat $sel ; fi +read foo diff --git a/cmd/newwin b/cmd/newwin index 01af462..47c5529 100755 --- a/cmd/newwin +++ b/cmd/newwin @@ -1,4 +1,4 @@ -#!/bin/sh -ex +#!/bin/sh -e cmd="$(dirname "$(realpath -- "$0")")" what="$1" diff --git a/cmd/start b/cmd/start index 173aef1..b5e33f9 100755 --- a/cmd/start +++ b/cmd/start @@ -7,7 +7,7 @@ $TMUX has-session -t mmc 2>/dev/null && exit mkdir -p users rm -f debug users/status mkfifo debug users/status -[ -s tmux.conf ] || sed "s#NEWWIN#$cmd/newwin#" < "$cmd"/tmux.conf > tmux.conf +[ -s tmux.conf ] || sed "s#NEWWIN#$cmd/newwin# ; s#CATFILE#$cmd/catfile#" < "$cmd"/tmux.conf > tmux.conf $TMUX -f tmux.conf new-session -d -n ROOT -s mmc "cat debug | tai64n | tai64nlocal" $TMUX split-window -h 'while : ; do cat users/status | spc -e grn,"^O:.*" -e cya,"^A:.*" ; sleep 5 ; clear ; done' $TMUX split-window -v "$cmd/mmc/mmc -debug debug -user-status users/status -newwin $cmd/newwin -notify $cmd/notify | tai64n | tai64nlocal" diff --git a/cmd/tmux.conf b/cmd/tmux.conf index 89cb091..fc5face 100644 --- a/cmd/tmux.conf +++ b/cmd/tmux.conf @@ -20,6 +20,7 @@ set-window-option -g window-status-last-style "bg=cyan" bind-key Q kill-session bind-key c new-window NEWWIN bind-key d kill-window +bind-key S new-window CATFILE bind-key -n C-PgUp previous-window bind-key -n C-PgDn next-window diff --git a/doc/arch.texi b/doc/arch.texi index efc624b..15f5cd4 100644 --- a/doc/arch.texi +++ b/doc/arch.texi @@ -12,6 +12,8 @@ cmd/start R tail -f debug | tai64n R for { cat users/status ; sleep 5 } R fzf **(/) | cmd/newwin + R cmd/catfile + R fzf **(.) | fmt R cmd/mmc | tai64n F users/status F users/.../{id,email,name,|in,out.rec,|status,last} diff --git a/doc/usage.texi b/doc/usage.texi index 9b26e01..870fae1 100644 --- a/doc/usage.texi +++ b/doc/usage.texi @@ -39,6 +39,9 @@ prefix is prepended. If message contains appended files, then @item By pressing @code{Prefix+d} you will close the window. +@item By pressing @code{Prefix+S}, list of available files is shown +inside @command{fzf}, just to quickly display it. + @item Status change and typing notifications are shown as a short-lived message at the bottom of the screen. -- 2.44.0