zsh-settings/.zshrc
2024-11-06 21:16:58 +01:00

265 lines
9.2 KiB
Bash

# 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
# 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/.dotfiles/zsh-settings/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
#ZSH_THEME="powerlevel10k/powerlevel10k"
#Powerlevel10k Theme
source ~/.dotfiles/zsh-settings/themes/powerlevel10k/powerlevel10k.zsh-theme
#Starship Theme
#eval "$(starship init zsh)"
# 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"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-ollowing line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Long history and no double entries, share history between all open sessions,
## Histfile is always loaded into ram, so to big might occupy a lot of ram
export HISTFILESIZE=100000 # max would be 1000000000
export HISTSIZE=100000 # max would be 1000000000
setopt SHARE_HISTORY # Share history between all sessions.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
#setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
ZSH_CUSTOM=~/.dotfiles/zsh-settings
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
aliases
ansible
archlinux
battery
colored-man-pages
colorize
copybuffer
# copypath
copyfile
dirhistory
emacs
emoji
extract
fzf
git
git-lfs
git-prompt
history-substring-search
isodate
jump
kate
macos
npm
pip
pylint
python
rsync
sudo
supervisor
systemadmin
systemd
ubuntu
vscode
web-search
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# 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
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# 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"
# Move standard ls
alias ols="ls"
# Base formats
alias ls="colorls -A" # short, multi-line
#alias ll="colorls -1A" # list, 1 per line
alias ld="ll" # ^^^, NOTE: Trying to move to this for alternate hand commands
alias la="colorls -lA" # list w/ info
# [d] Sort output with directories first
alias lsd="ls --sort-dirs"
alias lld="ll --sort-dirs"
alias ldd="ld --sort-dirs"
alias lad="la --sort-dirs"
# [t] Sort output with recent modified first
alias lst="ls -t"
alias llt="ll -t"
alias ldt="ld -t"
alias lat="la -t"
# [g] Add git status of each item in output
alias lsg="ls --git-status"
alias llg="ll --git-status"
alias ldg="ld --git-status"
alias lag="la --git-status"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
source $(dirname $(gem which colorls))/tab_complete.sh
#by es
## Size of all folders in the current dir
alias dud='du -h --max-depth=1 | sort -h'
## cd shorter
alias cd..="cd .."
alias ..="cd .."
## grep proc with "psg procname"
alias psg="ps aux | grep -v grep | grep -i -e VSZ -e"
## always make parent dir if needed (and verbose)
alias mkdir="mkdir -pv"
## make wget to use continue as default
alias wget="wget -c"
## get external IP
alias myip="curl http://ipecho.net/plain; echo"
## vim as default editor
export EDITOR=vim
##replace htop with bpytop
alias htop="bpytop"
##Civili Change between repo and play
alias civrepo="rm -f ~/.local/share/Steam/steamapps/common/Sid\ Meier\'s\ Civilization\ IV\ Beyond\ the\ Sword/Beyond\ the\ Sword/Mods/Better\ Choices && ln -s /home/elmar/.local/share/Steam/steamapps/common/Sid\ Meier\'s\ Civilization\ IV\ Beyond\ the\ Sword/Beyond\ the\ Sword/Mods/Better\ Choices_repo /home/elmar/.local/share/Steam/steamapps/common/Sid\ Meier\'s\ Civilization\ IV\ Beyond\ the\ Sword/Beyond\ the\ Sword/Mods/Better\ Choices"
alias civplay="rm -f ~/.local/share/Steam/steamapps/common/Sid\ Meier\'s\ Civilization\ IV\ Beyond\ the\ Sword/Beyond\ the\ Sword/Mods/Better\ Choices && ln -s /home/elmar/.local/share/Steam/steamapps/common/Sid\ Meier\'s\ Civilization\ IV\ Beyond\ the\ Sword/Beyond\ the\ Sword/Mods/Better\ Choices_play /home/elmar/.local/share/Steam/steamapps/common/Sid\ Meier\'s\ Civilization\ IV\ Beyond\ the\ Sword/Beyond\ the\ Sword/Mods/Better\ Choices"
## sshuttle to ssh.geo (root all traffic but local and ssh.geo itself)
alias geossh="sshuttle --dns -r ssh -x 192.189.78.0/23 -x 192.168.178.0/23 -x 128.131.74.216 0/0"
alias geoes="sshuttle --dns -r es -x 192.189.78.0/23 -x 192.168.178.0/23 -x 128.131.74.216 -x 128.131.72.92 -x 128.131.72.55 0/0"
##Librewolf diff profiles
alias lwmain="librewolf -p main"
alias lwwiss="librewolf -p wiss"
## Copy VS Code Products.json (Extension Lib) to VS Codium
alias cpvsc="cp /opt/visual-studio-code/resources/app/product.json /opt/vscodium-bin/resources/app/."
#### Show OS Info on startup
#if [ -f /usr/bin/screenfetch ]; then screenfetch; fi
### to prevent accidental shudown, add confirm dialog to commands:
askreboot() {
autoload colors; colors
read -q "answ?Server: $fg[red]$HOST$reset_color - Continue (y/N)?"
if [[ "$answ" =~ ^[Yy]$ ]]
then
echo
echo "OK - Rebooting..."
sleep 2
reboot
else
echo
echo "Canceling..."
return
fi
}
askshutdown() {
read -q "answ?Server: $fg[red]$HOST$reset_color - Continue (y/N)?"
if [[ "$answ" =~ ^[Yy]$ ]]
then
echo
echo "OK - Shutting down..."
sleep 2
shutdown
else
echo
echo "Canceling..."
return
fi
}
askpoweroff() {
read -q "answ?Server: $fg[red]$HOST$reset_color - Continue (y/N)?"
if [[ "$answ" =~ ^[Yy]$ ]]
then
echo
echo "OK - Powering down..."
sleep 2
poweroff
else
echo
echo "Canceling..."
return
fi
}
alias reboot="askreboot"
alias shutdown="askshutdown"
alias poweroff="askpoweroff"
#for android-sdk
export JAVA_HOME='/usr/lib/jvm/java-8-openjdk/jre'
export PATH=$JAVA_HOME/bin:$PATH
export ANDROID_HOME=/opt/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools