Get a scratch buffer when Neovim starts that you can use to easily execute small pieces of code in any of the supported languages with full autocompletion, language server (LSP) support and interactive evaluation through Conjure.
Heavily inspired by the Emacs Scratch buffer.
scratch-buffer.nvim.mp4
- Support multiple languages:
- lua (default)
- fennel
- python
- Customize the buffer heading to your liking 🎨
- Optional: Conjure if you want interactive evaluation recommended
Install with your plugin manager of choice. Example for lazy
{
"miguelcrespo/scratch-buffer.nvim",
event = 'VimEnter',
config = function()
require('scratch-buffer').setup()
end,
dependencies = {
-- Recommended if you want interactive evaluation
"Olical/conjure"
}
},
Scratch Buffer comes with the following defaults:
{
filetype = "lua", -- fennel, python
buffname = "*scratch*",
with_lsp = true, -- Use a temporal file to start the LSP server
heading = "...", -- A nice Neovim ASCII header, feel free to change it :D
with_neovim_version = true, -- Display the Neovim version bellow the heading
}
After installing the plugin, just open Neovim as you normally do and you will see the new scratch buffer 🚀
To evaluate a piece of code inside the buffer you can use the default Conjure mappings (it won't work if you have not mapped the localleader
):
<localleader>er
Evaluate the root form under the cursor<localleade>ee
Evaluate the current form under the cursor<localleader>eb
Evaluate the current buffer contents
- Startup ASCII art taken from ascii.nvim
- Conjure for being such an amazing plugin
- Emacs for the idea
- Fennel because I built this plugin just to learn it