summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachIR <zachir@librem.one>2025-01-18 23:39:25 -0600
committerZachIR <zachir@librem.one>2025-01-18 23:45:39 -0600
commit44fbfc95f779e5d6bbdaaf250ada4dfcdae5cb2a (patch)
treee2fb9b34f28d7833213f90efcae7f81e5ccb2cf2
parent2b9df77bbc5fa85f94b15b043c659168a606d1db (diff)
Cleanup zsh configs + add zplug
Just a couple plugins for syntax highlighting and history searching, removing a bunch of old unused files, and changing to just accept the standard of using dotfiles in the home directory.
-rw-r--r--Makefile16
-rwxr-xr-xinstallers/set_zshdirs.sh13
-rw-r--r--sh/profile2
-rw-r--r--zsh/.zlogout1
-rw-r--r--zsh/.zprofile6
-rw-r--r--zsh/.zshrc100
-rw-r--r--zsh/zshenv (renamed from zsh/.zshenv)1
-rw-r--r--zsh/zshrc72
8 files changed, 85 insertions, 126 deletions
diff --git a/Makefile b/Makefile
index e27af0a..898fe9e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,26 @@
VIM := $(shell command -v vim 2>/dev/null)
NVIM := $(shell command -v nvim 2>/dev/null)
-ZCONFS := zsh/.zshenv
+ZCONFS := zsh/zshenv zsh/zshrc
+SCONFS := sh/profile
DCONFS := doas.conf
all:
-install: install-zshconfigs vimplug-vim vimplug-nvim
+install: install-zshconfigs install-shconfigs vimplug-vim vimplug-nvim
install-zshconfigs: $(ZCONFS)
@echo "Installing zsh conf files..."
- @echo "Setting ZSHDOTDIR globally..."
- @$(shell sudo installers/set_zshdirs.sh)
@echo ".zshenv..."
- @ln -sf `pwd`/zsh/.zshenv ~/.zshenv
+ @ln -sf `pwd`/zsh/zshenv ~/.zshenv
+ @echo ".zshrc..."
+ @ln -sf `pwd`/zsh/zshrc ~/.zshrc
@echo "Done."
+install-shconfigs: $(SCONFS)
+ @echo "Installing sh conf files..."
+ @echo ".profile..."
+ @ln -sf `pwd`/sh/profile ~/.profile
+
vimplug-vim: installers/vimplug_vim.sh
ifdef VIM
@echo "Installing vim-plug for vim..."
diff --git a/installers/set_zshdirs.sh b/installers/set_zshdirs.sh
deleted file mode 100755
index 2d82f19..0000000
--- a/installers/set_zshdirs.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-if [ -f /etc/zshenv ]; then
- ZSHENV="/etc/zshenv"
-elif [ -d /etc/zsh ]; then
- ZSHENV="/etc/zsh/zshenv"
-else
- ZSHENV="/etc/zshenv"
-fi
-
-if ! grep -q "ZDOTDIR" $ZSHENV 2>/dev/null; then
- echo "export ZDOTDIR=\"\$HOME\"/.config/zsh" >> $ZSHENV
-fi
diff --git a/sh/profile b/sh/profile
index de79a65..b83d012 100644
--- a/sh/profile
+++ b/sh/profile
@@ -36,7 +36,7 @@ export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages
export RXVT_SOCKET="$XDG_RUNTIME_DIR"/urxvtd
export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
-export ZDOTDIR=$HOME/.config/zsh
+#export ZDOTDIR=$HOME/.config/zsh
export CARGO_HOME="$XDG_DATA_HOME"/cargo
export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
export WEECHAT_HOME="$XDG_CONFIG_HOME"/weechat
diff --git a/zsh/.zlogout b/zsh/.zlogout
deleted file mode 100644
index 33666be..0000000
--- a/zsh/.zlogout
+++ /dev/null
@@ -1 +0,0 @@
-rm -rf /tmp/xorg-awake
diff --git a/zsh/.zprofile b/zsh/.zprofile
deleted file mode 100644
index 1eae5e7..0000000
--- a/zsh/.zprofile
+++ /dev/null
@@ -1,6 +0,0 @@
-#export GDK_DPI_SCALE=0.7
-
-#gnome_schema=org.gnome.desktop.interface
-#
-#gsettings set $gnome_schema gtk-theme 'Plata-Noir-Compact'
-#gsettings set $gnome_schema icon-theme 'Papirus-Dark'
diff --git a/zsh/.zshrc b/zsh/.zshrc
deleted file mode 100644
index a00f116..0000000
--- a/zsh/.zshrc
+++ /dev/null
@@ -1,100 +0,0 @@
-HISTFILE="$ZDOTDIR"/hist
-SAVEHIST=1000
-HISTSIZE=1000
-setopt APPEND_HISTORY
-setopt HIST_FIND_NO_DUPS
-setopt HIST_EXPIRE_DUPS_FIRST
-setopt HIST_VERIFY
-setopt HIST_IGNORE_DUPS
-setopt INC_APPEND_HISTORY
-setopt HIST_REDUCE_BLANKS
-
-_SH="zsh"
-
-if [ -f "$XDG_CONFIG_HOME"/sh/aliases ]; then
- source "$XDG_CONFIG_HOME"/sh/aliases
-fi
-if [ -f "$XDG_CONFIG_HOME"/sh/functions ]; then
- source "$XDG_CONFIG_HOME"/sh/functions
-fi
-
-if [ -n "$ZDOTDIR"/.zshrc -a -f "$ZDOTDIR"/.zshrc ]; then
- alias e='source "$ZDOTDIR"/.zshrc'
-elif [ -f "$HOME"/.zshrc ]; then
- alias e='source ~/.zshrc'
-fi
-
-bindkey "^?" backward-delete-char
-
-# bindkey -v
-
-if [ "$TERM" = "st-256color" ] || [ "$TERM" = "xterm-256color" ]; then
- function zle-line-init () { echoti smkx }
- function zle-line-finish () { echoti rmkx }
-
- zle -N zle-line-init
- zle -N zle-line-finish
-fi
-
-unset COLOR1
-ZSHTHEMERC="${ZDOTDIR:-$HOME}/.zsh_theme"
-[ -f "$ZSHTHEMERC" ] && . "$ZSHTHEMERC"
-
-if [ -z "$COLOR1" ]; then
- case "$(whoami)" in
- zachir) COLOR1="014" ;;
- git) COLOR1="013" ;;
- subsonic) COLOR1="012" ;;
- *) COLOR1="015" ;;
- esac
-fi
-
-MYPROMPT='%B%S%F{'"$COLOR1"'}[%n@%m]:%f%s%F{015}%~%f%S%F{'"$COLOR1"'}%#%f%s%b '
-function zle-line-init zle-keymap-select {
- VIM_PROMPT="%B%F{012}[%n@%m]:%f%F{015}%~%f%F{012}%#%f%b "
- PS1="${${KEYMAP/vicmd/$VIM_PROMPT}/main/$MYPROMPT}"
- #PS1="$PROMPT $KEYMAP"
- zle reset-prompt
-}
-
-unset COLOR1
-
-zle -N zle-line-init
-zle -N zle-keymap-select
-export KEYTIMEOUT=1
-
-fpath+="$ZDOTDIR/zfunc"
-
-autoload -Uz compinit promptinit
-compinit -d $CONFIG/zcompdump
-promptinit
-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
-
-zstyle ':completion:*' menu select
-zstyle ':completion::complete:*' gain-privileges 1
-zstyle ':completion:*' rehash true
-
-setopt COMPLETE_ALIASES
-setopt AUTO_CD
-
-typeset -g -A key
-
-key[Up]="${terminfo[kcuu1]}"
-key[Down]="${terminfo[kcud1]}"
-key[Left]="${terminfo[kcub1]}"
-key[Right]="${terminfo[kcuf1]}"
-key[Shift-Tab]="${terminfo[kcbt]}"
-key[Delete]="${terminfo[kdch1]}"
-
-[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search
-bindkey -- '^[[A' up-line-or-beginning-search
-bindkey -- '^[[B' down-line-or-beginning-search
-[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search
-[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
-[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
-[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
-[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
-
-eval "$(_AUTO_CPUFREQ_COMPLETE=zsh_source auto-cpufreq)"
diff --git a/zsh/.zshenv b/zsh/zshenv
index f02f83a..df0371e 100644
--- a/zsh/.zshenv
+++ b/zsh/zshenv
@@ -1,5 +1,6 @@
# ZSH SPECIFIC CONFIGS
unset HISTFILE
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
+export skip_global_compinit=1
[ -f /etc/profile ] && . /etc/profile
[ -f "$XDG_CONFIG_HOME/sh/profile" ] && . "$XDG_CONFIG_HOME/sh/profile"
diff --git a/zsh/zshrc b/zsh/zshrc
new file mode 100644
index 0000000..fb5b167
--- /dev/null
+++ b/zsh/zshrc
@@ -0,0 +1,72 @@
+#zmodload zsh/zprof
+if [ -d "$HOME/.zplug" ]; then
+ export ZPLUG_INSTALLED="y"
+ source "$HOME/.zplug/init.zsh"
+fi
+HISTFILE="$XDG_CONFIG_HOME/zsh/hist"
+SAVEHIST=1000
+HISTSIZE=1000
+setopt APPEND_HISTORY
+setopt HIST_FIND_NO_DUPS
+setopt HIST_EXPIRE_DUPS_FIRST
+setopt HIST_VERIFY
+setopt HIST_IGNORE_DUPS
+setopt INC_APPEND_HISTORY
+setopt HIST_REDUCE_BLANKS
+setopt COMPLETE_ALIASES
+setopt AUTO_CD
+
+_SH="zsh"
+
+if [ -f "$XDG_CONFIG_HOME"/sh/aliases ]; then
+ source "$XDG_CONFIG_HOME"/sh/aliases
+fi
+if [ -f "$XDG_CONFIG_HOME"/sh/functions ]; then
+ source "$XDG_CONFIG_HOME"/sh/functions
+fi
+
+if [ -f "$XDG_CONFIG_HOME/zsh/zshrc" ]; then
+ alias e='source "$XDG_CONFIG_HOME/zsh/zshrc"'
+elif [ -f "$XDG_CONFIG_HOME/zshrc" ]; then
+ alias e='source "$XDG_CONFIG_HOME/zshrc"'
+elif [ -f "$HOME"/.zshrc ]; then
+ alias e='source ~/.zshrc'
+fi
+
+bindkey -v
+
+MYPROMPT=$'%B%S%F{002}[%n@%m]%s\UE0B0%F{015}%~%S%F{002}\UE0B0%#%s\UE0B0%f%k%b '
+function zle-line-init zle-keymap-select {
+ VIM_PROMPT=$'%B%S%F{012}[%n@%m]%s\UE0B0%F{015}%~%S%F{012}\UE0B0%#%s\UE0B0%f%k%b '
+ PS1="${${KEYMAP/vicmd/$VIM_PROMPT}/main/$MYPROMPT}"
+ zle reset-prompt
+}
+
+zle -N zle-line-init
+zle -N zle-keymap-select
+export KEYTIMEOUT=1
+
+fpath+="$XDG_CONFIG_HOME/zsh/zfunc"
+
+if [ -n "$ZPLUG_INSTALLED" ]; then
+ # zsh history substring search
+ zplug "zsh-users/zsh-history-substring-search", as:plugin
+
+ bindkey '^[[A' history-substring-search-up
+ bindkey '^[[B' history-substring-search-down
+ bindkey -M vicmd '^[[A' history-substring-search-up
+ bindkey -M vicmd '^[[B' history-substring-search-down
+ bindkey -M vicmd 'k' history-substring-search-up
+ bindkey -M vicmd 'j' history-substring-search-down
+
+ # zsh syntax highlighting
+ zplug "zsh-users/zsh-syntax-highlighting", defer:2
+
+ # load zsh plugins
+ zplug load
+fi
+
+autoload -Uz compinit
+compinit
+
+#zprof