# Buffers

**URL:** <https://discuss.kakoune.com/t/buffers/536>\
**Category:** Manual++\
**Created:** [May 8, 2019, 2:12am UTC](https://discuss.kakoune.com/t/buffers/536 "2019-05-08T02:12:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertmeta](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/robertmeta/32/833_2.png) [@robertmeta](https://discuss.kakoune.com/u/robertmeta)\
**Post date:** [May 8, 2019, 2:12am UTC](https://discuss.kakoune.com/t/buffers/536/1 "2019-05-08T02:12:57Z")

</div>

# Commands

To open buffers or navigate through the buffers list see  
[`:doc commands files-and-buffers`](https://discuss.kakoune.com/t/commands/538#files-and-buffers).

# Scratch Buffers

Scratch buffers are useful for volatile data and quick prototyping. They  
are not linked to files, so Kakoune does not warn about unsaved changes  
at exit, and the `:write` command requires an explicit filename.

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)

A scratch buffer can be created by passing the `-scratch` switch to the  
`:edit` command.

# Debug Buffers

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`  
completers

- Hooks are not always run (like the `BufCreate`/`BufClose` hooks)

- Display profiling is disabled

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.

A debug buffer can be created by passing the `-debug` switch to the  
`:edit` command.

# FIFO Buffers

The `:edit` command can take a `-fifo` switch:

```
:edit -fifo <filename> [-scroll] <buffername>

```

In this case, a buffer named `<buffername>` is created which reads its  
content from the fifo (also called “named pipe”) `<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 write end of the fifo is closed, the buffer becomes an ordinary  
[scratch buffer](https://discuss.kakoune.com/t/buffers/536#scratch-buffers). When the buffer is deleted,  
Kakoune closes the read end of the fifo, 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.
