From 3fa3268575dff1374dd419f2f3882704731f7eb7 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Sun, 9 May 2021 10:47:26 -0400 Subject: added some aliases, changed up zsh prompt, removed widthxcol in alacritty --- .aliases | 18 +++--- .config/alacritty/alacritty.yml | 4 +- .config/i3blocks/config | 3 +- .zshrc | 134 +++++++++------------------------------- 4 files changed, 40 insertions(+), 119 deletions(-) diff --git a/.aliases b/.aliases index 2f0937c..bafc8be 100644 --- a/.aliases +++ b/.aliases @@ -4,22 +4,20 @@ alias define="dict -d gcide" alias df="df -h" alias doom2="crispy-doom -iwad ~/games/doom/DOOM2.WAD" alias doom="crispy-doom -iwad ~/games/doom/DOOM.WAD" -alias dosbox="timidity -iA & dosbox && killall timidity" alias du="du -h -c" -alias ffmpeg ffmpeg -hide_banner -alias ffprobe ffprobe -hide_banner +alias ffmpeg="ffmpeg -hide_banner" +alias ffprobe="ffprobe -hide_banner" +alias g="git status -s" +alias gg="git add -A && git commit ; git push" alias grep="grep --color=auto" -alias gs='git status -s' -alias gu='git add -A && git commit ; git push' -alias i3conf=vim ~/.config/wpg/templates/i3.base alias l="ls --color=auto" alias la="ls -lah --color=auto" -alias lightgtk=GTK2_RC_FILES= GTK_DATA_PREFIX= GTK_THEME=Adwaita +alias lightgtk="GTK2_RC_FILES= GTK_DATA_PREFIX= GTK_THEME=Adwaita" alias ll="ls -lh --color=auto" alias ln="ln -v" alias ls="ls --color=auto" -alias noprompt=PROMPT= RPROMPT= +alias noprompt="PROMPT= RPROMPT= " alias sigil="crispy-doom -iwad ~/games/doom/DOOM.WAD -file ~/games/doom/SIGIL_v1_21/SIGIL_COMPAT_v1_21.wad" -alias sudo='doas' +alias sudo="doas" alias synonym="dict -d moby-thesaurus" -alias tar='tar -v' +alias tar="tar -v" diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index 81ff3a7..4481802 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -18,8 +18,8 @@ window: # Specified in number of columns/lines, not pixels. # If both are `0`, this setting is ignored. #dimensions: - columns: 24 - lines: 80 + #columns: 24 + #lines: 80 # Window position (changes require restart) # diff --git a/.config/i3blocks/config b/.config/i3blocks/config index 8791d17..e094451 100644 --- a/.config/i3blocks/config +++ b/.config/i3blocks/config @@ -34,8 +34,7 @@ interval=86399 command=doas freebsd-update updatesready > /dev/null ; [ $? -ne 2 ] && printf "󰣠Updates ready" || return 0 [weather] -interval=3600 -#command=[ "$BLOCK_BUTTON" = 3 ] && alacritty -e zsh -i -c "fetch --user-agent=curl -qo - https://wttr.in/23435 && read line" || fetch -qo - "https://wttr.in/23435?format=%c+%f+%h+%w" +interval=300 command=weather.sh [net] diff --git a/.zshrc b/.zshrc index 2b522a0..c4aaca2 100644 --- a/.zshrc +++ b/.zshrc @@ -1,137 +1,61 @@ -## Autoload Section -[ -r /tmp/.cwd ] && cd "$(< /tmp/.cwd)" +## Theming section (cat $HOME/.config/wpg/sequences &) +autoload -U compinit colors zcalc +compinit -d +colors +## Autoload -## chcwd hook to open new shells in same CWD +# chcwd hook to open new shells in same CWD +[ -r /tmp/.cwd ] && cd "$(< /tmp/.cwd)" set_cwd() { - $(pwd > /tmp/.cwd &) + $(pwd > /tmp/.cwd) } autoload -Uz add-zsh-hook add-zsh-hook chpwd set_cwd - -## Print a greeting message when shell is started -ufetch || echo $USER@$HOST $(uname -srm) - -## Options section +## Options setopt correct # Auto correct mistakes setopt extendedglob # Extended globbing. Allows using regular expressions with * setopt nocaseglob # Case insensitive globbing -setopt rcexpandparam # Array expension with parameters +setopt rcexpandparam # Array expansion with parameters setopt nocheckjobs # Don't warn about running processes when exiting setopt numericglobsort # Sort filenames numerically when it makes sense setopt nobeep # No beep setopt appendhistory # Immediately append history instead of overwriting setopt histignorealldups # If a new command is a duplicate, remove the older one -setopt autocd # if only directory path is entered, cd there. - +setopt autocd # if only directory path is entered, cd there +unsetopt beep nomatch notify zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc) zstyle ':completion:*' rehash true # automatically find new executables in path -# Speed up completions zstyle ':completion:*' accept-exact '*(N)' zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path $HOME/.zsh/cache HISTFILE=$HOME/.zhistory -HISTSIZE=10000 -SAVEHIST=10000 -#WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word +HISTSIZE=1000 +SAVEHIST=100000 WORDCHARS=${WORDCHARS//[&.;]} # Don't consider certain characters part of the word -## Keybindings section +## Keybindings bindkey -v -## Alias section +## Aliases source $HOME/.aliases -## Theming section -autoload -U compinit colors zcalc -compinit -d -colors +## Plugins +source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # syntax highlighting +source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh # autosuggestions +ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20 +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8' -# enable substitution for prompt +## Git Branch +autoload -Uz vcs_info +precmd_vcs_info() { vcs_info } +precmd_functions+=( precmd_vcs_info ) setopt prompt_subst +zstyle ':vcs_info:git:*' formats '├ %b'$'\n' -## Prompt on right side: -# - shows status of git when in git repository (code adapted from https://techanic.net/2012/12/30/my_git_prompt_for_zsh.html) -# - shows exit status of previous command (if previous command finished with an error) -# - is invisible, if neither is the case - -# Modify the colors and symbols in these variables as desired. -GIT_PROMPT_SYMBOL="%{$fg[blue]%}󰊢 " # plus/minus - clean repo -GIT_PROMPT_AHEAD="%{$fg[red]%}󰄾 NUM%{$reset_color%}" # A"NUM" - ahead by "NUM" commits -GIT_PROMPT_BEHIND="%{$fg[cyan]%}󰄽 NUM%{$reset_color%}" # B"NUM" - behind by "NUM" commits -GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}󰾕 %{$reset_color%}" # lightning bolt - merge conflict -GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}󰾖 %{$reset_color%}" # red circle - untracked files -GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%}󰯓 %{$reset_color%}" # yellow circle - tracked files modified -GIT_PROMPT_STAGED="%{$fg_bold[green]%}󰯑 %{$reset_color%}" # green circle - staged changes present = ready for "git push" - -parse_git_branch() { - # Show Git branch/tag, or name-rev if on detached head - ( git symbolic-ref -q HEAD || git name-rev --name-only --no-undefined --always HEAD ) 2> /dev/null -} - -parse_git_state() { - # Show different symbols as appropriate for various Git repository states - # Compose this value via multiple conditional appends. - local GIT_STATE="" - local NUM_AHEAD="$(git log --oneline @{u}.. 2> /dev/null | wc -l | tr -d ' ')" - if [ "$NUM_AHEAD" -gt 0 ]; then - GIT_STATE=$GIT_STATE${GIT_PROMPT_AHEAD//NUM/$NUM_AHEAD} - fi - local NUM_BEHIND="$(git log --oneline ..@{u} 2> /dev/null | wc -l | tr -d ' ')" - if [ "$NUM_BEHIND" -gt 0 ]; then - GIT_STATE=$GIT_STATE${GIT_PROMPT_BEHIND//NUM/$NUM_BEHIND} - fi - local GIT_DIR="$(git rev-parse --git-dir 2> /dev/null)" - if [ -n $GIT_DIR ] && test -r $GIT_DIR/MERGE_HEAD; then - GIT_STATE=$GIT_STATE$GIT_PROMPT_MERGING - fi - if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then - GIT_STATE=$GIT_STATE$GIT_PROMPT_UNTRACKED - fi - if ! git diff --quiet 2> /dev/null; then - GIT_STATE=$GIT_STATE$GIT_PROMPT_MODIFIED - fi - if ! git diff --cached --quiet 2> /dev/null; then - GIT_STATE=$GIT_STATE$GIT_PROMPT_STAGED - fi - if [[ -n $GIT_STATE ]]; then - echo "$GIT_STATE" - fi -} - -git_prompt_string() { - local git_where="$(parse_git_branch)" - - # If inside a Git repository, print its branch and state - [ -n "$git_where" ] && echo "$GIT_PROMPT_SYMBOL$(parse_git_state)%{$fg[yellow]%}${git_where#(refs/heads/|tags/)}" - - # If not inside the Git repo, print exit codes of last command (only if it failed) - [ ! -n "$git_where" ] && echo "%{$fg[red]%} %(?..󰚑 %?)" -} - -RPROMPT='$(git_prompt_string)' - -## Prompt on left side - -error_prompt_string() { - local error_code=$(echo "%?") - [ ! "$error_code" = "0" ] && echo && echo "$error_code" -} - -# PROMPT="%(!.%{$fg[red]%}[%n@%m %1~]%{$reset_color%}# .%{$fg[green]%}[%n@%m %1~]%{$reset_color%}$ " -# PROMPT="%B%{$fg[cyan]%}%(4~|%-1~/.../%2~|%~)%u%b >%{$fg[cyan]%}>%B%(?.%{$fg[cyan]%}.%{$fg[red]%})>%{$reset_color%}%b " -PROMPT="╭󰷏 %B%{$fg[cyan]%}%(4~|%-1~/.../%2~|%~)%u%b -╰󰶻 " - -## Plugins section: Enable fish style features -# Use syntax highlighting -source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -# Use history substring search TODO: -#source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh -# Use autosuggestion -source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh -ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20 -ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8' +## Prompt +RPROMPT=$'%(?.%t.%? %t)' +PROMPT=$'\n╭ %B$fg[cyan]%(4~|%-1~/.../%2~|%~)%b\n\$vcs_info_msg_0_╰ ' -- cgit v1.2.3