diff --git a/shell/bashrc.d/01-common.sh b/shell/bashrc.d/01-common.sh index a95d968..a6b6c73 100644 --- a/shell/bashrc.d/01-common.sh +++ b/shell/bashrc.d/01-common.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + set -o vi shopt -s histappend shopt -s cmdhist @@ -7,19 +9,21 @@ HISTCONTROL=ignoreboth HISTIGNORE='ls:history' HISTTIMEFORMAT='%F %T ' -export TERM_ITALICS=true eval "$(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)" -export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/lib" -export PATH="$HOME/.local/bin:$PATH:$HOME/skynet/bin:$HOME/node/node_modules/.bin:$HOME/go/bin:$HOME/.dotnet:$HOME/.dotnet/tools:$HOME/.cargo/bin:$HOME/.luarocks/bin" +LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.local/lib" +PATH="$HOME/.local/bin:$PATH:$HOME/skynet/bin:$HOME/node/node_modules/.bin:$HOME/go/bin:$HOME/.dotnet:$HOME/.dotnet/tools:$HOME/.cargo/bin:$HOME/.luarocks/bin" -export EDITOR=vim -export PAGER=bat -export MANPAGER=batman -export DOTNET_ROOT=~/.dotnet -export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1 -export GPG_TTY=$(tty) +TERM_ITALICS=true +EDITOR=vim +PAGER=bat +MANPAGER=batman +DOTNET_ROOT=~/.dotnet +ANDROID_EMULATOR_USE_SYSTEM_LIBS=1 +GPG_TTY=$(tty) + +export TERM_ITALICS LD_LIBRARY_PATH PATH EDITOR PAGER MANPAGER DOTNET_ROOT ANDROID_EMULATOR_USE_SYSTEM_LIBS GPG_TTY alias ls='exa --icons' alias cat='bat' diff --git a/shell/bashrc.d/02-plugin-config.sh b/shell/bashrc.d/02-plugin-config.sh index e59c729..b902a03 100644 --- a/shell/bashrc.d/02-plugin-config.sh +++ b/shell/bashrc.d/02-plugin-config.sh @@ -1,16 +1,25 @@ +#!/usr/bin/env bash + +# set prefix if in termux +if uname -a | grep -q Android; then + pathprefix=/data/data/com.termux/files +else + pathprefix= +fi; + # fzf config -[ -f /usr/share/fzf/completion.bash ] && source /usr/share/fzf/completion.bash -[ -f /usr/share/fzf/key-bindings.bash ] && source /usr/share/fzf/key-bindings.bash +[ -f "$pathprefix/usr/share/fzf/completion.bash" ] && source "$pathprefix/usr/share/fzf/completion.bash" +[ -f "$pathprefix/usr/share/fzf/key-bindings.bash" ] && source "$pathprefix/usr/share/fzf/key-bindings.bash" # goto [ -f ~/skynet/scripts/goto.sh ] && source ~/skynet/scripts/goto.sh # bash completion -test -e /usr/share/bash-completion/bash_completion && source /usr/share/bash-completion/bash_completion +test -e "$pathprefix/usr/share/bash-completion/bash_completion" && source "$pathprefix/usr/share/bash-completion/bash_completion" # colorizer GRC_ALIASES=true -test -e /usr/share/grc/grc.sh && source /usr/share/grc/grc.sh +test -e "$pathprefix/usr/share/grc/grc.sh" && source "$pathprefix/usr/share/grc/grc.sh" # git bash completions test -e ~/skynet/scripts/git-completion.bash && source ~/skynet/scripts/git-completion.bash @@ -19,3 +28,15 @@ test -e ~/skynet/scripts/git-completion.bash && source ~/skynet/scripts/git-comp test -e ~/.nvm/nvm.sh && source ~/.nvm/nvm.sh test -e ~/.cargo/env && source ~/.cargo/env + +# bat theme +BAT_THEME='Catppuccin-mocha' + +# nnn color config +NNN_PLUG='d:dragdrop;i:imgview' +NNN_PREVIEWDIR="$HOME/.cache/nnn/previews" +BLK="03" CHR="03" DIR="04" EXE="02" REG="07" HARDLINK="05" SYMLINK="05" MISSING="08" ORPHAN="01" FIFO="06" SOCK="03" UNKNOWN="01" +NNN_COLORS="#04020301;4231" +NNN_FCOLORS="$BLK$CHR$DIR$EXE$REG$HARDLINK$SYMLINK$MISSING$ORPHAN$FIFO$SOCK$UNKNOWN" + +export GRC_ALIASES BAT_THEME NNN_PLUG NNN_PREVIEWDIR NNN_COLORS NNN_FCOLORS diff --git a/shell/bashrc.d/03-functions.sh b/shell/bashrc.d/03-functions.sh index 253c2e0..a534042 100644 --- a/shell/bashrc.d/03-functions.sh +++ b/shell/bashrc.d/03-functions.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # dictionary define(){ dict -d gcide "$1" | bat @@ -10,14 +12,14 @@ synonym(){ # mount with user permissions mmount(){ - sudo mount -o uid=`whoami`,gid=`whoami` "/dev/$1" "/mnt/$2" + sudo mount -o uid="$(whoami)",gid="$(whoami)" "/dev/$1" "/mnt/$2" } # easy ssh-agent persistence function ssha() { - test=`ps -ef | grep '\sssh-agent$' | grep -v grep | awk '{print $2}' | xargs` + test=$(ps -ef | grep '\sssh-agent$' | grep -v grep | awk '{print $2}' | xargs) if [ "$test" = "" ]; then - if [ -e "~/.ssh-agent.sh" ]; then + if [ -e ~/.ssh-agent.sh ]; then rm -f ~/.ssh-agent.sh fi ssh-agent | grep -v echo >&~/.ssh-agent.sh diff --git a/shell/bashrc.d/04-prompt.sh b/shell/bashrc.d/04-prompt.sh index d2f20db..9d9552b 100644 --- a/shell/bashrc.d/04-prompt.sh +++ b/shell/bashrc.d/04-prompt.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + RED=$(tput setaf 1) GREEN=$(tput setaf 2) YELLOW=$(tput setaf 3) diff --git a/shell/bashrc.d/05-env.sh b/shell/bashrc.d/05-env.sh deleted file mode 100644 index fe089b6..0000000 --- a/shell/bashrc.d/05-env.sh +++ /dev/null @@ -1,9 +0,0 @@ -# bat theme -export BAT_THEME='Catppuccin-mocha' - -# nnn color config -export NNN_PLUG='d:dragdrop;i:imgview' -export NNN_PREVIEWDIR='~/.cache/nnn/previews' -BLK="03" CHR="03" DIR="04" EXE="02" REG="07" HARDLINK="05" SYMLINK="05" MISSING="08" ORPHAN="01" FIFO="06" SOCK="03" UNKNOWN="01" -export NNN_COLORS="#04020301;4231" -export NNN_FCOLORS="$BLK$CHR$DIR$EXE$REG$HARDLINK$SYMLINK$MISSING$ORPHAN$FIFO$SOCK$UNKNOWN"