Skip to content

carlosgrillet/demo-paste.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

demo-paste.nvim

A simple Neovim plugin that lets you paste text line-by-line or paragraph-by-paragraph. Perfect for live coding demos, tutorials, and presentations.

Why use it?

When you're doing a live demo or teaching, pasting everything at once can be confusing. This plugin lets you paste one line at a time, so you can explain as you go.

Installation

Using lazy.nvim

{
  'carlosgrillet/demo-paste.nvim',
  config = function()
    require('demo-paste').setup()
  end
}

Using packer.nvim

use {
  "carlosgrillet/demo-paste.nvim",
  config = function()
    require('demo-paste').setup()
  end
}

Using vim-plug

Plug 'carlosgrillet/demo-paste.nvim'

Quick Start

  1. Setup the plugin (with default settings):
require('demo-paste').setup()
  1. Copy some text to your clipboard

  2. In Neovim, position your cursor where you want the text to go

  3. Press <leader>s to start the demo paste session

  4. Press <leader>c each time you want to paste the next line

How it works

  1. Load - The plugin reads content from a source (clipboard, file, or buffer)
  2. Start - You mark where you want to paste
  3. Paste step-by-step - Each time you press the key, one line gets pasted
  4. Done - When all lines are pasted, you get a notification

What you can paste from

  • System clipboard (default) - Copy text normally, then paste it one line at a time
  • A file - Load from any text file on your computer
  • Current buffer - Paste lines from another open buffer

Configuration

Here's what you can change:

require('demo-paste').setup({
  -- Enter insert mode after all lines are pasted
  enter_insert = false,

  -- Where to get text from: "register", "filepath", or "current_buffer"
  paste_from = "register",

  -- Which register to use (+ = system clipboard)
  register = "+",

  -- File path (if using filepath mode)
  filepath = nil,

  -- How to split content: "line" or "paragraph"
  delimiter = "line",

  -- Show messages during pasting
  notifications = true,

  -- Your keyboard shortcuts
  keymaps = {
    start = "<leader>s",  -- Start pasting
    next = "<leader>c"    -- Paste next line
  }
})

Examples

Example 1: Paste from clipboard (default)

Just install and use it. Copy text, position cursor, press <leader>s then <leader>c repeatedly.

Example 2: Paste from a file

require('demo-paste').setup({
  paste_from = "filepath",
  filepath = "~/my-code.lua"
})

Then use <leader>s to start from that file.

Example 3: Custom keyboard shortcuts

require('demo-paste').setup({
  keymaps = {
    start = "<F2>",   -- Use F2 instead of <leader>s
    next = "<F3>"     -- Use F3 instead of <leader>c
  }
})

Example 4: For live demos

require('demo-paste').setup({
  paste_from = "filepath",
  filepath = "~/demo.lua",
  enter_insert = true,        -- Auto-enter insert mode when done
  notifications = true,        -- Show what's happening
  keymaps = {
    start = "<F2>",
    next = "<F3>"
  }
})

Commands

:DemoPasteStart

Start a new paste session. Loads your content and remembers where your cursor is.

:DemoPasteNext

Paste the next line or paragraph.

Tips

  • You can restart a paste session anytime by pressing <leader>s again
  • If you want to manually edit after pasting some lines, just do it. You can continue pasting where you left off
  • Press <leader>c as many times as you want to paste all the lines

For more details

Check the full documentation with:

:help demo-paste

Made from someone who loves to teach for people who love to teach!

About

This plugin allows you to paste line-by-line a copied buffer, for code demos and presentations.

Topics

Resources

License

Stars

Watchers

Forks

Languages