A simple Neovim plugin that lets you paste text line-by-line or paragraph-by-paragraph. Perfect for live coding demos, tutorials, and presentations.
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.
{
'carlosgrillet/demo-paste.nvim',
config = function()
require('demo-paste').setup()
end
}use {
"carlosgrillet/demo-paste.nvim",
config = function()
require('demo-paste').setup()
end
}Plug 'carlosgrillet/demo-paste.nvim'- Setup the plugin (with default settings):
require('demo-paste').setup()-
Copy some text to your clipboard
-
In Neovim, position your cursor where you want the text to go
-
Press
<leader>sto start the demo paste session -
Press
<leader>ceach time you want to paste the next line
- Load - The plugin reads content from a source (clipboard, file, or buffer)
- Start - You mark where you want to paste
- Paste step-by-step - Each time you press the key, one line gets pasted
- Done - When all lines are pasted, you get a notification
- 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
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
}
})Just install and use it. Copy text, position cursor, press <leader>s then <leader>c repeatedly.
require('demo-paste').setup({
paste_from = "filepath",
filepath = "~/my-code.lua"
})Then use <leader>s to start from that file.
require('demo-paste').setup({
keymaps = {
start = "<F2>", -- Use F2 instead of <leader>s
next = "<F3>" -- Use F3 instead of <leader>c
}
})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>"
}
})Start a new paste session. Loads your content and remembers where your cursor is.
Paste the next line or paragraph.
- You can restart a paste session anytime by pressing
<leader>sagain - If you want to manually edit after pasting some lines, just do it. You can continue pasting where you left off
- Press
<leader>cas many times as you want to paste all the lines
Check the full documentation with:
:help demo-pasteMade from someone who loves to teach for people who love to teach!