more solid nvim clipboard inside tmux

This commit is contained in:
2025-03-15 05:28:45 -04:00
parent 5148fc03ea
commit 6e3a38a722
9 changed files with 178 additions and 179 deletions

View File

@@ -1,26 +1,27 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"blink.cmp": { "branch": "main", "commit": "bff6c0f06bdc1114c5816b0f6b19ad6a7e15a638" },
"catppuccin": { "branch": "main", "commit": "faf15ab0201b564b6368ffa47b56feefc92ce3f4" },
"blink.cmp": { "branch": "main", "commit": "b6f11a0aa33e601c469a126e3ed6e35208fe3ea3" },
"catppuccin": { "branch": "main", "commit": "0b2437bcc12b4021614dc41fcea9d0f136d94063" },
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
"lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2daa8921b7afdcfa47419a21ea343c3df6d74fa0" },
"lazy.nvim": { "branch": "main", "commit": "f15a93907ddad3d9139aea465ae18336d87f5ce6" },
"lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" },
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "805c31ec6bfb557975143712ecff6956d3227141" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.icons": { "branch": "main", "commit": "44c0160526f7ae17ca8e8eab9ab235d047fcf7a6" },
"noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" },
"mini.icons": { "branch": "main", "commit": "ec61af6e606fc89ee3b1d8f2f20166a3ca917a36" },
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
"nvim-highlight-colors": { "branch": "main", "commit": "e967e2ba13fd4ca731b41d0e5cc1ac2edcd6e25e" },
"nvim-lspconfig": { "branch": "master", "commit": "040001d85e9190a904d0e35ef5774633e14d8475" },
"nvim-highlight-colors": { "branch": "main", "commit": "16a3cd4a32a655c8537de6e5643c234a9b38183a" },
"nvim-lspconfig": { "branch": "master", "commit": "6c17f8656f667727b27f5f598463afedb7791b18" },
"nvim-scrollbar": { "branch": "main", "commit": "6994eb9f73d5fdc36ee2c8717940e8c853e51a49" },
"nvim-treesitter": { "branch": "master", "commit": "2405274937718d520a40e03df92030dca6b4f0fd" },
"nvim-web-devicons": { "branch": "master", "commit": "0eb18da56e2ba6ba24de7130a12bcc4e31ad11cb" },
"oil.nvim": { "branch": "master", "commit": "dba037598843973b8c54bc5ce0318db4a0da439d" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"snacks.nvim": { "branch": "main", "commit": "98df370703b3c47a297988f3e55ce99628639590" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
"nvim-treesitter": { "branch": "master", "commit": "6d957c22cb48a734b009a69d03c18d20042c4754" },
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
"oil.nvim": { "branch": "master", "commit": "32dd3e378d47673679e76a773451f82f971a66df" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"rustaceanvim": { "branch": "master", "commit": "2b0f0b7e03751cf8ed123322f9b02d8f73fa9df7" },
"snacks.nvim": { "branch": "main", "commit": "121e74e4a5b7962ee370a8d8ae75d1c7b4c2e11c" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "2a5ceff981501cff8f46871d5402cd3378a8ab6a" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"vim-tmux-navigator": { "branch": "master", "commit": "424b5caa154bff34dc258ee53cec5a8e36cf7ea8" }
"vim-tmux-navigator": { "branch": "master", "commit": "d847ea942a5bb4d4fab6efebc9f30d787fd96e65" }
}

View File

@@ -0,0 +1,43 @@
-- https://mitchellt.com/2022/05/15/WSL-Neovim-Lua-and-the-Windows-Clipboard.html
if os.getenv('WSL_DISTRO_NAME') ~= nil then
vim.g.clipboard = {
name = 'wsl clipboard',
copy = {
["+"] = { "clip.exe" },
["*"] = { "clip.exe" }
},
paste = {
["+"] = { 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))' },
["*"] = { 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))' }
},
cache_enabled = true
}
elseif vim.env.TMUX ~= nil then
local copy = { 'tmux', 'load-buffer', '-w', '-' }
local paste = { 'bash', '-c', 'tmux refresh-client -l && sleep 0.05 && tmux save-buffer -' }
vim.g.clipboard = {
name = 'tmux',
copy = {
['+'] = copy,
['*'] = copy,
},
paste = {
['+'] = paste,
['*'] = paste,
},
cache_enabled = 0,
}
else
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('*'),
},
cache_enabled = true
}
end

View File

@@ -1,7 +1,7 @@
vim.g.mapleader = ' '
require("kamu.clipboard")
require("kamu.options")
--require("kamu.commands")
require("kamu.lazy")
require("kamu.keymaps")

View File

@@ -21,11 +21,8 @@ vim.keymap.set("n", "<space><space>x", "<cmd>source %<CR>")
vim.keymap.set("n", "<space>x", ":.lua<CR>")
vim.keymap.set("v", "<space>x", ":lua<CR>")
-- Highlight when yanking text
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking text",
group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
-- copy to system clipboard
vim.keymap.set("v", "<space>y", "\"+y")
vim.keymap.set("n", "<space>y", "\"+y")
vim.keymap.set("v", "<space>p", "\"+p")
vim.keymap.set("n", "<space>p", "\"+p")

View File

@@ -1,35 +1,3 @@
local in_wsl = os.getenv('WSL_DISTRO_NAME') ~= nil
-- https://mitchellt.com/2022/05/15/WSL-Neovim-Lua-and-the-Windows-Clipboard.html
if in_wsl then
vim.g.clipboard = {
name = 'wsl clipboard',
copy = {
["+"] = { "clip.exe" },
["*"] = { "clip.exe" }
},
paste = {
["+"] = { 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))' },
["*"] = { 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))' } },
cache_enabled = true
}
end
-- if in_wsl then
-- vim.g.clipboard = {
-- name = 'WslClipboard',
-- copy = {
-- ['+'] = 'clip.exe',
-- ['*'] = 'clip.exe',
-- },
-- paste = {
-- ['+'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
-- ['*'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
-- },
-- cache_enabled = false,
-- }
-- end
-- Highlight on Yank
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking text",
@@ -94,4 +62,3 @@ local options = {
for option, value in pairs(options) do
vim.opt[option] = value
end

View File

@@ -14,8 +14,10 @@ return {
},
},
},
build = 'cargo build --release',
version = '*',
-- build = 'cargo build --release',
opts = {
snippets = { preset = 'luasnip' },
keymap = { preset = 'super-tab' },
appearance = {
use_nvim_cmp_as_default = true,
@@ -41,16 +43,16 @@ return {
},
},
ghost_text = {
enabled = true
enabled = false
}
},
signature = { enabled = true },
sources = {
default = { 'lsp', 'path', 'luasnip', 'buffer' },
default = { 'lsp', 'path', 'snippets', 'buffer' },
-- TODO: add cmp-emoji as another cmp source -- needs https://github.com/Saghen/blink.compat
per_filetype = {
tex = { 'lsp', 'path', 'luasnip', 'buffer' },
lua = { 'lsp', 'path', 'luasnip', 'buffer', 'lazydev' },
tex = { 'lsp', 'path', 'snippets', 'buffer' },
lua = { 'lsp', 'path', 'snippets', 'buffer', 'lazydev' },
},
providers = {
lazydev = {
@@ -58,28 +60,9 @@ return {
module = "lazydev.integrations.blink",
fallbacks = { "lsp" },
},
luasnip = {
name = 'Luasnip',
module = 'blink.cmp.sources.luasnip',
opts = {
use_show_condition = true,
show_autosnippets = true,
}
},
},
},
snippets = {
expand = function(snippet) require('luasnip').lsp_expand(snippet) end,
active = function(filter)
if filter and filter.direction then
return require('luasnip').jumpable(filter.direction)
end
return require('luasnip').in_snippet()
end,
jump = function(direction) require('luasnip').jump(direction) end,
},
},
config = function(_, opts)
vim.opt.completeopt = { "menu", "menuone" }

View File

@@ -1,4 +1,5 @@
return {
{
-- lsp client plugin
"neovim/nvim-lspconfig", -- https://github.com/neovim/nvim-lspconfig
dependencies = {
@@ -13,8 +14,6 @@ return {
require('mason-lspconfig').setup({
ensure_installed = {
'lua_ls',
'astro',
'ansiblels',
},
handlers = {
function(server_name)
@@ -30,6 +29,21 @@ return {
},
})
end,
["rust-analyzer"] = function()
require("lspconfig")['rust-analyzer'].setup({
cargo = {
buildScripts = {
enable = true,
},
},
filetypes = {
"rs",
},
rustfmt = {
extraArgs = { "+nightly" },
},
})
end,
["astro"] = function()
require("lspconfig")['astro'].setup({
filetypes = {
@@ -48,7 +62,8 @@ return {
local client = vim.lsp.get_client_by_id(ev.data.client_id)
if not client then return end
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "<leader>gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "<leader>gr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set('n', '<space>f', function()
@@ -59,7 +74,6 @@ return {
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
@@ -72,7 +86,24 @@ return {
end,
})
end
vim.opt.updatetime = 100
-- Show diagnostic popup on cursor hover
local diag_float_grp = vim.api.nvim_create_augroup("DiagnosticFloat", { clear = true })
vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
vim.diagnostic.open_float(nil, { focusable = false })
end,
group = diag_float_grp,
})
end,
})
end
},
-- {
-- 'mrcjkb/rustaceanvim',
-- version = '^5', -- Recommended
-- lazy = false, -- This plugin is already lazy
-- }
}

View File

@@ -3,39 +3,17 @@ return {
priority = 1000,
lazy = false,
keys = {
{ "<leader>sh", "<cmd>lua Snacks.notifier.show_history()<CR>", mode = "n", desc = "Show the notification History" }
{ "<leader>sh", "<cmd>lua Snacks.notifier.show_history()<CR>", mode = "n", desc = "Show the notification History" },
{ "<leader><space>", function() Snacks.picker.smart() end, desc = "Smart Find Files" },
},
opts = {
dashboard = { enabled = true },
bigfile = { enabled = true },
notifier = {
enabled = true,
{
timeout = 3000, -- default timeout in ms
width = { min = 40, max = 0.4 },
height = { min = 1, max = 0.6 },
margin = { top = 0, right = 1, bottom = 0 },
padding = true, -- add 1 cell of left/right padding to the notification window
sort = { "level", "added" }, -- sort by level and time
level = vim.log.levels.TRACE,
icons = {
error = "",
warn = "",
info = "",
debug = "",
trace = "",
},
keep = function(notif)
return vim.fn.getcmdpos() > 0
end,
style = "compact",
top_down = true, -- place notifications from top to bottom
date_format = "%R", -- time format for notifications
more_format = " ↓ %d lines ",
refresh = 50, -- refresh at most every 50ms
}
},
notifier = { enabled = true },
quickfile = { enabled = true },
picker = { enabled = true },
statuscolumn = { enabled = true },
image = { enabled = true },
words = { enabled = true },
},
init = function()

View File

@@ -20,7 +20,6 @@ return {
"javascript",
"dockerfile",
"html",
"latex",
"css",
"scss",
},