summaryrefslogtreecommitdiff
path: root/.zshrc
diff options
context:
space:
mode:
Diffstat (limited to '.zshrc')
-rwxr-xr-x.zshrc170
1 files changed, 143 insertions, 27 deletions
diff --git a/.zshrc b/.zshrc
index a991f24..33afbbb 100755
--- a/.zshrc
+++ b/.zshrc
@@ -1,14 +1,18 @@
-# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
-# Initialization code that may require console input (password prompts, [y/n]
-# confirmations, etc.) must go above this block; everything else may go below.
-if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
- source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
-fi
+# ------------------------------------------------------------------------------
+# You'll need to install oh-my-zsh and alien
+#
+# 1. oh-my-zsh
+#
+# sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
+#
+# 2. alien
+#
+# git clone https://github.com/eendroroy/alien.git && cd alien && git submodule update --init --recursive
+# ------------------------------------------------------------------------------
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
-# Path to your oh-my-zsh installation.
export ZSH="/home/kamen/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
@@ -19,12 +23,6 @@ export ZSH="/home/kamen/.oh-my-zsh"
ZSH_THEME="gruvbox"
SOLARIZED_THEME="dark"
-# Set list of themes to pick from when loading at random
-# Setting this variable when ZSH_THEME=random will cause zsh to load
-# a theme from this variable instead of looking in $ZSH/themes/
-# If set to an empty array, this variable will have no effect.
-# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
-
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
@@ -89,11 +87,11 @@ source $ZSH/oh-my-zsh.sh
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
-# if [[ -n $SSH_CONNECTION ]]; then
-# export EDITOR='vim'
-# else
-# export EDITOR='mvim'
-# fi
+if [[ -n $SSH_CONNECTION ]]; then
+ export EDITOR='vim'
+else
+ export EDITOR='vim'
+fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
@@ -101,16 +99,7 @@ source $ZSH/oh-my-zsh.sh
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
-# For a full list of active aliases, run `alias`.
-#
-# Example aliases
-# alias zshconfig="mate ~/.zshrc"
-# alias ohmyzsh="mate ~/.oh-my-zsh"
-source ~/powerlevel10k/powerlevel10k.zsh-theme
-
-# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
-[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
@@ -120,6 +109,133 @@ export NVM_DIR="$HOME/.nvm"
stty -F/dev/tty -ixon -ixoff
# ------------------------------------------------------------------------------
+# Alien theme config
+# ------------------------------------------------------------------------------
+
+source ~/alien/alien.zsh
+
+# colors
+
+export ALIEN_THEME="gruvbox"
+export ALIEN_SECTION_BATTERY_FG=223
+export ALIEN_SECTION_PATH_FG=178
+export ALIEN_SECTION_USER_FG=223
+export ALIEN_SECTION_USER_BG=66
+
+# custom symbols
+
+export ALIEN_PROMPT_SYM=
+export ALIEN_GIT_SYM=
+export ALIEN_BRANCH_SYM=
+
+# sections
+
+export ALIEN_SECTION_TIME_FORMAT=%H:%M:%S
+
+export ALIEN_SECTIONS_LEFT=(
+ left_cap
+ ssh
+ user
+ path
+ git_branch:async
+ git_status:async
+ left_end_cap
+ newline
+ prompt
+)
+
+export ALIEN_SECTIONS_RIGHT=(
+ exit
+ time
+ battery
+ right_end_cap
+)
+
+# custom sections
+
+alien_prompt_section_left_cap() {
+ __section=(
+ content "%B%b"
+ foreground $ALIEN_SECTION_USER_BG
+ )
+}
+
+alien_prompt_section_right_end_cap() {
+ __section=(
+ content "%B%b"
+ foreground $ALIEN_SECTION_BATTERY_BG
+ )
+}
+
+alien_prompt_section_git_branch() {
+ local __branch_info=
+ if [[ $(alien_is_git) == 1 ]]; then
+ __branch_info=$(alien_git_branch)
+ else
+ return 1
+ fi
+ __section=(
+ content " ${__branch_info}"
+ foreground $ALIEN_SECTION_VCS_BRANCH_BG
+ background $ALIEN_SECTION_EXIT_BG
+ )
+}
+
+alien_prompt_section_git_status() {
+ local __stash_info=
+ local __lr_info=
+ if [[ $(alien_is_git) == 1 ]]; then
+ __stash_info=$(alien_git_stash)
+ __lr_info=$(alien_git_lr)
+ else
+ return 1
+ fi
+ __section=(
+ content " ${__stash_info}${__lr_info}"
+ foreground 214
+ background $ALIEN_SECTION_EXIT_BG
+ separator 1
+ )
+}
+
+# default section overrides (for stuff that can only be changed by changing the source)
+
+alien_prompt_section_exit() {
+ __section=(
+ content "%(?.  . %? )"
+ foreground "%(?.$ALIEN_SECTION_VCS_BRANCH_BG.$ALIEN_SECTION_EXIT_FG)"
+ background "%(?.$ALIEN_SECTION_EXIT_BG.$ALIEN_SECTION_EXIT_BG_ERROR)"
+ separator 1
+ )
+}
+
+alien_prompt_section_prompt() {
+ __section=(
+ content "%B${ALIEN_PROMPT_SYM}%b "
+ foreground "%(?.$ALIEN_PROMPT_FG.$ALIEN_SECTION_EXIT_BG_ERROR)"
+ )
+}
+
+alien_battery_stat(){ # overrides the default implementation
+ __os=$(uname)
+ if [[ ${__os} = "Linux" ]]; then
+ if command -v upower > /dev/null 2>&1 ; then
+ __bat_power=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep state | awk '{print $2}')
+ __bat_power_ind=""
+ if [[ ${__bat_power} = "charging" ]]; then __bat_power_ind=""
+ elif [[ ${__bat_power} = "discharging" ]]; then __bat_power_ind=""
+ elif [[ ${__bat_power} = "fully-charged" ]]; then __bat_power_ind=""
+ fi
+ __bat_per=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | awk '{print $2}' | sed "s|%||g")
+ if [[ -n ${__bat_per} ]]; then
+ echo -n "${__bat_power_ind} ${__bat_per}%%"
+ fi
+ fi
+ fi
+ unset __os __bat_power __bat_power_ind __bat_per
+}
+
+# ------------------------------------------------------------------------------
# Aliases
# ------------------------------------------------------------------------------