mirror of
https://github.com/Baipyrus/nvim-config.git
synced 2024-11-15 05:23:50 +00:00
copying extracted data to system clipboard
This commit is contained in:
parent
6806aa7977
commit
197b1f4ca0
@ -83,6 +83,7 @@ end
|
|||||||
local function global_cmd_yank()
|
local function global_cmd_yank()
|
||||||
-- Prompt user input for expression
|
-- Prompt user input for expression
|
||||||
local inexpr = vim.fn.input 'Enter expression: '
|
local inexpr = vim.fn.input 'Enter expression: '
|
||||||
|
local outsep = vim.fn.input 'Enter separator: '
|
||||||
|
|
||||||
-- Get the (selected) lines
|
-- Get the (selected) lines
|
||||||
local lines = nil
|
local lines = nil
|
||||||
@ -98,6 +99,11 @@ local function global_cmd_yank()
|
|||||||
local extracted = vim.tbl_map(function(value)
|
local extracted = vim.tbl_map(function(value)
|
||||||
return value['text']
|
return value['text']
|
||||||
end, matches)
|
end, matches)
|
||||||
|
|
||||||
|
-- Concat matches according to separator
|
||||||
|
local value = table.concat(extracted, outsep)
|
||||||
|
-- Write to system register
|
||||||
|
vim.fn.setreg('+', value)
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<leader>gy', global_cmd_yank, { desc = '[G]lobal command [Y]ank' })
|
vim.keymap.set({ 'n', 'v' }, '<leader>gy', global_cmd_yank, { desc = '[G]lobal command [Y]ank' })
|
||||||
|
Loading…
Reference in New Issue
Block a user