-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I yank to clipboard? #1099
Comments
On Macos this works also use pbcopy for copy and pastehook global NormalKey y|d|c %{ nop %sh{ |
has this been implemented? im interested in using kak for small simple editing but actually having to configure the most basic of functionalities is offputting |
It has not. But configuring this should not be that difficult:
Now if you hit |
Assuming you want to also paste things into kakoune from your clipboard here is the line for that:
Similarly you use |
@mawww is there any hope of making this build-in with some simple command? I followed this: https://stackoverflow.com/a/42296453/10898116 and got copy/paste working, but it seems fairly elaborate (required installing |
copying one snippet and installing one program is complicated? |
More complicated than just a snippet, which in turn is more complicated than "it just works the way I expect". These things are always relative. |
# Yank
hook global NormalKey '[ydc]' %{
nop %sh{
(printf '%s' "$kak_main_reg_dquote" | xclip -filter | xclip -selection clipboard) < /dev/null > /dev/null 2>&1 &
}
}
# Paste
map global user p -docstring 'Paste (After)' '<a-!>xclip -out -selection clipboard<ret>'
map global user P -docstring 'Paste (Before)' '!xclip -out -selection clipboard<ret>'
map global user R -docstring 'Replace' '|xclip -out -selection clipboard<ret>' |
@SolitudeSF If it's quite hard to build basic copy/paste functionality into the kakoune by default, then that's completely understandable. If not, then it's obviously a needless complication for users that should be addressed. |
It'd be pretty easy for, say, Cygwin's clipboard support, where you can just read and write It'd be a bit more complex for macOS, since you can shell out to It'd be more complex yet again for X11, since X11 doesn't provide a place to store clipboard data, it just stores "which application last copied", so the application has to stay running at least until some other application copies. Since Kakoune is single-threaded, long-running, blocking processes are annoying (although not impossible) to deal with, as in #2325. It'd be even more complex for Wayland, since for security reasons Wayland only allows an application to copy to the clipboard while it's processing an input event, like a mouse-click on a "copy" toolbar button, or a "Ctrl-C" keyboard event. Since Kakoune runs inside a terminal, it never gets to see Wayland input events, and so it couldn't interact with the clipboard... EXCEPT that most Wayland servers are running XWayland, so you can just use the X11 solution, EXCEPT that XWayland is not guaranteed to be present, and Kakoune would probably fail in a very confusing and difficult-to-debug fashion in that case. Supporting all of the above would be much more complex than any of them individually, just because new features are always multiplicative rather than additive. As a point of comparison, Vim decided to take on the complexity of multiple native ports long ago, so it already supports all those clipboard APIs and more. In fact, Vim's so portable that one of the early goals of the NeoVim fork was to make it less portable, in the name of maintainability. From that point of view, Kakoune's already way ahead of the curve, since it only supports one platform, POSIX. Sadly, the POSIX standard doesn't include any kind of clipboard API. |
In addition to @bhajneet answer, you might want to also use the proper selection for pasting. For me it was causing the use of "middle-click clipboard" instead of the "classic one".
|
link to new page: https://github.com/mawww/kakoune/wiki/Registers---Clipboard |
Also note, if you want the clipboard to work across ssh, you need to enable trusted X11 forwarding. There are two ways to do this:
|
If I yank a word in kakoune, how do I paste it into another editor (e.g. gedit)?
The text was updated successfully, but these errors were encountered: