2022-01-15 19:00:35 +09:00
|
|
|
#! bash oh-my-bash.module
|
2022-08-23 11:38:26 +09:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Note on copyright (2022-08-23): The aliases defined in this file seems to
|
|
|
|
# originally come from a blog post [1]. See also the comments in lib/base.sh.
|
2017-10-10 18:07:01 +07:00
|
|
|
#
|
2022-08-23 11:38:26 +09:00
|
|
|
# [1] Nathaniel Landau, "My Mac OSX Bash Profile",
|
|
|
|
# https://natelandau.com/my-mac-osx-bash_profile/, 2013-07-02.
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------------
|
2017-10-10 18:07:01 +07:00
|
|
|
# Description: This file holds all general BASH aliases
|
|
|
|
#
|
2019-01-23 03:05:32 -08:00
|
|
|
# For your own benefit, we won't load all aliases in the general, we will
|
|
|
|
# keep the very generic command here and enough for daily basis tasks.
|
2017-10-10 18:07:01 +07:00
|
|
|
#
|
2019-01-23 03:05:32 -08:00
|
|
|
# If you are looking for the more sexier aliases, we suggest you take a look
|
|
|
|
# into other core alias files which installed by default.
|
2017-10-10 18:07:01 +07:00
|
|
|
#
|
2022-08-23 11:38:26 +09:00
|
|
|
#------------------------------------------------------------------------------
|
2017-10-10 18:07:01 +07:00
|
|
|
|
|
|
|
# -----------------------------
|
|
|
|
# 1. MAKE TERMINAL BETTER
|
|
|
|
# -----------------------------
|
|
|
|
|
2022-08-23 12:05:02 +09:00
|
|
|
# Determines the use of the option `-v' on the first call
|
|
|
|
# Ref. https://github.com/ohmybash/oh-my-bash/issues/351
|
|
|
|
function _omb_alias_general_cp_init {
|
|
|
|
if (tmp=$(_omb_util_mktemp); trap 'rm -f "$tmp"{,.2}' EXIT; command cp -v "$tmp" "$tmp.2" &>/dev/null); then
|
2022-09-16 20:17:42 +09:00
|
|
|
alias cp='cp -iv' && function _omb_alias_general_cp_init { command cp -iv "$@"; }
|
2022-08-23 12:05:02 +09:00
|
|
|
else
|
2022-09-16 20:17:42 +09:00
|
|
|
alias cp='cp -i' && function _omb_alias_general_cp_init { command cp -i "$@"; }
|
|
|
|
fi &&
|
|
|
|
_omb_alias_general_cp_init "$@"
|
2022-08-23 12:05:02 +09:00
|
|
|
}
|
|
|
|
function _omb_alias_general_mv_init {
|
|
|
|
if (tmp=$(_omb_util_mktemp); trap 'rm -f "$tmp.2"' EXIT; command mv -v "$tmp" "$tmp.2" &>/dev/null); then
|
2022-09-16 20:17:42 +09:00
|
|
|
alias mv='mv -iv' && function _omb_alias_general_mv_init { command mv -iv "$@"; }
|
2022-08-23 12:05:02 +09:00
|
|
|
else
|
2022-09-16 20:17:42 +09:00
|
|
|
alias mv='mv -i' && function _omb_alias_general_mv_init { command mv -i "$@"; }
|
|
|
|
fi &&
|
|
|
|
_omb_alias_general_mv_init "$@"
|
2022-08-23 12:05:02 +09:00
|
|
|
}
|
|
|
|
function _omb_alias_general_mkdir_init {
|
|
|
|
if command mkdir -pv . &>/dev/null; then
|
2022-09-16 20:17:42 +09:00
|
|
|
alias mkdir='mkdir -pv' && function _omb_alias_general_mkdir_init { command mkdir -pv "$@"; }
|
2022-08-23 12:05:02 +09:00
|
|
|
else
|
2022-09-16 20:17:42 +09:00
|
|
|
alias mkdir='mkdir -p' && function _omb_alias_general_mkdir_init { command mkdir -p "$@"; }
|
|
|
|
fi &&
|
|
|
|
_omb_alias_general_mkdir_init "$@"
|
2022-08-23 12:05:02 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
alias cp='_omb_alias_general_cp_init' # Preferred 'cp' implementation
|
|
|
|
alias mv='_omb_alias_general_mv_init' # Preferred 'mv' implementation
|
|
|
|
alias mkdir='_omb_alias_general_mkdir_init' # Preferred 'mkdir' implementation
|
2017-10-10 18:07:01 +07:00
|
|
|
alias ll='ls -lAFh' # Preferred 'ls' implementation
|
|
|
|
alias less='less -FSRXc' # Preferred 'less' implementation
|
2019-01-23 03:05:32 -08:00
|
|
|
alias nano='nano -W' # Preferred 'nano' implementation
|
2017-10-10 18:07:01 +07:00
|
|
|
alias wget='wget -c' # Preferred 'wget' implementation (resume download)
|
|
|
|
alias c='clear' # c: Clear terminal display
|
|
|
|
alias path='echo -e ${PATH//:/\\n}' # path: Echo all executable Paths
|
|
|
|
alias show_options='shopt' # Show_options: display bash options settings
|
|
|
|
alias fix_stty='stty sane' # fix_stty: Restore terminal settings when screwed up
|
2020-06-11 01:37:51 -07:00
|
|
|
alias fix_term='echo -e "\033c"' # fix_term: Reset the conosle. Similar to the reset command
|
2022-08-23 12:06:06 +09:00
|
|
|
alias cic='bind "set completion-ignore-case on"' # cic: Make tab-completion case-insensitive
|
2017-10-10 18:07:01 +07:00
|
|
|
alias src='source ~/.bashrc' # src: Reload .bashrc file
|