changes made in this commit related to zsh:
- remove the shebang, not much useful - setup sudo alias of doas with a trailing space - zsh does not have readarray, remove the alias, will just use the GUI launcher - add host vasudev for check in syntax highlighting - declare ZSH_CONFS_DIRECTORY before it is used - add keybinds for various keys like PgDown, PgUp, F* - fix syntax error of using "else if" when "elif" is correct - remove the pts* case for fonts, it is not usefu
This commit is contained in:
parent
925432e2b8
commit
2c955944a4
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/env zsh
|
||||
# ~/.config/zsh_confs/01_history: zsh history file
|
||||
|
||||
# export variables
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env zsh
|
||||
# ~/.config/zsh_confs/XX_aliases: my [zsh] shell aliases
|
||||
# ~/.config/zsh_confs/20_aliases: my [zsh] shell aliases
|
||||
|
||||
# hostname
|
||||
MACHINE_HOSTNAME=$(cat /etc/hostname)
|
||||
|
@ -61,7 +60,7 @@ fi
|
|||
|
||||
if command -v doas > /dev/null; then
|
||||
unalias sudo
|
||||
alias sudo="doas"
|
||||
alias sudo="doas "
|
||||
fi
|
||||
|
||||
# OS/hostname specific aliases
|
||||
|
@ -90,25 +89,6 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|||
# aliases for flatpak
|
||||
alias flatpakupdates="flatpak remote-ls --updates flathub"
|
||||
alias flatpakautoremove="flatpak remove --unused --delete-data"
|
||||
# generate `flatpak run <name>`
|
||||
if command -v flatpak > /dev/null; then
|
||||
# Get a list of flatpak applications in the reverse domain name format
|
||||
readarray -t ids < <(flatpak list --app --columns=application)
|
||||
for id in "${ids[@]}"; do
|
||||
|
||||
# Take everything past the last dot (the name)
|
||||
name="${id##*.}"
|
||||
# Make it lowercase to approximate binary name
|
||||
binary="${name,,}"
|
||||
|
||||
# If there is not already a command at that name
|
||||
if ! command -v "${binary}" > /dev/null; then
|
||||
|
||||
# Create an alias that runs the flatpak
|
||||
alias "$binary=flatpak run \"$id\""
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# other common aliases
|
||||
alias tmux="/usr/bin/tmux -f $HOME/.config/tmux/tmux.conf"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env zsh
|
||||
# ~/.config/zsh_confs/XX_alias_funcs: my alias functions
|
||||
# ~/.config/zsh_confs/21_alias_funcs: my alias functions
|
||||
|
||||
towebp() {
|
||||
cwebp -q 80 "$1" -o "$1".webp
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#!/usr/bin/env zsh
|
||||
# ~/.config/zsh_confs/XX_syntax_highlight: zsh file for syntax highlighting
|
||||
# ~/.config/zsh_confs/90_syntax_highlight: zsh file for syntax highlighting
|
||||
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
|
||||
MACHINE_HOSTNAME=$(cat /etc/hostname)
|
||||
|
||||
if [[ "$MACHINE_HOSTNAME" == "flameboi" ]]; then
|
||||
if [[ "$MACHINE_HOSTNAME" == "flameboi" || "$MACHINE_HOSTNAME" == "vasudev" ]]; then
|
||||
ZSH_SYNTAX_HIGHLIGHT_PATH="/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
elif [[ "$MACHINE_HOSTNAME" == "sentinel" || "$MACHINE_HOSTNAME" == "bluefeds" ]]; then
|
||||
ZSH_SYNTAX_HIGHLIGHT_PATH="/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
|
@ -15,4 +14,4 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|||
ZSH_SYNTAX_HIGHLIGHT_PATH="/usr/local/opt/zsh-fast-syntax-highlighting/share/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh"
|
||||
fi
|
||||
|
||||
source ZSH_SYNTAX_HIGHLIGHT_PATH
|
||||
[ ! -z $ZSH_SYNTAX_HIGHLIGHT_PATH ] && [ -f $ZSH_SYNTAX_HIGHLIGHT_PATH ] && source $ZSH_SYNTAX_HIGHLIGHT_PATH
|
||||
|
|
32
.zshrc
32
.zshrc
|
@ -6,6 +6,8 @@ case $- in
|
|||
*) return;;
|
||||
esac
|
||||
|
||||
# directory where most of my zsh files are stored
|
||||
ZSH_CONFS_DIRECTORY=$HOME/.config/zsh_confs
|
||||
HISTORY_CONF=$ZSH_CONFS_DIRECTORY/10_history
|
||||
ALIASES_CONF=$ZSH_CONFS_DIRECTORY/20_aliases
|
||||
SYNTAX_HIGHLIGHT_CONF=$ZSH_CONFS_DIRECTORY/90_syntax_highlight
|
||||
|
@ -13,9 +15,6 @@ SYNTAX_HIGHLIGHT_CONF=$ZSH_CONFS_DIRECTORY/90_syntax_highlight
|
|||
# for using comments in interactive shell
|
||||
setopt INTERACTIVECOMMENTS
|
||||
|
||||
# directory where most of my zsh files are stored
|
||||
ZSH_CONFS_DIRECTORY="$HOME/.config/zsh_confs"
|
||||
|
||||
# load options related to history
|
||||
[ -f $HISTORY_CONF ] && source $HISTORY_CONF
|
||||
|
||||
|
@ -23,16 +22,34 @@ ZSH_CONFS_DIRECTORY="$HOME/.config/zsh_confs"
|
|||
ZLE_REMOVE_SUFFIX_CHARS=""
|
||||
|
||||
# key-bindings
|
||||
if [[ -f "$HOME/.zkbd/$TERM" ]]; then
|
||||
source $HOME/.zkbd/$TERM
|
||||
if [[ -f "$HOME/.zkbd/xterm-256color" ]]; then
|
||||
source $HOME/.zkbd/xterm-256color
|
||||
|
||||
[[ -n ${key[Home]} ]] && bindkey "${key[Home]}" beginning-of-line
|
||||
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
|
||||
[[ -n ${key[Delete]} ]] && bindkey "${key[Delete]}" delete-char
|
||||
[[ -n ${key[PageUp]} ]] && bindkey "${key[PageUp]}" backward-word
|
||||
[[ -n ${key[PageDown]} ]] && bindkey "${key[PageDown]}" forward-word
|
||||
[[ -n ${key[Insert]} ]] && bindkey "${key[Insert]}" vi-replace
|
||||
|
||||
# disable all fn keys
|
||||
# re-enable them when needed
|
||||
[[ -n ${key[F1]} ]] && bindkey "${key[F1]}" ""
|
||||
[[ -n ${key[F2]} ]] && bindkey "${key[F2]}" ""
|
||||
[[ -n ${key[F3]} ]] && bindkey "${key[F3]}" ""
|
||||
[[ -n ${key[F4]} ]] && bindkey "${key[F4]}" ""
|
||||
[[ -n ${key[F5]} ]] && bindkey "${key[F5]}" ""
|
||||
[[ -n ${key[F6]} ]] && bindkey "${key[F6]}" ""
|
||||
[[ -n ${key[F7]} ]] && bindkey "${key[F7]}" ""
|
||||
[[ -n ${key[F8]} ]] && bindkey "${key[F8]}" ""
|
||||
[[ -n ${key[F9]} ]] && bindkey "${key[F9]}" ""
|
||||
[[ -n ${key[F10]} ]] && bindkey "${key[F10]}" ""
|
||||
[[ -n ${key[F11]} ]] && bindkey "${key[F11]}" ""
|
||||
[[ -n ${key[F12]} ]] && bindkey "${key[F12]}" ""
|
||||
fi
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
bindkey '^i' expand-or-complete-prefix
|
||||
bindkey "^i" expand-or-complete-prefix
|
||||
|
||||
# prompt
|
||||
PROMPT=$'\n%F{11}─┬─[%f %F{5}%y %f%F{white}%? %D %*%f %F{11}]%f
|
||||
|
@ -51,11 +68,10 @@ if [[ "$MACHINE_HOSTNAME" == "flameboi" ]]; then
|
|||
autuload -Uz compinit
|
||||
compinit
|
||||
# End of lines added by compinstall
|
||||
else if [[ "$MACHINE_HOSTNAME" == "bluefeds" || "$MACHINE_HOSTNAME" == "sentinel" ]]; then
|
||||
elif [[ "$MACHINE_HOSTNAME" == "bluefeds" || "$MACHINE_HOSTNAME" == "sentinel" ]]; then
|
||||
# use bigger fonts on the console
|
||||
case $(tty) in
|
||||
(/dev/tty[0-9]) setfont /usr/share/consolefonts/Lat2-Terminus28x14.psf.gz;;
|
||||
(/dev/pts[0-9]) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
changes made in this commit related to zsh:
|
||||
- remove the shebang, not much useful
|
||||
- setup sudo alias of doas with a trailing space
|
||||
- zsh does not have readarray, remove the alias, will just use the GUI launcher
|
||||
- add host vasudev for check in syntax highlighting
|
||||
- declare ZSH_CONFS_DIRECTORY before it is used
|
||||
- add keybinds for various keys like PgDown, PgUp, F*
|
||||
- fix syntax error of using "else if" when "elif" is correct
|
||||
- remove the pts* case for fonts, it is not useful
|
Loading…
Reference in New Issue