manager/config/bash/bashrc.d/functions
Dan Anglin 30038788b4
feat(bash): XDG Dir spec updates and other fixes
- Update program configurations to use the XDG Directories with the help
  of xdg-ninja.
- Add missing alias for the copy command.
- Remove the alias for tmux since it should now support XDG_CONFIG_HOME
  by default.
- Remove the run_package_updates function since this is now a bash
  script.
- Update the MANPAGER variable so that it works properly with neovim,
2022-05-15 21:33:17 +01:00

29 lines
690 B
Bash

## Description: All aliases are defined here.
## vim: ft=sh :
# mkcd creates a new directory (including the parent directories if they don't exist)
# and makes it the current directory.
mkcd() {
mkdir -p $1
cd $1
}
# go_up() navigates up a specified number of parent directories.
# Inspired from DT's up() function:
# https://gitlab.com/dwt1/dotfiles/-/blob/80632c5cad56ac96955e0ca1d582a4b59741bace/.bashrc#L109
go_up() {
local d=""
local steps="$1"
if [ -z "$steps" ] || [ "$steps" -lt 1 ]; then
steps=1
fi
for ((i=1; i<=steps; i++)); do
d="../$d"
done
if ! cd "$d"; then
echo "Unable to go up $steps directories."
fi
}