From 26b9ff01382a0bb4a7363a54a14cad173d10d172 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 18 Dec 2021 13:40:42 +0200 Subject: Updated merged zshrc.android and zshrc.server into zshrc --- .zshrc | 134 ++++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 96 insertions(+), 38 deletions(-) (limited to '.zshrc') diff --git a/.zshrc b/.zshrc index 10b8991..d0b9e08 100644 --- a/.zshrc +++ b/.zshrc @@ -10,6 +10,8 @@ # git clone https://github.com/eendroroy/alien.git && cd alien && git submodule update --init --recursive # }}} +device="desktop" # can be either "desktop" (default when empty), "server" or "android" + # General {{{ # Exports {{{ export PATH=$HOME/bin:/usr/local/bin:$PATH # Adds ~/bin and /usr/local/bin paths to PATH @@ -55,6 +57,10 @@ # recognize comments setopt interactivecomments + + # don't backward-kill-word on forward slash + autoload -U select-word-style + select-word-style bash # }}} # }}} @@ -69,7 +75,14 @@ export ALIEN_SECTION_USER_BG=66 export ALIEN_GIT_TRACKED_COLOR=196 export ALIEN_GIT_UN_TRACKED_COLOR=214 - + + if [[ $device == "server" ]]; then + export ALIEN_SECTION_BATTERY_FG=0 + export ALIEN_SECTION_BATTERY_BG=67 + export ALIEN_SECTION_USER_FG=0 + export ALIEN_SECTION_USER_BG=67 + fi + export ALIEN_PROMPT_SYM=" " export ALIEN_GIT_SYM= export ALIEN_BRANCH_SYM= @@ -199,6 +212,44 @@ separator 1 ) } + + if [[ $device == "server" ]]; then + alien_ssh_client(){ + if [[ -n "${SSH_CLIENT}" ]]; then + echo " syndamia.com" + fi + } + + alien_prompt_section_ssh() { + local __ssh_info + __ssh_info=$(alien_ssh_client) + [[ -n $__ssh_info ]] || return 1 + __section=( + content "${__ssh_info}" + foreground $ALIEN_SECTION_USER_FG + background $ALIEN_SECTION_USER_BG + ) + } + fi + + if [[ $device == "android" ]]; then + alien_user_info() { + whoami + } + + alien_battery_stat(){ + echo " " + } + + alien_prompt_section_battery() { + __section=( + content " " + foreground $ALIEN_SECTION_BATTERY_FG + background $ALIEN_SECTION_BATTERY_BG + separator 1 + ) + } + fi # }}} # }}} @@ -240,6 +291,8 @@ # alias sagt="sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo youtube-dl --update && wget -O - https://raw.githubusercontent.com/laurent22/joplin/master/Joplin_install_and_update.sh | bash" # }}} + if [[ device != "server" ]]; then + # General commands {{{ if [[ -x "$(command -v exa)" ]]; then alias ll="exa --icons --group-directories-first --git --time-style long-iso -labh" @@ -276,6 +329,8 @@ alias cdl="cd ~/Programming/GitLab-repos/ && mcd" alias cds="cd ~/Programming/source/ && mcd" # }}} + + fi # }}} # Binds {{{ @@ -283,32 +338,6 @@ # }}} # Functions {{{ - if [[ -x "$(command -v vimx)" ]]; then - # Open vim with .vim-session file, if it exists and the vim command doesn't have any parameters - vim () { - if [ -f ".vim-session" ] && [ -z "$1" ]; then - vimx -S .vim-session - else - vimx $@ - fi - } - fi - - if [[ -x "$(command -v grit)" ]]; then - # Add to grit parent, where first value is parent number and everything else is node value - grap () { - parent="$1" - shift - grit add -p $parent -- $@ - } - fi - - if [[ -x "$(command -v nemo)" ]]; then - onemo() { - bgr "nemo ./" - } - fi - # Execute multiple commands mexec () { for cmd in "${@[@]}"; do @@ -338,23 +367,52 @@ pkill $@ bgr $@ } + + if [[ device != "server" && device != "android" ]]; then + + if [[ -x "$(command -v vimx)" ]]; then + # Open vim with .vim-session file, if it exists and the vim command doesn't have any parameters + vim () { + if [ -f ".vim-session" ] && [ -z "$1" ]; then + vimx -S .vim-session + else + vimx $@ + fi + } + fi - # Launch .desktop application (either full path or just name) - dela () { - name=$1 - if [[ ${name:0:1} != "/" ]]; then - name="/usr/share/applications/${name}" + if [[ -x "$(command -v grit)" ]]; then + # Add to grit parent, where first value is parent number and everything else is node value + grap () { + parent="$1" + shift + grit add -p $parent -- $@ + } fi - if [[ ! $name =~ .desktop$ ]]; then - name+=".desktop" + + if [[ -x "$(command -v nemo)" ]]; then + onemo() { + bgr "nemo ./" + } fi - comm=($(awk -F= '$1=="Exec"{$1=""; print}' "$name")) - bgr "$comm" - } + + # Launch .desktop application (either full path or just name) + dela () { + name=$1 + if [[ ${name:0:1} != "/" ]]; then + name="/usr/share/applications/${name}" + fi + if [[ ! $name =~ .desktop$ ]]; then + name+=".desktop" + fi + comm=($(awk -F= '$1=="Exec"{$1=""; print}' "$name")) + bgr "$comm" + } + + fi # }}} # Execute on startup {{{ - (grit) #}}} # Added by scripts: -- cgit v1.2.3