aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/vim.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/lua/vim.lua')
-rw-r--r--src/nvim/lua/vim.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua
index 5514819a02..adb90084db 100644
--- a/src/nvim/lua/vim.lua
+++ b/src/nvim/lua/vim.lua
@@ -165,6 +165,20 @@ end
--- Paste handler, invoked by |nvim_paste()| when a conforming UI
--- (such as the |TUI|) pastes text into the editor.
---
+--- Example: To remove ANSI color codes when pasting:
+--- <pre>
+--- vim.paste = (function()
+--- local overridden = vim.paste
+--- return function(lines, phase)
+--- for i,line in ipairs(lines) do
+--- -- Scrub ANSI color codes from paste input.
+--- lines[i] = line:gsub('\27%[[0-9;mK]+', '')
+--- end
+--- overridden(lines, phase)
+--- end
+--- end)()
+--- </pre>
+---
--@see |paste|
---
--@param lines |readfile()|-style list of lines to paste. |channel-lines|