1682

· 👁 17 views

My new great #bash #alias (actually a #hotkey) for faster #cd

# Like cd, but accept a path with spaces - so no quotation is needed
# How to use it: paste/type a path and press Ctrl-g
bind "\"\C-g\": \"\C-acd '\C-e'\C-j\""
# How it works: it executes multiple commands:
# Ctrl-a to go to the line start
# Types cd '
# Ctrl-e to go to the line end
# Add single quote
# Ctrl-j hits the Enter
# =====
# I tried an alias/function
# `cd "$*"`
# and
# `cd "$1"`
# but got error when path contains `(`