Refactored to make zsh support as seamless as bash

This commit is contained in:
Lockszmith 2022-06-18 14:13:08 -04:00
parent 42d570d673
commit 0c569629bc
13 changed files with 73 additions and 46 deletions

View file

@ -1,5 +1,10 @@
alias sudo="/usr/bin/sudo "
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias lessr="less --raw-control-chars "
alias sz-edshrc="ed ~/.sz.shrc.d ; exec $SHELL"

View file

@ -1,6 +1,6 @@
PREFERED_VI=$(type -fP nvim vim | head -1)
PREFERED_VI=$(which-command nvim vim | head -1)
if [[ -z "$PREFERED_VI" ]]; then
PREFERED_VI=$(type -fP vi | head -1)
PREFERED_VI=$(which-command vi | head -1)
if [[ -z "$PREFERED_VI" ]]; then
alias my_vi='eval $EDITOR '
@ -12,9 +12,9 @@ else
fi
if [[ -r "$HOME/.config/_my.emacs/spacemacs/emacs.d/init.el" \
&& -n "$(type -fP emacsclient)" \
&& -n "$(type -fP emacs)" \
&& -n "$(type -fP edit-with-spacemacs)" \
&& -n "$(which-command emacsclient)" \
&& -n "$(which-command emacs)" \
&& -n "$(which-command edit-with-spacemacs)" \
]]; then
alias my_editor='edit-with-spacemacs'
else

View file

@ -1,3 +1,3 @@
if [[ -n "$(type -fP zfs)" ]]; then
if [[ -n "$(which-command zfs)" ]]; then
alias zls='sudo zfs list -o name,used,avail,refer,canmount,mounted,mountpoint'
fi

View file

@ -1,4 +1,4 @@
if [[ -n "$(type -fP setxkbmap)" && -n "$DISPLAY" ]]; then
if [[ -n "$(which-command setxkbmap)" && -n "$DISPLAY" ]]; then
setxkbmap -option
setxkbmap -option caps:escape
setxkbmap -option caps:ctrl_modifier

View file

@ -1,4 +1,4 @@
if [[ -n "$(type -fP chezmoi)" ]]; then
if [[ -n "$(which-command chezmoi)" ]]; then
alias cdcz="cd $(chezmoi source-path)"
alias czcd="cdcz "

View file

@ -1,4 +1,4 @@
if [[ -n "$(type -fP oh-my-posh)" && -z "$INSIDE_EMACS" ]]; then
if [[ -n "$(which-command oh-my-posh)" ]]; then
OHMYPOSH_CONFIG=''
[[ -r ~/.poshtheme.omp.json ]] && OHMYPOSH_CONFIG="~/.poshtheme.omp.json"
eval "$(oh-my-posh init bash --config $OHMYPOSH_CONFIG)"

View file

@ -4,6 +4,4 @@ export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
# Save and reload the history after each command finishes
if ! [[ "$PROMPT_COMMAND" =~ "history -a; history -c; history -r;" ]]; then
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
fi
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"

View file

@ -0,0 +1,6 @@
if [[ -n "$(which-command oh-my-posh)" ]]; then
OHMYPOSH_CONFIG=''
[[ -r ~/.poshtheme.omp.json ]] && OHMYPOSH_CONFIG="~/.poshtheme.omp.json"
eval "$(oh-my-posh init zsh --config $OHMYPOSH_CONFIG)"
unset OHMYPOSH_CONFIG
fi

View file

@ -0,0 +1,15 @@
# The following lines were added by compinstall
zstyle ':completion:*' completer _complete _ignored
zstyle :compinstall filename '/mnt/szmedia/USERDATA/home/sz/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=99999
bindkey -e
# End of lines configured by zsh-newuser-install

View file

@ -0,0 +1 @@
alias which_command="whence "