Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit 1914a2d

Browse files
feat: add support for yanking result
1 parent fddd49e commit 1914a2d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lua/icon-picker/init.lua

+14
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ local function insert_user_choice_normal(choice)
6060
end
6161
end
6262

63+
local function yank_user_choice_normal(choice)
64+
if choice then
65+
local split = vim.split(choice, " ")
66+
67+
vim.schedule(function()
68+
vim.cmd("let @+='" .. split[1] .. "'")
69+
end)
70+
end
71+
end
72+
6373
local function insert_user_choice_insert(choice)
6474
if choice then
6575
local split = vim.split(choice, " ")
@@ -117,6 +127,10 @@ for type, data in pairs(list_types) do
117127
generate_list(data["icon_types"], data["desc"], insert_user_choice_normal)
118128
end, {})
119129

130+
vim.api.nvim_create_user_command(type .. "Yank", function()
131+
generate_list(data["icon_types"], data["desc"], yank_user_choice_normal)
132+
end, {})
133+
120134
vim.api.nvim_create_user_command(type .. "Insert", function()
121135
generate_list(data["icon_types"], data["desc"], insert_user_choice_insert)
122136
end, {})

0 commit comments

Comments
 (0)