Usually when I need a scratch buffer, it's to put information that I don't intend to execute.
I used to use Emacs for notetaking but I'm using neovim now.
Right now, if I try to open a scratch buffer of type markdown, it gives me a cryptic error message.
Seems like you've sort of hardcoded that functionality. I'm not sure how you would like it to be instead though.
|
function buffer.eval() |
|
local lines = vim.api.nvim_buf_get_lines(buffer.bufnr, 0, -1, true) |
|
local filetype = vim.api.nvim_buf_get_option(buffer.bufnr, "filetype") |
|
require("scratch.eval")[filetype](lines) |
|
end |
Can you add filetypes for markdown, org, asciidoc, and plaintext? That should cover the major ones.
Maybe also add json, yaml, xml, and other information types that also don't evaluate.
Steps:
- Run ex command
:Telescope scratch md
Expected:
Open the buffer without issue.
Actual:
A cryptic error message is shown to me.
Workaround:
Just use :ScratchNew md
Usually when I need a scratch buffer, it's to put information that I don't intend to execute.
I used to use Emacs for notetaking but I'm using neovim now.
Right now, if I try to open a scratch buffer of type markdown, it gives me a cryptic error message.
Seems like you've sort of hardcoded that functionality. I'm not sure how you would like it to be instead though.
scratch.nvim/lua/scratch/buffer.lua
Lines 10 to 14 in 95a533a
Can you add filetypes for markdown, org, asciidoc, and plaintext? That should cover the major ones.
Maybe also add json, yaml, xml, and other information types that also don't evaluate.
Steps:
:Telescope scratch mdExpected:
Open the buffer without issue.
Actual:
A cryptic error message is shown to me.
Workaround:
Just use
:ScratchNew md