Allow zsh to copy/paste to clipboard
This commit is contained in:
parent
20ce605e17
commit
5d5a506f35
4 changed files with 25 additions and 0 deletions
3
zsh/.zsh/functions/x-copy-region-as-kill
Normal file
3
zsh/.zsh/functions/x-copy-region-as-kill
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# -*- mode: sh; -*-
|
||||||
|
zle copy-region-as-kill
|
||||||
|
print -rn $CUTBUFFER | xsel -bi
|
3
zsh/.zsh/functions/x-kill-region
Normal file
3
zsh/.zsh/functions/x-kill-region
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# -*- mode: sh; -*-
|
||||||
|
zle kill-region
|
||||||
|
print -rn $CUTBUFFER | xsel -bi
|
3
zsh/.zsh/functions/x-yank
Normal file
3
zsh/.zsh/functions/x-yank
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# -*- mode: sh; -*-
|
||||||
|
CUTBUFFER=$(xsel -bo < /dev/null)
|
||||||
|
zle yank
|
|
@ -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.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue