From ed68edf73252c44de9670e4d1d30e7d3a88fdb7d Mon Sep 17 00:00:00 2001 From: binaryDiv Date: Thu, 1 Nov 2018 01:04:07 +0100 Subject: [PATCH] Added bash dotfiles from kanaya --- .bash_logout | 3 ++ .bash_profile | 10 +++++ .bashrc | 113 ++++++++++++++++++++++++++++++++++++++++++++++++- .profile | 26 ++++++++++++ createlinks.sh | 3 ++ 5 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 .bash_logout create mode 100644 .bash_profile create mode 100644 .profile diff --git a/.bash_logout b/.bash_logout new file mode 100644 index 0000000..0e4e4f1 --- /dev/null +++ b/.bash_logout @@ -0,0 +1,3 @@ +# +# ~/.bash_logout +# diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..be69f23 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,10 @@ +# +# ~/.bash_profile +# + +# Run .profile +[[ -f ~/.profile ]] && . ~/.profile + +# Run .bashrc +[[ -f ~/.bashrc ]] && . ~/.bashrc + diff --git a/.bashrc b/.bashrc index d352c7e..26ee230 100644 --- a/.bashrc +++ b/.bashrc @@ -1 +1,112 @@ -# stub +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# Bash settings +set -o noclobber +shopt -s checkwinsize +export HISTCONTROL=ignorespace + +# Color output +export TERM=xterm-color +export GREP_OPTS='--color=auto' +export LS_OPTS='--color=auto -hFN --group-directories-first' +export LESS="--RAW-CONTROL-CHARS -i" + +man() { + env \ + LESS_TERMCAP_mb=$(printf "\e[1;31m") \ + LESS_TERMCAP_md=$(printf "\e[1;31m") \ + LESS_TERMCAP_me=$(printf "\e[0m") \ + LESS_TERMCAP_se=$(printf "\e[0m") \ + LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ + LESS_TERMCAP_ue=$(printf "\e[0m") \ + LESS_TERMCAP_us=$(printf "\e[1;32m") \ + man "$@" +} + +alias ls='ls ${LS_OPTS}' +alias grep='grep ${GREP_OPTS}' + +# Aliases and color output +alias l='ls -l' +alias la='ls -a' +alias ll='ls -la' +alias dusch='du -sch' +alias sorth='sort -hr' + +alias woman='man' +alias enby='man' + +# Stop Ctrl-S from doing terminally things in vim +vim() +{ + local STTYOPTS="$(stty --save)" + stty stop '' -ixoff + command vim "$@" + stty "$STTYOPTS" +} + +vimdiff() +{ + local STTYOPTS="$(stty --save)" + stty stop '' -ixoff + command vimdiff "$@" + stty "$STTYOPTS" +} + +alias gvimr='gvim --remote-silent' +alias xo='xdg-open' + +alias ps-grep='ps aux | grep' + +alias wine32='env WINEARCH=win32 WINEPREFIX="$HOME/.wine32" wine' + +# TODO: aliases/functions auslagern? + +alias xclip_='xclip -selection clipboard' + +xclip-greppassword() { + grepstr="Password: " + filename="$1" + + if [ "$#" -ge 2 ]; then + grepstr="$1" + filename="$2" + fi + + grep -m 1 "$grepstr" "$filename" | cut -d " " -f 2 | xclip -r -selection clipboard +} + +calc() +{ + echo "$@" | bc +} + +#alias su="su -l" + +# Create and cd to tmp dir +alias cdtmp='cd $(mktemp -d -p ~/tmp/)' + +# Bash prompt +PS1='[\u@\h \W]\$ ' + + TRED='\[\e[0;31m\]' # Red + TGREEN='\[\e[0;32m\]' # Green + TBLUE='\[\e[1;34m\]' # Blue +TWHITEB='\[\e[1;37m\]' # White bold + TRESET='\[\e[0m\]' # Text Reset + +if [[ ${EUID} == 0 ]] ; then + PS1="${TRED}\u@\h ${TBLUE}\w ${TWHITEB}\$ ${TRESET}" +else + PS1="${TGREEN}\u@\h ${TBLUE}\w ${TWHITEB}\$ ${TRESET}" +fi + +export PROMPT_DIRTRIM=3 + +unset TRED TGREEN TBLUE TWHITEB TRESET + diff --git a/.profile b/.profile new file mode 100644 index 0000000..19677c1 --- /dev/null +++ b/.profile @@ -0,0 +1,26 @@ +#!/bin/sh + +# SSH key agent started by systemd user +export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.sock" + +# GPG key stuff +export GPG_TTY=$(tty) + +# Environment variables +export TERMINAL=sakura +export EDITOR=vim +export BC_ENV_ARGS="-lq $HOME/.bcrc" + +# PATH +export PATH="$HOME/bin:$PATH" +#export PATH="/opt/mxe/usr/bin:$PATH" + +# Android SDK stuff +export ANDROID_HOME="/opt/Android_SDK" +export NDK_ROOT="/opt/Android_SDK/ndk-bundle" +export ANDROID_SDK_ROOT="/opt/Android_SDK" +export ANT_ROOT="/usr/bin" + +# Wine: do not change filetype associations +export WINEDLLOVERRIDES=winemenubuilder.exe=d + diff --git a/createlinks.sh b/createlinks.sh index 6e03b9c..1e674c2 100644 --- a/createlinks.sh +++ b/createlinks.sh @@ -42,5 +42,8 @@ makelink_simple() { makelink "$dotfiles/bin/" bin # dotfiles +makelink_simple .profile makelink_simple .bashrc +makelink_simple .bash_profile +makelink_simple .bash_logout