-
Notifications
You must be signed in to change notification settings - Fork 1
/
myaliases
77 lines (77 loc) · 3.8 KB
/
myaliases
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
# vim: set filetype=sh softtabstop=2 shiftwidth=2 smarttab cindent:
# my aliases
alias a='alias'
alias f='find . -iname'
alias g='git'
alias h='history'
alias hh='history 20'
alias lt='ll -t'
alias lta='lt -A'
alias lla='ll -A'
alias ..='pushd ..'
alias ...='pushd ../..'
alias ....='pushd ../../..'
alias .sudo='sudo ' # if the alias's last character is a blank, then the next word will be alias expansion.
#alias sudovim='sudo vim -u ~/.vimrc'
#alias sudovim='sudo -E vim'
alias sudovim='EDITOR=vim sudoedit'
alias cp-backup='cp -ip --backup=t'
alias mv-backup='mv -i --backup=t'
alias st='(git status ; svn stat -u) 2>/dev/null'
alias sts='(git status -sb ; svn stat -u) 2>/dev/null'
[ -z "$MYGIT_LOG_ARGS" ] && export MYGIT_LOG_ARGS=-10
alias log=' _(){ export MYGIT_LOG_ARGS="${@:-$MYGIT_LOG_ARGS}" ; git log $MYGIT_LOG_ARGS; }; \_'
alias logs=' _(){ export MYGIT_LOG_ARGS="${@:-$MYGIT_LOG_ARGS}" ; git logs $MYGIT_LOG_ARGS; }; \_'
alias logsg='_(){ export MYGIT_LOG_ARGS="${@:-$MYGIT_LOG_ARGS}" ; git logsg $MYGIT_LOG_ARGS; }; \_'
alias logss='_(){ export MYGIT_LOG_ARGS="${@:-$MYGIT_LOG_ARGS}" ; git logss $MYGIT_LOG_ARGS; }; \_'
alias logsd='_(){ export MYGIT_LOG_ARGS="${@:-$MYGIT_LOG_ARGS}" ; git logsd $MYGIT_LOG_ARGS; }; \_'
alias today='git today'
alias todays='git todays'
if [ -z "$(alias ll 2>/dev/null)" ]; then alias ll='ls -alF'; fi
if [ -z "$(alias la 2>/dev/null)" ]; then alias la='ls -A'; fi
if [ -z "$(alias l 2>/dev/null)" ]; then alias l='ls -CF'; fi
if [ -z "$(alias rm 2>/dev/null)" ]; then alias rm='rm -i'; fi
if [ -z "$(alias cp 2>/dev/null)" ]; then alias cp='cp -i'; fi
if [ -z "$(alias mv 2>/dev/null)" ]; then alias mv='mv -i'; fi
if [ -z "$(alias df 2>/dev/null)" ]; then alias df='df -h'; fi
if [ -z "$(alias du 2>/dev/null)" ]; then alias du='du -h'; fi
alias aw='type -a'
alias clipin='xsel -bi'
alias clipout='xsel -bo'
[ -z `type -t pbcopy` ] || alias clipin='pbcopy' # for macOS
[ -z `type -t pbpaste` ] || alias clipout='pbpaste' # for macOS
[ -z `type -t clip` ] || alias clipin='clip' # for windows
[ -z `type -t clipx` ] || alias clipin='clipx' # my tools
[ -z `type -t clipx` ] || alias clipout='clipx -p' # my tools
alias sjistig='iconv -f sjis | tig' # convert sjis to utf-8, and view
alias utf8bom='nkf --overwrite --oc=UTF-8-BOM' # convert to UTF-8-BOM
alias noeol='perl -i.bak -pe "BEGIN{undef \$/;} s/(\r\n|\r|\n)\$//g;"' # read all-lines at once by undef $/, and remove CRLF at EOF.
if [ -d "${USERPROFILE}" ]; then # Git bash, cygwin
alias winhome='pushd "${USERPROFILE}"'
alias windoc='pushd "${USERPROFILE}/Documents"'
fi
if [ -d "/mnt/c/Users/$USER/" ]; then # WSL Windows Subsystem for Linux
alias winhome='pushd "/mnt/c/Users/$USER"'
alias windoc='pushd "/mnt/c/Users/$USER/Documents"'
fi
# cygwin .bashrc
##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
##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' #
# ubuntu .bashrc
##alias ls='ls --color=auto'
##alias grep='grep --color=auto'
##alias fgrep='fgrep --color=auto'
##alias egrep='egrep --color=auto'
##alias ll='ls -alF'
##alias la='ls -A'
##alias l='ls -CF'
##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$//'\'')"'