add yank and paste to system clipboard

This commit is contained in:
Mans Ziesel 2023-11-12 19:49:32 +01:00
parent d95ca94917
commit 2f01e7ed9c

View File

@ -185,9 +185,10 @@ require('lazy').setup({
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim` -- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt` -- See `:help indent_blankline.txt`
main = "ibl",
opts = { opts = {
char = '', -- char = '┊',
show_trailing_blankline_indent = false, -- show_trailing_blankline_indent = false,
}, },
}, },
@ -200,6 +201,7 @@ require('lazy').setup({
branch = '0.1.x', branch = '0.1.x',
dependencies = { dependencies = {
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
'olexsmir/gopher.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system -- Only load if `make` is available. Make sure you have the system
-- requirements installed. -- requirements installed.
@ -249,7 +251,7 @@ require('lazy').setup({
require("tokyonight").setup({ require("tokyonight").setup({
style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day` style = "night", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
transparent = true, -- Enable this to disable setting the background color transparent = false, -- Enable this to disable setting the background color
}) })
vim.cmd[[colorscheme tokyonight]] vim.cmd[[colorscheme tokyonight]]
@ -316,6 +318,18 @@ vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex) vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
-- Copy to clipboard
vim.api.nvim_set_keymap('n', '<leader>y', '"+y', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>Y', '"+yg_', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>yy', '"+yy', { noremap = true, silent = true })
vim.api.nvim_set_keymap('v', '<leader>y', '"+y', { noremap = true, silent = true })
-- Paste from clipboard
vim.api.nvim_set_keymap('n', '<leader>p', '"+p', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>P', '"+P', { noremap = true, silent = true })
vim.api.nvim_set_keymap('v', '<leader>p', '"+p', { noremap = true, silent = true })
vim.api.nvim_set_keymap('v', '<leader>P', '"+P', { noremap = true, silent = true })
-- [[ Highlight on yank ]] -- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()` -- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })