Skip to content

Instantly share code, notes, and snippets.

View uga-rosa's full-sized avatar
💭
busy

NAKAI Tsuyoshi uga-rosa

💭
busy
View GitHub Profile
@uga-rosa
uga-rosa / nvim-oscyank.lua
Last active March 18, 2025 01:23
copy text to clipboard via osc52
-- Yank to OS clipboard via OSC52
---@enum (key) mode
local commands = {
block = "`[`]y",
char = "`[v`]y",
line = "`[V`]y",
}
---@param command string
if vim.api.orig == nil then
vim.api.orig = {}
for name, func in pairs(vim.api) do
vim.api.orig[name] = func
end
local default_win_config = {
border = "single",
}
local cmp_config
local function cmp_enable()
local ok, cmp = pcall(require, "cmp")
if ok then
cmp.setup({ enabled = cmp_config.enabled })
end
end
local function cmp_disable()
@uga-rosa
uga-rosa / is_array.lua
Last active October 20, 2021 13:18
Chacks if t is an array
local function tbl_copy(t)
if type(t) ~= "table" then
return t
end
local res = {}
for k, v in pairs(t) do
res[k] = tbl_copy(v)
end