Allow zsh to copy/paste to clipboard

This commit is contained in:
Tom Willemse 2016-10-21 14:51:21 +02:00
parent 20ce605e17
commit 5d5a506f35
4 changed files with 25 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# -*- mode: sh; -*-
zle copy-region-as-kill
print -rn $CUTBUFFER | xsel -bi

View file

@ -0,0 +1,3 @@
# -*- mode: sh; -*-
zle kill-region
print -rn $CUTBUFFER | xsel -bi

View file

@ -0,0 +1,3 @@
# -*- mode: sh; -*-
CUTBUFFER=$(xsel -bo < /dev/null)
zle yank

View file

@ -56,6 +56,22 @@ Load all plugins.
zplug load --verbose zplug load --verbose
#+END_SRC #+END_SRC
Make some widgets for interacting with the clipboard.
#+BEGIN_SRC sh
zle -N x-copy-region-as-kill
zle -N x-kill-region
zle -N x-yank
#+END_SRC
Bind them to keyboard shortcuts.
#+BEGIN_SRC sh
bindkey -e '^[w' x-copy-region-as-kill
bindkey -e '^W' x-kill-region
bindkey -e '^Y' x-yank
#+END_SRC
Initialize completion. This triggers loading of Initialize completion. This triggers loading of
zsh-syntax-highlighting as well. zsh-syntax-highlighting as well.