Skip to content

Commit

Permalink
add osc52 copy command for nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
BarretRen committed Mar 29, 2024
1 parent 8875f65 commit 23609c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions nvim/lua/cmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, {
end,
})

-- osc52 copy text to host clipboard
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
pattern = { "*" },
callback = function()
vim.cmd([[
let c = join(v:event.regcontents,"\n")
let c64 = system("base64", c)
let s = "\e]52;c;" . trim(c64) . "\x07"
call chansend(v:stderr, s)
]])
end,
})

-- keep layout after delete buffer
vim.api.nvim_create_user_command("BufferDelete", function(ctx)
---@diagnostic disable-next-line: missing-parameter
Expand Down
2 changes: 1 addition & 1 deletion nvim/lua/plugins/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ return {
require("telescope").load_extension("live_grep_args")
require('telescope').setup{
defaults = {
wrap_results = true,
-- wrap_results = true,
layout_strategy = 'vertical',
layout_config = { width = 0.9 },
vimgrep_arguments = {
Expand Down

0 comments on commit 23609c0

Please sign in to comment.