added install_ohmyzsh.sh & zshrc example

This commit is contained in:
1ndev 2024-12-14 07:42:17 -08:00
parent 8a667ce584
commit 5cc58e5233
2 changed files with 262 additions and 0 deletions

8
install_ohmyzsh.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
sudo pacman -S zsh lsd git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i 's/^ZSH_THEME=.*$/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
echo "alias ls='lsd'" >> ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
sed -i 's/plugins=(\(git\))/plugins=(\n \1\n zsh-autosuggestions\n)/' ~/.zshrc

254
zshrc Normal file
View File

@ -0,0 +1,254 @@
alias cls='clear'
alias x='exit'
alias nixins='nix-env -iA nixpkgs.$1'
alias nixsearch='nix search nixpkgs $1'
alias fpl='flatpak list'
alias lstin='sudo pacman -Qe'
alias lst='sudo pacman -Q'
alias inspkg='sudo dpkg -i '
# alias upd='sudo pacman -S'
alias upg='sudo apt upgrade -y'
alias ins='sudo pacman -S '
alias uni='sudo pacman -R'
alias cln='sudo apt autoremove -y'
alias fix='sudo apt --fix-broken install -y'
alias n='nano'
alias browser='lynx https://search.1ndev.com/'
alias biggest='du . -ha | sort -hr | head -n $1'
export WORK_WEEK=$(date "+%yww%W.%u")
export LAN_IP=$(ip -json route get 8.8.8.8 | jq -r '.[].prefsrc')
export TAILSCALE_IP=$(tailscale status | awk '{print $1}' | awk 'NR == 1 {print}')
echo "Configure System? [y/n]"
read -q inputconfigsys
if [[ $inputconfigsys =~ ^[Yy]$ ]]; then
echo ''
echo "Disable read-only ? [y/n] (sudo access)"
read -q inputrw
if [[ $inputrw =~ ^[Yy]$ ]]; then
sudo steamos-readonly disable
sudo pacman-key --init
sudo pacman-key --populate holo
sudo pacman -Syu
sudo pacman -Sy archlinux-keyring
fi
echo ''
echo "Update packages via pacman? [y/n]"
read -q inputupdatepackages
if [[ $inputupdatepackages =~ ^[Yy]$ ]]; then
sudo pacman -Syyu
fi
echo ''
echo "Install nix? [y/n]"
read -q inputnix
if [[ $inputnix =~ ^[Yy]$ ]]; then
echo ''
fi
echo ''
echo "Enable verbose boot ? [y/n]"
read -q inputverbose
if [[ $inputverbose =~ ^[Yy]$ ]]; then
sudo awk '{gsub(/steamenv_quiet="loglevel=4 splash=verbose fbcon=nodefer"/, "steamenv_noisy=\"loglevel=4 splash=verbose fbcon=nodefer\"")} 1' /etc/grub.d/00_header > temp_file
sudo mv temp_file /etc/grub.d/00_header
sudo update-grub
fi
echo ''
echo "Install/Enable tailscale (VPN) ? [y/n]"
read -q inputvpn
if [[ $inputvpn =~ ^[Yy]$ ]]; then
git clone https://github.com/tailscale-dev/deck-tailscale
cd deck-tailscale
sudo bash tailscale.sh
source /etc/profile.d/tailscale.sh
sudo tailscale up --operator=deck --ssh
fi
echo ''
echo "Install/Enable no machine (NX) ? [y/n]"
read -q inputrx
if [[ $inputrx =~ ^[Yy]$ ]]; then
sudo steamos-readonly disable
sudo wget https://download.nomachine.com/download/8.14/Linux/nomachine_8.14.2_1_x86_64.tar.gz -P /usr
sudo tar -xvf /usr/nomachine_8.14.2_1_x86_64.tar.gz -C /usr/
sudo /usr/NX/nxserver --install redhat
sudo rm -r /usr/nomachine_8.14.2_1_x86_64.tar.gz
fi
echo ''
echo "Install Android Tools (adb) ? [y/n]"
read -q inputadb
if [[ $inputadb =~ ^[Yy]$ ]]; then
sudo pacman -S --noconfirm android-tools
fi
echo ''
echo "Install Docker ? [y/n]"
read -q inputdocker
if [[ $inputdocker =~ ^[Yy]$ ]]; then
sudo pacman -S --noconfirm docker
systemctl start docker
fi
echo ''
echo "Install/Enable pip ? [y/n]"
read -q inputpip
if [[ $inputpip =~ ^[Yy]$ ]]; then
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py --user --break-system-packages
sudo rm get-pip.py
fi
echo ''
echo "Install JDK 21 ? [y/n]"
read -q inputjre
if [[ $inputjre =~ ^[Yy]$ ]]; then
sudo pacman -Syy
sudo pacman -Su
git clone https://github.com/BlackCorsair/install-jdk-on-steam-deck.git && \
JDK_VERSION=21 ./install-jdk-on-steam-deck/scripts/install-jdk.sh && \
sudo rm -r ./install-jdk-on-steam-deck
fi
echo ''
echo "Install yay ? [y/n]"
read -q inputyay
if [[ $inputjre =~ ^[Yy]$ ]]; then
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
git checkout 96f90180a3cf72673b1769c23e2c74edb0293a9f
makepkg -si
fi
fi
echo "$WORK_WEEK"
echo ''
date
echo ''
cal
echo "TAILSCALE IP: $TAILSCALE_IP"
echo "LAN IP: $LAN_IP"
echo "WAN IP: $WAN_IP"
echo ''
$HOME/.local/bin/fastfetch --logo-preserve-aspect-ratio true --logo-type none
echo ''
# 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
export PATH="$HOME/.local/bin:$HOME/.local/jdk:/opt/tailscale:$PATH"
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.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"
# 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 one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13
# Uncomment the following 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.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #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"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# 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=(
git
zsh-autosuggestions
)
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"
alias ls="lsd"
alias ifconfig="ip add"
alias androidscreen="scrcpy -w"
source ~/.oh-my-zsh/powerlevel10k/powerlevel10k.zsh-theme
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh