vdotfiles

Cem's Dotfiles for Void Linux
git clone git://git.ckyln.com/vdotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit fe858406b9405728227a890a9c300c7466721e6c
parent 4d4f9110fc9c7f8c23f867cbed68000889fedac1
Author: Cem Keylan <cem@ckyln.com>
Date:   Thu, 14 Nov 2019 15:09:30 +0300

simple clip manager in shell

Diffstat:
A.local/bin/sclip | 38++++++++++++++++++++++++++++++++++++++
M.zshrc | 2++
2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/.local/bin/sclip b/.local/bin/sclip @@ -0,0 +1,38 @@ +#!/bin/sh + +# Dumb clipboard manager for tty + +usage() { + cat <<EOF +usage: ${0##*/} [option] + +You can pipe into sclip in order to copy a text + + Options: + -p Print clipboard content to stdout + -d Delete clipboard content + -o Pipe the text inserted to stdout + + -h/--help Print this help message + +sclip is a simple clipboard manager intended for +clip management on tty, with great flexibility. +EOF +exit 1 +} +[ "$1" = "-h" ] || [ "$1" = "--help" ] && usage + +mkdir -p "$HOME/.cache" + +while getopts ':pdo' args; do + case $args in + p) cat "$HOME/.cache/clipboard"; exit ;; + d) printf "" > "$HOME/.cache/clipboard"; exit ;; + o) stdout="1" ;; + :) printf "${0##*/}: option $OPTARG requires an argument\\n"; exit 1 ;; + ?) printf "${0##*/}: invalid option -- $OPTARG\\n" ; exit 1 ;; + esac +done +cat > "$HOME/.cache/clipboard" +[ -z "$stdout" ] && exit 0 +cat "$HOME/.cache/clipboard"; exit 0 diff --git a/.zshrc b/.zshrc @@ -131,6 +131,8 @@ lfcd () { bindkey -s '^e' "scriptedit\n" scriptedit() {ls $HOME/.local/bin/ | fzf | xargs -r -I {} $EDITOR $HOME/.local/bin/{};} gcnb() {git branch $1 && git checkout $1;} +copys() { printf "$1" | sclip ;} +xtos() { xclip -selection clipboard -o | sclip } # Stolen from Luke Smith # Change cursor shape for different vi modes.