commit 69a80081b6c4007ec1a3a9db4d9f191d3aae8b29
parent 0c8019395e1e5b1a2d3a1081ebe82ab57a6cd0bd
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 14 May 2020 16:27:06 +0200
Add paste from cclip, add option to remove trailing newline
Diffstat:
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/.local/bin/cclip b/.local/bin/cclip
@@ -7,12 +7,20 @@ toclip() {
fromclip() {
upload -g "$f"
- printf '%s\n' "$(cat "$f")"
+ if [ "$1" = nonewline ]; then
+ printf '%s' "$(cat "$f")"
+ else
+ printf '%s\n' "$(cat "$f")"
+ fi
rm -f "$f"
}
if [ "$1" = "-o" ]; then
- fromclip
+ if [ "$2" = "-n" ]; then
+ fromclip nonewline
+ else
+ fromclip
+ fi
else
toclip
fi
diff --git a/.tmux.conf b/.tmux.conf
@@ -116,6 +116,7 @@ if-shell 'uname | grep -qi Cygwin' 'bind -T copy-mode-vi y send-keys -X copy-pip
# Paste with C-a p or M-p
bind p run "DISPLAY=:0 xclip -o | tmux load-buffer - ; tmux paste-buffer"
bind P run "DISPLAY=:0 xclip -selection clipboard -o | tmux load-buffer - ; tmux paste-buffer"
+bind C-p run "DISPLAY=:0 cclip -o -n | tmux load-buffer - ; tmux paste-buffer"
if-shell 'uname | grep -qi Darwin && which reattach-to-user-namespace > /dev/null' 'bind p run "pbpaste | tmux load-buffer - ; tmux paste-buffer"'
if-shell 'uname | grep -qi Cygwin' 'bind p run "cat /dev/clipboard | tmux load-buffer - ; tmux paste-buffer"'