home/doc/pages/buffers.asciidoc

50 lines
1.8 KiB
Plaintext
Raw Normal View History

= Buffers
== Commands
To open buffers or navigate through the buffers list
see <<commands#files-and-buffers,`:doc commands files-and-buffers`>>.
== Scratch Buffers
Scratch buffers are useful for volatile data and quick prototyping.
They are not linked to files.
One particular scratch buffer, named *\*scratch*\*, is automatically created
when there are no other buffers left in the current session. (which is also
the case at Kakoune's startup when no files to open have been provided)
You can create you own by using the `-scratch` parameter of the `:edit` command.
== Debug Buffers
Debug buffers are used to gather diagnostics. They are not accessible while cycling
over the buffers list.
A specific *\*debug*\* buffer is used by Kakoune to write errors or warnings.
This is also where the ouput of the `:debug` and the `:echo -debug` commands will land.
You can create you own by using the `-debug` parameter of the `:edit` command.
== FIFO Buffers
The `:edit` command can take a `-fifo` parameter:
---------------------------------------------
:edit -fifo <filename> [-scroll] <buffername>
---------------------------------------------
In this case, a buffer named `<buffername>` is created which reads its content
from the fifo `<filename>`. When the fifo is written to, the buffer is
automatically updated.
If the `-scroll` switch is specified, the window displaying the buffer
will scroll so that the newest data is always visible.
This is very useful for running some commands asynchronously while displaying
their result in a buffer. See `rc/make.kak` and `rc/grep.kak` for examples.
When the buffer is deleted, the fifo will be closed, so any program writing
to it will receive `SIGPIPE`. This is useful as it permits to stop the writing
program when the buffer is deleted.