From 0c73e44eb94d2435045294ad26f0c2db6f768994 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 27 Oct 2016 06:22:00 +0300 Subject: .bashrc: remove dead code + configure Ruby --- %HOME%/.bashrc | 191 +++++++-------------------------------------------------- 1 file changed, 22 insertions(+), 169 deletions(-) diff --git a/%HOME%/.bashrc b/%HOME%/.bashrc index e68f71b..9aea508 100644 --- a/%HOME%/.bashrc +++ b/%HOME%/.bashrc @@ -1,51 +1,5 @@ -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# You should have received a copy of the CC0 Public Domain Dedication along -# with this software. -# If not, see . - -# base-files version 4.2-4 - -# ~/.bashrc: executed by bash(1) for interactive shells. - -# The latest version as installed by the Cygwin Setup program can -# always be found at /etc/defaults/etc/skel/.bashrc - -# Modifying /etc/skel/.bashrc directly will prevent -# setup from updating it. - -# The copy in your home directory (~/.bashrc) is yours, please -# feel free to customise it to create a shell -# environment to your liking. If you feel a change -# would be benifitial to all, please feel free to send -# a patch to the cygwin mailing list. - -# User dependent .bashrc file - -# If not running interactively, don't do anything [[ "$-" != *i* ]] && return -# Shell Options -# -# See man bash for more options... -# -# Don't wait for job termination notification -# set -o notify -# -# Don't use ^D to exit -# set -o ignoreeof -# -# Use case-insensitive filename globbing -# shopt -s nocaseglob -# -# Make bash append rather than overwrite the history on disk -# shopt -s histappend -# -# When changing directory small typos can be ignored by bash -# for example, cd /vr/lgo/apaache would find /var/log/apache -# shopt -s cdspell - # Completion options # # These completion tuning parameters change the default behavior of bash_completion: @@ -77,144 +31,28 @@ # Whenever displaying the prompt, write the previous line to disk # export PROMPT_COMMAND="history -a" -# Aliases -# -# Some people use a different file for aliases -# if [ -f "${HOME}/.bash_aliases" ]; then -# source "${HOME}/.bash_aliases" -# fi -# -# Some example alias instructions -# If these are enabled they will be used instead of any instructions -# they may mask. For example, alias rm='rm -i' will mask the rm -# application. To override the alias instruction use a \ before, ie -# \rm will call the real rm not the alias. -# -# Interactive operation... -# alias rm='rm -i' -# alias cp='cp -i' -# alias mv='mv -i' -# -# Default to human readable figures -# alias df='df -h' -# alias du='du -h' -# -# Misc :) -# alias less='less -r' # raw control characters -# alias whence='type -a' # where, of a sort -# alias grep='grep --color' # show differences in colour -# alias egrep='egrep --color=auto' # show differences in colour -# alias fgrep='fgrep --color=auto' # show differences in colour -# -# Some shortcuts for different directory listings -# alias ls='ls -hF --color=tty' # classify files in colour -# alias dir='ls --color=auto --format=vertical' -# alias vdir='ls --color=auto --format=long' -# alias ll='ls -l' # long list -# alias la='ls -A' # all but . and .. -# alias l='ls -CF' # - -# Umask -# -# /etc/profile sets 022, removing write perms to group + others. -# Set a more restrictive umask: i.e. no exec perms for others: -# umask 027 -# Paranoid: neither group nor others have any perms: -# umask 077 - -# Functions -# -# Some people use a different file for functions -# if [ -f "${HOME}/.bash_functions" ]; then -# source "${HOME}/.bash_functions" -# fi -# -# Some example functions: -# -# a) function settitle -# settitle () -# { -# echo -ne "\e]2;$@\a\e]1;$@\a"; -# } -# -# b) function cd_func -# This function defines a 'cd' replacement function capable of keeping, -# displaying and accessing history of visited directories, up to 10 entries. -# To use it, uncomment it, source this file and try 'cd --'. -# acd_func 1.0.5, 10-nov-2004 -# Petar Marinov, http:/geocities.com/h2428, this is public domain -# cd_func () -# { -# local x2 the_new_dir adir index -# local -i cnt -# -# if [[ $1 == "--" ]]; then -# dirs -v -# return 0 -# fi -# -# the_new_dir=$1 -# [[ -z $1 ]] && the_new_dir=$HOME -# -# if [[ ${the_new_dir:0:1} == '-' ]]; then -# # -# # Extract dir N from dirs -# index=${the_new_dir:1} -# [[ -z $index ]] && index=1 -# adir=$(dirs +$index) -# [[ -z $adir ]] && return 1 -# the_new_dir=$adir -# fi -# -# # -# # '~' has to be substituted by ${HOME} -# [[ ${the_new_dir:0:1} == '~' ]] && the_new_dir="${HOME}${the_new_dir:1}" -# -# # -# # Now change to the new dir and add to the top of the stack -# pushd "${the_new_dir}" > /dev/null -# [[ $? -ne 0 ]] && return 1 -# the_new_dir=$(pwd) -# -# # -# # Trim down everything beyond 11th entry -# popd -n +11 2>/dev/null 1>/dev/null -# -# # -# # Remove any other occurence of this dir, skipping the top of the stack -# for ((cnt=1; cnt <= 10; cnt++)); do -# x2=$(dirs +${cnt} 2>/dev/null) -# [[ $? -ne 0 ]] && return 0 -# [[ ${x2:0:1} == '~' ]] && x2="${HOME}${x2:1}" -# if [[ "${x2}" == "${the_new_dir}" ]]; then -# popd -n +$cnt 2>/dev/null 1>/dev/null -# cnt=cnt-1 -# fi -# done -# -# return 0 -# } -# -# alias cd=cd_func - PS1='\[\e[33m\]\W\[\e[0m\]: ' set -o nounset set -o pipefail +shopt -s checkwinsize shopt -s dotglob +shopt -s histappend shopt -s nullglob shopt -s nocaseglob -export PYTHONSTARTUP="$HOME/.pythonrc" - alias df='df --human-readable' alias du='du --human-readable' + alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' -alias less='less --RAW-CONTROL-CHARS' + alias ls='ls --almost-all -l --human-readable --color=auto' +alias dir='ls --format=vertical' + +alias less='less --RAW-CONTROL-CHARS' alias tree='tree -a' [ "$( uname -o )" == 'Cygwin' ] && alias list_packages='cygcheck -cd' @@ -223,4 +61,19 @@ alias tree='tree -a' [ -f "$HOME/.bash_utils/distr.sh" ] && source "$HOME/.bash_utils/distr.sh" [ -f "$HOME/.bash_utils/file.sh" ] && source "$HOME/.bash_utils/file.sh" [ -f "$HOME/.bash_utils/git.sh" ] && source "$HOME/.bash_utils/git.sh" +[ -f "$HOME/.bash_utils/path.sh" ] && source "$HOME/.bash_utils/path.sh" [ -f "$HOME/.bash_utils/text.sh" ] && source "$HOME/.bash_utils/text.sh" + +export PYTHONSTARTUP="$HOME/.pythonrc" + +update_ruby_settings() { + local user_dir + + command -v ruby &> /dev/null \ + && command -v gem &> /dev/null \ + && user_dir="$( ruby -e 'print Gem.user_dir' )" \ + && add_path "$user_dir" \ + && export GEM_HOME="$user_dir" +} + +update_ruby_settings -- cgit v1.2.3