| @@ -16,13 +16,11 @@ __match(){ | |||||
| expr "$1" : ".*$2.*" >/dev/null | expr "$1" : ".*$2.*" >/dev/null | ||||
| } | } | ||||
| alias isinteractive=false | |||||
| __match "$-" i >/dev/null && alias isinteractive=true | |||||
| alias issourced=true | |||||
| expr "$0" : "^.*shrc$" >/dev/null && alias issourced=false # invoked as script | |||||
| ########################## | ########################## | ||||
| # system type | # system type | ||||
| # aliases: | |||||
| # ismsys, iscygwin iswindows, isdarwin, islinux, | |||||
| # with_coreutils, inbash, inzsh | |||||
| alias ismsys=false | alias ismsys=false | ||||
| alias iscygwin=false | alias iscygwin=false | ||||
| @@ -53,6 +51,10 @@ then | |||||
| fi | fi | ||||
| ################################# | ################################# | ||||
| # file pathes: | |||||
| # shrc: Path to this file | |||||
| # dotdir: Path to .dotfiles directory | |||||
| if inbash | if inbash | ||||
| then | then | ||||
| @@ -65,11 +67,21 @@ fi | |||||
| dotdir="`dirname "$shrc"`" | dotdir="`dirname "$shrc"`" | ||||
| ################################# | ################################# | ||||
| # aliases: | |||||
| # isinteractive: true if the current session is interactive | |||||
| # issourced: true if this file is sourced from another file (not so assured) | |||||
| # __firstload: true if this file is sourced for the first time (not so | |||||
| # assured) | |||||
| alias isinteractive=false | |||||
| __match "$-" i >/dev/null && alias isinteractive=true | |||||
| alias issourced=true | |||||
| expr "$0" : "^.*shrc$" >/dev/null && alias issourced=false # invoked as script | |||||
| alias firstload=false | |||||
| __match "$PATH" "$HOME/.local/bin" || alias firstload=true | |||||
| alias __firstload=false | |||||
| __match "$PATH" "$HOME/.local/bin" || alias __firstload=true | |||||
| if firstload | |||||
| if __firstload | |||||
| then | then | ||||
| if test -d "$HOME/.local/bin" | if test -d "$HOME/.local/bin" | ||||
| then | then | ||||
| @@ -97,6 +109,8 @@ then | |||||
| fi | fi | ||||
| ################################## | ################################## | ||||
| # Some EnvVal definitions | |||||
| export LANG=ja_JP.UTF-8 | export LANG=ja_JP.UTF-8 | ||||
| export LC_MESSAGES=C | export LC_MESSAGES=C | ||||
| @@ -104,6 +118,14 @@ export TERMCAP="${TERMCAP}:vb=" | |||||
| ismsys && export HOSTNAME | ismsys && export HOSTNAME | ||||
| export ENV=~/.shrc | export ENV=~/.shrc | ||||
| if ! with_coreutils | |||||
| then | |||||
| export LSCOLORS=gxfxcxdxbxegedabagacad | |||||
| else | |||||
| # http://qiita.com/yuyuchu3333/items/84fa4e051c3325098be3 | |||||
| null type dircolors && eval `dircolors` | |||||
| fi | |||||
| if false iswindows | if false iswindows | ||||
| then | then | ||||
| export PAGER='tr -d \\r | less' | export PAGER='tr -d \\r | less' | ||||
| @@ -165,31 +187,19 @@ if iswindows; then | |||||
| export USER=$USERNAME | export USER=$USERNAME | ||||
| fi | fi | ||||
| _tmux_prefs(){ | |||||
| null type tmux || return 1 | |||||
| tmux set -g mode-keys vi | |||||
| } | |||||
| if test -d ~/dbx | if test -d ~/dbx | ||||
| then | then | ||||
| export CHIT_PATH="$HOME/dbx/.chit" | export CHIT_PATH="$HOME/dbx/.chit" | ||||
| fi | fi | ||||
| if inzsh | |||||
| then | |||||
| # http://zsh.sourceforge.net/Guide/zshguide06.html#l147 | |||||
| autoload -U compinit; compinit | |||||
| unsetopt auto_menu | |||||
| setopt bash_auto_list | |||||
| bindkey -e | |||||
| fi | |||||
| ####################### | ####################### | ||||
| # If not running interactively, don't do anything | # If not running interactively, don't do anything | ||||
| issourced || exit | issourced || exit | ||||
| isinteractive || return | isinteractive || return | ||||
| ###################### | |||||
| # Print welcome messages | |||||
| iswindows && alias tty="echo cmd.exe" | iswindows && alias tty="echo cmd.exe" | ||||
| type fortune >/dev/null 2>&1 && { | type fortune >/dev/null 2>&1 && { | ||||
| fortune | fortune | ||||
| @@ -222,11 +232,6 @@ _timeformat_num="%Y%m%d%H%M%S" | |||||
| alias datenum="date +$_timeformat_num" | alias datenum="date +$_timeformat_num" | ||||
| alias ls="ls -hCF${_coloroption}${_timeoption}" | alias ls="ls -hCF${_coloroption}${_timeoption}" | ||||
| if ! with_coreutils | |||||
| then | |||||
| export LSCOLORS=gxfxcxdxbxegedabagacad | |||||
| alias ls="ls -G" | |||||
| fi | |||||
| # export GREP_OPTIONS="" | # export GREP_OPTIONS="" | ||||
| alias gr="grep -n --color=always" | alias gr="grep -n --color=always" | ||||
| iswindows && alias grep="grep -n" | iswindows && alias grep="grep -n" | ||||
| @@ -631,6 +636,11 @@ tx(){ | |||||
| fi | fi | ||||
| } | } | ||||
| _tmux_prefs(){ | |||||
| null type tmux || return 1 | |||||
| tmux set -g mode-keys vi | |||||
| } | |||||
| dt(){ | dt(){ | ||||
| # dt [<name>] [<command ...>] | # dt [<name>] [<command ...>] | ||||
| __dtach_dir="${TMP}/dtach" | __dtach_dir="${TMP}/dtach" | ||||
| @@ -959,8 +969,20 @@ dpaste(){ | |||||
| } | } | ||||
| ########################## | |||||
| # Zsh specific preferences | |||||
| if inzsh | |||||
| then | |||||
| # http://zsh.sourceforge.net/Guide/zshguide06.html#l147 | |||||
| autoload -U compinit; compinit | |||||
| unsetopt auto_menu | |||||
| setopt bash_auto_list | |||||
| bindkey -e | |||||
| fi | |||||
| ###################################### | ###################################### | ||||
| ## Prompt | |||||
| ## Prompt Settings | |||||
| __my_moc_state(){ | __my_moc_state(){ | ||||
| type mocp >/dev/null 2>&1 || return | type mocp >/dev/null 2>&1 || return | ||||