Termux variant

This commit is contained in:
2024-02-28 12:48:12 +01:00
parent e9a01401bb
commit fba5b40824
98 changed files with 125 additions and 17866 deletions

102
.bashrc
View File

@@ -1,65 +1,59 @@
#### BASH Config file
### Jan Andrle
## Info:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) for examples
export EDITOR='vim'
BASH_DOTFILES=$HOME/.bash
[ -f $BASH_DOTFILES/.bash_aliases ] && . $BASH_DOTFILES/.bash_aliases
shopt -s expand_aliases
[ -f $BASH_DOTFILES/.bash_jaaENV ] && . $BASH_DOTFILES/.bash_jaaENV
[ -f $BASH_DOTFILES/.bash_sdkman ] && . $BASH_DOTFILES/.bash_sdkman
[ -f $BASH_DOTFILES/.bash_nvm ] && . $BASH_DOTFILES/.bash_nvm
# Install Ruby Gems to ~/.local/share/gems
export GEM_HOME="$HOME/.local/share/gems"
export PATH="$HOME/.local/share/gems/bin:$HOME/.local/bin:$PATH"
[ -f $BASH_DOTFILES/.bash_completions ] && . $BASH_DOTFILES/.bash_completions # for Vim
export GREP_COLOR="1;32"
export EDITOR="vim"
export SUDO_EDITOR="vim"
export VISUAL="vim"
[[ -f /etc/bashrc ]] && . /etc/bashrc # Source global definitions
[ -d "$HOME/bin" ] && PATH="$HOME/bin:$PATH"
[[ $- != *i* ]] && return # If not running interactively, don't do anything
## General
set -o vi # VIM mode for bash
export HISTCONTROL=ignoreboth:erasedups
shopt -s histappend cmdhist
shopt -s histverify
export HISTSIZE=1000
export HISTFILESIZE=2000
set -o vi
bind -m vi-command 'Control-l: clear-screen'
bind -m vi-insert 'Control-l: clear-screen'
export MANPAGER="/bin/sh -c \"col -b | vim --not-a-term -c 'set ft=man ts=8 nomod nolist noma' -\""
shopt -s checkwinsize # dynamic columns update after every cmd
## History
export HISTCONTROL=ignoreboth:erasedups # No duplicate entries and started with spaces. See bash(1) for more options
shopt -s histappend cmdhist # saving multiline + append
export HISTFILESIZE=10000 # increase history file size (default is 500)
export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
export HSTR_CONFIG=hicolor,prompt-bottom
export HSTR_PROMPT='?: '
## UI/UX
# clors for .inputrc (set colored-stats On)
export LS_COLORS=$LS_COLORS:'tw=01;04;34:ow=01;04;34:'
# set variable identifying the chroot you work in (used in the prompt below)
[ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ] && debian_chroot=$(cat /etc/debian_chroot)
# Set a fancy prompt (non-color, unless we know we "want" color)
[[ $TERM == "xterm-color" ]] || [[ $TERM == *-256color ]] && color_prompt=yes
[ ! -x /usr/bin/tput ] || ! tput setaf 1 >&/dev/null && color_prompt=
[ -f $BASH_DOTFILES/.bash_promt ] && . $BASH_DOTFILES/.bash_promt
alias myip='curl -s -m 5 https://ipleak.net/json/'
alias q='exit'
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
fi
export GPG_TTY=$(tty)
alias myls='ls -pQFhA --group-directories-first'
alias myrm='rm -vi'
alias mycp='cp -vi'
alias mymv='mv -vi'
alias mydf='df -Th'
alias myless='less -R -S'
mylsl(){ mls -l $* --color=always | mless; }
# HSTR configuration - add this to ~/.bashrc
# if this is interactive shell, then bind hstr to Ctrl-space
if [[ $- =~ .*i.* ]]; then bind '"\C-@": "\e^ihstr -- \n"'; fi
myup(){ cd $(eval printf '../'%.0s {1..$1}); }
mkcd(){ mkdir -p "${1:?}" && cd "${1}"; }
update(){ ~/update.sh && mv ~/update_new.sh ~/update.sh; }
myping(){ # Pings ip address of noip.com and www.google.com.
ping -c 1 -q 8.23.224.107 | grep --color=never -A 1 -i '\---'
ping -c 1 -q www.google.com | grep --color=never -A 1 -i '\---'
}
pushd(){ builtin pushd "$@" >/dev/null && dirs -v; }
popd() { builtin popd "$@" >/dev/null && dirs -v; }
usevim() { ln -s $PREFIX/bin/vim ~/bin/termux-file-editor; }
LAST_PWD_PATH="$(dirname "${BASH_SOURCE[0]}")/.bash_last_pwd"
[ -f "$LAST_PWD_PATH" ] && OLDPWD=`cat $LAST_PWD_PATH`
cd(){ builtin cd "$@" && echo `pwd` > "$LAST_PWD_PATH"; }
# termux-setup-storage