mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-01-31 04:57:57 +00:00
0681d1fd7c
It's been a while but I've been using NixOS (or anything styled like it like GuixSD, for example) and distro-hopped from Arch Linux. I think it's high noon for making the structure of this setup to be truer to one of the big objectives which is how easy to transfer this between different setups. Which means I removed some things such as the package lists, systemd config files, and package manager-specific configs. While the solution is easy (which is to simply ignore the system-specific files) but I'm not going with the pragmatic solution not because I'm a dumbass but because I'm so smart that I want to create a challenge for myself to solve a puzzle on figuring out a way on how to structure my dotfiles. :) Such a productive use of my time, that's for sure.
104 lines
3.6 KiB
Bash
Executable File
104 lines
3.6 KiB
Bash
Executable File
# This is the part that configures the interactive shell.
|
|
|
|
# Add pywal to the bootup of the interactive shell
|
|
cat ~/.cache/wal/sequences
|
|
|
|
# The prompt.
|
|
# Adding basic version control support to the zsh prompt.
|
|
# https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Zsh
|
|
autoload -Uz vcs_info
|
|
precmd_vcs_info() { vcs_info }
|
|
precmd_functions+=( precmd_vcs_info )
|
|
setopt prompt_subst
|
|
zstyle ':vcs_info:*' formats '[%s] (%b)'
|
|
autoload -U colors && colors
|
|
PROMPT="%F%{${fg[white]}%}%(0?.√.%?) %B%{$fg[magenta]%}%1~%{$reset_color%} \$vcs_info_msg_0_ $%f%b "
|
|
RPROMPT="[%D %*]"
|
|
|
|
# Configuring the command history.
|
|
HISTSIZE=1000
|
|
SAVEHIST=1000
|
|
HISTFILE=~/.cache/zsh/history
|
|
|
|
# Shell keybindings in Vim mode.
|
|
# bindkey -v
|
|
|
|
# Keybindings.
|
|
# create a zkbd compatible hash;
|
|
# to add other keys to this hash, see: man 5 terminfo
|
|
typeset -g -A key
|
|
|
|
key[Home]="${terminfo[khome]}"
|
|
key[End]="${terminfo[kend]}"
|
|
key[Insert]="${terminfo[kich1]}"
|
|
key[Backspace]="${terminfo[kbs]}"
|
|
key[Delete]="${terminfo[kdch1]}"
|
|
key[Up]="${terminfo[kcuu1]}"
|
|
key[Down]="${terminfo[kcud1]}"
|
|
key[Left]="${terminfo[kcub1]}"
|
|
key[Right]="${terminfo[kcuf1]}"
|
|
key[PageUp]="${terminfo[kpp]}"
|
|
key[PageDown]="${terminfo[knp]}"
|
|
key[ShiftTab]="${terminfo[kcbt]}"
|
|
|
|
# setup key accordingly
|
|
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
|
|
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
|
|
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
|
|
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
|
|
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
|
|
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
|
|
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
|
|
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
|
|
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
|
|
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
|
|
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
|
|
[[ -n "${key[ShiftTab]}" ]] && bindkey -- "${key[ShiftTab]}" reverse-menu-complete
|
|
|
|
# Finally, make sure the terminal is in application mode, when zle is
|
|
# active. Only then are the values from $terminfo valid.
|
|
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
|
autoload -Uz add-zle-hook-widget
|
|
function zle_application_mode_start {
|
|
echoti smkx
|
|
}
|
|
function zle_application_mode_stop {
|
|
echoti rmkx
|
|
}
|
|
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
|
|
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
|
|
fi
|
|
|
|
# History searching.
|
|
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
|
|
zle -N up-line-or-beginning-search
|
|
zle -N down-line-or-beginning-search
|
|
|
|
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search
|
|
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search
|
|
|
|
# Enable prompts
|
|
autoload -Uz promptinit
|
|
promptinit
|
|
|
|
# Loading completion feature.
|
|
autoload -Uz compinit
|
|
zstyle ':completion:*' menu select
|
|
zstyle ':completion::complete:*' gain-prvileges 1
|
|
compinit
|
|
|
|
setopt COMPLETE_ALIASES
|
|
|
|
# This block is managed by conda.
|
|
__conda_setup="$('/home/foo-dogsquared/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
|
|
if [ $? -eq 0 ]; then
|
|
eval "$__conda_setup"
|
|
else
|
|
if [ -f "/home/foo-dogsquared/anaconda3/etc/profile.d/conda.sh" ]; then
|
|
. "/home/foo-dogsquared/anaconda3/etc/profile.d/conda.sh"
|
|
else
|
|
export PATH="/home/foo-dogsquared/anaconda3/bin:$PATH"
|
|
fi
|
|
fi
|
|
unset __conda_setup
|