From f955ff59fcb99f6d789bae54f82625596f7c4133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Sat, 26 Apr 2014 16:45:54 +0200 Subject: [PATCH] Merge bash with zsh config and remove bash config. --- bash/bash_aliases | 46 -------------------- bash/bash_functions | 91 --------------------------------------- bash/bash_greeting | 11 ----- bash/bash_logout | 7 --- bash/bash_profile | 3 -- bash/bash_prompt | 18 -------- bash/bash_variables | 7 --- bash/bashrc | 60 -------------------------- scripts/setup.bash | 2 +- zsh/zshrc | 101 ++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 102 insertions(+), 244 deletions(-) delete mode 100644 bash/bash_aliases delete mode 100644 bash/bash_functions delete mode 100644 bash/bash_greeting delete mode 100644 bash/bash_logout delete mode 100644 bash/bash_profile delete mode 100644 bash/bash_prompt delete mode 100644 bash/bash_variables delete mode 100644 bash/bashrc diff --git a/bash/bash_aliases b/bash/bash_aliases deleted file mode 100644 index 0623cea..0000000 --- a/bash/bash_aliases +++ /dev/null @@ -1,46 +0,0 @@ -# File to define bash aliases. Read by ~/.bashrc. - -alias ll='ls -AlF' -alias la='ls -A' - -alias ls='ls --group-directories-first --classify --color=auto' - -alias grep='grep --color=auto' -alias fgrep='fgrep --color=auto' -alias egrep='egrep --color=auto' - -alias rm='rm -v' -alias cp='cp -v' -alias mv='mv -v' -alias ln='ln -v' - -#alias 'sudo rm -rf --no-preserve-root /'='echo "..."' -#alias 'sudo find / -delete'='echo "..."' - -alias du='du -h' -alias df='df -h' - -alias ..='cd ..' -alias ...='cd ../..' -alias ....='cd ../../..' -alias .....='cd ../../../..' - -alias root='sudo -sE' - -alias back='cd $OLDPWD' - -alias more='less' - -alias sag='sudo apt-get' -alias sagi='sudo apt-get install' -alias sagu='sudo apt-get update' -alias sagug='sudo apt-get upgrade' -alias sagdug='sudo apt-get dist-upgrade' -alias sources='cat /etc/apt/sources.list /etc/apt/sources.list.d/*' - -alias cs="cryptsetup" - -alias le_haxxor_1='clear && dmesg | pv -qL $[15 + (RANDOM % 10)]' -alias le_haxxor_2='clear && hexdump -C /dev/urandom | grep "1e 4c"' - -alias YOLO="pacman -Syu --force" diff --git a/bash/bash_functions b/bash/bash_functions deleted file mode 100644 index 4f33d76..0000000 --- a/bash/bash_functions +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# File to define bash functions. Read by ~/.bashrc. - -function mount() { - if [[ $# == 0 ]] ; then - /usr/bin/env mount | column -t - else - /usr/bin/env mount $* - fi -} - -ff() { - find . -type f -iname "*"$*"*" ; -} - -ffcs() { - find . -type f -name "*"$*"*" ; -} - -extract() # Handy Extract Program. -{ - if [ -f $1 ] ; then - case $1 in - *.tar.bz2 ) tar xvjf $1 ;; - *.tar.gz ) tar xvzf $1 ;; - *.bz2 ) bunzip2 $1 ;; - *.rar ) unrar x $1 ;; - *.gz ) gunzip $1 ;; - *.tar ) tar xvf $1 ;; - *.tbz2 ) tar xvjf $1 ;; - *.tgz ) tar xvzf $1 ;; - *.zip ) unzip $1 ;; - *.Z ) uncompress $1 ;; - *.7z ) 7z x $1 ;; - *) echo "$1 cannot be extracted via extract()" ;; - esac - else - echo "$1 is not a valid file" - fi -} - -update() { - sudo bash -c "apt-get update && apt-get -y dist-upgrade && apt-get -y autoremove" -} - -showclock() { - while : ; do - clear - echo "========" - date +"%T" - echo "========" - sleep 1 - done -} - -ruler() { - for s in '....^....|' '1234567890'; do - w=${#s} - str=$(for (( i=1; $i<=$(( ($COLUMNS + $w) / $w )) ; i=$i+1 )); do echo -n $s; done ) - str=$(echo $str | cut -c -$COLUMNS) - echo $str - done -} - -up() { - [ "${1/[^0-9]/}" == "$1" ] && { - local ups="" - for i in $(seq 1 $1) - do - ups=$ups"../" - done - cd $ups - } || echo "usage: up " -} - -ckwww() { - ping -c 3 www.google.com -} - -topcmds() { - history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -nr | head -} - -fnottype() { - find . -maxdepth 1 ! -type $1 -} - -# simple calculator -c () { - echo "$*" | bc -l -} diff --git a/bash/bash_greeting b/bash/bash_greeting deleted file mode 100644 index 790366b..0000000 --- a/bash/bash_greeting +++ /dev/null @@ -1,11 +0,0 @@ -# File with instructions to greet the user. Read at the end of ~/.bashrc - -#COUNTER_DESTROYED=3 - - -clear -#echo -ne "${NC}Hello, $USER. Today is $(date +"%A, %-d %B %Y, %T")\n\n" -#echo -ne "${NC}" ; ncal -MC -#echo -ne "${NC}System is $(uptime | grep -o "up.*:[[:digit:]][[:digit:]]" | tr -s " ") hours\n" -#echo -ne "${NC}Your personal counter for destroyed linuxes is: $COUNTER_DESTROYED\n" -#echo -ne "${NC}Keep it up and have fun.\n" diff --git a/bash/bash_logout b/bash/bash_logout deleted file mode 100644 index de4f5f7..0000000 --- a/bash/bash_logout +++ /dev/null @@ -1,7 +0,0 @@ -# ~/.bash_logout: executed by bash(1) when login shell exits. - -# when leaving the console clear the screen to increase privacy - -if [ "$SHLVL" = 1 ]; then - [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q -fi diff --git a/bash/bash_profile b/bash/bash_profile deleted file mode 100644 index 7a55c40..0000000 --- a/bash/bash_profile +++ /dev/null @@ -1,3 +0,0 @@ -f [ -n "$DISPLAY" ]; then - BROWSER=firefox -fi diff --git a/bash/bash_prompt b/bash/bash_prompt deleted file mode 100644 index 76d7d29..0000000 --- a/bash/bash_prompt +++ /dev/null @@ -1,18 +0,0 @@ -### File to set the prompt of bash. Read by ~/.bashrc -### -### Usable veriables: -### \h Hostname auf dem die Shell läuft bis zum ersten "." -### \H Hostname komplett -### \t Uhrzeit im 24-Stunden Format (hh:mm:ss) -### \T Uhrzeit im 12-Stunden Format (hh:mm:ss) -### \u Name des Nutzers, der die Shell gestartet hat -### \w momentanes Arbeitsverzeichnis -### \W letzte Komponente des Arbeitsverzeichnisses -### \$ Wenn root ein "#", sonst ein "$" -### \\ Backslash - -export PS1="\[${BLUE}\][\t] [\!] \[${GREEN}\]\u\[${NC}\]@\[${RED}\]\h\[${NC}\]:\[${YELLOW}\] \w \[${NC}\]\$> " - -#export PS1=">" - -#export PS1="[\t] [\!] \u@\h: \w \$> " diff --git a/bash/bash_variables b/bash/bash_variables deleted file mode 100644 index 88b5ff7..0000000 --- a/bash/bash_variables +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -export USERBIN=$HOME/bin - -export ENCFS_MOUNT="$HOME/.crypt/encfs/mount" -export ENCFS_DEV="$HOME/.crypt/encfs/dev" - -export MOZ_DISABLE_PANGO=1 diff --git a/bash/bashrc b/bash/bashrc deleted file mode 100644 index d08ab7c..0000000 --- a/bash/bashrc +++ /dev/null @@ -1,60 +0,0 @@ -# If not interactive, do nothing. -[ -z "$PS1" ] && return - -HISTCONTROL=ignoreboth -shopt -s histappend -HISTSIZE="unlimited" -HISTFILESIZE="unlimited" -HISTCONTROL=ignorespace - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# make less more friendly for non-text input files, see lesspipe(1) -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in -if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -BLACK='\e[0;30m' -BLUE='\e[0;34m' -GREEN='\e[0;32m' -CYAN='\e[0;36m' -RED='\e[0;31m' -PURPLE='\e[0;35m' -BROWN='\e[0;33m' -LIGHTGRAY='\e[0;37m' -DARKGRAY='\e[1;30m' -LIGHTBLUE='\e[1;34m' -LIGHTGREEN='\e[1;32m' -LIGHTCYAN='\e[1;36m' -LIGHTRED='\e[1;31m' -LIGHTPURPLE='\e[1;35m' -YELLOW='\e[1;33m' -WHITE='\e[1;37m' -NC='\e[0m' # No Color - -# Sets default editor. -export EDITOR=vim - -# adding some other program paths to PATH -export PATH=${PATH}:/sbin:/usr/sbin:usr/local/bin -# adding a user's private path if it exists -[ -d ~/bin/ ] && export PATH=${PATH}:${HOME}/bin - -[ -f /etc/bash_completion ] && . /etc/bash_completion - -export BASH_ALIASES="$HOME/.bash_aliases" -export BASH_FUNCTIONS="$HOME/.bash_functions" -export BASH_PROMPT="$HOME/.bash_prompt" -export BASH_GREETING="$HOME/.bash_greeting" -export BASH_VARIABLES="$HOME/.bash_variables" - -[ -f "$BASH_ALIASES" ] && . "$BASH_ALIASES" -[ -f "$BASH_FUNCTIONS" ] && . "$BASH_FUNCTIONS" -[ -f "$BASH_PROMPT" ] && . "$BASH_PROMPT" -[ -f "$BASH_GREETING" ] && . "$BASH_GREETING" -[ -f "$BASH_VARIABLES" ] && . "$BASH_VARIABLES" diff --git a/scripts/setup.bash b/scripts/setup.bash index 806591a..a8f6d1d 100755 --- a/scripts/setup.bash +++ b/scripts/setup.bash @@ -10,7 +10,7 @@ backup_dir="$HOME/.dotfiles.bak/" # the following folders inside $config_dir will be inspected and the # contents symlinked: -symlink_folders='bash git i3 vim zsh conky x mpd ncmpcpp' +symlink_folders='git i3 vim zsh conky x mpd ncmpcpp' MAPPING_SEPARATOR='::' diff --git a/zsh/zshrc b/zsh/zshrc index 904d94a..efde24f 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -59,4 +59,105 @@ man() { [[ $TERM == "urxvt" ]] && export TERM="rxvt-unicode" +### ALIASES +# alias su="su -" + +alias ll='ls -AlF' +alias la='ls -A' + +alias ls='ls --group-directories-first --classify --color=auto' + +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' + +alias rm='rm -v' +alias cp='cp -v' +alias mv='mv -v' +alias ln='ln -v' + +alias du='du -h' +alias df='df -h' + +alias root='sudo -sE' + +alias b='cd $OLDPWD' + +alias cs="cryptsetup" + +alias le_haxxor_1='clear && dmesg | pv -qL $[15 + (RANDOM % 10)]' +alias le_haxxor_2='clear && hexdump -C /dev/urandom | grep "1e 4c"' + +alias YOLO="pacman -Syu --force" + +alias such="git" +alias very="git" +alias much="git" +alias wow="git status" + +### FUNCTIONS + +function mount() { + if [[ $# == 0 ]] ; then + /usr/bin/env mount | column -t + else + /usr/bin/env mount $* + fi +} + +ff() { + find . -type f -iname "*"$*"*" ; +} + +ffcs() { + find . -type f -name "*"$*"*" ; +} + +extract() # Handy Extract Program. +{ + if [ -f $1 ] ; then + case $1 in + *.tar.bz2 ) tar xvjf $1 ;; + *.tar.gz ) tar xvzf $1 ;; + *.bz2 ) bunzip2 $1 ;; + *.rar ) unrar x $1 ;; + *.gz ) gunzip $1 ;; + *.tar ) tar xvf $1 ;; + *.tbz2 ) tar xvjf $1 ;; + *.tgz ) tar xvzf $1 ;; + *.zip ) unzip $1 ;; + *.Z ) uncompress $1 ;; + *.7z ) 7z x $1 ;; + *) echo "$1 cannot be extracted via extract()" ;; + esac + else + echo "$1 is not a valid file" + fi +} + +ruler() { + for s in '....^....|' '1234567890'; do + w=${#s} + str=$(for (( i=1; $i<=$(( ($COLUMNS + $w) / $w )) ; i=$i+1 )); do echo -n $s; done ) + str=$(echo $str | cut -c -$COLUMNS) + echo $str + done +} + +ckwww() { + ping -c 3 www.google.com +} + +topcmds() { + history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -nr | head +} + +fnottype() { + find . -maxdepth 1 ! -type $1 +} + +# simple calculator +c () { + echo "$*" | bc -l +}