mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 01:43:15 +00:00
zsh-clipboard: init at 1.0 (#115450)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
parent
c8919c6f14
commit
ea0e582d8a
40
pkgs/shells/zsh/zsh-clipboard/clipboard.plugin.zsh
Normal file
40
pkgs/shells/zsh/zsh-clipboard/clipboard.plugin.zsh
Normal file
@ -0,0 +1,40 @@
|
||||
_cb-yank() {
|
||||
AA=$(clippaste 2>/dev/null) && CUTBUFFER="$AA"
|
||||
zle yank
|
||||
}
|
||||
_cb-kill-line() {
|
||||
zle kill-line
|
||||
printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
|
||||
}
|
||||
_cb-kill-whole-line() {
|
||||
zle kill-whole-line
|
||||
printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
|
||||
}
|
||||
_cb-kill-word() {
|
||||
zle kill-word
|
||||
printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
|
||||
}
|
||||
_cb-backward-kill-word() {
|
||||
zle backward-kill-word
|
||||
printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
|
||||
}
|
||||
_cb-copy-region-as-kill() {
|
||||
## https://unix.stackexchange.com/questions/19947/
|
||||
zle copy-region-as-kill
|
||||
zle set-mark-command -n -1
|
||||
printf "%s" "$CUTBUFFER" | clipcopy 2>/dev/null
|
||||
}
|
||||
|
||||
zle -N _cb-yank
|
||||
zle -N _cb-kill-line
|
||||
zle -N _cb-kill-whole-line
|
||||
zle -N _cb-kill-word
|
||||
zle -N _cb-backward-kill-word
|
||||
zle -N _cb-copy-region-as-kill
|
||||
|
||||
bindkey '^y' _cb-yank
|
||||
bindkey '^k' _cb-kill-line
|
||||
bindkey '^u' _cb-kill-whole-line
|
||||
bindkey '\ed' _cb-kill-word
|
||||
bindkey '\e^?' _cb-backward-kill-word
|
||||
bindkey '\ew' _cb-copy-region-as-kill
|
27
pkgs/shells/zsh/zsh-clipboard/default.nix
Normal file
27
pkgs/shells/zsh/zsh-clipboard/default.nix
Normal file
@ -0,0 +1,27 @@
|
||||
{ stdenv, lib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "zsh-clipboard";
|
||||
version = "1.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
install -D -m0444 -t $out/share/zsh/plugins/clipboard ./clipboard.plugin.zsh
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Ohmyzsh plugin that integrates kill-ring with system clipboard";
|
||||
longDescription = ''
|
||||
Ohmyzsh plugin that integrates kill-ring with system clipboard.
|
||||
|
||||
Key bindings for C-y, C-k, C-u, M-d, M-backspace and M-w are rebound.
|
||||
Behaviour of these keys should not be changed.
|
||||
'';
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ bb2020 ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
@ -9655,6 +9655,8 @@ in
|
||||
|
||||
zsh-bd = callPackage ../shells/zsh/zsh-bd { };
|
||||
|
||||
zsh-clipboard = callPackage ../shells/zsh/zsh-clipboard { };
|
||||
|
||||
zsh-git-prompt = callPackage ../shells/zsh/zsh-git-prompt { };
|
||||
|
||||
zsh-history = callPackage ../shells/zsh/zsh-history { };
|
||||
|
Loading…
Reference in New Issue
Block a user