1

Regenerate nvim config

This commit is contained in:
2024-06-02 03:29:20 +02:00
parent 75eea0c030
commit ef2e28883d
5576 changed files with 604886 additions and 503 deletions

View File

@ -0,0 +1,77 @@
local yanky = require("yanky")
local function get_buf_lines()
local result = vim.api.nvim_buf_get_lines(0, 0, vim.api.nvim_buf_line_count(0), false)
return result
end
local function execute_keys(feedkeys)
local keys = vim.api.nvim_replace_termcodes(feedkeys, true, false, true)
vim.api.nvim_feedkeys(keys, "x!", false)
end
local function setup()
yanky.setup({ ring = { storage = "memory" } })
local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_command("buffer " .. buf)
vim.api.nvim_buf_set_lines(0, 0, -1, true, {
"void test() {",
" int a = 1;",
" int b = 2;",
" for (int i = 0; i < 10; ++i) {",
" cout << a;",
" cout << b;",
" }",
"}",
})
vim.cmd("set ft=c")
end
describe("Special Put", function()
before_each(setup)
it("should PutAfterFilter", function()
vim.cmd("5")
execute_keys("2yy")
vim.cmd("3")
vim.cmd('execute "normal \\<Plug>(YankyPutAfterFilter)"')
assert.are.same({
"void test() {",
" int a = 1;",
" int b = 2;",
" cout << a;",
" cout << b;",
" for (int i = 0; i < 10; ++i) {",
" cout << a;",
" cout << b;",
" }",
"}",
}, get_buf_lines())
assert.are.same({ 4, 4 }, vim.api.nvim_win_get_cursor(0))
end)
it("should GPutBeforeFilter", function()
vim.cmd("5")
execute_keys("2yy")
vim.cmd("4")
vim.cmd('execute "normal \\<Plug>(YankyGPutBeforeFilter)"')
assert.are.same({
"void test() {",
" int a = 1;",
" int b = 2;",
" cout << a;",
" cout << b;",
" for (int i = 0; i < 10; ++i) {",
" cout << a;",
" cout << b;",
" }",
"}",
}, get_buf_lines())
assert.are.same({ 6, 0 }, vim.api.nvim_win_get_cursor(0))
end)
end)

View File

@ -0,0 +1,29 @@
local yanky = require("yanky")
-- local system_clipboard = require("yanky.system_clipboard")
-- local utils = require("yanky.utils")
describe("Sync clipbard", function()
before_each(function()
yanky.setup({
ring = {
storage = "memory",
},
system_clipboard = {
sync_with_ring = true,
},
})
end)
it("should add system clipboard to history on focus", function()
-- vim.fn.setreg("*", "default_value", "V")
-- system_clipboard.on_focus_lost()
--
-- vim.fn.setreg("*", "new_value", "v")
-- system_clipboard.on_focus_gained()
--
-- assert.are.same({
-- regcontents = "new_value",
-- regtype = "v",
-- }, yanky.history.first())
end)
end)