- What's wrong with the screen?
“By the fact that it is GNU and besides it cannot divide the window vertically.”
#!/bin/sh # ide interpreter="sbcl" windowname="ide" ide_running=`tmux list-windows | grep "$windowname"` if [ "$TMUX" ]; then if [ "$ide_running" ]; then tmux select-window -t "$windowname" else tmux rename-window "$windowname" \; split-window -dhp 40 "$interpreter" fi else if [ "$ide_running" ]; then tmux attach-session \; select-window -t "$windowname" elif tmux has-session >/dev/null 2>&1; then tmux attach-session \; new-window -n "$windowname" \; split-window -dhp 40 "$interpreter" else tmux new-session -n "$windowname" \; split-window -dhp 40 "$interpreter" fi fi
#!/bin/sh # idepipe tmpfile=`mktemp /tmp/tmuxbuffer.XXXXXX` tee $tmpfile tmux load-buffer $tmpfile >/dev/null 2>&1 tmux paste-buffer -dt 1 >/dev/null 2>&1 rm -f $tmpfile
:%!idepipe
. For those who are not familiar with vi, it should be clarified: the colon starts the command, %
means the entire file, idepipe
name of the filter. In human language, it will sound like this: output the entire buffer to the input of the idepipe
and overwrite the entire buffer with what we get at the output. It's clear that we don’t want to change the code, so tee
used inside the idepipe
. If everything worked out as planned, then the interpreter window will contain all the desired code, as well as the result of its execution. To execute all the code, the last line in the file must be empty, otherwise you need to press enter in the interpreter window yourself.%
sign, you can use many more address symbols. Thus, only part of the code (which has been changed) can be sent to the interpreter, without the need to re-digest the entire file.Moreover, there is no need to type these commands every time, it is enough to put them down once.:10,30!idepipe
- interpret everything between 10 and 30 lines, inclusive(!)idepipe
(without a colon) - interpret one lisp block
:map {ctrl-v}{F3} {ctrl-v}{esc}(!)idepipe{ctrl-v}{enter}
- we interpret the code block by pressing F3:map {ctrl-v}{F5} {ctrl-v}{esc}:%!idepipe{ctrl-v}{enter}
- we interpret the entire file by pressing F5
In place of curly brackets, you must press the corresponding key
Both commands operate including from edit mode.
- And will work with other interpreters.
- Should work with any REPL environments (Read Eval Print Loop). Check out a couple more.
- It looks good, but I still want cards and girls.
- No problem. Add a mega feature.
#!/bin/sh # idepipe tmpfile=`mktemp /tmp/tmuxbuffer.XXXXXX` tee $tmpfile tmux load-buffer $tmpfile >/dev/null 2>&1 tmux paste-buffer -t 1 >/dev/null 2>&1 tmux paste-buffer -t 2 >/dev/null 2>&1 tmux paste-buffer -dt 3 >/dev/null 2>&1 rm -f $tmpfile
Wow, two new lines. What kind of minimalism is there? What makes this change? Everything is very simple: instead of one interpreter, we can send the code to three at once. To the unspoken question “why?” The answer is very simple: different implementations of the common lisp language have incompatibilities. Checking the code in three interpreters at once - we kill idepipe
written without any kind of fool protection, so to avoid the strange behavior of tmux, you must manually create two additional panels on the ide window and run interpreters in them. The number of interpreter panels (as can be seen from the script) should be 1, 2 and 3.(!)idepipe
familiar command (!)idepipe
on one of the functions and observe the execution of the code in three different interpreters. This is WAY cool! We will limit ourselves to one feature, minimalism demands.Source: https://habr.com/ru/post/123163/
All Articles