liverepl

Evaluer ses scripts en temps réel (dangereux ⚠️) - retour accueil

git clone git://bebou.netlib.re/liverepl
Log | Files | Refs | README |

commit 0dbfaefa860aec8540eb76ccdd80a344969bc29d
parent 9db913c4b98ed5e0b89918146e2e18830a23ec42
Auterice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Wed,  8 May 2024 12:52:20 +0200

Version avec tmux

Diffstat:
Mliverepl | 20++++++++++++++------
Ds | 6------
Atmuxliverepl | 16++++++++++++++++
3 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/liverepl b/liverepl @@ -1,10 +1,18 @@ #! /bin/sh -touch s -chmod +x s +[ -e "$2" ] && { echo "fichier $2 existe déjà"; exit 1; } +script=${1:-$(mktemp)} +data=${2:-$(mktemp)} +touch "$script" +chmod +x "$script" vim -c "set aw"\ - -c "autocmd TextChanged * silent! !./s > A 2>&1"\ - -c "autocmd TextChangedI * silent! !./s > A 2>&1"\ - -c "vnew A"\ + -c "autocmd TextChanged * silent! !$(pwd)/$script > $data 2>&1"\ + -c "autocmd TextChangedI * silent! !$(pwd)/$script > $data 2>&1"\ + -c "vnew $data"\ -c "set ar"\ - -c "wincmd h" s + -c "wincmd h"\ + -c "autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() !~ '\v(c|r.?|!|t)' && getcmdwintype() == '' | checktime | endif"\ + -c "doautocmd TextChanged"\ + "$script" +echo "script : $script" +echo "données : $data" diff --git a/s b/s @@ -1,6 +0,0 @@ -#! /bin/sh - -cat ~/git/emoji/emoji-test.txt | - grep -Ev '^(#.*)?$' | - sed -E 's/^.*# ([^ ]+) [^ ]+ (.*)$/\1 \2/' - diff --git a/tmuxliverepl b/tmuxliverepl @@ -0,0 +1,16 @@ +#! /bin/sh + +[ -e "$2" ] && { echo "fichier $2 existe déjà"; exit 1; } +script=${1:-$(mktemp)} +data=${2:-$(mktemp)} +touch "$script" +chmod +x "$script" +tmux new \ +vim -c "set aw"\ + -c "autocmd TextChanged * silent! !$(pwd)/$script > $data 2>&1"\ + -c "autocmd TextChangedI * silent! !$(pwd)/$script > $data 2>&1"\ + -c "doautocmd TextChanged"\ + "$script"\ +\; split-window -h "watch -t -n 0.1 less $data" \; select-pane -L +echo "script : $script" +echo "données : $data"