[profiles/base] modify bash config
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
# emacs specific stuff
|
# emacs specific stuff
|
||||||
|
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
[[ ${EAT_SHELL_INTEGRATION_DIR} ]] && . "${EAT_SHELL_INTEGRATION_DIR}/bash"
|
[[ -n "${EAT_SHELL_INTEGRATION_DIR}" ]] &&
|
||||||
|
. "${EAT_SHELL_INTEGRATION_DIR}/bash"
|
||||||
|
|||||||
@@ -22,6 +22,6 @@ export GPGKEY="4A45503BBE575E3D4DAF28E27264AFFDC98D52BB"
|
|||||||
# gpg-agent
|
# gpg-agent
|
||||||
unset SSH_AGENT_PID
|
unset SSH_AGENT_PID
|
||||||
if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne "$$" ]]; then
|
if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne "$$" ]]; then
|
||||||
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket 2>/dev/null)
|
SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket 2>/dev/null)"
|
||||||
export SSH_AUTH_SOCK
|
export SSH_AUTH_SOCK
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -11,43 +11,48 @@ if command -v batcat >/dev/null 2>&1; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# HSTR configuration - add this to ~/.bashrc
|
# HSTR configuration - add this to ~/.bashrc
|
||||||
alias hh=hstr # hh to be alias for hstr
|
alias hh="hstr" # hh to be alias for hstr
|
||||||
export HSTR_CONFIG=hicolor # get more colors
|
export HSTR_CONFIG="hicolor" # get more colors
|
||||||
shopt -s histappend # append new history items to .bash_history
|
shopt -s histappend # append new history items to .bash_history
|
||||||
export HISTCONTROL=ignorespace # leading space hides commands from history
|
export HISTCONTROL="ignorespace" # leading space hides commands from history
|
||||||
export HISTFILESIZE=10000 # increase history file size (default is 500)
|
export HISTFILESIZE="10000" # increase history file size (default is 500)
|
||||||
export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)
|
export HISTSIZE="${HISTFILESIZE}" # increase history size (default is 500)
|
||||||
# ensure synchronization between bash memory and history file
|
# ensure synchronization between bash memory and history file
|
||||||
export PROMPT_COMMAND=("history -a; history -n;" "${PROMPT_COMMAND[@]}")
|
export PROMPT_COMMAND=("history -a; history -n;" "${PROMPT_COMMAND[@]}")
|
||||||
function hstrnotiocsti {
|
function hstrnotiocsti {
|
||||||
{ READLINE_LINE="$( { </dev/tty hstr -- "${READLINE_LINE}"; } 2>&1 1>&3 3>&- )"; } 3>&1;
|
{ READLINE_LINE="$({ </dev/tty hstr -- "${READLINE_LINE}"; } \
|
||||||
READLINE_POINT=${#READLINE_LINE}
|
2>&1 1>&3 3>&-)"; } 3>&1
|
||||||
|
READLINE_POINT="${#READLINE_LINE}"
|
||||||
}
|
}
|
||||||
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
|
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
|
||||||
if [[ $- =~ .*i.* ]]; then bind -x '"\C-r": "hstrnotiocsti"'; fi
|
if [[ $- =~ .*i.* ]]; then
|
||||||
export HSTR_TIOCSTI=n
|
bind -x '"\C-r": "hstrnotiocsti"'
|
||||||
|
fi
|
||||||
|
export HSTR_TIOCSTI="n"
|
||||||
|
|
||||||
# ranger
|
# ranger
|
||||||
ranger_cd() {
|
ranger_cd() {
|
||||||
temp_file=$(mktemp -t "ranger_cd.XXXXXXXXXX")
|
temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")"
|
||||||
ranger --choosedir="${temp_file}" -- "${@:-${PWD}}"
|
ranger --choosedir="${temp_file}" -- "${@:-${PWD}}"
|
||||||
if chosen_dir="$(cat -- "${temp_file}")" && [[ "${chosen_dir}" ]] && [[ "${chosen_dir}" != "${PWD}" ]]; then
|
if chosen_dir="$(cat -- "${temp_file}")" &&
|
||||||
|
[[ -n "${chosen_dir}" ]] &&
|
||||||
|
[[ "${chosen_dir}" != "${PWD}" ]]; then
|
||||||
cd -- "${chosen_dir}" || exit 1
|
cd -- "${chosen_dir}" || exit 1
|
||||||
fi
|
fi
|
||||||
rm -f -- "${temp_file}"
|
rm -f -- "${temp_file}"
|
||||||
}
|
}
|
||||||
alias ranger=ranger_cd
|
alias ranger="ranger_cd"
|
||||||
|
|
||||||
# mc
|
# mc
|
||||||
|
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
[[ -f /usr/libexec/mc/mc.sh ]] && . /usr/libexec/mc/mc.sh
|
[[ -f "/usr/libexec/mc/mc.sh" ]] && . "/usr/libexec/mc/mc.sh"
|
||||||
[[ -f /usr/lib/mc/mc.sh ]] && . /usr/lib/mc/mc.sh
|
[[ -f "/usr/lib/mc/mc.sh" ]] && . "/usr/lib/mc/mc.sh"
|
||||||
|
|
||||||
# inside tmux, we don't know if Sway got restarted
|
# inside tmux, we don't know if Sway got restarted
|
||||||
if [[ -v TMUX ]]; then
|
if [[ -v TMUX ]]; then
|
||||||
swaymsg() {
|
swaymsg() {
|
||||||
SWAYSOCK=${XDG_RUNTIME_DIR}/sway-ipc.${UID}.$(pgrep -x sway).sock
|
SWAYSOCK="${XDG_RUNTIME_DIR}/sway-ipc.${UID}.$(pgrep -x sway).sock"
|
||||||
export SWAYSOCK
|
export SWAYSOCK
|
||||||
command swaymsg "$@"
|
command swaymsg "$@"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ alias tq="tmuxinator start quake"
|
|||||||
alias sudo="sudo "
|
alias sudo="sudo "
|
||||||
alias rsync_copy="rsync -aAXUHvh --partial-dir=.rsync-partial --progress"
|
alias rsync_copy="rsync -aAXUHvh --partial-dir=.rsync-partial --progress"
|
||||||
alias rsync_copy_ssh="rsync_copy -e ssh"
|
alias rsync_copy_ssh="rsync_copy -e ssh"
|
||||||
alias rsync_backup="rsync_copy --numeric-ids --delete --exclude={'/dev/*','/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found'}"
|
alias rsync_backup="rsync_copy --numeric-ids --delete --exclude={'/dev/*', \
|
||||||
|
'/proc/*','/sys/*','/tmp/*','/run/*','/mnt/*','/media/*','/lost+found'}"
|
||||||
alias rsync_backup_ssh="rsync_backup -e ssh"
|
alias rsync_backup_ssh="rsync_backup -e ssh"
|
||||||
alias rsync_restore="rsync_copy --numeric-ids --delete --exclude='lost+found'"
|
alias rsync_restore="rsync_copy --numeric-ids --delete --exclude='lost+found'"
|
||||||
alias rsync_restore_ssh="rsync_restore -e ssh"
|
alias rsync_restore_ssh="rsync_restore -e ssh"
|
||||||
alias glog="git log --oneline"
|
alias glog="git log --oneline"
|
||||||
alias emerge_world="emerge --ask --verbose --deep --newuse --update @world"
|
alias emerge_world="emerge --ask --verbose --deep --newuse --update @world"
|
||||||
alias sync_repo="rsync_copy_ssh --delete ~/arch_paczuchy/* vps.paraboletancza.org:/srv/http/arch.paraboletancza.org"
|
alias sync_repo="rsync_copy_ssh --delete ~/arch_paczuchy/* \
|
||||||
|
vps.paraboletancza.org:/srv/http/arch.paraboletancza.org"
|
||||||
alias aur_sync="aur sync --sign --chroot"
|
alias aur_sync="aur sync --sign --chroot"
|
||||||
alias aur_build="aur build --sign --chroot"
|
alias aur_build="aur build --sign --chroot"
|
||||||
|
|||||||
@@ -1,4 +1,35 @@
|
|||||||
take() {
|
take() {
|
||||||
mkdir -p "$1"
|
local -r directory="$1"
|
||||||
cd "$1" || exit 1
|
mkdir -p "${directory}"
|
||||||
|
cd "${directory}" || exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# downloading from youtube
|
||||||
|
yt-dlp() {
|
||||||
|
local -a -r args=(
|
||||||
|
--cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser"
|
||||||
|
--extractor-args "youtube:player_client=default,web_safari;player_js_version=actual"
|
||||||
|
--fragment-retries infinite
|
||||||
|
)
|
||||||
|
command yt-dlp "${args[@]}" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
yt_dl_mp3() {
|
||||||
|
yt-dlp -t mp3 --embed-thumbnail "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
yt_dl_channel() {
|
||||||
|
local -a -r args=(
|
||||||
|
--download-archive "archive.txt"
|
||||||
|
--output "%(upload_date)s.%(title)s.%(id)s.%(ext)s"
|
||||||
|
--merge-output-format mkv
|
||||||
|
--ignore-errors
|
||||||
|
--write-sub
|
||||||
|
--sub-langs "en,pl"
|
||||||
|
--cookies-from-browser "chromium:${HOME}/.local/share/qutebrowser"
|
||||||
|
--write-description
|
||||||
|
--write-info-json
|
||||||
|
--write-thumbnail
|
||||||
|
)
|
||||||
|
yt-dlp "${args[@]}" "$@"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# load bash configuration
|
# load bash configuration
|
||||||
readonly CONF_DIR="${HOME}/.bash/conf.d"
|
CONF_DIR="${HOME}/.bash/conf.d"
|
||||||
|
readonly CONF_DIR
|
||||||
|
|
||||||
if [[ -d "${CONF_DIR}" ]]; then
|
if [[ -d "${CONF_DIR}" ]]; then
|
||||||
for conf_file in "${CONF_DIR}"/*.bash; do
|
for conf_file in "${CONF_DIR}"/*.bash; do
|
||||||
|
|||||||
Reference in New Issue
Block a user