Write To A Buffer In Neovim Via The API

June - 2021

TODO: Fix the formatting of this post that got busted during the move to nextjs

    vim.api.nvim_buf_set_lines(0, 2, 3, false, lines)
via: https://neovim.io/doc/user/api.html

nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing}, {replacement})
                Sets (replaces) a line-range in the buffer.

                Indexing is zero-based, end-exclusive. Negative indices are
                interpreted as length+1+index: -1 refers to the index past the
                end. So to change or delete the last element use start=-2 and

                To insert lines at a given index, set `start` and `end` to the
                same index. To delete a range of lines, set `replacement` to
                an empty array.

                Out-of-bounds indices are clamped to the nearest valid value,
                unless `strict_indexing` is set.

                    not allowed when |textlock| is active

                    {buffer}           Buffer handle, or 0 for current buffer
                    {start}            First line index
                    {end}              Last line index (exclusive)
                    {strict_indexing}  Whether out-of-bounds should be an
                    {replacement}      Array of lines to use as replacement