1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
return {
{
'svermeulen/vim-cutlass',
},
{
'gbprod/substitute.nvim',
config = function()
local map = require("helpers.keys").map
map("n", "s", require('substitute').operator, "substitute")
map("n", "ss", require('substitute').line, "substitute: linewise")
map("n", "S", require('substitute').eol, "substitute: eol")
map("x", "s", require('substitute').visual, "substitute: visual")
map("n", "<leader>s", require('substitute.range').operator, "substitute: over range")
map("x", "<leader>s", require('substitute.range').visual, "substitute: over visual")
map("n", "<leader>ss", require('substitute.range').word, "substitute: with word over range")
map("n", "sx", require('substitute.exchange').operator, "exchange")
map("n", "sxx", require('substitute.exchange').line, "exchange line")
map("x", "sX", require('substitute.exchange').visual, "exchange visual")
map("n", "sxc", require('substitute.exchange').cancel, "exchange cancel")
require("substitute").setup({
highlight_substituted_text = {
enabled = true,
timer = 300,
},
})
end,
},
{
"gbprod/yanky.nvim",
config = function()
if os.getenv("WAYLAND_DISPLAY") then
vim.g.clipboard = {
name = "wl-clipboard",
copy = {
["+"] = 'wl-copy --foreground --type text/plain',
["*"] = 'wl-copy --foreground --primary --type text/plain',
},
paste = {
["+"] = (function()
return vim.fn.systemlist('wl-paste --no-newline', { '' }, 1) -- '1' keeps empty lines
end),
["*"] = (function()
return vim.fn.systemlist('wl-paste --primary --no-newline', { '' }, 1)
end),
},
cache_enabled = true
}
else
-- fix Target STRING not available
-- if we are using xsel (X11)
vim.g.clipboard = {
name = 'xsel_override',
copy = {
['+'] = 'xsel --input --clipboard',
['*'] = 'xsel --input --primary',
},
paste = {
['+'] = 'xsel --output --clipboard',
['*'] = 'xsel --output --primary',
},
cache_enabled = 1,
}
end
local map = require("helpers.keys").map
map({ "n", "x" }, 'p', '<Plug>(YankyPutAfter)')
map({ "n", "x" }, 'P', '<Plug>(YankyPutBefore)')
map("n", "<c-n>", "<Plug>(YankyCycleForward)")
map("n", "<c-p>", "<Plug>(YankyCycleBackward)")
local utils = require("yanky.utils")
local mapping = require("yanky.telescope.mapping")
require("yanky").setup({
ring = {
history_length = 100,
storage = "shada",
sync_with_numbered_registers = true,
cancel_event = "update",
ignore_registers = { "_" },
},
system_clipboard = {
sync_with_ring = true,
},
picker = {
telescope = {
use_default_mappings = false,
mappings = {
default = mapping.set_register(utils.get_default_register()),
},
},
},
highlight = {
on_put = true,
on_yank = true,
timer = 300,
},
})
end,
}
}
|