Giter VIP home page Giter VIP logo

scratch.nvim's Introduction

Neovim Scratch Buffer Plugin

This plugin provides a simple way to work with scratch buffers in Neovim. It allows you to quickly open a scratch buffer in your current window or in a new split window. The plugin also offers the flexibility to configure the default name of the scratch buffer.

This plugin is based on vim-scratch, but written in lua for Neovim.

Features

  • Open a scratch buffer in the current window.
  • Open a scratch buffer in a new split window.
  • Automatically switch to an existing scratch buffer if it's already open.
  • Configure the default name for the scratch buffer.
  • The scratch buffer acts as a temporary workspace and is not backed by a file.

Installation

To install this plugin, you can use your favorite Neovim package manager. For example:

lazy (recommended)

{
  "https://git.sr.ht/~swaits/scratch.nvim",
  lazy = true,
  keys = {
    { "<leader>bs", "<cmd>Scratch<cr>", desc = "Scratch Buffer", mode = "n" },
    { "<leader>bS", "<cmd>ScratchSplit<cr>", desc = "Scratch Buffer (split)", mode = "n" },
  },
  cmd = {
    "Scratch",
    "ScratchSplit",
  },
  opts = {},
}
{
  "https://git.sr.ht/~swaits/scratch.nvim",
  config = function()
    require("scratch").setup()
  end
}
Plug 'https://git.sr.ht/~swaits/scratch.nvim'
lua require("scratch").setup()

Configuring

The default configuration options are listed below:

opts = {
  -- The name of the scratch buffer
  buffer_name = "_SCRATCH_",
}

Usage

Commands

The plugin provides two commands:

  • :Scratch — Opens or switches to the scratch buffer in the current window.
  • :ScratchSplit — Opens or switches to the scratch buffer in a new split window.

Lua Functions

You can also use the plugin's Lua functions directly:

  • require('scratch').open() — Equivalent to :Scratch.
  • require('scratch').split() — Equivalent to :ScratchSplit.

License

MIT License

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

scratch.nvim's People

Contributors

swaits avatar

Stargazers

Hodossy, Szabolcs avatar ik9999 avatar tkancf avatar Brett Feltmate  avatar Toby Slater avatar Mark avatar  avatar Kyle Chamberlain avatar Rob Owens avatar Jonny Gamba avatar Andis Spriņķis avatar  avatar  avatar Bartek Łuka avatar Oğulcan Girginç avatar Vaso Putica avatar kohane27 avatar Yuta Katayama avatar

Watchers

 avatar

Forkers

montajesaj1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.