global cmd with capture group yank

This commit is contained in:
Baipyrus 2024-07-03 12:39:17 +02:00
parent db73a4653f
commit 216d892c17
2 changed files with 14 additions and 1 deletions

View File

@ -61,6 +61,18 @@ vim.keymap.set({ 'n', 'v' }, '<M-.>', '<C-W>>')
vim.keymap.set({ 'n', 'v' }, '<M-=>', '<C-W>+')
vim.keymap.set({ 'n', 'v' }, '<M-->', '<C-W>-')
local function global_cmd_yank()
-- Get the (selected) lines
local lines = nil
local mode = vim.api.nvim_get_mode()['mode']
if string.find(mode:lower(), '^v') then
else
lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
end
end
vim.keymap.set({ 'n', 'v' }, '<leader>gy', global_cmd_yank, { desc = '[G]lobal command [Y]ank' })
if vim.g.neovide then
-- System clipboard keybinds in normal and visual mode
vim.keymap.set({ 'n', 'v' }, '<C-S-c>', '"+y', { desc = 'Yank to System clipboard' })

View File

@ -25,7 +25,7 @@ return {
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]it/[G]lobal', _ = 'which_key_ignore' },
['<leader>b'] = { name = '[B]uffer/[B]reakpoint', _ = 'which_key_ignore' },
['<leader>c'] = { name = '[C]ode/[C]odeium/[C]hange', _ = 'which_key_ignore' },
['<leader>cd'] = { name = '[D]irectory', _ = 'which_key_ignore' },
@ -50,6 +50,7 @@ return {
['<leader>pn'] = { name = '[N]o', _ = 'which_key_ignore' },
['<leader>l'] = { name = '[L]ist', _ = 'which_key_ignore' },
['<leader>f'] = { name = '[F]ormat/[F]ile', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]lobal', _ = 'which_key_ignore' },
}, { mode = 'v' })
end,
},