From 3daf1fff7751ffedffd1ea7c471ccb4d4436ca5c Mon Sep 17 00:00:00 2001 From: Nikolas Weger Date: Wed, 11 Dec 2019 14:28:27 +0100 Subject: [PATCH] updated stuff --- zsh/.zshrc | 8 +++- zsh/libs/clipboard.zsh | 86 ------------------------------------------ zsh/libs/functions.zsh | 79 -------------------------------------- 3 files changed, 6 insertions(+), 167 deletions(-) delete mode 100644 zsh/libs/clipboard.zsh diff --git a/zsh/.zshrc b/zsh/.zshrc index 1aee8bb..647c2ba 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -5,8 +5,12 @@ fi source $ZDOTDIR/exports.zsh source $ZDOTDIR/dircolor.zsh -source $share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh -source $share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme +if [[ $(hostname) == "megumi" || $(hostname) == "sayaka" ]]; then + source $share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh + source $share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme +else + source $share/zsh-autosuggestions/zsh-autosuggestions.zsh +fi autoload -Uz compinit if [[ -n $HOME/.cache/zsh/compdump(#qN.mh+24) ]]; then compinit -d $HOME/.cache/zsh/compdump; else compinit -d $HOME/.cache/zsh/compdump -C; fi diff --git a/zsh/libs/clipboard.zsh b/zsh/libs/clipboard.zsh deleted file mode 100644 index 2c93d1b..0000000 --- a/zsh/libs/clipboard.zsh +++ /dev/null @@ -1,86 +0,0 @@ -# System clipboard integration -# -# This file has support for doing system clipboard copy and paste operations -# from the command line in a generic cross-platform fashion. -# -# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other -# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the -# "system clipboard", and the X Windows `xclip` command must be installed. - -# clipcopy - Copy data to clipboard -# -# Usage: -# -# | clipcopy - copies stdin to clipboard -# -# clipcopy - copies a file's contents to clipboard -# -function clipcopy() { - emulate -L zsh - local file=$1 - if [[ $OSTYPE == darwin* ]]; then - if [[ -z $file ]]; then - pbcopy - else - cat $file | pbcopy - fi - elif [[ $OSTYPE == cygwin* ]]; then - if [[ -z $file ]]; then - cat > /dev/clipboard - else - cat $file > /dev/clipboard - fi - else - if (( $+commands[xclip] )); then - if [[ -z $file ]]; then - xclip -in -selection clipboard - else - xclip -in -selection clipboard $file - fi - elif (( $+commands[xsel] )); then - if [[ -z $file ]]; then - xsel --clipboard --input - else - cat "$file" | xsel --clipboard --input - fi - else - print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 - return 1 - fi - fi -} - -# clippaste - "Paste" data from clipboard to stdout -# -# Usage: -# -# clippaste - writes clipboard's contents to stdout -# -# clippaste | - pastes contents and pipes it to another process -# -# clippaste > - paste contents to a file -# -# Examples: -# -# # Pipe to another process -# clippaste | grep foo -# -# # Paste to a file -# clippaste > file.txt -function clippaste() { - emulate -L zsh - if [[ $OSTYPE == darwin* ]]; then - pbpaste - elif [[ $OSTYPE == cygwin* ]]; then - cat /dev/clipboard - else - if (( $+commands[xclip] )); then - xclip -out -selection clipboard - elif (( $+commands[xsel] )); then - xsel --clipboard --output - else - print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 - return 1 - fi - fi -} diff --git a/zsh/libs/functions.zsh b/zsh/libs/functions.zsh index 61dfa47..2fa8ad2 100644 --- a/zsh/libs/functions.zsh +++ b/zsh/libs/functions.zsh @@ -1,15 +1,3 @@ -function zsh_stats() { - fc -l 1 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20 -} - -function uninstall_oh_my_zsh() { - env ZSH=$ZSH sh $ZSH/tools/uninstall.sh -} - -function upgrade_oh_my_zsh() { - env ZSH=$ZSH sh $ZSH/tools/upgrade.sh -} - function take() { mkdir -p $@ && cd ${@:$#} } @@ -17,7 +5,6 @@ function take() { function open_command() { local open_cmd - # define the open command case "$OSTYPE" in darwin*) open_cmd='open' ;; cygwin*) open_cmd='cygstart' ;; @@ -34,92 +21,26 @@ function open_command() { ${=open_cmd} "$@" &>/dev/null } -# -# Get the value of an alias. -# -# Arguments: -# 1. alias - The alias to get its value from -# STDOUT: -# The value of alias $1 (if it has one). -# Return value: -# 0 if the alias was found, -# 1 if it does not exist -# function alias_value() { (( $+aliases[$1] )) && echo $aliases[$1] } -# -# Try to get the value of an alias, -# otherwise return the input. -# -# Arguments: -# 1. alias - The alias to get its value from -# STDOUT: -# The value of alias $1, or $1 if there is no alias $1. -# Return value: -# Always 0 -# function try_alias_value() { alias_value "$1" || echo "$1" } -# -# Set variable "$1" to default value "$2" if "$1" is not yet defined. -# -# Arguments: -# 1. name - The variable to set -# 2. val - The default value -# Return value: -# 0 if the variable exists, 3 if it was set -# function default() { (( $+parameters[$1] )) && return 0 typeset -g "$1"="$2" && return 3 } -# -# Set environment variable "$1" to default value "$2" if "$1" is not yet defined. -# -# Arguments: -# 1. name - The env variable to set -# 2. val - The default value -# Return value: -# 0 if the env variable exists, 3 if it was set -# function env_default() { (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0 export "$1=$2" && return 3 } - -# Required for $langinfo zmodload zsh/langinfo -# URL-encode a string -# -# Encodes a string using RFC 2396 URL-encoding (%-escaped). -# See: https://www.ietf.org/rfc/rfc2396.txt -# -# By default, reserved characters and unreserved "mark" characters are -# not escaped by this function. This allows the common usage of passing -# an entire URL in, and encoding just special characters in it, with -# the expectation that reserved and mark characters are used appropriately. -# The -r and -m options turn on escaping of the reserved and mark characters, -# respectively, which allows arbitrary strings to be fully escaped for -# embedding inside URLs, where reserved characters might be misinterpreted. -# -# Prints the encoded string on stdout. -# Returns nonzero if encoding failed. -# -# Usage: -# omz_urlencode [-r] [-m] [-P] -# -# -r causes reserved characters (;/?:@&=+$,) to be escaped -# -# -m causes "mark" characters (_.!~*''()-) to be escaped -# -# -P causes spaces to be encoded as '%20' instead of '+' function omz_urlencode() { emulate -L zsh zparseopts -D -E -a opts r m P