clipboard leader y
This commit is contained in:
parent
11250db2cc
commit
fd0ed3dc57
|
@ -75,17 +75,20 @@ map('n', 'zh', 'z4h')
|
|||
-- Clipboard
|
||||
-- ===
|
||||
|
||||
-- TODO: make <leader>y copy to system
|
||||
-- Yank to system clipboard
|
||||
map({'n', 'v', 'x'}, '<leader>y', '"+y"')
|
||||
map({'n', 'v', 'x'}, '<leader>yy', '"+yy"')
|
||||
map({'n', 'v', 'x'}, '<leader>Y', '"+Y"')
|
||||
|
||||
-- Yank buffer's relative path to clipboard
|
||||
map('n', '<Leader>y', function()
|
||||
map('n', '<Leader>yp', function()
|
||||
local path = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ':~:.')
|
||||
vim.fn.setreg('+', path)
|
||||
vim.notify(path, vim.log.levels.INFO, { title = 'Yanked relative path' })
|
||||
end, { silent = true, desc = 'Yank relative path' })
|
||||
|
||||
-- Yank absolute path
|
||||
map('n', '<Leader>Y', function()
|
||||
map('n', '<Leader>Yp', function()
|
||||
local path = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ':p')
|
||||
vim.fn.setreg('+', path)
|
||||
vim.notify(path, vim.log.levels.INFO, { title = 'Yanked absolute path' })
|
||||
|
@ -136,10 +139,6 @@ map('n', '<DOWN>', '<cmd>move+<CR>==', { desc = 'Move line down' })
|
|||
map('x', '<UP>', ":move'<-2<CR>gv=gv", { desc = 'Move selection up' })
|
||||
map('x', '<DOWN>', ":move'>+<CR>gv=gv", { desc = 'Move selection down' })
|
||||
|
||||
-- Duplicate lines without affecting PRIMARY and CLIPBOARD selections.
|
||||
map('n', 'yyp', 'm`""Y""P``', { desc = 'Duplicate line' })
|
||||
map('x', 'yyp', '""Y""Pgv', { desc = 'Duplicate selection' })
|
||||
|
||||
-- Remove spaces at the end of lines
|
||||
map('n', '<Leader>cw', '<cmd>lua MiniTrailspace.trim()<CR>', { desc = 'Erase Whitespace' })
|
||||
|
||||
|
|
Loading…
Reference in New Issue