From: Jannik ZANDER Date: Wed, 4 Jul 2018 11:27:06 +0000 (+0200) Subject: Bash cleanup X-Git-Url: https://git.zndr.dk/?a=commitdiff_plain;h=46aded53817c81e4d521b46c33c82fd1ab8cfc16;p=dotfiles.git Bash cleanup --- diff --git a/.bashrc b/.bashrc index c4d9c10..3b9326d 100644 --- a/.bashrc +++ b/.bashrc @@ -1,5 +1,12 @@ # .bashrc is for configuring the interactive Bash usage, like Bash aliases, setting favorite editor, setting Bash prompt, etc. +# Set favorites +export SHELL='bash' +export EDITOR='vim' +export VISUAL='vim' +export PAGER='less -eFRX' +export MANPAGER="less -eFRX" + # If not running interactively, don't do anything [[ -z "$PS1" ]] && return @@ -7,7 +14,7 @@ if [[ -z "$MSYS2_PS1" ]]; then PS1='${debian_chroot:+($debian_chroot)}' # debian else - PS1='\[\033]0;$PWD\007\]' # terminal title = PWD + PS1='\[\033]0;$PWD\007\]' # terminal title in msys2 cd ~ GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)" COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}" @@ -19,7 +26,6 @@ else fi fi - PS1="$PS1"'\[\033[01;32m\]' # change color PS1="$PS1"'\u@\h' # user@host PS1="$PS1"'\[\033[00m\]' # change color @@ -40,20 +46,18 @@ export GIT_PS1_HIDE_IF_PWD_IGNORED=1 # Whenever displaying the prompt, write the previous line to disk export PROMPT_COMMAND="history -a;" -# Set favorites -export SHELL='bash' -export EDITOR='vim' -export VISUAL='vim' -export PAGER='less -eFRX' -export MANPAGER="less -eFRX" -export BROWSER='lynx -vikeys -use_mouse' - # Larger bash history export HISTFILESIZE=10000; export HISTSIZE=5000; export HISTCONTROL=ignoreboth:erasedups export HISTIGNORE="ll:ls:cd:cd -:pwd:exit:date:* --help"; +# colored GCC warnings and errors +export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# Highlight section titles in manual pages +export LESS_TERMCAP_md="${yellow}"; + # Load aliases, functions, etc for file in ${HOME}/.config/bash/*; do diff --git a/.config/bash/aliases b/.config/bash/aliases index 2c27026..8059952 100644 --- a/.config/bash/aliases +++ b/.config/bash/aliases @@ -1,4 +1,3 @@ -alias open='xdg-open &>/dev/null' alias sl=ls alias la='ls -A' alias ll='ls -l' @@ -16,55 +15,34 @@ else # OS X `ls` fi alias ls="ls $colorflag $lsflags" + +# grep alias grep='grep --color=auto' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' -alias h='history' - -if [ -e /usr/bin/vimx ]; then alias vim='/usr/bin/vimx'; fi # Shortcuts +alias less='less -erFRX' # raw control characters, don't clear the screen after quitting +alias info='info --vi-keys' +alias open='xdg-open &>/dev/null' +alias h='history' alias dit='git --git-dir=$HOME/.dit --work-tree=$HOME' alias ag='ag --path-to-ignore=$HOME/.ignore --skip-vcs-ignores' alias rg='rg --path-separator="//"' - -# Easier navigation: .., ..., ...., ....., ~ and - -alias ..="cd .." -alias ...="cd ../.." -alias ....="cd ../../.." -alias .....="cd ../../../.." -alias ~="cd ~" # `cd` is probably faster to type though -alias -- -="cd -" -alias cd=cd_func -alias -- --="cd --" -alias -- -0="cd -0" -alias -- -1="cd -1" -alias -- -2="cd -2" -alias -- -3="cd -3" -alias -- -4="cd -4" -alias -- -5="cd -5" -alias -- -6="cd -6" -alias -- -7="cd -7" -alias -- -8="cd -8" -alias -- -9="cd -9" - # Secure settings alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias md='mkdir -p' alias rd='rmdir' -alias mkdate='mkdir "$(date +'%Y%m%d')"' -alias fstab='sudo vim /etc/fstab' + if [ ! -x "$(which tree 2>/dev/null)" ] then alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" fi -alias info='info --vi-keys' -#alias less='less -rX' # raw control characters, don't clear the screen after quitting # Enable aliases to be sudo'ed alias sudo='sudo ' @@ -76,3 +54,5 @@ alias week='date +%V' # Stopwatch alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' +# make date folders +alias mkdate='mkdir "$(date +'%Y%m%d')"' diff --git a/.config/bash/completion b/.config/bash/completion index 6af29cb..938c3af 100644 --- a/.config/bash/completion +++ b/.config/bash/completion @@ -1,9 +1,9 @@ # Add tab completion for many Bash commands [ -f /etc/bash_completion ] && . /etc/bash_completion -# Enable tab completion for `g` by marking it as an alias for `git` +# Enable tab completion for `dit` by marking it as an alias for `git` if type _git &> /dev/null; then - complete -o default -o nospace -F _git g; + complete -o default -o nospace -F _git dit; fi; # Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards diff --git a/.config/user-dirs.dirs b/.config/user-dirs.dirs index 779e1e5..e56ad96 100644 --- a/.config/user-dirs.dirs +++ b/.config/user-dirs.dirs @@ -5,7 +5,7 @@ # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. # -XDG_DESKTOP_DIR="$HOME" +XDG_DESKTOP_DIR="$HOME/cloud" XDG_DOWNLOAD_DIR="$HOME/Download" XDG_TEMPLATES_DIR="$HOME/cloud/Templates" XDG_PUBLICSHARE_DIR="$HOME/cloud/PublicShare" diff --git a/.profile b/.profile index b7ddc9a..97d7b17 100644 --- a/.profile +++ b/.profile @@ -5,21 +5,6 @@ if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi -# colored GCC warnings and errors -export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' - -# Highlight section titles in manual pages -export LESS_TERMCAP_md="${yellow}"; - -# Always enable colored `grep` output -#export GREP_OPTIONS="--color=auto"; - -# Set up syntax highlighting for 'less' (requires source-highlight package) -# See http://www.gnu.org/software/src-highlite/source-highlight.html -# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" -export LESS=-eFRX - - # Prefer US language with SI units (Danish) export LANG="en_DK.UTF-8" @@ -31,26 +16,16 @@ if [ -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs ]; then . ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs export XDG_DESKTOP_DIR XDG_DOWNLOAD_DIR XDG_TEMPLATES_DIR XDG_PUBLICSHARE_DIR XDG_DOCUMENTS_DIR XDG_MUSIC_DIR XDG_PICTURES_DIR XDG_VIDEOS_DIR fi -#export XDG_CONFIG_HOME = $HOME/.config/ -#export XDG_DATA_HOME = $HOME/.local/share/ -#export XDG_DATA_DIRS = /usr/local/share/:/usr/share/ +#export XDG_CONFIG_HOME=$HOME/.config/ +#export XDG_DATA_HOME=$HOME/.local/share/ +#export XDG_DATA_DIRS=/usr/local/share/:/usr/share/ export QT_STYLE_OVERRIDE=adwaita-dark export USERNAME=$LOGNAME export HOSTNAME=`hostname` -echo Welcome $USERNAME. You are on Server: $HOSTNAME !!! +echo Welcome $USERNAME @ $HOSTNAME ! ################################# DEBIAN LOCAL SETTINGS ##### TO BE MOVED #### #export JAVA_HOME='/usr/lib/jvm/java-8-openjdk-amd64' -################################# WINDOWS LOCAL SETTINGS ##### TO BE MOVED #### -export VIRTUALENVWRAPPER_PYTHON=/mingw64/bin/python3 -export GRADLE_USER_HOME=$HOME/.cache/gradle -#export GTEST_DIR='c:/googletest-release-1.7.0' -#export GTEST_DIR='c:/googletest-release-1.8.0' -#export CPPUNITDIR='c:/cppunit-1.12.1' -#export CPPUNITDIR='c:/cppunit-1.13.2' -export CPPUNITDIR_2013='c:/programs/cppunit_2013' -export RTEGENERATEVSCODE=1 -