Created
December 20, 2011 14:34
-
-
Save kaze/1501752 to your computer and use it in GitHub Desktop.
sample bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# --------------------------------------------------------------------------- # | |
# karakterkészlet | |
# --------------------------------------------------------------------------- # | |
export LC_CTYPE=hu_HU.UTF-8 | |
export LC_ALL=hu_HU.UTF-8 | |
# localedef -v -c -i hu_HU -f UTF-8 hu_HU.UTF-8 | |
# --------------------------------------------------------------------------- # | |
# coloring the terminal | |
# --------------------------------------------------------------------------- # | |
export CLICOLOR=1; | |
# --------------------------------------------------------------------------- # | |
# terminal history | |
# --------------------------------------------------------------------------- # | |
shopt -s histappend | |
HISTSIZE=100000 | |
HISTFILESIZE=100000 | |
export HISTTIMEFORMAT='%Y-%m-%d %H:%M:%S - ' | |
# --------------------------------------------------------------------------- # | |
# prompt | |
# --------------------------------------------------------------------------- # | |
PS1="\[\033]0;\w\007\]\u $> " | |
PS2='$(($LINENO+1)): > ' | |
PS4='+: > ' | |
PS4='$0 line $LINENO: ' | |
PROMPT_COMMAND='history -n;echo "$(history 1 | grep "defaults write")" | sed '/^$/d' >> ~/code/notes/defaults-log.txt' | |
# --------------------------------------------------------------------------- # | |
# modified bash prompt: minuses and bold fontface for commands | |
# --------------------------------------------------------------------------- # | |
# Fill with minuses | |
# (this is recalculated every time the prompt is shown in function prompt_command): | |
# --------------------------------------------------------------------------- # | |
fill="--- " | |
reset_style='\[\033[00m\]' | |
status_style=$reset_style'\[\033[0;90m\]' # gray color; use 0;37m for lighter color | |
prompt_style=$reset_style | |
command_style=$reset_style'\[\033[1;29m\]' # bold black | |
# Prompt variable: | |
# --------------------------------------------------------------------------- # | |
# PS1="$status_style"'$fill \t\n'"$prompt_style"'${debian_chroot:+($debian_chroot)}\u@\h:\w\$'"$command_style " | |
PS1="$status_style"'$fill \t\n'"$prompt_style"'\w\n\[\033]0;\w\007\]\u $> '"$command_style " | |
# Reset color for command output | |
# (this one is invoked every time before a command is executed): | |
# --------------------------------------------------------------------------- # | |
trap 'echo -ne "\033[00m"' DEBUG | |
# prompt command: | |
# --------------------------------------------------------------------------- # | |
function prompt_command { | |
# create a $fill of all screen width minus the time string and a space: | |
let fillsize=${COLUMNS}-9 | |
fill="" | |
while [ "$fillsize" -gt "0" ] | |
do | |
fill="-${fill}" # fill with underscores to work on | |
let fillsize=${fillsize}-1 | |
done | |
# If this is an xterm set the title to user@host:dir | |
# case "$TERM" in | |
# xterm*|rxvt*) | |
# bname=`basename "${PWD/$HOME/~}"` | |
# echo -ne "\033]0;${bname}: ${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007" | |
# ;; | |
# *) | |
# ;; | |
# esac | |
} | |
PROMPT_COMMAND=prompt_command | |
# --------------------------------------------------------------------------- # | |
# aliasok | |
# --------------------------------------------------------------------------- # | |
# általános | |
# --------------------------------------------------------------------------- # | |
alias ll="ls -l" | |
alias la="ls -al" | |
alias xmod="chmod +x " | |
alias c="clear" | |
alias stt='set_terminal_title' | |
alias man='gem man -s' | |
# végrehajtja az előző parancsot sudo-val, ha elfelejtettem | |
# --------------------------------------------------------------------------- # | |
alias redo='sudo \-l' | |
# vim aliasok | |
# --------------------------------------------------------------------------- # | |
# alias vim="vim -u ~/.vimrc" | |
# alias mvim="mvim -u $MYVIMRC" | |
# --------------------------------------------------------------------------- # | |
# functions | |
# --------------------------------------------------------------------------- # | |
# set terminal title | |
# --------------------------------------------------------------------------- # | |
function set_terminal_title() { | |
if [[ -z $@ ]] | |
then | |
PS1="$PS1\e]2;${PWD}\a" | |
else | |
PS1="$PS1\e]2;${@}\a" | |
fi | |
} | |
alias stt="set_terminal_title" | |
# elkészíti a paraméterként megadott könyvtárat és belép abba | |
# --------------------------------------------------------------------------- # | |
function take { | |
mkdir -p $1 && cd $1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment