Add basic XDG compliant sh architecture
The only file left in $HOME is .zshenv, which sets up zsh to source everything from XDG_CONFIG_HOME/zsh.
Shell files are split into sh and zsh directories, for global assignments (which should be posix compliant, work on any posix shell) like environemnt variables, xdg vars, and global aliases. zsh contains zsh specific customization (prompt customization, plugin loading, zsh completions).
Zsh initialization will pull from sh directory first, loading the respective mirror to its startup file (`.zprofile` loads `sh/profile` and `profile.d/*`, `.zshenv` loads `sh/env` and `sh/env.d/*` and `zsh/env.d/*`, `.zshrc` loads `sh/alias`, `sh/alias.d/*` and `zsh/alias.d/*`)
Once all is done, it will have loaded both global variables, aliases and settings, and zsh-only specifications. Other stow modules, if they want to add shell functionality, can include their aliases and functions in one of the above directories to automatically be picked up by zsh.
2020-02-02 15:08:40 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
#
|
|
|
|
# Global aliases for any shell
|
|
|
|
|
|
|
|
exist() { type "$1" >/dev/null 2>&1; }
|
|
|
|
|
|
|
|
# Avoid aliases which I did not create -- unalias EVERYTHING
|
|
|
|
unalias -a
|
|
|
|
|
|
|
|
# v shorthand for neovim
|
2021-03-05 13:03:46 +00:00
|
|
|
if exist nvim; then
|
2021-06-02 21:23:16 +00:00
|
|
|
alias v="nvim"
|
2022-01-11 16:27:28 +00:00
|
|
|
alias vim="nvim"
|
2022-08-10 07:01:09 +00:00
|
|
|
alias vs="nvim -c 'ScratchPad'" # open an empty 'scratchpad' which simply disappears after use
|
|
|
|
alias vw="nvim -c \"lua require 'zettelkasten'.index_open()\"" # open to personal wiki
|
2021-03-05 13:03:46 +00:00
|
|
|
elif exist vim; then
|
2021-06-02 21:23:16 +00:00
|
|
|
alias v="vim"
|
2021-03-05 13:03:46 +00:00
|
|
|
else
|
2021-06-02 21:23:16 +00:00
|
|
|
alias v="vi"
|
2022-01-11 16:27:28 +00:00
|
|
|
alias vim="vi"
|
2021-03-05 13:03:46 +00:00
|
|
|
fi
|
Add basic XDG compliant sh architecture
The only file left in $HOME is .zshenv, which sets up zsh to source everything from XDG_CONFIG_HOME/zsh.
Shell files are split into sh and zsh directories, for global assignments (which should be posix compliant, work on any posix shell) like environemnt variables, xdg vars, and global aliases. zsh contains zsh specific customization (prompt customization, plugin loading, zsh completions).
Zsh initialization will pull from sh directory first, loading the respective mirror to its startup file (`.zprofile` loads `sh/profile` and `profile.d/*`, `.zshenv` loads `sh/env` and `sh/env.d/*` and `zsh/env.d/*`, `.zshrc` loads `sh/alias`, `sh/alias.d/*` and `zsh/alias.d/*`)
Once all is done, it will have loaded both global variables, aliases and settings, and zsh-only specifications. Other stow modules, if they want to add shell functionality, can include their aliases and functions in one of the above directories to automatically be picked up by zsh.
2020-02-02 15:08:40 +00:00
|
|
|
|
|
|
|
# exit shell mimicks vim
|
|
|
|
alias :q="exit"
|
|
|
|
|
|
|
|
# ls defaults
|
|
|
|
if exist exa; then
|
2022-06-13 15:50:36 +00:00
|
|
|
alias l="exa -l --git --git-ignore --group-directories-first"
|
|
|
|
alias L="exa -hal --grid --git --group-directories-first"
|
2021-06-02 21:23:16 +00:00
|
|
|
# a recursive tree
|
|
|
|
# - usually want to change levels recursed with -L2 -L3 or similar
|
2022-06-13 15:50:36 +00:00
|
|
|
alias ll="exa --tree -L2 --group-directories-first"
|
|
|
|
alias LL="exa -a --tree -L2 --group-directories-first"
|
2023-01-07 13:54:55 +00:00
|
|
|
alias lla="exa --tree --group-directories-first"
|
|
|
|
alias LLA="exa -a --tree --group-directories-first"
|
Add basic XDG compliant sh architecture
The only file left in $HOME is .zshenv, which sets up zsh to source everything from XDG_CONFIG_HOME/zsh.
Shell files are split into sh and zsh directories, for global assignments (which should be posix compliant, work on any posix shell) like environemnt variables, xdg vars, and global aliases. zsh contains zsh specific customization (prompt customization, plugin loading, zsh completions).
Zsh initialization will pull from sh directory first, loading the respective mirror to its startup file (`.zprofile` loads `sh/profile` and `profile.d/*`, `.zshenv` loads `sh/env` and `sh/env.d/*` and `zsh/env.d/*`, `.zshrc` loads `sh/alias`, `sh/alias.d/*` and `zsh/alias.d/*`)
Once all is done, it will have loaded both global variables, aliases and settings, and zsh-only specifications. Other stow modules, if they want to add shell functionality, can include their aliases and functions in one of the above directories to automatically be picked up by zsh.
2020-02-02 15:08:40 +00:00
|
|
|
else
|
2021-06-02 21:23:16 +00:00
|
|
|
alias l="ls -lhF"
|
|
|
|
alias L="ls -lAhF"
|
Add basic XDG compliant sh architecture
The only file left in $HOME is .zshenv, which sets up zsh to source everything from XDG_CONFIG_HOME/zsh.
Shell files are split into sh and zsh directories, for global assignments (which should be posix compliant, work on any posix shell) like environemnt variables, xdg vars, and global aliases. zsh contains zsh specific customization (prompt customization, plugin loading, zsh completions).
Zsh initialization will pull from sh directory first, loading the respective mirror to its startup file (`.zprofile` loads `sh/profile` and `profile.d/*`, `.zshenv` loads `sh/env` and `sh/env.d/*` and `zsh/env.d/*`, `.zshrc` loads `sh/alias`, `sh/alias.d/*` and `zsh/alias.d/*`)
Once all is done, it will have loaded both global variables, aliases and settings, and zsh-only specifications. Other stow modules, if they want to add shell functionality, can include their aliases and functions in one of the above directories to automatically be picked up by zsh.
2020-02-02 15:08:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# cd defaults
|
|
|
|
alias ..="cd .."
|
|
|
|
alias ...="cd ../.."
|
|
|
|
alias ~="cd ~"
|
|
|
|
|
2020-02-16 13:21:42 +00:00
|
|
|
alias md="mkdir -p"
|
|
|
|
|
Add basic XDG compliant sh architecture
The only file left in $HOME is .zshenv, which sets up zsh to source everything from XDG_CONFIG_HOME/zsh.
Shell files are split into sh and zsh directories, for global assignments (which should be posix compliant, work on any posix shell) like environemnt variables, xdg vars, and global aliases. zsh contains zsh specific customization (prompt customization, plugin loading, zsh completions).
Zsh initialization will pull from sh directory first, loading the respective mirror to its startup file (`.zprofile` loads `sh/profile` and `profile.d/*`, `.zshenv` loads `sh/env` and `sh/env.d/*` and `zsh/env.d/*`, `.zshrc` loads `sh/alias`, `sh/alias.d/*` and `zsh/alias.d/*`)
Once all is done, it will have loaded both global variables, aliases and settings, and zsh-only specifications. Other stow modules, if they want to add shell functionality, can include their aliases and functions in one of the above directories to automatically be picked up by zsh.
2020-02-02 15:08:40 +00:00
|
|
|
# clear my screen
|
|
|
|
alias cl="clear"
|
|
|
|
|
|
|
|
# Display current external ip address
|
|
|
|
alias myip="curl -s icanhazip.com"
|
|
|
|
|
|
|
|
# fzf
|
|
|
|
if exist fzf; then
|
2021-06-02 21:23:16 +00:00
|
|
|
# Display fuzzy-searchable history
|
|
|
|
alias fzfhistory="history -l -E -D 0 | fzf --tac --height 20"
|
|
|
|
fzfman() {
|
|
|
|
man "$(apropos --long "$1" | fzf | awk '{print $2, $1}' | tr -d '()')"
|
|
|
|
}
|
2020-07-23 13:33:02 +00:00
|
|
|
|
2021-06-02 21:23:16 +00:00
|
|
|
# Fuzzy search packages to install
|
|
|
|
if exist yay; then
|
|
|
|
fzf_pkg_tool=yay
|
|
|
|
elif exist paru; then
|
|
|
|
fzf_pkg_tool=paru
|
2022-01-30 10:37:18 +00:00
|
|
|
elif exist pacman; then
|
|
|
|
fzf_pkg_tool=pacman
|
2021-06-02 21:23:16 +00:00
|
|
|
fi
|
|
|
|
# shellcheck disable=2139 # we *want* this to be done at shell startup instead of dynamically
|
|
|
|
if [ -n "$fzf_pkg_tool" ]; then
|
|
|
|
alias fzfyay="$fzf_pkg_tool -Slq | fzf -m --preview '$fzf_pkg_tool -Si {1}' | xargs -ro $fzf_pkg_tool -S"
|
|
|
|
# Fuzzy uninstall packages
|
|
|
|
alias fzfyayrns="$fzf_pkg_tool -Qeq | fzf -m --preview '$fzf_pkg_tool -Qi {1}' | xargs -ro $fzf_pkg_tool -Rns"
|
|
|
|
fi
|
|
|
|
unset fzf_pkg_tool
|
2020-11-25 10:36:21 +00:00
|
|
|
|
2021-06-02 21:23:16 +00:00
|
|
|
# ripgrep-all to fzf search through any documents
|
|
|
|
if exist rga; then
|
|
|
|
fzfrga() {
|
|
|
|
RG_PREFIX="rga --files-with-matches"
|
|
|
|
xdg-open "$(
|
|
|
|
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
|
|
|
|
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
|
|
|
|
--phony -q "$1" \
|
|
|
|
--bind "change:reload:$RG_PREFIX {q}" \
|
|
|
|
--preview-window="70%:wrap"
|
|
|
|
)"
|
|
|
|
}
|
|
|
|
fi
|
Add basic XDG compliant sh architecture
The only file left in $HOME is .zshenv, which sets up zsh to source everything from XDG_CONFIG_HOME/zsh.
Shell files are split into sh and zsh directories, for global assignments (which should be posix compliant, work on any posix shell) like environemnt variables, xdg vars, and global aliases. zsh contains zsh specific customization (prompt customization, plugin loading, zsh completions).
Zsh initialization will pull from sh directory first, loading the respective mirror to its startup file (`.zprofile` loads `sh/profile` and `profile.d/*`, `.zshenv` loads `sh/env` and `sh/env.d/*` and `zsh/env.d/*`, `.zshrc` loads `sh/alias`, `sh/alias.d/*` and `zsh/alias.d/*`)
Once all is done, it will have loaded both global variables, aliases and settings, and zsh-only specifications. Other stow modules, if they want to add shell functionality, can include their aliases and functions in one of the above directories to automatically be picked up by zsh.
2020-02-02 15:08:40 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# vifm
|
|
|
|
if exist vifm; then
|
2021-06-02 21:23:16 +00:00
|
|
|
alias vm=vifm
|
|
|
|
alias vmm='vifm ${PWD}'
|
Add basic XDG compliant sh architecture
The only file left in $HOME is .zshenv, which sets up zsh to source everything from XDG_CONFIG_HOME/zsh.
Shell files are split into sh and zsh directories, for global assignments (which should be posix compliant, work on any posix shell) like environemnt variables, xdg vars, and global aliases. zsh contains zsh specific customization (prompt customization, plugin loading, zsh completions).
Zsh initialization will pull from sh directory first, loading the respective mirror to its startup file (`.zprofile` loads `sh/profile` and `profile.d/*`, `.zshenv` loads `sh/env` and `sh/env.d/*` and `zsh/env.d/*`, `.zshrc` loads `sh/alias`, `sh/alias.d/*` and `zsh/alias.d/*`)
Once all is done, it will have loaded both global variables, aliases and settings, and zsh-only specifications. Other stow modules, if they want to add shell functionality, can include their aliases and functions in one of the above directories to automatically be picked up by zsh.
2020-02-02 15:08:40 +00:00
|
|
|
fi
|
2022-04-11 10:52:19 +00:00
|
|
|
|
2023-01-07 13:54:32 +00:00
|
|
|
# default image viewer
|
|
|
|
if exist imv-folder; then
|
|
|
|
iv() {
|
|
|
|
if [ "$#" -eq 1 ] && [ -f "$1" ]; then
|
|
|
|
imv-folder "$1"
|
|
|
|
else
|
|
|
|
imv "$@"
|
|
|
|
fi
|
|
|
|
}
|
2023-01-08 19:37:17 +00:00
|
|
|
else
|
|
|
|
for cmd in imv nsxiv vimiv sxiv feh; do
|
|
|
|
if exist "$cmd"; then alias iv="$cmd"; break; fi
|
|
|
|
done
|
2022-08-06 19:54:55 +00:00
|
|
|
fi
|
|
|
|
|
2022-04-11 10:52:19 +00:00
|
|
|
# python
|
|
|
|
if exist ptipython; then
|
|
|
|
alias py=ptipython
|
|
|
|
elif exist ipython; then
|
|
|
|
alias py=ipython
|
|
|
|
elif exist python; then
|
|
|
|
alias py=python
|
|
|
|
fi
|
2023-01-10 15:47:16 +00:00
|
|
|
|
|
|
|
# distrobox
|
|
|
|
if exist distrobox; then
|
|
|
|
alias db=distrobox
|
|
|
|
fi
|