]> git.huck.website - zsh.git/commitdiff
update: zsh configs inline with desktop
authorHuck Boles <huck@huck.website>
Sat, 20 May 2023 15:38:55 +0000 (10:38 -0500)
committerHuck Boles <huck@huck.website>
Sat, 20 May 2023 15:38:55 +0000 (10:38 -0500)
.gitignore
.zshenv
.zshrc
include/aliases.zsh
include/zshmux.sh [new file with mode: 0644]
include/zshmux.zsh [deleted file]

index cb95fc3dc27982d596e94a6c626e3ee85aa54322..e92ea9ba98c980ca6718bbcc060800ff538f8973 100644 (file)
@@ -1,6 +1,7 @@
 *
 !.gitignore
 !*.zsh
+!*.sh
 !.zshrc
 !.zshenv
 !.zprofile
diff --git a/.zshenv b/.zshenv
index f07dac7d7bf2572c0bce3a86c4c67469e373e6ae..1f3ea5621deaa16a4876c9100c91d36d152e84da 100644 (file)
--- a/.zshenv
+++ b/.zshenv
@@ -10,7 +10,7 @@ export XDG_CACHE_HOME="$HOME/.local/cache"
 # shell variables
 export SHELL="/bin/zsh"
 export ZDOTDIR="$HOME/.config/zsh"
-export ZSH="$XDG_CONFIG_HOME/zsh"
+export ZSH="$ZDOTDIR"
 export ZSH_CUSTOM="$ZSH/custom"
 export ZSH_COMPDUMP="$ZSH/cache/.zcompdump-$HOST"
 
@@ -26,12 +26,11 @@ export LANG=en_US.UTF-8
 
 # path variables
 export PATH="$PATH:$HOME/.local/bin:."
-export PATH="$PATH:$REPOS/script:$REPOS/ruby:"
+export PATH="$PATH:$REPOS/script:$REPOS/ruby"
 export CDPATH=".:$HOME:$HOME/$REPOS:$HOME/$XDG_CONFIG_HOME:/"
 
 # language variables
 export GOPATH="$XDG_DATA_HOME/go"
-export PERL5LIB="$XDG_DATA_HOME/perl5::$PERL5LIB"
 export PERL_LOCAL_LIB_ROOT="$XDG_DATA_HOME/perl5"
 export CARGO_HOME="$XDG_DATA_HOME/cargo"
 export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
@@ -39,17 +38,15 @@ export PATH="$PATH:$XDG_DATA_HOME/cargo/bin"
 export PATH="$PATH:$XDG_DATA_HOME/gem/ruby/3.0.0/bin"
 
 # preferred programs
-export PAGER='less'
-export MANPAGER='less'
-export EDITOR="nvim"
-export DIFFPROG="nvim -d"
-export VISUAL="nvim"
-export BROWSER="firefox"
+export PAGER='/usr/bin/less'
+export LESS='-R --use-color -Dd+r$Du+b'
+export MANPAGER='/usr/bin/less -R --use-color -Dd+r -Du+b'
+export EDITOR="/usr/bin/nvim"
+export DIFFPROG="/usr/bin/nvim -d"
+export VISUAL="/usr/bin/nvim"
+export BROWSER="/usr/bin/firefox"
 export EMAIL='huck@huck.website'
 
-# vim config
-export MYVIMRC="$XDG_CONFIG_HOME/nvim/init.lua"
-
 # config paths
 export LESSHISTFILE="$XDG_STATE_HOME/less/history"
 export TERMINFO="$XDG_DATA_HOME/terminfo"
diff --git a/.zshrc b/.zshrc
index 30e5a130552667250b4a07259ac9a35080b3eb00..de10c6642a190583f8e5efc577e623cc2e51d41d 100644 (file)
--- a/.zshrc
+++ b/.zshrc
@@ -3,20 +3,14 @@
 . $ZSH/.zshenv
 ZSHEXTRA=$ZSH/extra
 ZSHINCLUDE=$ZSH/include
-[[ ! -d $ZSH ]] && mkdir $ZSH/{,cache,extra,include,include}
-
-fpath+="$ZSHEXTRA/zfunc"
+[[ ! -d $ZSH ]] && mkdir $ZSH/{,cache,extra,include}
 
 # source files from include dir
-for file in $ZSHINCLUDE/*; do
-    . ${file}
-done
-
+for file in $ZSHINCLUDE/*; do . ${file}; done
 
-# start programs 
-[[ -z $(pgrep tmux) ]] && tmux start &
+# start programs
 [[ -f $XDG_CONFIG_HOME/.dircolors ]] && eval $(dircolors -b $XDG_CONFIG_HOME/.dircolors)
-eval "$(zoxide init zsh --cmd z)"
+[[ $(which zoxide) ]] && eval "$(zoxide init zsh --cmd z)"
 
 # options ------------------------------------------------------------
 ENABLE_CORRECTION="true"
@@ -77,7 +71,7 @@ autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
 
 add-zsh-hook chpwd chpwd_recent_dirs
 
-chpwd() { l }
+chpwd() { ls -Ah }
 
 autoload -Uz run-help
 
@@ -91,8 +85,8 @@ bindkey "\e[2~" quoted-insert
 
 # custom prompt -----------------------------------------------------
 if [[ -n $SSH_CONNECTION ]]; then
-PROMPT='%(?..%B%F{red}x) 
-%B%F{yellow}%n%b%f@%B%F{blue}%M%b%f -> %F{green}%d %F{red}[SSH] %B%F{magenta}[gentoo]%b%f $(git_prompt_enhanced_status) 
+PROMPT='%(?..%B%F{red}x)
+%B%F{yellow}%n%b%f@%B%F{blue}%M%b%f -> %F{green}%d %F{red}[SSH] %B%F{magenta}[gentoo]%b%f $(git_prompt_enhanced_status)
 %B%F{green}%(!.#.$) %f%b> '
 RPROMPT='[%!]'
 else
@@ -104,4 +98,3 @@ fi
 
 PS2='%B%F{green}%(!.#.$)%f%b >  %F{cyan}*%f '
 PS3='%B%F{green}%(!.#.$)%f%b %B%F{magenta}? '
-
index 531639fb448eb1b7cca1be5028d813483e74b69f..15f9ce9f9e4cc155e7398b0808bb7eb1ad6e5a60 100644 (file)
@@ -7,7 +7,6 @@ alias mount='mount --mkdir'
 alias lsblk='lsblk -f'
 alias reload='source $ZSH/.zshrc'
 alias quit='disown -a && exit'
-alias msg='sudo dmesg -H --level=err'
 alias :q='exit'
 
 # vim aliases
diff --git a/include/zshmux.sh b/include/zshmux.sh
new file mode 100644 (file)
index 0000000..0115284
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# start tmux server if it's not already running
+[[ ! $(pgrep tmux) ]] && tmux start
+
+# exit if already in a tmux session
+[[ -n $TMUX ]] && return
+
+# check if any sessions exit
+if [[ $(tmux list-sessions | wc -l) -ne 0 ]]; then
+    if [[ $(tmux list-sessions -F"#{?session_attached,,x}" | grep "x" | wc -l) -eq 1 ]] && [[ -z $SSH_CLIENT ]]; then
+        tmux attach-session -t $(tmux list-sessions -F"#{?session_attached,,#S}"  )
+        return
+    else
+        printf '\033[32;1mcurrent \033[33;1mtmux \033[32;1msessions\033[0m:\n'
+        tmux list-sessions -F"#S - (#{?session_attached,attached,not attached})"
+        printf '\033[34;1mattach session?\033[0;m: [\033[35;1mname\033[0m] \033[37;2m(empty if none)\033[0m: '
+    fi
+else
+    printf '\033[34;1mno \033[33;1mtmux \033[34;1msessions active\n'
+    printf '\033[34;1mcreate new session?\033[0;m: [\033[35;1mname\033[0m] \033[37;2m(empty if none)\033[0m: '
+fi
+
+read session
+
+# start requested session - since it uses grep you just have to put enough of a unique identifier to select
+if [[ -n $session ]]; then
+    if tmux list-sessions -F"#S" | grep -q "$session"; then
+        tmux attach-session -t $session 
+        return
+    elif [[ $session == new ]]; then
+        tmux new-session
+        return
+    else
+        tmux new-session -s $session
+        return
+    fi
+fi
+
+return
diff --git a/include/zshmux.zsh b/include/zshmux.zsh
deleted file mode 100644 (file)
index 0e47eb3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/zsh
-if [[ -z $TMUX ]]; then
-    if [[ $(tmux list-sessions | wc -l) -ne 0 ]]; then
-        if [[ $(tmux list-sessions -F"#{?session_attached,,x}" | grep "x" | wc -l) -eq 1 ]] && [[ -z $SSH_CLIENT ]]; then
-            tmux attach-session -t $(tmux list-sessions -F"#{?session_attached,,#S}"  )
-            return
-        else
-            printf '\033[32;1mCurrent \033[33;1mtmux \033[32;1msessions\033[0m:\n'
-            tmux list-sessions -F"#S - (#{?session_attached,Attached,Not Attached})"
-            printf '\033[34;1mAttach session?\033[0;m: [\033[35;1mname\033[0m] \033[37;2m(empty if none)\033[0m: '
-
-        fi
-    else
-        printf '\033[34;1mNo \033[33;1mtmux \033[34;1msessions active\n'
-        printf '\033[34;1mCreate new session?\033[0;m: [\033[35;1mname\033[0m] \033[37;2m(empty if none)\033[0m: '
-    fi
-
-    read session
-
-    if [[ -n $session ]]; then
-        if tmux list-sessions -F"#S" | grep -q "$session"; then
-            tmux attach-session -t $session 
-            return
-        elif [[ $session == new ]]; then
-            tmux new-session
-            return
-        else
-            tmux new-session -s $session
-            return
-        fi
-    fi
-    return
-fi