Add basic aliases and profile configuration

This commit is contained in:
Marty Oehme 2020-02-01 16:29:27 +01:00
parent 8e3dae10fe
commit 902ca7dc02
3 changed files with 46 additions and 3 deletions

View File

@ -2,6 +2,8 @@
#
# Global aliases for any shell
exist() { type "$1" >/dev/null 2>&1; }
# Avoid aliases which I did not create -- unalias EVERYTHING
unalias -a
@ -12,8 +14,14 @@ alias v="nvim"
alias :q="exit"
# ls defaults
if [ "$(uname -s)" = "Linux" ]; then
# we're on linux
if exist exa; then
alias l="exa -l --git --git-ignore"
alias L="exa -hal --grid --git"
# a recursive tree
# - usually want to change levels recursed with -L2 -L3 or similar
alias ll="exa --tree -L2"
alias LL="exa -a --tree -L2"
else
alias l="ls -lhF"
alias L="ls -lAhF"
fi
@ -26,5 +34,25 @@ alias ~="cd ~"
# clear my screen
alias cl="clear"
# Display your current external ip address
# Display current external ip address
alias myip="curl -s icanhazip.com"
# fzf
if exist fzf; then
# Display fuzzy-searchable history
alias fzf_history="history | fzf --tac --height 20"
# Fuzzy search packages to install
alias fzf_yay="yay -Slq | fzf -m --preview 'yay -Si {1}' | xargs -ro yay -S"
# Fuzzy uninstall packages
alias fzf_yayrns="yay -Qeq | fzf -m --preview 'yay -Qi {1}' | xargs -ro yay -Rns"
fi
# vifm
if exist vifm; then
alias vm=vifm
alias vmm='vifm ${PWD}'
# enable picture preview script
exist vifmrun && alias vifm=vifmrun
fi
unset -f exist

View File

@ -16,3 +16,13 @@ if [ -d "$XDG_CONFIG_HOME/sh/env.d" ]; then
done
unset _env
fi
# shellcheck source=alias
[ -f "$XDG_CONFIG_HOME/sh/alias" ] && . "$XDG_CONFIG_HOME/sh/alias"
# load additional aliases
if [ -d "$XDG_CONFIG_HOME/sh/alias.d" ]; then
for _alias in "$XDG_CONFIG_HOME/sh/alias.d"/*.sh; do
. "$_alias"
done
unset _alias
fi

View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
if [ ! "$DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then
exec startx "$XDG_CONFIG_HOME"/xresources/xinitrc
fi