rm bash, now i'm friends with zsh

This commit is contained in:
Vitor Gonçalves 2024-01-22 18:11:56 -03:00
parent 232f64ffce
commit e9325dcabe
Signed by: vitorg
GPG Key ID: B90BF113DF56EB41
18 changed files with 1979 additions and 192 deletions

View File

@ -1,24 +0,0 @@
# vim: ft=sh
alias ls="eza -laH --group-directories-first"
alias la="eza -aH --group-directories-first"
alias l="eza -H --group-directories-first"
alias du="dust"
alias df="duf"
alias history="mcfly"
alias top="bottom"
alias ping="gping"
alias dig="dog"
# git aliases
alias g="git"
alias gs="git status"
alias gc="git commit"
alias gd="git diff"
alias gl="git log --oneline --decorate"
alias cfg="git --git-dir=$HOME/.local/share/dotfiles-repo/ --work-tree=$HOME"
alias monerod="monerod --data-dir "$XDG_DATA_HOME"/bitmonero"
alias update-web="ssh vern.cc -t \"cd public_html; git pull\""

View File

@ -1,92 +0,0 @@
# vim: ft=sh
pf() {
# project finder
root_dir="$HOME/docs/src"
selected_dir=$(find "$root_dir" -maxdepth 1 -type d | sed "s:$root_dir::;s:/::;/^$/ d" | BEMENU_BACKEND=curses bemenu -p "Choose directory") && cd "$root_dir"/"$selected_dir" || return
}
xb() {
# function for handling xbps in a nicer way
case $1 in
install | i)
sudo xbps-install "${@:2}"
;;
remove | r)
sudo xbps-remove -R "${@:2}"
;;
query | q)
xbps-query "${@:2}"
;;
search | s)
xbps-query -Rs "${@:2}"
;;
upgrade | u)
sudo xbps-install -Su
;;
locate | l)
xlocate "${@:2}"
;;
*)
printf "Usage:\n"
printf "xb i: xbps-install\n"
printf "xb r: xbps-remove -R\n"
printf "xb q: xbps-query\n"
printf "xb s: xbps-query -Rs\n"
printf "xb u: xbps-install -Su\n"
printf "xb l: xlocate\n"
;;
esac
}
p() {
# function for handling pacman in a nicer way too
case $1 in
install | i)
sudo pacman -S "${@:2}"
;;
remove | r)
sudo pacman -Rns "${@:2}"
;;
query | q)
pacman -Q "${@:2}"
;;
search | s)
pacman -Ss "${@:2}"
;;
upgrade | u)
sudo pacman -Syu
;;
locate | l)
pacman -F "${@:2}"
;;
*)
printf "Usage:\n"
printf "p i: pacman -S\n"
printf "p r: pacman -Rns\n"
printf "p q: pacman -Qs\n"
printf "p s: pacman -Ss\n"
printf "p u: pacman -Syu\n"
printf "p l: pacman -F\n"
;;
esac
}
ap() {
# function to make aurutils a bit more friendly
case $1 in
i)
aur sync ${@:2}
sudo pacman -S ${@:2}
;;
u)
aur sync -u
sudo pacman -Syu
;;
*)
printf "Usage:\n"
printf "ap i: aur sync && pacman -S\n"
printf "ap u: aur sync -u && pacman -Syu\n"
;;
esac
}

View File

@ -1,4 +0,0 @@
# .bash_profile
# Get the aliases and functions
[ -f $HOME/.bashrc ] && . $HOME/.bashrc

View File

@ -1,51 +0,0 @@
# vim: ft=sh
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "- [${BRANCH}${STAT}] "
else
echo ""
fi
}
# get current status of git repo
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
if [ "${renamed}" == "0" ]; then
bits=">${bits}"
fi
if [ "${ahead}" == "0" ]; then
bits="*${bits}"
fi
if [ "${newfile}" == "0" ]; then
bits="+${bits}"
fi
if [ "${untracked}" == "0" ]; then
bits="?${bits}"
fi
if [ "${deleted}" == "0" ]; then
bits="x${bits}"
fi
if [ "${dirty}" == "0" ]; then
bits="!${bits}"
fi
if [ ! "${bits}" == "" ]; then
echo " ${bits}"
else
echo ""
fi
}
export PS1="\[\e[34m\]\u\[\e[m\]\[\e[34m\]@\[\e[m\]\[\e[34m\]\h\[\e[m\] \[\e[31m\]\w\[\e[m\] \[\e[35m\]\`parse_git_branch\`\[\e[m\]\[\e[32m\]\\$\[\e[m\] "

View File

@ -1,21 +0,0 @@
# vim: ft=sh
shopt -s autocd
shopt -s histappend
bind 'set bell-style visible'
bind 'set completion-ignore-case on'
bind 'set expand-tilde on'
export XDG_CONFIG_HOME="$HOME/.config" XDG_CACHE_HOME="$HOME/.cache" XDG_DATA_HOME="$HOME/.local/share" XDG_STATE_HOME="$HOME/.local/state"
export PATH="$PATH:$HOME/.local/bin"
export EDITOR="nvim" VISUAL="nvim"
export GNUPGHOME="$XDG_DATA_HOME/gnupg" PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass" HISTFILE="$XDG_STATE_HOME/bash/history" INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export GPG_TTY=$(tty)
export AUR_PAGER="nnn"
source "$HOME/.config/bash/aliases"
source "$HOME/.config/bash/functions"
source "$HOME/.config/bash/prompt"

1850
.config/zsh/.zcompdump Normal file

File diff suppressed because it is too large Load Diff

0
.config/zsh/.zprofile Normal file
View File

17
.config/zsh/.zshenv Normal file
View File

@ -0,0 +1,17 @@
XDG_CONFIG_HOME="$HOME/.config"
XDG_CACHE_HOME="$HOME/.cache"
XDG_DATA_HOME="$HOME/.local/share"
XDG_STATE_HOME="$HOME/.local/state"
PATH="$PATH:$HOME/.local/bin"
EDITOR="nvim"
VISUAL="nvim"
GNUPGHOME="$XDG_DATA_HOME/gnupg"
PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass"
HISTFILE="$XDG_STATE_HOME/bash/history"
INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
GPG_TTY=$(tty)
AUR_PAGER="nnn"
ZPLUGINS="$ZDOTDIR/plugins"

19
.config/zsh/.zshrc Normal file
View File

@ -0,0 +1,19 @@
autoload -U colors && colors # colors
autoload -U compinit && compinit # basic completion
autoload -U compinit colors zcalc # theming
setopt PROMPT_SUBST
source "$ZDOTDIR/aliases.zsh"
# plugins
source "$ZPLUGINS/git-aliases/git-aliases.zsh"
source "$ZPLUGINS/zsh-vi-mode/zsh-vi-mode.plugin.zsh"
source "$ZPLUGINS/zsh-completions/zsh-completions.plugin.zsh"
source "$ZPLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh"
source "$ZPLUGINS/zsh-bd/bd.zsh"
source "$ZPLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
source "$ZPLUGINS/banana.zsh-theme"
HISTFILE="$HOME/.local/share/zsh/histfile"
HISTSIZE=110000
SAVEHIST=100000

6
.config/zsh/aliases.zsh Normal file
View File

@ -0,0 +1,6 @@
alias ls="eza -laH --group-directories-first"
alias la="eza -aH --group-directories-first"
alias l="eza -H --group-directories-first"
alias cfg="git --git-dir=$HOME/.local/share/dotfiles-repo/ --work-tree=$HOME"

View File

@ -0,0 +1,63 @@
function __git_prompt_git() {
GIT_OPTIONAL_LOCKS=0 command git "$@"
}
function parse_git_dirty() {
local STATUS
local -a FLAGS
FLAGS=('--porcelain')
if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
FLAGS+='--untracked-files=no'
fi
case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
git)
# let git decide (this respects per-repo config in .gitmodules)
;;
*)
# if unset: ignore dirty submodules
# other values are passed to --ignore-submodules
FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
;;
esac
STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
fi
if [[ -n $STATUS ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
}
function git_prompt_info() {
# If we are on a folder not tracked by git, get out.
# Otherwise, check for hide-info at global and local repository level
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
|| [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
return 0
fi
local ref
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
|| ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) \
|| return 0
# Use global ZSH_THEME_GIT_SHOW_UPSTREAM=1 for including upstream remote info
local upstream
if (( ${+ZSH_THEME_GIT_SHOW_UPSTREAM} )); then
upstream=$(__git_prompt_git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null) \
&& upstream=" -> ${upstream}"
fi
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
local host_status="$USER@${:-%m}"
PROMPT='${ret_status}${host_status} %{$fg[cyan]%}%~%{$reset_color%} $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"

@ -0,0 +1 @@
Subproject commit c4cfe2cf5cf59a3da6bf3b735a20921a2c06c58d

@ -0,0 +1 @@
Subproject commit c3d4e576c9c86eac62884bd47c01f6faed043fc5

@ -0,0 +1 @@
Subproject commit d4a55e661b4c9ef6ae4568c6abeff48bdf1b1af7

@ -0,0 +1 @@
Subproject commit f7c3173886f4f56bf97d622677c6d46ab005831f

@ -0,0 +1 @@
Subproject commit e0165eaa730dd0fa321a6a6de74f092fe87630b0

@ -0,0 +1 @@
Subproject commit ea1f58ab9b1f3eac50e2cde3e3bc612049ef683b

18
.gitmodules vendored
View File

@ -7,3 +7,21 @@
[submodule ".config/nvim/pack/plugins/start/emmet-vim"]
path = .config/nvim/pack/plugins/start/emmet-vim
url = https://github.com/mattn/emmet-vim
[submodule ".config/zsh/plugins/git-aliases"]
path = .config/zsh/plugins/git-aliases
url = https://github.com/mdumitru/git-aliases
[submodule ".config/zsh/plugins/zsh-vi-mode"]
path = .config/zsh/plugins/zsh-vi-mode
url = https://github.com/jeffreytse/zsh-vi-mode
[submodule ".config/zsh/plugins/zsh-completions"]
path = .config/zsh/plugins/zsh-completions
url = https://github.com/zsh-users/zsh-completions
[submodule ".config/zsh/plugins/zsh-autosuggestions"]
path = .config/zsh/plugins/zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions
[submodule ".config/zsh/plugins/zsh-bd"]
path = .config/zsh/plugins/zsh-bd
url = https://github.com/Tarrasch/zsh-bd
[submodule ".config/zsh/plugins/zsh-syntax-highlighting"]
path = .config/zsh/plugins/zsh-syntax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting.git