|
| 1 | +# ~/.bashrc: executed by bash(1) for non-login shells. |
| 2 | +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) |
| 3 | +# for examples |
| 4 | + |
| 5 | +# If not running interactively, don't do anything |
| 6 | +case $- in |
| 7 | + *i*) ;; |
| 8 | + *) return;; |
| 9 | +esac |
| 10 | + |
| 11 | +# don't put duplicate lines or lines starting with space in the history. |
| 12 | +# See bash(1) for more options |
| 13 | +HISTCONTROL="ignoredups:erasedups:ignorespace" |
| 14 | + |
| 15 | +# append to the history file, don't overwrite it |
| 16 | +shopt -s histappend |
| 17 | + |
| 18 | +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) |
| 19 | +HISTSIZE=10000 |
| 20 | +HISTFILESIZE=10000000 |
| 21 | +HISTFILE=/home/fpsdk/.bash_history.d/history |
| 22 | + |
| 23 | +# Disable history ! expansion |
| 24 | +set +H |
| 25 | + |
| 26 | +export RSYNC_RSH=ssh |
| 27 | +export PAGER="less -R -i -x 4 -+C" |
| 28 | +export PERLDOC_PAGER="less -R -i -x 4 -+C" |
| 29 | +export LESSCHARSET=UTF-8 |
| 30 | +export EDITOR='vim' |
| 31 | +export GIT_EDITOR=vim |
| 32 | + |
| 33 | +# nicely coloured man pages |
| 34 | +export LESS_TERMCAP_mb=$'\E[01;31m' |
| 35 | +export LESS_TERMCAP_md=$'\E[01;31m' |
| 36 | +export LESS_TERMCAP_me=$'\E[0m' |
| 37 | +export LESS_TERMCAP_se=$'\E[0m' |
| 38 | +export LESS_TERMCAP_so=$'\E[01;44;33m' |
| 39 | +export LESS_TERMCAP_ue=$'\E[0m' |
| 40 | +export LESS_TERMCAP_us=$'\E[01;32m' |
| 41 | + |
| 42 | +export LESS="FRSX" |
| 43 | + |
| 44 | +# N.B. -R must be first or lesspipe.sh will be confused |
| 45 | +# warning: -R not compatible with +F (follow mode)! |
| 46 | +alias less='less -R -i -x 4 -S' |
| 47 | + |
| 48 | +# Enable core dumps (does it?) |
| 49 | +ulimit -c 1048576 |
| 50 | + |
| 51 | +# check the window size after each command and, if necessary, |
| 52 | +# update the values of LINES and COLUMNS. |
| 53 | +shopt -s checkwinsize |
| 54 | + |
| 55 | +# If set, the pattern "**" used in a pathname expansion context will |
| 56 | +# match all files and zero or more directories and subdirectories. |
| 57 | +#shopt -s globstar |
| 58 | + |
| 59 | +# make less more friendly for non-text input files, see lesspipe(1) |
| 60 | +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" |
| 61 | + |
| 62 | +# set variable identifying the chroot you work in (used in the prompt below) |
| 63 | +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then |
| 64 | + debian_chroot=$(cat /etc/debian_chroot) |
| 65 | +fi |
| 66 | + |
| 67 | +# set a fancy prompt (non-color, unless we know we "want" color) |
| 68 | +case "$TERM" in |
| 69 | + xterm-color|*-256color) color_prompt=yes;; |
| 70 | +esac |
| 71 | + |
| 72 | +# uncomment for a colored prompt, if the terminal has the capability; turned |
| 73 | +# off by default to not distract the user: the focus in a terminal window |
| 74 | +# should be on the output of commands, not on the prompt |
| 75 | +#force_color_prompt=yes |
| 76 | + |
| 77 | +if [ -n "$force_color_prompt" ]; then |
| 78 | + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then |
| 79 | + # We have color support; assume it's compliant with Ecma-48 |
| 80 | + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such |
| 81 | + # a case would tend to support setf rather than setaf.) |
| 82 | + color_prompt=yes |
| 83 | + else |
| 84 | + color_prompt= |
| 85 | + fi |
| 86 | +fi |
| 87 | + |
| 88 | +if [ "$color_prompt" = yes ]; then |
| 89 | + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
| 90 | +else |
| 91 | + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' |
| 92 | +fi |
| 93 | +unset color_prompt force_color_prompt |
| 94 | + |
| 95 | +# If this is an xterm set the title to user@host:dir |
| 96 | +case "$TERM" in |
| 97 | +xterm*|rxvt*) |
| 98 | + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" |
| 99 | + ;; |
| 100 | +*) |
| 101 | + ;; |
| 102 | +esac |
| 103 | + |
| 104 | +# enable color support of ls and also add handy aliases |
| 105 | +if [ -x /usr/bin/dircolors ]; then |
| 106 | + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" |
| 107 | + alias ls='ls --color=auto' |
| 108 | + #alias dir='dir --color=auto' |
| 109 | + #alias vdir='vdir --color=auto' |
| 110 | + |
| 111 | + alias grep='grep --color=auto' |
| 112 | + alias fgrep='fgrep --color=auto' |
| 113 | + alias egrep='egrep --color=auto' |
| 114 | +fi |
| 115 | + |
| 116 | +# colored GCC warnings and errors |
| 117 | +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' |
| 118 | + |
| 119 | +# some more ls aliases |
| 120 | +alias ll='ls -alF' |
| 121 | +alias la='ls -A' |
| 122 | +alias l='ls -CF' |
| 123 | +alias rm='rm -i' |
| 124 | +alias mv='mv -i' |
| 125 | + |
| 126 | +# Add an "alert" alias for long running commands. Use like so: |
| 127 | +# sleep 10; alert |
| 128 | +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' |
| 129 | + |
| 130 | +# Alias definitions. |
| 131 | +# You may want to put all your additions into a separate file like |
| 132 | +# ~/.bash_aliases, instead of adding them here directly. |
| 133 | +# See /usr/share/doc/bash-doc/examples in the bash-doc package. |
| 134 | + |
| 135 | +if [ -f ~/.bash_aliases ]; then |
| 136 | + . ~/.bash_aliases |
| 137 | +fi |
| 138 | + |
| 139 | +# enable programmable completion features (you don't need to enable |
| 140 | +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile |
| 141 | +# sources /etc/bash.bashrc). |
| 142 | +if ! shopt -oq posix; then |
| 143 | + if [ -f /usr/share/bash-completion/bash_completion ]; then |
| 144 | + . /usr/share/bash-completion/bash_completion |
| 145 | + elif [ -f /etc/bash_completion ]; then |
| 146 | + . /etc/bash_completion |
| 147 | + fi |
| 148 | +fi |
| 149 | + |
| 150 | +if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then |
| 151 | + # https://github.com/magicmonty/bash-git-prompt |
| 152 | + GIT_PROMPT_THEME=fpsdk |
| 153 | + source ~/.bash-git-prompt/gitprompt.sh |
| 154 | +fi |
| 155 | + |
| 156 | +# Source ROS environment |
| 157 | +if [ -n "${ROS_DISTRO}" ]; then |
| 158 | + source /opt/ros/${ROS_DISTRO}/setup.bash |
| 159 | + export ROSCONSOLE_STDOUT_LINE_BUFFERED=1 |
| 160 | + export ROSCONSOLE_FORMAT='${severity} ${time:%Y-%m-%d %H:%M:%S.%f} ${logger} - ${message}' |
| 161 | + # export RCUTILS_LOGGING_BUFFERED_STREAM=1 |
| 162 | + # export RCUTILS_LOGGING_USE_STDOUT=1 |
| 163 | + export RCUTILS_COLORIZED_OUTPUT=1 |
| 164 | + case "${ROS_DISTRO}" in |
| 165 | + jazzy|rolling) |
| 166 | + export RCUTILS_CONSOLE_OUTPUT_FORMAT="{severity} {date_time_with_ms} {name} - {message}" |
| 167 | + ;; |
| 168 | + *) |
| 169 | + export RCUTILS_CONSOLE_OUTPUT_FORMAT="{severity} {time} {name} - {message}" |
| 170 | + ;; |
| 171 | + esac |
| 172 | + |
| 173 | +fi |
0 commit comments