.bashrc chopped into separate file.

This commit is contained in:
2021-06-16 04:12:17 -07:00
parent 3cb73cb62c
commit 4609a035af
6 changed files with 186 additions and 113 deletions

62
config/.bash_profile Executable file
View File

@@ -0,0 +1,62 @@
#!/bin/bash
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Find out system details.
#
os=`uname` #GNU/Linux AIX Solaris
cpu=`uname -p` #x86_64 powerpc sparc
kernel=`uname -s` #Linux AIX SunOS
kversion=`uname -v`
krelease=`uname -r`
hostnm=`hostname`
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Bash history
#
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=5000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# vi edit mode.
set -o vi
export EDITOR=vim
export LESS=-R
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# User specific environment and startup programs
#
if [ -e $HOME/bin ]; then
export PATH=$HOME/bin:$PATH
fi
MYSCRIPTS=$HOME/devel/scripts
if [ -e $MYSCRIPTS/bin ]; then
export PATH=$MYSCRIPTS/bin:$PATH
fi
MYCFG=${MYSCRIPTS}/config
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Set command prompt
[ -x ${MYCFG}/.profile.prompt ] && source ${MYCFG}/.profile.prompt
[ -x ${MYCFG}/.profile.dircolor ] && source ${MYCFG}/.profile.dircolor
[ -x ${MYCFG}/.profile.completion ] && source ${MYCFG}/.profile.completion
[ -x ${MYCFG}/.profile.dev ] && source ${MYCFG}/.profile.dev
[ -x ${MYCFG}/.profile.aliases ] && source ${MYCFG}/.profile.aliases
#
# Clean error level.
#
[ 1 ]

View File

@@ -58,13 +58,6 @@ HISTFILESIZE=5000
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
set -o vi
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Set command prompt
[ -x ~/devel/scripts/config/.profile.prompt ] && source ~/devel/scripts/config/.profile.prompt
# [ -x ${MYDIR}/.profile.dircolor ] && source ${MYDIR}/.profile.dircolor
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# User specific environment and startup programs
@@ -84,107 +77,6 @@ fi
export EDITOR=vim
export LESS=-R
#
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
#
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
#
# GIT
#
[ -f $MYSCRIPTS/bash/git-completion.bash ] && . $MYSCRIPTSE/bash/git-completion.bash
#
# colored GCC warnings and errors
#
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Aliases
#
if [ $kernel == "Darwin" ]; then
alias ls='ls -a'
alias ll='ls -la'
alias pd='pushd >/dev/null'
alias bd='popd'
else
alias ls='ls -a --color=auto'
alias ll='ls -la --color=auto'
alias pd='pushd >/dev/null'
alias bd='popd'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
function cgrep() {
if [[ $# -eq 0 ]]
then
echo "Usage: codegrep <pattern> "
else
grep -nR --colour \
--include=\*.cpp \
--include=\*.c \
--include=\*.hpp \
--include=\*.h \
--include=\*.inc \
--include=\*.php \
--include=\*.py \
--include=\*.sh \
--exclude-dir=.git \
--exclude-dir=.svn \
--exclude-dir=llcalc* \
--exclude-dir=00* \
"$1" .
fi
}
function create_tags() {
#Bloomberg
if [ -e /opt/swt/bin/ctags ]; then
CTAGS=/opt/swt/bin/ctags
else
CTAGS=ctags
fi
CTAGS_OPT='--recurse=yes '
CTAGS_OPT+='--verbose '
CTAGS_OPT+='--totals=yes '
CTAGS_OPT+='--tag-relative=yes '
CTAGS_DIR_CFG='.ctags_dir'
CTAGS_ROOT="$PWD"
if [ ! -f $PWD/$CTAGS_DIR_CFG ]; then
GIT_ROOT=$(git top pwd)
if [ -f $GIT_ROOT/$CTAGS_DIR_CFG ]; then
CTAGS_ROOT="$GIT_ROOT"
fi
fi
if [ -f $CTAGS_ROOT/$CTAGS_DIR_CFG ]; then
CTAGS_SRC="-L $CTAGS_ROOT/$CTAGS_DIR"
else
CTAGS_SRC="$@"
fi
cd $CTAGS_ROOT
$CTAGS $CTAGS_OPT $CTAGS_SRC
cd -
}
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
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$//'\'')"'
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Run local settings.

25
config/.profile.aliases Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
#
# Aliases
#
if [ $kernel == "Darwin" ]; then
alias ls='ls -a'
alias ll='ls -la'
alias pd='pushd >/dev/null'
alias bd='popd'
else
alias ls='ls -a --color=auto'
alias ll='ls -la --color=auto'
alias pd='pushd >/dev/null'
alias bd='popd'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
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$//'\'')"'

21
config/.profile.comletion Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
#
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
#
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
#
# GIT
#
[ -f $MYSCRIPTS/bash/git-completion.bash ] && source $MYSCRIPTSE/bash/git-completion.bash
[ -f /opt/facebook/share/bash_completion ] && source /opt/facebook/share/bash_completion

62
config/.profile.dev Executable file
View File

@@ -0,0 +1,62 @@
#!/bin/bash
#
# colored GCC warnings and errors
#
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
function cgrep() {
if [[ $# -eq 0 ]]
then
echo "Usage: cgrep <pattern> "
else
grep -nR --colour \
--include=\*.cpp \
--include=\*.c \
--include=\*.hpp \
--include=\*.h \
--include=\*.inc \
--include=\*.php \
--include=\*.py \
--include=\*.sh \
--exclude-dir=.git \
--exclude-dir=.svn \
--exclude-dir=llcalc* \
--exclude-dir=00* \
"$1" .
fi
}
function create_tags() {
#Bloomberg
if [ -e /opt/swt/bin/ctags ]; then
CTAGS=/opt/swt/bin/ctags
else
CTAGS=ctags
fi
CTAGS_OPT='--recurse=yes '
CTAGS_OPT+='--verbose '
CTAGS_OPT+='--totals=yes '
CTAGS_OPT+='--tag-relative=yes '
CTAGS_DIR_CFG='.ctags_dir'
CTAGS_ROOT="$PWD"
if [ ! -f $PWD/$CTAGS_DIR_CFG ]; then
GIT_ROOT=$(git top pwd)
if [ -f $GIT_ROOT/$CTAGS_DIR_CFG ]; then
CTAGS_ROOT="$GIT_ROOT"
fi
fi
if [ -f $CTAGS_ROOT/$CTAGS_DIR_CFG ]; then
CTAGS_SRC="-L $CTAGS_ROOT/$CTAGS_DIR"
else
CTAGS_SRC="$@"
fi
cd $CTAGS_ROOT
$CTAGS $CTAGS_OPT $CTAGS_SRC
cd -
}

View File

@@ -16,7 +16,7 @@ set -g status-position top
set -g history-limit 100000
# 256color mode.
set -g default-terminal "screen-256color"
set -g default-terminal "tmux-256color"
setw -g xterm-keys on
# VI mode
@@ -30,15 +30,26 @@ setw -g mode-keys vi
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
#bind p paste-buffer
bind -n C-1 select-pane -t 1
bind -n C-2 select-pane -t 2
bind -n C-3 select-pane -t 3
bind -n C-4 select-pane -t 4
bind -n C-5 select-pane -t 5
bind -n C-6 select-pane -t 6
bind -n C-7 select-pane -t 7
bind -n C-8 select-pane -t 8
bind -n C-9 select-pane -t 9
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
#bind -r C-h resize-pane -L
#bind -r C-j resize-pane -D
#bind -r C-k resize-pane -U
#bind -r C-l resize-pane -R
bind -r M-h resize-pane -L
bind -r M-j resize-pane -D
bind -r M-k resize-pane -U
bind -r M-l resize-pane -R
#No mouse
#set -g mode-mouse off