first commit
This commit is contained in:
11
profiles/base/.zsh/conf.d/00-base.zsh
Normal file
11
profiles/base/.zsh/conf.d/00-base.zsh
Normal file
@@ -0,0 +1,11 @@
|
||||
# Set PATH environment variable
|
||||
typeset -U path PATH
|
||||
path=("${HOME}/.local/bin" "/usr/local/sbin" "/usr/local/bin" "/usr/sbin" "/sbin" "${path[@]}")
|
||||
export PATH
|
||||
|
||||
# Configure shell history behavior
|
||||
HISTFILE="${HOME}/.zsh_history"
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
setopt appendhistory
|
||||
setopt HIST_IGNORE_SPACE
|
||||
13
profiles/base/.zsh/conf.d/01-prompt.zsh
Normal file
13
profiles/base/.zsh/conf.d/01-prompt.zsh
Normal file
@@ -0,0 +1,13 @@
|
||||
# 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
|
||||
|
||||
# plugins
|
||||
source "${HOME}/.zsh/plugins/powerlevel10k/powerlevel10k.zsh-theme"
|
||||
source "${HOME}/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.zsh/prompt/p10k.zsh.
|
||||
[[ -f "${HOME}/.zsh/prompt/p10k.zsh" ]] && source "${HOME}/.zsh/prompt/p10k.zsh"
|
||||
33
profiles/base/.zsh/conf.d/02-vi-keybindings.zsh
Normal file
33
profiles/base/.zsh/conf.d/02-vi-keybindings.zsh
Normal file
@@ -0,0 +1,33 @@
|
||||
# Enable vi keybindings
|
||||
bindkey -v
|
||||
export KEYTIMEOUT=1
|
||||
autoload -z edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '^e' edit-command-line
|
||||
|
||||
# Fix backspace character behavior in vi mode
|
||||
bindkey '^?' backward-delete-char
|
||||
bindkey '^W' backward-kill-word
|
||||
bindkey '^H' backward-delete-char # Control-h also deletes the previous char.
|
||||
bindkey '^U' backward-kill-line
|
||||
|
||||
# Change cursor shape for different vi modes
|
||||
zle-keymap-select() {
|
||||
if [[ ${KEYMAP} == vicmd ]] ||
|
||||
[[ $1 = "block" ]]; then
|
||||
echo -ne '\e[4 q'
|
||||
elif [[ ${KEYMAP} == main ]] ||
|
||||
[[ ${KEYMAP} == viins ]] ||
|
||||
[[ ${KEYMAP} == "" ]] ||
|
||||
[[ $1 == "beam" ]]; then
|
||||
echo -ne '\e[6 q'
|
||||
fi
|
||||
}
|
||||
zle -N zle-keymap-select
|
||||
zle-line-init() {
|
||||
zle -K viins # Initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
|
||||
echo -ne '\e[6 q'
|
||||
}
|
||||
zle -N zle-line-init
|
||||
echo -ne '\e[6 q' # Use beam shape cursor on startup
|
||||
preexec() { echo -ne '\e[6 q' } # Use beam shape cursor for each new prompt
|
||||
14
profiles/base/.zsh/conf.d/03-plugins.zsh
Normal file
14
profiles/base/.zsh/conf.d/03-plugins.zsh
Normal file
@@ -0,0 +1,14 @@
|
||||
## Plugins configuration
|
||||
|
||||
# Completions
|
||||
fpath=("${HOME}/.zsh/plugins/zsh-completions/src" "${fpath[@]}")
|
||||
autoload -U compinit promptinit
|
||||
compinit
|
||||
promptinit
|
||||
[[ -f "/etc/gentoo-release" ]] && prompt gentoo
|
||||
|
||||
# Enable cache for completions
|
||||
zstyle ":completion::complete:*" use-cache 1
|
||||
|
||||
# Syntax highlighting in zsh prompt
|
||||
source "${HOME}/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
3
profiles/base/.zsh/conf.d/04-emacs.zsh
Normal file
3
profiles/base/.zsh/conf.d/04-emacs.zsh
Normal file
@@ -0,0 +1,3 @@
|
||||
# emacs specific stuff
|
||||
[ -n "${EAT_SHELL_INTEGRATION_DIR}" ] && \
|
||||
source "${EAT_SHELL_INTEGRATION_DIR}/zsh"
|
||||
26
profiles/base/.zsh/conf.d/05-env.zsh
Normal file
26
profiles/base/.zsh/conf.d/05-env.zsh
Normal file
@@ -0,0 +1,26 @@
|
||||
# Set environment variables
|
||||
if command -v nvim &> /dev/null; then
|
||||
export EDITOR="nvim"
|
||||
else
|
||||
export EDITOR="vim"
|
||||
fi
|
||||
# export EDITOR="ec"
|
||||
export VISUAL="${EDITOR}"
|
||||
export SUDO_EDITOR="${EDITOR}"
|
||||
export VIRSH_DEFAULT_CONNECT_URI="qemu:///system"
|
||||
export BROWSER="chromium"
|
||||
export PAGER="less -R -F"
|
||||
export BAT_PAGER="${PAGER}"
|
||||
export MANPAGER="less -R --use-color -Dd+r -Du+b"
|
||||
[ -f "/usr/share/cowsay/cows" ] && export COWPATH="/usr/share/cowsay/cows"
|
||||
export CHROOT="${HOME}/arch_chroot"
|
||||
export AUR_REPO="whiteman808"
|
||||
export AURDEST="${HOME}/.cache/paru/clone"
|
||||
export AUR_PAGER="ranger"
|
||||
export GPGKEY="4A45503BBE575E3D4DAF28E27264AFFDC98D52BB"
|
||||
|
||||
# gpg-agent
|
||||
unset SSH_AGENT_PID
|
||||
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
||||
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket 2>/dev/null)"
|
||||
fi
|
||||
22
profiles/base/.zsh/conf.d/06-color-output.zsh
Normal file
22
profiles/base/.zsh/conf.d/06-color-output.zsh
Normal file
@@ -0,0 +1,22 @@
|
||||
alias diff="diff --color=auto"
|
||||
alias grep="grep --color=auto"
|
||||
alias ip="ip -color=auto"
|
||||
alias ls="ls --color=auto"
|
||||
export MANROFFOPT="-P -c"
|
||||
export LESS='-R --use-color -Dd+r$Du+b$'
|
||||
|
||||
zmodload zsh/zpty
|
||||
|
||||
pty() {
|
||||
zpty pty-${UID} ${1+$@}
|
||||
if [[ ! -t 1 ]]; then
|
||||
setopt local_traps
|
||||
trap '' INT
|
||||
fi
|
||||
zpty -r pty-${UID}
|
||||
zpty -d pty-${UID}
|
||||
}
|
||||
|
||||
ptyless() {
|
||||
pty $@ | less
|
||||
}
|
||||
101
profiles/base/.zsh/conf.d/07-tool-integrations.zsh
Normal file
101
profiles/base/.zsh/conf.d/07-tool-integrations.zsh
Normal file
@@ -0,0 +1,101 @@
|
||||
# HSTR configuration - add this to ~/.zshrc
|
||||
if type "hstr" >/dev/null; then
|
||||
alias hh=hstr # hh to be alias for hstr
|
||||
setopt histignorespace # skip cmds w/ leading space from history
|
||||
export HSTR_CONFIG=hicolor # get more colors
|
||||
hstr_no_tiocsti() {
|
||||
zle -I
|
||||
{ HSTR_OUT="$( { </dev/tty hstr ${BUFFER}; } 2>&1 1>&3 3>&- )"; } 3>&1;
|
||||
BUFFER="${HSTR_OUT}"
|
||||
CURSOR=${#BUFFER}
|
||||
zle redisplay
|
||||
}
|
||||
zle -N hstr_no_tiocsti
|
||||
bindkey '\C-r' hstr_no_tiocsti
|
||||
export HSTR_TIOCSTI=n
|
||||
else
|
||||
bindkey '\C-r' history-incremental-search-backward
|
||||
fi
|
||||
|
||||
# better ls
|
||||
if command -v "eza" >/dev/null 2>&1; then
|
||||
alias ll="eza -bghHlS"
|
||||
else
|
||||
alias ll="exa -bghHlS"
|
||||
fi
|
||||
|
||||
# bat (debian)
|
||||
if command -v "batcat" >/dev/null 2>&1; then
|
||||
alias bat="batcat"
|
||||
fi
|
||||
|
||||
# lf
|
||||
lfwrapper() {
|
||||
command lf "$@"
|
||||
|
||||
# cleanup
|
||||
awk '$1 == "archivemount" { print $2 }' /etc/mtab | while read -r mntdir; do
|
||||
sanitized_input="$(printf "${mntdir}")" # /etc/mtab uses octal representation of spaces (possible other symbols too), printf would convert octal representation, so that it can be used in the umount & rmdir commands.
|
||||
umount "${sanitized_input}"
|
||||
rmdir "${sanitized_input}"
|
||||
done
|
||||
}
|
||||
|
||||
lfcd() {
|
||||
dir="$(lfwrapper -print-last-dir "$@")"
|
||||
while ! cd "${dir}" 2>/dev/null; do
|
||||
dir="$(dirname -- "${dir}")"
|
||||
done
|
||||
}
|
||||
alias lf=lfcd
|
||||
|
||||
# ranger
|
||||
ranger_cd() {
|
||||
temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")"
|
||||
ranger --choosedir="${temp_file}" -- "${@:-${PWD}}"
|
||||
if chosen_dir="$(cat -- "${temp_file}")" && [ -n "${chosen_dir}" ] && [ "${chosen_dir}" != "${PWD}" ]; then
|
||||
cd -- "${chosen_dir}"
|
||||
fi
|
||||
rm -f -- "${temp_file}"
|
||||
}
|
||||
alias ranger=ranger_cd
|
||||
|
||||
# mc
|
||||
if [ -f "/usr/libexec/mc/mc.sh" ]; then
|
||||
source "/usr/libexec/mc/mc.sh"
|
||||
fi
|
||||
|
||||
# nix package manager
|
||||
if [ -e "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||
source "${HOME}/.nix-profile/etc/profile.d/nix.sh"
|
||||
fi # added by Nix installer
|
||||
|
||||
# nix shell
|
||||
if command -v nix-your-shell >/dev/null 2>&1; then
|
||||
nix-your-shell zsh | source /dev/stdin
|
||||
fi
|
||||
|
||||
# node.js
|
||||
export NVM_DIR="${HOME}/.nvm"
|
||||
[ -s "${NVM_DIR}/nvm.sh" ] && source "${NVM_DIR}/nvm.sh" # This loads nvm
|
||||
[ -s "${NVM_DIR}/bash_completion" ] && source "${NVM_DIR}/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
# rvm
|
||||
[ -s "${HOME}/.rvm/scripts/rvm" ] && source "${HOME}/.rvm/scripts/rvm"
|
||||
|
||||
# pyenv
|
||||
export PYENV_ROOT="${HOME}/.pyenv"
|
||||
if [[ -d "${PYENV_ROOT}/bin" ]]; then
|
||||
path=("${PYENV_ROOT}/bin" "${path[@]}")
|
||||
export PATH
|
||||
eval "$(pyenv init - zsh)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
fi
|
||||
|
||||
# inside tmux, we don't know if Sway got restarted
|
||||
if [[ -v TMUX ]]; then
|
||||
swaymsg() {
|
||||
export SWAYSOCK="${XDG_RUNTIME_DIR}/sway-ipc.${UID}.$(pgrep -x sway).sock"
|
||||
command swaymsg "$@"
|
||||
}
|
||||
fi
|
||||
17
profiles/base/.zsh/conf.d/08-aliases.zsh
Normal file
17
profiles/base/.zsh/conf.d/08-aliases.zsh
Normal file
@@ -0,0 +1,17 @@
|
||||
alias ncmpcpp="ncmpcpp -b ${HOME}/.config/ncmpcpp/bindings"
|
||||
alias tb="nc termbin.com 9999"
|
||||
alias mux="tmuxinator"
|
||||
alias tm="tmuxinator start misc"
|
||||
alias tq="tmuxinator start quake"
|
||||
alias sudo="sudo "
|
||||
alias rsync_copy="rsync -aAXUHvh --partial-dir=.rsync-partial --progress"
|
||||
alias rsync_copy_ssh="rsync_copy -e ssh"
|
||||
alias rsync_backup="rsync_copy --numeric-ids --delete --exclude={'/dev/*','/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found'}"
|
||||
alias rsync_backup_ssh="rsync_backup -e ssh"
|
||||
alias rsync_restore="rsync_copy --numeric-ids --delete --exclude='lost+found'"
|
||||
alias rsync_restore_ssh="rsync_restore -e ssh"
|
||||
alias glog="git log --oneline"
|
||||
alias emerge_world="emerge --ask --verbose --deep --newuse --update @world"
|
||||
alias sync_repo="rsync_copy_ssh --delete ~/arch_paczuchy/* vps.paraboletancza.org:/srv/http/arch.paraboletancza.org"
|
||||
alias aur_sync="aur sync --sign --chroot"
|
||||
alias aur_build="aur build --sign --chroot"
|
||||
35
profiles/base/.zsh/conf.d/09-functions.zsh
Normal file
35
profiles/base/.zsh/conf.d/09-functions.zsh
Normal file
@@ -0,0 +1,35 @@
|
||||
take() {
|
||||
local -r directory="$1"
|
||||
mkdir -p "${directory}"
|
||||
cd "${directory}"
|
||||
}
|
||||
|
||||
# downloading from youtube
|
||||
yt-dlp() {
|
||||
local -a -r args=(
|
||||
--cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser"
|
||||
--extractor-args "youtube:player_client=default,web_safari;player_js_version=actual"
|
||||
--fragment-retries infinite
|
||||
)
|
||||
command yt-dlp "${args[@]}" "$@"
|
||||
}
|
||||
|
||||
yt_dl_mp3() {
|
||||
yt-dlp -t mp3 --embed-thumbnail "$@"
|
||||
}
|
||||
|
||||
yt_dl_channel() {
|
||||
local -a -r args=(
|
||||
--download-archive "archive.txt"
|
||||
--output "%(upload_date)s.%(title)s.%(id)s.%(ext)s"
|
||||
--merge-output-format mkv
|
||||
--ignore-errors
|
||||
--write-sub
|
||||
--sub-langs "en,pl"
|
||||
--cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser"
|
||||
--write-description
|
||||
--write-info-json
|
||||
--write-thumbnail
|
||||
)
|
||||
yt-dlp "${args[@]}" "$@"
|
||||
}
|
||||
1
profiles/base/.zsh/conf.d/10-keybindings.zsh
Normal file
1
profiles/base/.zsh/conf.d/10-keybindings.zsh
Normal file
@@ -0,0 +1 @@
|
||||
bindkey -s '^o' 'ranger\n'
|
||||
Reference in New Issue
Block a user