buffers.asciidoc (2278B)
1 = Buffers 2 3 == Commands 4 5 To open buffers or navigate through the buffers list see 6 <<commands#files-and-buffers,`:doc commands files-and-buffers`>>. 7 8 == Scratch Buffers 9 10 Scratch buffers are useful for volatile data and quick prototyping. 11 They are not linked to files, so Kakoune does not warn about unsaved 12 changes at exit, and the `:write` command requires an explicit filename. 13 14 One particular scratch buffer, named `\*scratch*`, is automatically created 15 when there are no other buffers left in the current session, which is also 16 the case when Kakoune starts up without any files to open. 17 18 A scratch buffer can be created by passing the `-scratch` switch to the 19 `:edit` command. 20 21 == Debug Buffers 22 23 Debug buffers are used to gather diagnostics. They have a number of 24 restrictions compared to regular buffers: 25 26 - They are skipped when cycling over the buffers list. 27 - Their content is not considered for word completions with `word=all` 28 completers. 29 - Hooks are not always run (like the `BufCreate`/`BufClose` hooks). 30 - Display profiling is disabled. 31 32 A specific `\*debug*` buffer is used by Kakoune to write errors or 33 warnings. This is also where the ouput of the `:debug` and the `:echo 34 -debug` commands will land. 35 36 A debug buffer can be created by passing the `-debug` switch to the 37 `:edit` command. 38 39 == FIFO Buffers 40 41 The `:edit` command can take a `-fifo` switch: 42 43 --------------------------------------------- 44 :edit -fifo <filename> [-scroll] <buffername> 45 --------------------------------------------- 46 47 In this case, a buffer named `<buffername>` is created which reads 48 its content from the FIFO (also called "named pipe") `<filename>`. 49 When the FIFO is written to, the buffer is automatically updated. 50 51 If the `-scroll` switch is specified, the window displaying the buffer 52 will scroll so that the newest data is always visible. 53 54 This is very useful for running some commands asynchronously while 55 displaying their result in a buffer. See `rc/make.kak` and `rc/grep.kak` 56 for examples. 57 58 When the write end of the FIFO is closed, the buffer becomes an ordinary 59 <<buffers#scratch-buffers,scratch buffer>>. When the buffer is deleted, 60 Kakoune closes the read end of the FIFO. Any program writing to the FIFO 61 will receive `SIGPIPE`, which will terminate the program by default.