Comments (5)
Hello,
Could you share your config and your neovim version ?
from nvim-osc52.
I fully used the configuration in README.MD.
I added a hotkey lvim.builtin.which_key.vmappings["y"]
, which is available after the first launch, while the y
key is not.
{
"ojroques/nvim-osc52",
config = function()
lvim.builtin.which_key.vmappings["y"] = { require("osc52").copy_visual, "Copy to clipboard(Remote)" }
local function copy()
if vim.v.event.operator == "y" and vim.v.event.regname == "+" then
require("osc52").copy_register("+")
end
end
vim.api.nvim_create_autocmd("TextYankPost", { callback = copy })
end,
}
local function copy(lines, _)
require("osc52").copy(table.concat(lines, "\n"))
end
local function paste()
return { vim.fn.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") }
end
vim.g.clipboard = {
name = "osc52",
copy = { ["+"] = copy, ["*"] = copy },
paste = { ["+"] = paste, ["*"] = paste },
}
from nvim-osc52.
My preliminary judgment is that it is related to the following configuration. When I comment out the following code, it can be used normally, but there will be a "Register "+" is empty" warning when pasting.
local function copy()
if vim.v.event.operator == "y" and vim.v.event.regname == "+" then
require("osc52").copy_register("+")
end
end
vim.api.nvim_create_autocmd("TextYankPost", { callback = copy })
from nvim-osc52.
You have two options, try to choose only one of the two:
- Either you keep that part:
"ojroques/nvim-osc52",
config = function()
lvim.builtin.which_key.vmappings["y"] = { require("osc52").copy_visual, "Copy to clipboard(Remote)" }
local function copy()
if vim.v.event.operator == "y" and vim.v.event.regname == "+" then
require("osc52").copy_register("+")
end
end
vim.api.nvim_create_autocmd("TextYankPost", { callback = copy })
end,
If I understood correctly what you're trying to achieve, y
in visual mode will copy the text as well as "+y
in normal mode. Change the '+'
to ''
in the above code so that y
will copy to clipboard in normal mode.
- Or you keep that part:
local function copy(lines, _)
require("osc52").copy(table.concat(lines, "\n"))
end
local function paste()
return { vim.fn.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") }
end
vim.g.clipboard = {
name = "osc52",
copy = { ["+"] = copy, ["*"] = copy },
paste = { ["+"] = paste, ["*"] = paste },
}
Then in normal and visual mode "+y
will copy to clipboard using the plugin and it's Neovim itself that will call the plugin.
from nvim-osc52.
Thank you for your reply, but it doesn't work for me.
There are three pictures about register data at different times.
- The first time is the register when the editor is just opened.
![image](https://private-user-images.githubusercontent.com/56359329/243353114-a687c3fb-0c83-4c67-9cf7-3a9a8aac7775.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTUwMjA4OTEsIm5iZiI6MTcxNTAyMDU5MSwicGF0aCI6Ii81NjM1OTMyOS8yNDMzNTMxMTQtYTY4N2MzZmItMGM4My00YzY3LTljZjctM2E5YThhYWM3Nzc1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTA2VDE4MzYzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM1MTliNDRiMTY2NmNhMTkxZWJlNDUyYjI4NjRkZTBhZWZiMDQ1YzJjYzBjMmUwZmNkOTM3NGMwOWE4OWRhZGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.jVDwI6HA2POnsDAcBbgwfcCJak8bFFlerxrz0KgbLFI)
- after the first press of yy.
![image](https://private-user-images.githubusercontent.com/56359329/243353138-323d9a17-8cf4-40d9-b80d-4c67ec019a7d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTUwMjA4OTEsIm5iZiI6MTcxNTAyMDU5MSwicGF0aCI6Ii81NjM1OTMyOS8yNDMzNTMxMzgtMzIzZDlhMTctOGNmNC00MGQ5LWI4MGQtNGM2N2VjMDE5YTdkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTA2VDE4MzYzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFhY2JjYTQxZTQ1Y2Q3ZGZiNGNhOGI2YjI3MWM3MTA0NWIyMjNlZjI2OTI1N2NhZTRkMThlOGMzOWVlMmMyN2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.4expqOjx3aGH05ai3e0Br7xwy39KLKKHhe4x_xeqC8E)
- after pressing yy again.
"ojroques/nvim-osc52",
is the content I copied.
![image](https://private-user-images.githubusercontent.com/56359329/243353160-87cd9d35-75de-407b-8213-de41141a98f1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTUwMjA4OTEsIm5iZiI6MTcxNTAyMDU5MSwicGF0aCI6Ii81NjM1OTMyOS8yNDMzNTMxNjAtODdjZDlkMzUtNzVkZS00MDdiLTgyMTMtZGU0MTE0MWE5OGYxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTA2VDE4MzYzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdjNGE2MDg2Njk4YmI2NjBlMmFkNzY4ZGIxM2QyZmI4YzdjYzkyOTVkZDRjMDA1ODM0MzFmMWYxNWU1MDg1ZTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ACjDJjxZ8ba_zlsqAXjqv3u1HP5AV7E_U6JhghTl0cg)
In addition, I also found that I don't need to fully press yy
. Just pressing y
once to enter operation mode and then returning to normal mode, the copy function works normally again.
from nvim-osc52.
Related Issues (20)
- Copying gets broken on long text HOT 2
- Default leader copy command cuts buffer text HOT 1
- Feature: Query and paste from the clipboard HOT 7
- disable printing status, return status, <leader>cc not working. HOT 2
- dooes not work on WSL1 config tips? HOT 2
- Issues on displaying yanked region with vim-highlightedyank HOT 1
- Doesn't work inside tmux HOT 3
- copy_visual does not respect reselect-visual (gv) HOT 2
- osc52.lua line 43: attempt to index global 'visual_marks' (a nil value) HOT 1
- Yank behavior on a remote machine: `yy` does not yank, but `"*yy` yanks HOT 4
- Copying does not overwrite HOT 2
- auto copy contents from register not working as expected HOT 2
- Can't make it work with Mosh HOT 5
- failed to copy text with mouse after using nvim-osc52 inside the tmux in kitty HOT 1
- Can I paste from local system clipboard to remote neovim by "p"? HOT 3
- Example configuration behaves unexpectedly (LazyVim) HOT 4
- difference between using as a clipboard provider vs not? HOT 2
- Config cannot be applied on neovim 0.9 or instructions are unclear HOT 4
- How to turn clipboard blockwise
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-osc52.