If I yank a word in kakoune, how do I paste it into another editor (e.g. gedit)?
I have read How to make vim paste from (and copy to) system's clipboard? since vim is very similar but kakoune does not have any *
register.
If I yank a word in kakoune, how do I paste it into another editor (e.g. gedit)?
I have read How to make vim paste from (and copy to) system's clipboard? since vim is very similar but kakoune does not have any *
register.
Just so you are aware, there is also a great plugin to help with this issue. Kakboard works everywhere, including Mac, Xorg and even Wayland environments. You can also set your own custom command in more exotic environments by setting the kakboard_(copy|paste)_cmd
options.
Cross-platform, or platform-agnostic solution:
The system clipboard will update automatically when you yank.
Note, for linux, I use wl-copy for wayland.
hook global RegisterModified '"' %{ nop %sh{
case $(uname) in
Linux)
wl-copy -n "$kak_main_reg_dquote" > /dev/null 2>&1 & ;;
Darwin)
printf "%s" "$kak_main_reg_dquote" | pbcopy ;;
esac
}}
To add to the accepted answer, according to the documentation if your version of Kakoune is post July 2020 then you can add the following hook to your kakrc:
hook global RegisterModified '"' %{ nop %sh{
printf %s "$kak_main_reg_dquote" | xsel --input --clipboard
}}
In case all the links go away this is the complete solution:
Explanation:
<a-|>
pipes the current selection to what follows.xsel
is a program for manipulating X's clipboard.--input
tellsxsel
to read from stdin.--clipboard
tellsxsel
which 'selection' store to use. There are three of them and you want 'clipboard' in order to paste elsewhere.This will work on Linux. Not sure about MacOS, I'd imagine piping to
pbcopy
would Just Work.EDIT: To make live easier define a key binding in User mode like so (in your
.kakrc
):Now you can select the text and press
,y
to yank to the system clipboard. The leading comma tells Kakoune to look for the key binding in User mode.