Unhealthy Minimalism: ide
When programming in common lisp, the standard development environment is SLIME . Perhaps the only major drawback of SLIME is emacs, especially for vi fans. Of course there are crafts for vim, but vim itself is also not the top of minimalism.
Under the cut, the minimum ide for interpreted environmentswithout blackjack and whores .
What is needed:
The main problem with working with a clean interpreter is that you must somehow save the code (provided that it does not do this for you). It is solved quite simply:
The first script starts / restores a tmux session with an ide window and two panels. In the left console, in the right - the interpreter from the $ interpreter variable. In the console, launch your favorite text editor. On BSD vi systems, the default clone is nvi. It fits, we’ll launch it. The second script is a filter. The code for the interpreter is supplied to the standard input, the output is written to the interpreter window and to the standard output. The standard output is necessary for vi, without it all your precious code will bepermanently erased from the buffer.

We put the scripts in $ PATH, run ide. In the vi text editor, we type in arbitrary code. When it looks high enough, we recruit a team


I run Python for the first time, so the code is not too tricky, but it works.

In addition, mysql, irb, etc. should work.
First, let's modify the idepipe script.
two three birds with one stone.
disclaimer:


Favorite text editor tr3 geeks - ed. Who would have thought that ed is suitable for this article, but it is suitable. It is both minimal and able to transfer text to pipe. What else is needed for happiness? We execute 12,13w! Idepipe and the result appears in all panels.

Under the cut, the minimum ide for interpreted environments
What is needed:
- Quick introduction to tmux
- Tmux itself
- Interpreter of your favorite YP
- What is bad screen?
- The fact that he is GNU and in addition can not divide the window vertically.
Concept
The main problem with working with a clean interpreter is that you must somehow save the code (provided that it does not do this for you). It is solved quite simply:
- open a terminal with an interpreter
- open the text editor
- we type the code in the editor
- copy to terminal
- look at the result, rejoice / upset
Implementation
#!/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
The first script starts / restores a tmux session with an ide window and two panels. In the left console, in the right - the interpreter from the $ interpreter variable. In the console, launch your favorite text editor. On BSD vi systems, the default clone is nvi. It fits, we’ll launch it. The second script is a filter. The code for the interpreter is supplied to the standard input, the output is written to the interpreter window and to the standard output. The standard output is necessary for vi, without it all your precious code will be

Examples
Common lisp
We put the scripts in $ PATH, run ide. In the vi text editor, we type in arbitrary code. When it looks high enough, we recruit a team
:%!idepipe
. For those who are not familiar with vi, you should clarify: the colon starts a command, %
means the whole file, idepipe
- the name of the filter. In human language, it will sound like this: give the entire buffer to the input of the command idepipe
and overwrite the entire buffer with what we get at the output. It is clear that we do not want to change the code, so it is idepipe
used internally tee
. If everything turned out as planned, then the interpreter window will show 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 must press enter yourself in the interpreter window.
Except the sign
%
You can use many more address designations. Thus, only part of the code (which was changed) can be sent to the interpreter, without having to digest the entire file again.Moreover, there is no need to type these commands each time, it is enough to map them 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 keys
Both commands also work from the editing mode
- And it will work with other interpreters.
- Should work with any REPL environment (Read Eval Print Loop). Let's check a couple more.
Python

I run Python for the first time, so the code is not too tricky, but it works.
Shell

In addition, mysql, irb, etc. should work.
- It looks good, but still I want cards and girls.
- Not a problem. Add mega feature.
Mega feature
First, let's modify the idepipe script.
#!/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 whole new lines. What kind of minimalism is there? What gives 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 common lisp have incompatibilities. Checking the code in three interpreters at once, we kill disclaimer:
idepipe
written without any protection from the fool, therefore, to avoid the strange behavior of tmux, you need to manually create two additional panels on the ide window and run interpreters in them. The numbers of the interpreter panels (as can be seen from the script) should be 1, 2 and 3.
So, the moment X. We execute the familiar command
(!)idepipe
over one of the functions and observe the execution of the code in three different interpreters. This is WAY cool! One feature and restrict, minimalism requires.
A portion of unhealthy minimalism
Favorite text editor tr3 geeks - ed. Who would have thought that ed is suitable for this article, but it is suitable. It is both minimal and able to transfer text to pipe. What else is needed for happiness? We execute 12,13w! Idepipe and the result appears in all panels.
