-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc
159 lines (139 loc) · 5.32 KB
/
bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
##################################
#
# Author: Gustavo Yokoyama Ribeiro
# File: .bashrc
# Update: 20100401 10:45:23
# (C) Copyright 2010 Gustavo Yokoyama Ribeiro
# Licensed under CreativeCommons Attribution-ShareAlike 3.0 Unsupported
# http://creativecommons.org/licenses/by-sa/3.0/ for more info.
#
##################################
[ -z "${GYR_PATH}" ] && . ~/.gyr.d/dotfiles/gyrprofile
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# or
#[[ $- != *i* ]] && return
###################
# #
# VARIABLES #
# #
###################
# Source .bashrc for non-interactive Bash shells
export BASH_ENV=~/.bashrc
export SHELL=$(type -P bash)
export INPUTRC=${GYR_PATH}/dotfiles/inputrc
[ 'linux' = "${TERM}" ] && TERM=linux-16color
PR_SCREEN=''
if [ -n "${STY}" ]; then
# screen
PR_SCREEN="[${WINDOW}] "
elif [ -n "${TMUX}" ]; then
# tmux
PR_SCREEN="[$(tmux display -p '#I')] "
fi
#if [ -f "${HOME}/.gpg-agent-info" ]; then
# . "${HOME}/.gpg-agent-info"
# export GPG_AGENT_INFO
# export SSH_AUTH_SOCK
#fi
CDPATH=.:${GYR_PATH}:${CDPATH}
# If you are a developer, uncomment the following to make sure core dumps
# will be generated when they should be
#ulimit -c unlimited
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# ignore dups, lines started with space and erase dups
HISTCONTROL=ignoreboth:erasedups
# Do *not* append the following to our history: consecutive duplicate
# commands(& pattern), command starting with a space([ \t]* pattern), ls, bg and fg,exit, etc.
# Don't keep useless history commands. Note the last pattern is to not
# keep dangerous commands in the history file. Who really needs to
# repeat the shutdown(8) command accidentally from your command
# history?
#HISTIGNORE='\&:&:[ \t]*:ls:[fb]g:exit:pwd:cd ..:cd ~-:cd -:cd:jobs:set -x:ls -l:ls -l:l:ll:ls:la:lla:lt'
HISTIGNORE="&:ls:[fb]g:exit:pwd::cd -:cd:jobs:l:ll:ls:la:lla:lt:popd:reboot:halt:shutdown*:?:??"
#HISTIGNORE=${HISTIGNORE}':%1:%2:popd:top:pine:mutt:shutdown*'
# Turn off any filesize restrictions
#export HISTFILESIZE=10000
unset HISTFILESIZE
HISTSIZE=100000
###################
# #
# OPTIONS #
# #
###################
# Bash autocomplete case insensitive search
shopt -s nocaseglob
# an argument to the cd builtin command that is not a directory is assumed to be the name of a variable whose value is the directory to change to.
shopt -s cdable_vars
# correct minor spelling erros in a cd command.
shopt -s cdspell
# This option mostly keeps you from needing to run "hash -r" when you modify directories in your path
shopt -s checkhash
# check the window size after each command and, if necessary, update the values of LINES and COLUMNS.
shopt -s checkwinsize
# append multi-line commands in history as a single line command.
shopt -s cmdhist
# allow . files be returned in path-name expansion.
shopt -s dotglob
# extend pattern match.
shopt -s extglob
# the history list is appended when the shell exits, rather than overwriting the file.
shopt -s histappend
# allows you to audit the command as expanded before you enter it
shopt -s histverify
# [DISABLE] multi-line commands are saved to the history with embedded newlines rather than using semicolon separators where possible.
shopt -u lithist
# Hostname expansion
#shopt -s hostcomplete
if (( $BASH_VERSINFO >= 4 ));then
# Checks for running/stopped jobs before exit shell
shopt -s checkjobs
# attempts spelling corrention on directory names during completion
shopt -s dirspell
# the globbing code treats `**' specially -- it matches all directories (and files within them, when appropriate) recursively.
shopt -s globstar
fi
########
# sets input line and text editors
set -o vi
# Get immediate notification of background job termination
set -o notify
# Requires to press "CTRL+D" twice or type "exit" once to finish the current
# session.
#IGNOREEOF=1
# Disable [CTRL-D] which is used to exit the shell
set -o ignoreeof
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
#if [ -n "${DISPLAY}" ]; then
# #[ -n "$WINDOWID" ] && [[ "${TERM}" =~ .*screen.* ]] && xprop -frame -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY 0xf0000000 -id ${WINDOWID}
# #[[ "${TERM}" =~ .*screen.* ]] && TRANSPARENCY='0xf0000000' || TRANSPARENCY='0xd0000000'
# TRANSPARENCY='0xd0000000'
# xprop -frame -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY ${TRANSPARENCY} -id ${WINDOWID}
# unset TRANSPARENCY
#fi
#if [ "$PS1" ] ; then
# if [ -d /dev/cgroup/cpu/user/ ]; then
# mkdir -p -m 0700 /dev/cgroup/cpu/user/$$ > /dev/null 2>&1
# echo $$ > /dev/cgroup/cpu/user/$$/tasks
# echo "1" > /dev/cgroup/cpu/user/$$/notify_on_release
# fi
#fi
###################
# #
# COMMON SHELL #
# #
###################
# Load any supplementary scripts
if [ -d ${GYR_PATH}/dotfiles/bashrc.d ] ; then
for config in "${GYR_PATH}"/dotfiles/bashrc.d/*.bash ; do
source "$config"
done
unset -v config
fi
[ -f ${GYR_PATH}/dotfiles/gyrrc ] && . ${GYR_PATH}/dotfiles/gyrrc
# vim: set filetype=sh fileformat=unix foldmethod=indent