Skip to content

Latest commit

 

History

History
69 lines (50 loc) · 2.19 KB

README.md

File metadata and controls

69 lines (50 loc) · 2.19 KB

📋 Scratch Buffer

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

Features

  • Support multiple languages:
    • lua (default)
    • fennel
    • python
  • Customize the buffer heading to your liking 🎨

Requirements

  • Optional: Conjure if you want interactive evaluation recommended

Installation

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"
    }
  },

Configuration

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
}

Usage

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

Conjure mappings

Credits

  • 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