Skip to content

Commit 76642df

Browse files
committed
termux
1 parent 4694ed2 commit 76642df

File tree

6 files changed

+635
-304
lines changed

6 files changed

+635
-304
lines changed

termux/.bashrc

Lines changed: 100 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
# append to the history file, don't overwrite it
55
shopt -s autocd checkhash checkwinsize cmdhist globstar histappend
66

7+
# EXPORTS
8+
export XDG_CONFIG_HOME="$HOME/.config"
9+
export XDG_DATA_HOME="$HOME/.local/share"
10+
export XDG_CACHE_HOME="$HOME/.cache"
11+
712
# don't put duplicate lines or lines starting with space in the history.
813
HISTCONTROL=ignoreboth
914
HISTFILE=$HOME/.hist_bash
@@ -81,8 +86,8 @@ if test -t 1; then
8186
alias dir='dir --color=auto'
8287
alias vdir='vdir --color=auto'
8388
alias grep='grep --color=auto'
84-
alias fgrep='fgrep --color=auto'
85-
alias egrep='egrep --color=auto'
89+
alias fgrep='grep -F --color=auto'
90+
alias egrep='grep -E --color=auto'
8691
fi
8792

8893
# ALIASES
@@ -93,9 +98,21 @@ alias arch='uname -m'
9398
alias ll='ls -ahlF --group-directories-first'
9499
alias la='ls -A'
95100
alias ..='cd ..'
96-
alias compress_jpeg="find ./ -iname '*.jpg' -or -iname '*.jpeg' -type f -size +100k -exec jpeg-recompress --quality high --method ssim --accurate --min 70 {} {} \;"
97-
alias compress_png="find ./ -iname '*.png' -type f -size +100k -exec optipng {} \;"
98-
101+
alias compress_jpeg="fd -e jpg -e jpeg --size +100k --exec jpeg-recompress --quality high --method ssim --accurate --min 70 {} {} \;"
102+
alias compress_png="fd -e png --size +100k --exec optipng {} \;"
103+
alias cz='chezmoi'
104+
alias cza='chezmoi apply'
105+
alias czaf='chezmoi apply --force'
106+
alias czd='chezmoi diff'
107+
alias czm='chezmoi merge'
108+
alias czs='chezmoi status'
109+
alias scz='sudo chezmoi -D / -S $HOME/.local/share/chezmoi/root -c /root/.config/chezmoi/config.toml'
110+
alias scza='scz apply'
111+
alias sczaf='scz apply --force'
112+
alias sczd='scz diff'
113+
alias sczm='scz merge'
114+
alias sczs='scz status'
115+
alias crlt='curl -w "@$HOME/.config/curl-time-format"'
99116

100117
# CUSTOM FUNCTIONS
101118
command_exists () {
@@ -240,6 +257,14 @@ if command_exists pacman ; then
240257
alias piiy='yay -Sii'
241258
fi
242259

260+
if command_exists paru ; then
261+
alias paru='paru --aur --fm vifm --removemake --clonedir $PERS_DIR/bb'
262+
alias psuy='paru -Syua'
263+
alias pssy='paru -Ss'
264+
alias psiy='paru -Sa'
265+
alias piiy='paru -Sii'
266+
fi
267+
243268
paclist() {
244269
pacman -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'
245270
}
@@ -314,6 +339,7 @@ if command_exists emacs ; then
314339
alias e='emacs -nw'
315340
alias sem="$SUDO emacs -nw"
316341
export EDITOR='editor-run'
342+
export LSP_USE_PLISTS=true
317343
fi
318344
## END EDITORS
319345

@@ -335,30 +361,80 @@ if command_exists nnn ; then
335361
export NNN_USE_EDITOR=1
336362
export NNN_CONTEXT_COLORS='2745'
337363
export NNN_COPIER=$(which xsel)
338-
export NNN_NOTE=/opt/work/backup/notes
364+
export NNN_NOTE=/data/backup/notes
339365
export NNN_OPS_PROG=1
340366
fi
341367
## END FILE MANAGERS
342368

343369
if command_exists git ; then
370+
function git_main_branch() {
371+
command git rev-parse --git-dir &>/dev/null || return
372+
local ref
373+
for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk}; do
374+
if command git show-ref -q --verify $ref; then
375+
echo ${ref:t}
376+
return
377+
fi
378+
done
379+
echo master
380+
}
381+
382+
function git_current_branch() {
383+
local ref
384+
ref=$(__git_prompt_git symbolic-ref --quiet HEAD 2> /dev/null)
385+
local ret=$?
386+
if [[ $ret != 0 ]]; then
387+
[[ $ret == 128 ]] && return # no git repo.
388+
ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return
389+
fi
390+
echo ${ref#refs/heads/}
391+
}
392+
344393
alias g='git'
345-
alias pla='g pull'
346-
alias pll='pla origin'
347-
alias psh='g push origin'
348-
alias gst='g status'
349-
alias gco='g checkout'
350-
alias gadd='g add'
351-
alias gcmt='g commit -m'
394+
alias ga='g add'
395+
alias gb='git branch'
396+
alias gba='git branch -a'
397+
alias gbd='git branch -d'
398+
alias gbdf='git branch -D'
399+
alias gco='git checkout'
400+
alias gcb='git checkout -b'
401+
alias gcm='git checkout "$(git_main_branch)"'
402+
alias gcf='git config --list'
403+
alias gcmt='git commit -v -a -m'
404+
alias gcn='git clone'
405+
alias gd='git diff'
406+
alias gdca='git diff --cached'
407+
alias gf='git fetch'
408+
alias gfo='git fetch origin'
409+
alias gfc='git fetch origin "$(git_current_branch)"'
410+
alias gfm='git fetch origin "$(git_main_branch)"'
411+
alias gl='git pull'
412+
alias glo='git pull origin'
413+
alias glc='git pull origin "$(git_current_branch)"'
414+
alias glm='git pull origin "$(git_main_branch)"'
415+
alias glr='git pull --rebase'
416+
alias gm='git merge'
417+
alias gp='git push'
418+
alias gpo='git push origin'
419+
alias gpc='git push origin "$(git_current_branch)"'
420+
alias gpm='git push origin "$(git_main_branch)"'
421+
alias gr='git remote'
422+
alias gra='git remote add'
423+
alias grv='git remote -v'
424+
alias grb='git rebase'
425+
alias grba='git rebase --abort'
426+
alias grbc='git rebase --continue'
427+
alias grbi='git rebase -i'
428+
alias grhh='git reset --hard'
429+
alias grpo='git remote prune origin'
430+
alias gs='git status'
431+
alias gsb='git status -sb'
352432
fi
353433

354434
if command_exists tmux ; then
355435
alias tm='tmux attach || tmux new'
356436
fi
357437

358-
if command_exists bemenu ; then
359-
export BEMENU_OPTS='-I 0 -i --fn "Hack:26" --nb "#1e1e1e" --nf "#c0f440" --sf "#1e1e1e" --sb "#f4800d" --tb "#d7dd90" --tf "#111206" --hb "#49088c" --hf "#c2fbd3"'
360-
fi
361-
362438
if command_exists shiori ; then
363439
export SHIORI_DIR=/sdcard/Apks/wallet/sync
364440
fi
@@ -376,10 +452,6 @@ if command_exists cargo || [ -d $HOME/.rustup ]; then
376452
alias cup='cargo update'
377453
alias cbd='cargo build'
378454
alias cbr='cargo build --release'
379-
setup_cargo () {
380-
rustup completions zsh cargo > $LOCAL_ZSH_COMP_DIR/_cargo
381-
rustup completions zsh rustup > $LOCAL_ZSH_COMP_DIR/_rustup
382-
}
383455
setup_cargo_tools() {
384456
if ! command_exists cargo-expand; then
385457
cargo install cargo-expand
@@ -437,9 +509,8 @@ fi
437509

438510
## GO
439511
if command_exists go ; then
440-
export GOPATH=$HOME/go
441-
export PATH=$PATH:$GOPATH/bin
442-
export GO111MODULE=on
512+
export GOPATH="$HOME/.local/share/go"
513+
export GOBIN=$LOCAL_BIN
443514
fi
444515

445516
if command_exists fzf ; then
@@ -453,6 +524,7 @@ if command_exists fzf ; then
453524
else
454525
echo "install fzf"
455526
fi
527+
456528
if command_exists lf ; then
457529
lfcd () {
458530
tmp="$(mktemp)"
@@ -490,23 +562,14 @@ fi
490562
## END SCALA
491563

492564
## PYTHON
493-
#if [ -d "$HOME/.pyenv" ]; then
494-
# export PYENV_ROOT="$HOME/.pyenv"
495-
# export PATH="$PYENV_ROOT/bin:$PATH"
496-
# export PYENV_VIRTUALENV_DISABLE_PROMPT=1
497-
# eval "$(pyenv init --path)"
498-
# eval "$(pyenv init -)"
499-
# eval "$(pyenv virtualenv-init -)"
500-
#fi
501-
502565
clean_pyc (){
503566
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
504567
}
505568
## END PYTHON
506569

507570
## NPM
508571
if command_exists npm; then
509-
NPM_PACKAGES="${HOME}/.local"
572+
export NPM_PACKAGES="${HOME}/.local"
510573
export NODE_PATH="$NPM_PACKAGES/lib/node_modules"
511574
fi
512575

@@ -589,9 +652,9 @@ function set_git_branch() {
589652

590653
function set_prompt_symbol () {
591654
if test $1 -eq 0 ; then
592-
P_SYMBOL="${BLUE}\n─➤${NORMAL} "
655+
P_SYMBOL="${BLUE}\n─➤${NORMAL} "
593656
else
594-
P_SYMBOL="${LIGHT_RED}[$1]$INSIDE_VIFM\n─➤${NORMAL} "
657+
P_SYMBOL="${LIGHT_RED}[$1]$INSIDE_VIFM\n─➤${NORMAL} "
595658
fi
596659
}
597660

@@ -616,7 +679,7 @@ function set_bash_prompt () {
616679

617680
# Set the bash prompt variable.
618681
[[ $SSH_CONNECTION ]] && local uath="${YELLOW}@\h${NORMAL}"
619-
PS1="${BLUE}╭─\A${NORMAL} ${USERCOLOR}\u${NORMAL}${uath} ${PURPLE}{\w}${NORMAL}${BRANCH}${P_SYMBOL}"
682+
PS1="${BLUE}\A${NORMAL} ${USERCOLOR}\u${NORMAL}${uath} ${PURPLE}{\w}${NORMAL}${BRANCH}${P_SYMBOL}"
620683
}
621684

622685
# Tell bash to execute this function just before displaying its prompt.

0 commit comments

Comments
 (0)