changeset 619:6bd8aecfdaaa

use the updated trim function from nvim-osc52
author zegervdv <zegervdv@me.com>
date Tue, 26 Jul 2022 17:12:11 +0200
parents 7d581ebd5508
children 15c9da15a2f5
files .chezmoitemplates/init.lua
diffstat 1 files changed, 2 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/.chezmoitemplates/init.lua	Tue Jul 26 09:48:51 2022 +0200
+++ b/.chezmoitemplates/init.lua	Tue Jul 26 17:12:11 2022 +0200
@@ -29,24 +29,8 @@
   use {
     'ojroques/nvim-osc52',
     config = function()
-      require('osc52').setup { trim = false }
-      local copy = function(lines, _)
-        -- Trim indent before copying
-        local indent = 0
-        for _, line in ipairs(lines) do
-          local index, _ = line:find '[^ ]'
-          if index ~= nil then
-            indent = index
-            break
-          end
-        end
-        if indent ~= nil then
-          for key, line in ipairs(lines) do
-            lines[key] = line:sub(indent)
-          end
-        end
-        require('osc52').copy(table.concat(lines, '\n'))
-      end
+      require('osc52').setup { trim = true }
+      local copy = function(lines, _) require('osc52').copy(table.concat(lines, '\n')) end
       local paste = function() return { vim.fn.split(vim.fn.getreg '', '\n'), vim.fn.getregtype '' } end
       vim.g.clipboard = {
         name = 'osc52',