migrated dots setup

This commit is contained in:
2023-02-24 16:56:31 +01:00
commit 04560bb475
37 changed files with 11091 additions and 0 deletions

71
zsh/.aliases Normal file
View File

@@ -0,0 +1,71 @@
#!/bin/zsh
# Easier Navigation
alias cd..="cd .."
# Colors
alias ls="command exa"
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# List files
alias l="exa -G --icons"
alias ll="exa -l --icons"
alias lg="exa -lG"
alias lall="exa -lahF --icons --git"
alias lalg="exa -laGhF --icons --git"
alias latree="exa -laGghHT --git --icons"
alias la="exa -la --git --icons"
# List only directories
alias lsd="exa -laD"
alias cls="clear"
alias df="df -ahiT --total"
alias userlist="cut -d: -f1 /etc/passwd"
alias free="free -mt"
alias du="du -ach | sort -h"
alias ps="ps auxf"
# Enable aliases to be sudoed
alias sudo='doas '
alias sudo="doas"
# Get week number
alias week='date +%V'
# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
# Dice for the undecided
alias dice='echo $[ 1 + $RANDOM % 6 ]'
# Canonical hex dump; some systems have this symlinked
command -v hd > /dev/null || alias hd="hexdump -C"
# URL-encode strings
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
# For example, to list all directories that contain a certain file:
# find . -name .gitattributes | map dirname
alias map="xargs -n1"
# Reload the shell (i.e. invoke as a login shell)
alias reload="exec $SHELL -l"
alias path='echo -e ${PATH//:/\\n}' #Print each PATH entry on a separate line
alias mkdir='mkdir -pv' #Intuitive mkdir
# get top process eating memory
alias psmem='ps -e -orss=,args= | sort -b -k1 -nr'
alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -10'
# get top process eating cpu if not work try excute : export LC_ALL='C'
alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr'
alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -10'
# top10 of the history
alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
# Default xclip to use Ctrl-c/Ctrl-v clipboard
alias xclip="xclip -selection c"
alias :q="exit"

1641
zsh/.p10k.zsh Normal file

File diff suppressed because it is too large Load Diff

1
zsh/.zprofile Normal file
View File

@@ -0,0 +1 @@
[ "$(tty)" = "/dev/tty1" ] && ! pgrep -x Xorg >/dev/null && exec startx -- vt1 &> /dev/null

122
zsh/.zsh_compl/zoxide Normal file
View File

@@ -0,0 +1,122 @@
# =============================================================================
#
# Utility functions for zoxide.
#
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.
function __zoxide_pwd() {
\builtin pwd -L
}
# cd + custom logic based on the value of _ZO_ECHO.
function __zoxide_cd() {
# shellcheck disable=SC2164
\builtin cd -- "$@" >/dev/null
}
# =============================================================================
#
# Hook configuration for zoxide.
#
# Hook to add new entries to the database.
function __zoxide_hook() {
# shellcheck disable=SC2312
\command zoxide add -- "$(__zoxide_pwd)"
}
# Initialize hook.
# shellcheck disable=SC2154
if [[ ${precmd_functions[(Ie)__zoxide_hook]:-} -eq 0 ]] && [[ ${chpwd_functions[(Ie)__zoxide_hook]:-} -eq 0 ]]; then
chpwd_functions+=(__zoxide_hook)
fi
# =============================================================================
#
# When using zoxide with --no-cmd, alias these internal functions as desired.
#
__zoxide_z_prefix='z#'
# Jump to a directory using only keywords.
function __zoxide_z() {
# shellcheck disable=SC2199
if [[ "$#" -eq 0 ]]; then
__zoxide_cd ~
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then
__zoxide_cd "$1"
elif [[ "$@[-1]" == "${__zoxide_z_prefix}"* ]]; then
# shellcheck disable=SC2124
\builtin local result="${@[-1]}"
__zoxide_cd "${result:${#__zoxide_z_prefix}}"
else
\builtin local result
# shellcheck disable=SC2312
result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -- "$@")" &&
__zoxide_cd "${result}"
fi
}
# Jump to a directory using interactive search.
function __zoxide_zi() {
\builtin local result
result="$(\command zoxide query -i -- "$@")" && __zoxide_cd "${result}"
}
# =============================================================================
#
# Commands for zoxide. Disable these using --no-cmd.
#
\builtin unalias z &>/dev/null || \builtin true
function z() {
__zoxide_z "$@"
}
\builtin unalias zi &>/dev/null || \builtin true
function zi() {
__zoxide_zi "$@"
}
if [[ -o zle ]]; then
function __zoxide_z_complete() {
# Only show completions when the cursor is at the end of the line.
# shellcheck disable=SC2154
[[ "${#words[@]}" -eq "${CURRENT}" ]] || return
if [[ "${#words[@]}" -eq 2 ]]; then
_files -/
elif [[ "${words[-1]}" == '' ]]; then
\builtin local result
# shellcheck disable=SC2086,SC2312
if result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -i -- ${words[2,-1]})"; then
__zoxide_result="${result}"
else
__zoxide_result=''
fi
\builtin printf '\e[5n'
fi
}
function __zoxide_z_complete_helper() {
\builtin local result="${__zoxide_z_prefix}${__zoxide_result}"
# shellcheck disable=SC2296
[[ -n "${__zoxide_result}" ]] && LBUFFER="${LBUFFER}${(q-)result}"
\builtin zle reset-prompt
}
\builtin zle -N __zoxide_z_complete_helper
\builtin bindkey "\e[0n" __zoxide_z_complete_helper
if [[ "${+functions[compdef]}" -ne 0 ]]; then
\compdef -d z
\compdef -d zi
\compdef __zoxide_z_complete z
fi
fi
# =============================================================================
#
# To initialize zoxide, add this to your configuration (usually ~/.zshrc):
#
# eval "$(zoxide init zsh)"

30
zsh/.zshenv Normal file
View File

@@ -0,0 +1,30 @@
export QT_STYLE_OVERRIDE="kvantum";
# Defaults
export TERMINAL="alacritty";
export EDITOR='vim';
export BROWSER='firefox';
export BAT_THEME="Catppuccin-mocha";
# Enable persistent REPL history for `node`.
export NODE_REPL_HISTORY=~/.node_history;
# Allow 32³ entries; the default is 1000.
export NODE_REPL_HISTORY_SIZE='32768';
# Use sloppy mode by default, matching web browsers.
export NODE_REPL_MODE='sloppy';
# Make Python use UTF-8 encoding for output to stdin, stdout, and stderr.
export PYTHONIOENCODING='UTF-8';
# Less settings
if which less > /dev/null 2>&1;then
export PAGER="less"
export LESS="-R"
# Dont clear the screen after quitting a manual page.
export MANPAGER='less -X';
fi
export FZF_DEFAULT_OPTS="--color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 --color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 --color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796";

87
zsh/.zshrc Normal file
View File

@@ -0,0 +1,87 @@
# 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
###############################################################################################################################
# Initialization #
###############################################################################################################################
# Setting up Zinit, if not installed then clone it in.
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
if [[ ! -d $ZINIT_HOME ]]; then
mkdir -p "$(dirname $ZINIT_HOME)"
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
fi
# Load Zinit!
source "${ZINIT_HOME}/zinit.zsh"
#source external files
test -r "~/.dir_colors" && eval $(dircolors ~/.dir_colors)
source ~/.aliases
autoload -U colors
colors
autoload zcalc
autoload zmv
autoload zed
###############################################################################################################################
# History Settings #
###############################################################################################################################
HISTFILE=~/.zsh_history #History file - zsh in name, to differentiate, idk
HISTSIZE=1000010000 #1B history entries - storage space is cheap :)
SAVEHIST=1000000000 #A margin to store some duplicates
setopt INC_APPEND_HISTORY_TIME #Black magic, honestly - history nonblockingly gets written to histfile, but separate sessions keep their separate histories
setopt HIST_VERIFY #Forces user to confirm banging commands from history (!! pastes previous command to prompt)
setopt HIST_IGNORE_DUPS #Ignores duplicates of commands directly before
setopt HIST_EXPIRE_DUPS_FIRST #Pretty self-explanatory, really
setopt HIST_IGNORE_SPACE #Ignores commands with preceding space
setopt EXTENDED_HISTORY #Appends timestamps and run duration to the history file
setopt completealiases
setopt interactivecomments
#bash-like word character detection (alphanumeric only)
autoload -U select-word-style
select-word-style bash
# Load powerlevel10k theme
zinit ice depth"1" ##git clone depth
zinit light romkatv/powerlevel10k
zinit ice wait lucid
zinit light MichaelAquilina/zsh-you-should-use
zinit ice wait lucid
zinit light laggardkernel/zsh-thefuck
# zsh-autosuggestions
zinit ice wait lucid atload"!_zsh_autosuggest_start"
zinit load zsh-users/zsh-autosuggestions
# forgit
zinit ice wait lucid
zinit load 'wfxr/forgit'
zinit snippet ~/.zsh_compl/zoxide
zinit snippet OMZL::completion.zsh
zinit wait lucid for \
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
zdharma-continuum/fast-syntax-highlighting \
blockf \
zsh-users/zsh-completions \
atload"!_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions
#[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
zinit pack"binary" for fzf
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
(( ! ${+functions[p10k]} )) || p10k finalize