osc52 integration with nvim
This commit is contained in:
parent
77f1bfacc6
commit
7f7b939450
2 changed files with 20 additions and 2 deletions
|
|
@ -86,6 +86,10 @@ in
|
||||||
|
|
||||||
# Copy/paste
|
# Copy/paste
|
||||||
copy-on-select = false;
|
copy-on-select = false;
|
||||||
|
|
||||||
|
# OSC-52 clipboard integration (works with Neovim and tmux)
|
||||||
|
clipboard-read = "allow"; # Allow programs to read clipboard without prompting
|
||||||
|
clipboard-write = "allow"; # Allow programs to write to clipboard without prompting
|
||||||
|
|
||||||
# Scrollback
|
# Scrollback
|
||||||
scrollback-limit = 10000;
|
scrollback-limit = 10000;
|
||||||
|
|
|
||||||
|
|
@ -356,16 +356,30 @@ in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- OSC-52 clipboard integration (matches tmux setup, works with Ghostty)
|
||||||
|
-- This enables clipboard functionality across SSH, tmux, and multi-platform
|
||||||
|
vim.g.clipboard = {
|
||||||
|
name = 'OSC 52',
|
||||||
|
copy = {
|
||||||
|
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
|
||||||
|
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
|
||||||
|
},
|
||||||
|
paste = {
|
||||||
|
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
|
||||||
|
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
-- Close all buffers except current (preserving NvimTree and other special buffers)
|
-- Close all buffers except current (preserving NvimTree and other special buffers)
|
||||||
function close_other_buffers()
|
function close_other_buffers()
|
||||||
local current_buf = vim.api.nvim_get_current_buf()
|
local current_buf = vim.api.nvim_get_current_buf()
|
||||||
local buffers = vim.api.nvim_list_bufs()
|
local buffers = vim.api.nvim_list_bufs()
|
||||||
|
|
||||||
for _, buf in ipairs(buffers) do
|
for _, buf in ipairs(buffers) do
|
||||||
if buf ~= current_buf and vim.api.nvim_buf_is_valid(buf) then
|
if buf ~= current_buf and vim.api.nvim_buf_is_valid(buf) then
|
||||||
local buftype = vim.api.nvim_buf_get_option(buf, 'buftype')
|
local buftype = vim.api.nvim_buf_get_option(buf, 'buftype')
|
||||||
local filetype = vim.api.nvim_buf_get_option(buf, 'filetype')
|
local filetype = vim.api.nvim_buf_get_option(buf, 'filetype')
|
||||||
|
|
||||||
-- Skip special buffers (NvimTree, terminals, quickfix, etc.)
|
-- Skip special buffers (NvimTree, terminals, quickfix, etc.)
|
||||||
if buftype == "" and filetype ~= "NvimTree" then
|
if buftype == "" and filetype ~= "NvimTree" then
|
||||||
-- Only delete if it's a normal file buffer
|
-- Only delete if it's a normal file buffer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue