Hello, new user here. I looked through docs everywhere and i still don’t understand how it works. there is a mention about “running some commands asynchronously while displaying their result in a buffer”, which from what i understand there should be a possibility to create a setup where you write (for example) c code and compile it in one buffer, and in the another terminal see all compiler output.
Now i understand that this result could be very simply done with 2 terminals, one with code editor and one for compiling code, but i think it would be really cool to do it without needing to switch terminal windows and have a ability to do it in one window, and use another terminal window just for displaying.
btw, im having fun using kakoune, as a new user
Yep. If your C project uses a Makefile (or if you have set the
makeprg option to the name of the build-tool you’re using) you can type
:make and the compiler’s warnings and errors will be collected into a new buffer as they occur. If you want to view the build log and the code at the same time, you’ll need to open another Kakoune client in the same session with the
If you’d like to write your own plugin involving FIFO buffers, here’s what you need to know:
A FIFO is a named pipe between two processes. Instead of writing a shell-script with an anonymous pipe like:
ls | head
…you can do the same thing with a named pipe:
ls > /tmp/my-fifo
head < /tmp/my-fifo
A FIFO is not like an ordinary file because a program can keep writing to a file until the disk is full, while a program that writes more than a tiny amount (usually 4KB or so) to a FIFO is paused until somebody comes along to read from the other end.
FIFO data is never stored on disk.
If you create a FIFO and have a program writing to it, you can make Kakoune read from it with:
:edit -fifo /path/to/your/fifo *some-custom-buffer-name*
/path/to/your/fifo is the filesystem path of the FIFO you’ve created, and
*some-custom-buffer-name* is the name of the buffer Kakoune will create to collect the FIFO’s output.
*s around the buffer name are not required, but most plugins do that to follow the convention of the
Any data that is written to the FIFO, Kakoune will read into the buffer.
If you add
-scroll to the
:edit command that opens the FIFO, Kakoune will automatically scroll the buffer to the bottom when new data arrives, at least until the user does some manual scroll operation.
Once the writer closes its file-handle, Kakoune will convert the buffer into an ordinary scratch buffer
If you want to dive deeper into fifo territory, with more elaborate usage scenario between Kakoune and external commands, I also recommend having a look at this previous excellent explanation of @Screwtapello about
command_fifo: Command_fifo explanation?
That took me 3 days to understand what fifo’s do. After that i made make.kak extension your explanation helped ty!