From: Jannik ZANDER Date: Mon, 9 Jul 2018 17:02:25 +0000 (+0200) Subject: Fix completion in debian X-Git-Url: https://git.zndr.dk/?a=commitdiff_plain;h=f48c0f115aa52089a82dce18c6bcde7d9b948aa5;p=dotfiles.git Fix completion in debian --- diff --git a/.bash_aliases b/.bash_aliases new file mode 100644 index 0000000..7bd734a --- /dev/null +++ b/.bash_aliases @@ -0,0 +1,72 @@ +# ls with coloring +lsflags="-hF" + +# Detect which `ls` flavor is in use +if [ -x "$(which dircolors 2>/dev/null)" ]; then # GNU `ls` + colorflag="--color=auto" + lsflags="$lsflags -I NTUSER.\* -I ntuser.\*" +else # OS X `ls` + export CLICOLOR=1 + colorflag="-G" +fi + +alias ls="ls $colorflag $lsflags" +alias sl=ls +alias la='ls -A' +alias ll='ls -l' +alias l1='ls -1' +alias l.='ls -d .[a-z]*' + +# grep and less with coloring +alias grep='grep --color=auto' +alias egrep='egrep --color=auto' +alias fgrep='fgrep --color=auto' +alias less='less -m -N -g -i -J --underline-special --SILENT -X' +alias more='less' + +# Secure settings +alias rm='rm -i' +alias cp='cp -i' +alias mv='mv -i' +alias md='mkdir -p' +alias rd='rmdir' + +# My shortcuts +alias h='history' +alias q='exit' +alias e='ranger-cd' +alias o='rifle' +alias open='xdg-open &>/dev/null' +alias info='info --vi-keys' +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="//"' + +if [ ! -x "$(which tree 2>/dev/null)" ] +then + alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" +fi + +# Enable aliases to be sudo'ed +alias sudo='sudo ' + +# Get week number +alias week='date +%V' + +# Make directory named todays date +alias mkdate='mkdir "$(date +'%Y%m%d')"' + +# Stopwatch +alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' + +# Automatically change the directory in bash after closing ranger +function ranger-cd +{ + tempfile="$(mktemp -t tmp.XXXXXX)" + ranger --choosedir="$tempfile" "${@:-$(pwd)}" + test -f "$tempfile" && + if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then + cd -- "$(cat "$tempfile")" + fi + rm -f -- "$tempfile" +} diff --git a/.bash_completion b/.bash_completion new file mode 100644 index 0000000..fb39c4e --- /dev/null +++ b/.bash_completion @@ -0,0 +1,10 @@ +# Add tab completion for `dit` by marking it as an alias for `git` +_completion_loader git +if type _git &>/dev/null; then + complete -o "default" -o "nospace" -F _git dit; +fi; + +# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards +if [ -e ~/.ssh/config ]; then + complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh; +fi; diff --git a/.bashrc b/.bashrc index 8cb3282..813e386 100644 --- a/.bashrc +++ b/.bashrc @@ -70,10 +70,8 @@ elif [[ -f /usr/share/source-highlight/src-hilite-lesspipe.sh ]]; then fi export LESS=" -R " -# Load aliases, functions, etc -for file in ${HOME}/.config/bash/*.sh; do - [ -f "$file" ] && . "$file"; -done; - -# last line for local things +# Load completion, aliases, and local +[ -f /etc/bash_completion ] && . /etc/bash_completion +#[ -f ~/.bash_completion ] && . ~/.bash_completion; +[ -f ~/.bash_aliases ] && . ~/.bash_aliases; [ -f ~/.bashrc.local ] && . ~/.bashrc.local diff --git a/.config/bash/aliases.sh b/.config/bash/aliases.sh deleted file mode 100644 index 7bd734a..0000000 --- a/.config/bash/aliases.sh +++ /dev/null @@ -1,72 +0,0 @@ -# ls with coloring -lsflags="-hF" - -# Detect which `ls` flavor is in use -if [ -x "$(which dircolors 2>/dev/null)" ]; then # GNU `ls` - colorflag="--color=auto" - lsflags="$lsflags -I NTUSER.\* -I ntuser.\*" -else # OS X `ls` - export CLICOLOR=1 - colorflag="-G" -fi - -alias ls="ls $colorflag $lsflags" -alias sl=ls -alias la='ls -A' -alias ll='ls -l' -alias l1='ls -1' -alias l.='ls -d .[a-z]*' - -# grep and less with coloring -alias grep='grep --color=auto' -alias egrep='egrep --color=auto' -alias fgrep='fgrep --color=auto' -alias less='less -m -N -g -i -J --underline-special --SILENT -X' -alias more='less' - -# Secure settings -alias rm='rm -i' -alias cp='cp -i' -alias mv='mv -i' -alias md='mkdir -p' -alias rd='rmdir' - -# My shortcuts -alias h='history' -alias q='exit' -alias e='ranger-cd' -alias o='rifle' -alias open='xdg-open &>/dev/null' -alias info='info --vi-keys' -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="//"' - -if [ ! -x "$(which tree 2>/dev/null)" ] -then - alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" -fi - -# Enable aliases to be sudo'ed -alias sudo='sudo ' - -# Get week number -alias week='date +%V' - -# Make directory named todays date -alias mkdate='mkdir "$(date +'%Y%m%d')"' - -# Stopwatch -alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' - -# Automatically change the directory in bash after closing ranger -function ranger-cd -{ - tempfile="$(mktemp -t tmp.XXXXXX)" - ranger --choosedir="$tempfile" "${@:-$(pwd)}" - test -f "$tempfile" && - if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then - cd -- "$(cat "$tempfile")" - fi - rm -f -- "$tempfile" -} diff --git a/.config/bash/completion.sh b/.config/bash/completion.sh deleted file mode 100644 index 938c3af..0000000 --- a/.config/bash/completion.sh +++ /dev/null @@ -1,12 +0,0 @@ -# Add tab completion for many Bash commands -[ -f /etc/bash_completion ] && . /etc/bash_completion - -# 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 dit; -fi; - -# Add tab completion for SSH hostnames based on ~/.ssh/config, ignoring wildcards -if [ -e "$HOME/.ssh/config" ]; then - complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh; -fi; diff --git a/.profile b/.profile index 13555ca..9d47161 100644 --- a/.profile +++ b/.profile @@ -20,8 +20,3 @@ fi #export XDG_DATA_HOME=$HOME/.local/share/ #export XDG_DATA_DIRS=/usr/local/share/:/usr/share/ -################################# DEBIAN LOCAL SETTINGS ##### TO BE MOVED #### - -export QT_STYLE_OVERRIDE=adwaita-dark -#export JAVA_HOME='/usr/lib/jvm/java-8-openjdk-amd64' -