| @@ -127,6 +127,11 @@ _timeformat_iso="%Y-%m-%dT%H:%M:%S%z" | |||
| _timeformat_rfc2822="%a, %d %b %Y %T %z" | |||
| alias ls="ls -hCF${_coloroption}${_timeoption}" | |||
| if ! with_coreutils | |||
| then | |||
| export LSCOLORS=gxfxcxdxbxegedabagacad | |||
| alias ls="ls -G" | |||
| fi | |||
| # export GREP_OPTIONS="" | |||
| alias gr="grep -n --color=always" | |||
| iswindows && alias grep="grep -n" | |||
| @@ -175,7 +180,7 @@ null type screen && alias screen="screen -e^z^z" | |||
| null type gtags && alias gtags="gtags --verbose" | |||
| null type htags && alias htags="htags --xhtml --symbol --line-number \ | |||
| --frame --alphabet --verbose" | |||
| null type aunpack && alias aunp=aunpack | |||
| null type aunpack && alias aun=aunpack | |||
| null type lv && alias lv="lv|less" | |||
| isdarwin && alias updatedb="LC_ALL=C updatedb" | |||
| @@ -680,16 +685,19 @@ ip-address(){ | |||
| test -n "$ip" && printf $1 $ip | |||
| } | |||
| __my_ps1_script(){ | |||
| local last=$? | |||
| test -n "$SCRIPT" && echo "${__my_c5}SCR${__my_cdef} " | |||
| return $last | |||
| } | |||
| __my_ps1_scale(){ | |||
| local last=$? | |||
| printf "${LINES}x${COLUMNS}" | |||
| return $last | |||
| } | |||
| __my_ps1_tmux(){ | |||
| local last=$? | |||
| null type tmux || return $last | |||
| @@ -697,11 +705,13 @@ __my_ps1_tmux(){ | |||
| test -n "$TMUX" && echo "[TMUX:$tmuxc]" | |||
| return $last | |||
| } | |||
| __my_ps1_moc(){ | |||
| local last=$? | |||
| __my_moc_state "[MOC:%s]" | |||
| return $last | |||
| } | |||
| for f in /usr/share/git/git-prompt.sh \ | |||
| /opt/local/share/doc/git-core/contrib/completion/git-prompt.sh | |||
| do | |||
| @@ -716,11 +726,13 @@ __my_ps1_git(){ | |||
| __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]" | |||
| return $last | |||
| } | |||
| __my_ps1_ipaddr(){ | |||
| local last=$? | |||
| ! iswindows && ip-address [Addr:%s] | |||
| return $last | |||
| } | |||
| __my_ps1_bttry(){ | |||
| local last=$? | |||
| local bst="${TMP}/batterystatus" | |||
| @@ -733,19 +745,22 @@ __my_ps1_bttry(){ | |||
| fi | |||
| return $last | |||
| } | |||
| __my_ps1_dirs(){ | |||
| dirs | wc -l | |||
| } | |||
| __my_ps1_jobs(){ | |||
| jobs | wc -l | |||
| } | |||
| if test "$TERM" != dumb | |||
| then | |||
| __my_c1="\[\e[1;31m\]" # color for PWD | |||
| __my_c1="\[\e[0;33m\]" # color for PWD | |||
| __my_c2="\[\e[0;36m\]" # color for user | |||
| __my_c3="\[\e[1;30m\]" # color for OLDPWD | |||
| if test "`hostname`" = arch-aspireone; then __my_c4="\[\e[1;34m\]" | |||
| elif test "`hostname`" = darwin-mba.local; then __my_c4="\[\e[1;33m\]" | |||
| elif test "`hostname`" = darwin-mba.local; then __my_c4="\[\e[1;31m\]" | |||
| elif test "`hostname`" = newkiwi; then __my_c4="\[\e[1;35m\]" | |||
| else __my_c4="\[\e[1;32m\]" # color for :: | |||
| fi | |||
| @@ -213,9 +213,9 @@ found, otherwise returns nil." | |||
| t) | |||
| (require 'terminal-title nil t)) | |||
| (setq eol-mnemonic-dos "crlf") | |||
| (setq eol-mnemonic-mac "cr") | |||
| (setq eol-mnemonic-unix "lf") | |||
| (setq eol-mnemonic-dos "\\r\\n") | |||
| (setq eol-mnemonic-mac "\\r") | |||
| (setq eol-mnemonic-unix "\\n") | |||
| (which-function-mode 0) | |||
| @@ -270,6 +270,10 @@ found, otherwise returns nil." | |||
| (add-to-list 'nbl b))) | |||
| nbl)) | |||
| ;; http://www.masteringemacs.org/articles/2012/09/10/hiding-replacing-modeline-strings/ | |||
| ;; (add-to-list 'minor-mode-alist | |||
| ;; '(global-whitespace-mode "")) | |||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |||
| ;; show current info | |||
| (defun my-message-current-info () | |||
| @@ -703,7 +707,11 @@ found, otherwise returns nil." | |||
| (add-hook 'makefile-mode-hook | |||
| (lambda () | |||
| (define-key makefile-mode-map (kbd "C-m") 'newline-and-indent))) | |||
| (define-key makefile-mode-map (kbd "C-m") 'newline-and-indent) | |||
| ;; this functions is set in write-file-functions, i cannot find any | |||
| ;; good way to remove this. | |||
| (fset 'makefile-warn-suspicious-lines 'ignore) | |||
| )) | |||
| (defun make () | |||
| "Run \"make -k\" in current directory." | |||
| @@ -1716,11 +1724,13 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." | |||
| (buffer-name my-term)) | |||
| (pop-to-buffer my-term) | |||
| (setq my-term | |||
| (if (eq system-type 'windows-nt) | |||
| (eshell) | |||
| (if (require 'multi-term nil t) | |||
| (multi-term) | |||
| (ansi-term shell-file-name)))))) | |||
| (save-window-excursion | |||
| (if (eq system-type 'windows-nt) | |||
| (eshell) | |||
| (if (require 'multi-term nil t) | |||
| (multi-term) | |||
| (ansi-term shell-file-name))))) | |||
| (my-term))) | |||
| (defun my-delete-frame-or-kill-emacs () | |||
| "delete frame when opening multiple frame, kill emacs when only one." | |||
| @@ -31,6 +31,10 @@ test -f "${HOME}/.dotfiles/rc.py" && \ | |||
| export PYTHONSTARTUP="${HOME}/.dotfiles/rc.py" | |||
| #export PYTHONPATH="~/.local/share/lib/python3.2/site-packages" | |||
| export GEM_HOME="$HOME/.local/lib/gems" | |||
| export PATH="$PATH:$HOME/.local/lib/gems/bin" | |||
| export RUBYLIB="$RUBYLIB:$HOME/.local/lib/gems/lib" | |||
| __add_to_path(){ | |||
| for p in "$@" | |||
| do | |||
| @@ -48,36 +48,41 @@ install_symlink_script(){ | |||
| git_config(){ | |||
| type git >/dev/null 2>&1 || return 1 | |||
| git config --global user.name '10sr' | |||
| git config --global user.email '8slashes+git@gmail.com' | |||
| git config --global core.autocrlf false | |||
| git config --global core.excludesfile '~/.gitignore' | |||
| git config --global color.ui auto | |||
| git config --global status.relativePaths false | |||
| git config --global status.showUntrackedFiles normal | |||
| git config --global log.date iso | |||
| git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"%C(green)%h%C(reset) %C(white)%ad%C(reset) %C(red)%an%C(reset)%C(yellow)%d%C(reset) %C(white bold)%s%C(reset)\" --all --date=iso -n 499" | |||
| git config --global alias.st "status -s -b" | |||
| git config --global alias.b "branch" | |||
| git config --global alias.sb "show-branch" | |||
| git config --global alias.ci "commit --verbose" | |||
| git config --global alias.co "checkout" | |||
| git config --global alias.cim "commit --verbose -m" | |||
| git config --global alias.di "diff --color" | |||
| git config --global alias.me "merge --no-ff --stat -v" | |||
| git config --global alias.gr "grep -n" | |||
| git config --global alias.ls "ls-files" | |||
| # git config --global alias.ls "ls-files -v --full-name" | |||
| # git config --global alias.ls "status -u -s ." | |||
| git config --global alias.sl "!sl" | |||
| # git config --global alias.my-ls "ls-files | xargs ls" | |||
| # git config --global alias.ll "!git ls-files | xargs ls -l -CFG --color=auto --time-style=long-iso" | |||
| git config --global alias.addi "add -i" | |||
| git config --global alias.clean-p "!test -z \"\$(git status -s -uno)\"" | |||
| #git config --global alias.wc "!git ls-files -z | xargs -0 wc" | |||
| # git config --global push.default "simple" | |||
| _gitconfig="git config --global" | |||
| $_gitconfig user.name '10sr' | |||
| $_gitconfig user.email '8slashes+git@gmail.com' | |||
| $_gitconfig core.autocrlf false | |||
| $_gitconfig core.excludesfile '~/.gitignore' | |||
| $_gitconfig color.ui auto | |||
| $_gitconfig status.relativePaths false | |||
| $_gitconfig status.showUntrackedFiles normal | |||
| $_gitconfig log.date iso | |||
| type xz && \ | |||
| $_gitconfig tar.txz.command "xz -c" | |||
| $_gitconfig alias.graph "log --graph --date-order -C -M --pretty=tformat:\"%C(green)%h%C(reset) %C(white)%ad%C(reset) %C(red)%an%C(reset)%C(yellow)%d%C(reset) %C(white bold)%s%C(reset)\" --all --date=iso -n 499" | |||
| $_gitconfig alias.st "status -s -b" | |||
| $_gitconfig alias.b "branch" | |||
| $_gitconfig alias.sb "show-branch" | |||
| $_gitconfig alias.ci "commit --verbose" | |||
| $_gitconfig alias.co "checkout" | |||
| $_gitconfig alias.cim "commit --verbose -m" | |||
| $_gitconfig alias.di "diff --color" | |||
| $_gitconfig alias.me "merge --no-ff --stat -v" | |||
| $_gitconfig alias.gr "grep -n" | |||
| $_gitconfig alias.ls "ls-files" | |||
| # $_gitconfig alias.ls "ls-files -v --full-name" | |||
| # $_gitconfig alias.ls "status -u -s ." | |||
| $_gitconfig alias.sl "!sl" | |||
| # $_gitconfig alias.my-ls "ls-files | xargs ls" | |||
| # $_gitconfig alias.ll "!git ls-files | xargs ls -l -CFG --color=auto --time-style=long-iso" | |||
| $_gitconfig alias.addi "add -i" | |||
| $_gitconfig alias.clean-p "!test -z \"\$(git status -s -uno)\"" | |||
| #$_gitconfig alias.wc "!git ls-files -z | xargs -0 wc" | |||
| # $_gitconfig push.default "simple" | |||
| if _iswindows; then | |||
| git config --global core.fileMode false | |||
| $_gitconfig core.fileMode false | |||
| fi | |||
| } | |||
| @@ -9,7 +9,7 @@ my @tmux_setw_command = ("setw", "-g"); | |||
| my %color_prefs = ( | |||
| "arch-aspireone" => "blue,white", | |||
| "darwin-mba.local" => "yellow,black", | |||
| "darwin-mba.local" => "red,white", | |||
| "newkiwi" => "magenta,white" | |||
| ); | |||
| my $color_def = "green,white"; | |||