2017-11-10 19:50:54 +01:00
|
|
|
= Buffers
|
|
|
|
|
|
|
|
== Commands
|
|
|
|
|
2017-11-12 15:44:04 +01:00
|
|
|
To open buffers or navigate through the buffers list see
|
|
|
|
<<commands#files-and-buffers,`:doc commands files-and-buffers`>>.
|
2017-11-10 19:50:54 +01:00
|
|
|
|
|
|
|
== Scratch Buffers
|
|
|
|
|
|
|
|
Scratch buffers are useful for volatile data and quick prototyping.
|
2019-02-15 10:04:27 +01:00
|
|
|
They are not linked to files, so Kakoune does not warn about unsaved
|
|
|
|
changes at exit, and the `:write` command requires an explicit filename.
|
2017-11-10 19:50:54 +01:00
|
|
|
|
2022-05-17 19:39:06 +02:00
|
|
|
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 when Kakoune starts up without any files to open.
|
2017-11-10 19:50:54 +01:00
|
|
|
|
2017-11-12 15:44:04 +01:00
|
|
|
A scratch buffer can be created by passing the `-scratch` switch to the
|
|
|
|
`:edit` command.
|
2017-11-10 19:50:54 +01:00
|
|
|
|
|
|
|
== Debug Buffers
|
|
|
|
|
2019-02-17 01:09:58 +01:00
|
|
|
Debug buffers are used to gather diagnostics. They have a number of
|
|
|
|
restrictions compared to regular buffers:
|
|
|
|
|
|
|
|
- They are skipped when cycling over the buffers list.
|
|
|
|
- Their content is not considered for word completions with `word=all`
|
2022-05-17 19:39:06 +02:00
|
|
|
completers.
|
|
|
|
- Hooks are not always run (like the `BufCreate`/`BufClose` hooks).
|
|
|
|
- Display profiling is disabled.
|
2017-11-10 19:50:54 +01:00
|
|
|
|
2017-11-12 15:44:04 +01:00
|
|
|
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.
|
2017-11-10 19:50:54 +01:00
|
|
|
|
2018-05-11 12:52:19 +02:00
|
|
|
A debug buffer can be created by passing the `-debug` switch to the
|
2017-11-12 15:44:04 +01:00
|
|
|
`:edit` command.
|
2017-11-10 19:50:54 +01:00
|
|
|
|
|
|
|
== FIFO Buffers
|
|
|
|
|
2018-04-03 10:17:19 +02:00
|
|
|
The `:edit` command can take a `-fifo` switch:
|
2017-11-10 19:50:54 +01:00
|
|
|
|
|
|
|
---------------------------------------------
|
|
|
|
:edit -fifo <filename> [-scroll] <buffername>
|
|
|
|
---------------------------------------------
|
|
|
|
|
2017-11-12 15:44:04 +01:00
|
|
|
In this case, a buffer named `<buffername>` is created which reads
|
2022-05-17 19:39:06 +02:00
|
|
|
its content from the FIFO (also called "named pipe") `<filename>`.
|
|
|
|
When the FIFO is written to, the buffer is automatically updated.
|
2017-11-10 19:50:54 +01:00
|
|
|
|
|
|
|
If the `-scroll` switch is specified, the window displaying the buffer
|
|
|
|
will scroll so that the newest data is always visible.
|
|
|
|
|
2017-11-12 15:44:04 +01:00
|
|
|
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.
|
2017-11-10 19:50:54 +01:00
|
|
|
|
2022-05-17 19:39:06 +02:00
|
|
|
When the write end of the FIFO is closed, the buffer becomes an ordinary
|
2019-02-15 10:04:27 +01:00
|
|
|
<<buffers#scratch-buffers,scratch buffer>>. When the buffer is deleted,
|
2022-05-17 19:39:06 +02:00
|
|
|
Kakoune closes the read end of the FIFO. Any program writing to the FIFO
|
|
|
|
will receive `SIGPIPE`, which will terminate the program by default.
|