Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1vim.treesitter.start()
2
3vim.keymap.set('n', 'gO', function()
4 require('vim.treesitter._headings').show_toc()
5end, { buffer = 0, silent = true, desc = 'Show an Outline of the current buffer' })
6
7vim.keymap.set('n', ']]', function()
8 require('vim.treesitter._headings').jump({ count = 1 })
9end, { buffer = 0, silent = false, desc = 'Jump to next section' })
10vim.keymap.set('n', '[[', function()
11 require('vim.treesitter._headings').jump({ count = -1 })
12end, { buffer = 0, silent = false, desc = 'Jump to previous section' })
13
14vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
15 .. '\n sil! exe "nunmap <buffer> gO"'
16 .. '\n sil! exe "nunmap <buffer> ]]" | sil! exe "nunmap <buffer> [["'
17

After

1vim.treesitter.start()
2
3vim.keymap.set('n', 'gO', function()
4 require('vim.treesitter._headings').show_toc()
5end, { buf = 0, silent = true, desc = 'Show an Outline of the current buffer' })
6
7vim.keymap.set('n', ']]', function()
8 require('vim.treesitter._headings').jump({ count = 1 })
9end, { buf = 0, silent = false, desc = 'Jump to next section' })
10vim.keymap.set('n', '[[', function()
11 require('vim.treesitter._headings').jump({ count = -1 })
12end, { buf = 0, silent = false, desc = 'Jump to previous section' })
13
14vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
15 .. '\n sil! exe "nunmap <buffer> gO"'
16 .. '\n sil! exe "nunmap <buffer> ]]" | sil! exe "nunmap <buffer> [["'
17

Before

chunk
function_call
dot_index_expression
dot_index_expression
identifier "vim"
. "."
identifier "treesitter"
. "."
identifier "start"
arguments
( "("
) ")"
function_call
dot_index_expression
dot_index_expression
identifier "vim"
. "."
identifier "keymap"
. "."
identifier "set"
arguments
( "("
string
' "'"
string_content "n"
' "'"
, ","
string
' "'"
string_content "gO"
' "'"
, ","
function_definition (+23 nodes collapsed)
, ","
table_constructor
{ "{"
field
identifier "buffer"
= "="
number "0"
, ","
field
identifier "silent"
= "="
true "true"
, ","
field
identifier "desc"
= "="
string
' "'"
string_content "Show an Outline of the current buffer"
' "'"
} "}"
) ")"
function_call
dot_index_expression
dot_index_expression
identifier "vim"
. "."
identifier "keymap"
. "."
identifier "set"
arguments
( "("
string
' "'"
string_content "n"
' "'"
, ","
string
' "'"
string_content "]]"
' "'"
, ","
function_definition (+30 nodes collapsed)
, ","
table_constructor
{ "{"
field
identifier "buffer"
= "="
number "0"
, ","
field
identifier "silent"
= "="
false "false"
, ","
field
identifier "desc"
= "="
string
' "'"
string_content "Jump to next section"
' "'"
} "}"
) ")"
function_call
dot_index_expression
dot_index_expression
identifier "vim"
. "."
identifier "keymap"
. "."
identifier "set"
arguments
( "("
string
' "'"
string_content "n"
' "'"
, ","
string
' "'"
string_content "[["
' "'"
, ","
function_definition (+32 nodes collapsed)
, ","
table_constructor
{ "{"
field
identifier "buffer"
= "="
number "0"
, ","
field
identifier "silent"
= "="
false "false"
, ","
field
identifier "desc"
= "="
string
' "'"
string_content "Jump to previous section"
' "'"
} "}"
) ")"
assignment_statement (+40 nodes collapsed)

After

chunk
function_call
dot_index_expression
dot_index_expression
identifier "vim"
. "."
identifier "treesitter"
. "."
identifier "start"
arguments
( "("
) ")"
function_call
dot_index_expression
dot_index_expression
identifier "vim"
. "."
identifier "keymap"
. "."
identifier "set"
arguments
( "("
string
' "'"
string_content "n"
' "'"
, ","
string
' "'"
string_content "gO"
' "'"
, ","
function_definition (+23 nodes collapsed)
, ","
table_constructor
{ "{"
field
identifier "buf"
= "="
number "0"
, ","
field
identifier "silent"
= "="
true "true"
, ","
field
identifier "desc"
= "="
string
' "'"
string_content "Show an Outline of the current buffer"
' "'"
} "}"
) ")"
function_call
dot_index_expression
dot_index_expression
identifier "vim"
. "."
identifier "keymap"
. "."
identifier "set"
arguments
( "("
string
' "'"
string_content "n"
' "'"
, ","
string
' "'"
string_content "]]"
' "'"
, ","
function_definition (+30 nodes collapsed)
, ","
table_constructor
{ "{"
field
identifier "buf"
= "="
number "0"
, ","
field
identifier "silent"
= "="
false "false"
, ","
field
identifier "desc"
= "="
string
' "'"
string_content "Jump to next section"
' "'"
} "}"
) ")"
function_call
dot_index_expression
dot_index_expression
identifier "vim"
. "."
identifier "keymap"
. "."
identifier "set"
arguments
( "("
string
' "'"
string_content "n"
' "'"
, ","
string
' "'"
string_content "[["
' "'"
, ","
function_definition (+32 nodes collapsed)
, ","
table_constructor
{ "{"
field
identifier "buf"
= "="
number "0"
, ","
field
identifier "silent"
= "="
false "false"
, ","
field
identifier "desc"
= "="
string
' "'"
string_content "Jump to previous section"
' "'"
} "}"
) ")"
assignment_statement (+40 nodes collapsed)