mirror of
https://github.com/gyoder/dots.git
synced 2026-02-27 17:03:45 +00:00
nvim: actually got OSC52 working
This commit is contained in:
parent
7f9cb6e767
commit
6b312a8e49
1 changed files with 53 additions and 21 deletions
|
|
@ -68,27 +68,59 @@ vim.api.nvim_create_autocmd("TermOpen", {
|
||||||
|
|
||||||
vim.o.clipboard = "unnamedplus"
|
vim.o.clipboard = "unnamedplus"
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
vim.g.clipboard = {
|
||||||
callback = function()
|
name = "OSC 52",
|
||||||
vim.highlight.on_yank()
|
copy = {
|
||||||
local osc52 = require("vim.ui.clipboard.osc52")
|
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
|
||||||
local contents = vim.v.event.regcontents
|
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
|
||||||
local regtype = vim.v.event.regtype
|
},
|
||||||
|
paste = {
|
||||||
if type(contents) == "string" then
|
["+"] = require("vim.ui.clipboard.osc52").paste("+"),
|
||||||
contents = { contents }
|
["*"] = require("vim.ui.clipboard.osc52").paste("*"),
|
||||||
end
|
},
|
||||||
|
}
|
||||||
if regtype == "V" then
|
-- stupid hacky workaround to make it so i can paste from tmux with OSC52
|
||||||
for i, line in ipairs(contents) do
|
-- https://github.com/neovim/neovim/discussions/29350#discussioncomment-10299517
|
||||||
contents[i] = line .. "\n"
|
-- tracking issue about tmux behavior: https://github.com/tmux/tmux/issues/4275
|
||||||
end
|
if vim.env.TMUX ~= nil then
|
||||||
end
|
local copy = {'tmux', 'load-buffer', '-w', '-'}
|
||||||
|
local paste = {'bash', '-c', 'tmux refresh-client -l && sleep 0.05 && tmux save-buffer -'}
|
||||||
osc52.copy("+")(contents)
|
vim.g.clipboard = {
|
||||||
osc52.copy("*")(contents)
|
name = 'tmux',
|
||||||
end,
|
copy = {
|
||||||
})
|
['+'] = copy,
|
||||||
|
['*'] = copy,
|
||||||
|
},
|
||||||
|
paste = {
|
||||||
|
['+'] = paste,
|
||||||
|
['*'] = paste,
|
||||||
|
},
|
||||||
|
cache_enabled = 0,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.highlight.on_yank()
|
||||||
|
-- local osc52 = require("vim.ui.clipboard.osc52")
|
||||||
|
-- local contents = vim.v.event.regcontents
|
||||||
|
-- local regtype = vim.v.event.regtype
|
||||||
|
--
|
||||||
|
-- if type(contents) == "string" then
|
||||||
|
-- contents = { contents }
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- if regtype == "V" then
|
||||||
|
-- for i, line in ipairs(contents) do
|
||||||
|
-- contents[i] = line .. "\n"
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- osc52.copy("+")(contents)
|
||||||
|
-- osc52.copy("*")(contents)
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
--
|
||||||
-- Enable experimental UI in neovim-nightly
|
-- Enable experimental UI in neovim-nightly
|
||||||
require('vim._extui').enable({})
|
require('vim._extui').enable({})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue