fi
+################
+# Source files #
+################
+
+# Debian/Ubuntu don't source this from /etc/bash.bashrc
+[ -z "$BASH_COMPLETION_VERSINFO" ] && [ -r /usr/share/bash-completion/bash_completion ] && source /usr/share/bash-completion/bash_completion
+
+# This isn't sourced for interactive shells on Debian/Ubuntu/Arch
+# https://bugzilla.gnome.org/show_bug.cgi?id=697475
+[ -r /etc/profile.d/vte.sh ] && source /etc/profile.d/vte.sh
+
+
################
# bash options #
################
export HISTSIZE='100000'
export HISTTIMEFORMAT='%F %T '
-[ -r /etc/bash_completion ] && source /etc/bash_completion
-
###############
# Pager setup #
alias la='ls -ha'
alias l='ls -halF'
+
##############
# ps aliases #
##############
[ -r ~/.bashrc_local ] && source ~/.bashrc_local
-##################
-# xterm titlebar #
-##################
+########################
+# Terminal integration #
+########################
# When at a prompt display `workingdir (hostname)`
function print_title_prompt {
printf '\ekbash\e\\'
fi
}
-PROMPT_COMMAND=print_title_prompt
+
+# Preserve working directory when opening new terminals
+# This depends on /etc/profile/vte.sh
+function record_terminal_cwd {
+ [ "$(type -t __vte_osc7)" = "function" ] && __vte_osc7 || true
+}
+
+function prompt_command {
+ print_title_prompt
+ record_terminal_cwd
+}
+PROMPT_COMMAND=prompt_command
# Display the command about to be executed. This must go at the end of the
# bashrc to avoid running the trap on commands in the bashrc