diff --git a/bashrc b/bashrc index 9250955..f81e2f9 100755 --- a/bashrc +++ b/bashrc @@ -103,7 +103,7 @@ _timeformat_rfc2822="%a, %d %b %Y %T %z" alias ls="ls -hCF${_coloroption}${_timeoption}" # export GREP_OPTIONS="" -alias grep="grep -n${_coloroption}" +alias gr="grep -n${_coloroption}" iswindows && alias grep="grep -n" # alias ll="ls -l" # alias la="ls -A" @@ -118,7 +118,6 @@ alias psaux="ps auxww" alias q=exit alias e3=e3em #alias dirs="dirs -v -l | \grep -v \$(printf '%s$' \$PWD)" -alias dirs="dirs -v -l" alias po=popd alias pu=pushd alias sudo="sudo " # use aliases through sudo @@ -187,7 +186,8 @@ null type pacmatic && { null type apt-get && \ alias aupgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" null type port && \ - alias pupgrade="sudo port -v selfupdate && sudo port -v upgrade outdated && sudo port -v uninstall leaves" + alias port="port -v" + alias pupgrade="sudo port -v selfupdate && { sudo port -v upgrade outdated; sudo port -v uninstall leaves; }" if iscygwin; then null type windate || alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'" @@ -214,28 +214,44 @@ netwait(){ cd(){ if test $# -eq 0 then - pushd ~/ + pushd ~/ >/dev/null elif test $1 = - then local pwd="$PWD" - popd >/dev/null - pushd -n "$pwd" # stack last dir + command cd $OLDPWD + pushd -n "$pwd" >/dev/null # stack last dir + elif ! test -d "$1" + then + echo `basename ${SHELL}`: cd: "$1": No such file or directory 1>&2 + return 1 else - pushd "$@" + pushd "$1" >/dev/null fi + __dirs_rm_dup "$PWD" + echo "$PWD" } -# pushd(){ -# local pwd="$PWD" -# for l in $(\dirs -v -l | \grep "^ [0-9]\+ ${pwd}$" | cut -d " " -f 2 | tac) -# do -# echo $l -# test $l -eq 0 && continue -# popd +$l -n -# done -# command pushd "$@" >/dev/null -# } +__dirs_rm_dup(){ + for d in "$@" + do + local next="$(realpath --no-symlinks "$d")" + for l in $(\dirs -v -l | cut -d " +" -f 2- | \grep -x " *[0-9]\+ \+${next}" | \grep -o "^ *[0-9]\+ " | tac) + do + popd +$l -n >/dev/null + done + done +} +dh(){ + if test $# -eq 0 + then + dirs -v -l + else + local dir="$(dirs -v -l | \grep "^ *$1 \+" | sed "s/^ *[0-9]\+ *//g")" + cd "$dir" + fi +} input(){ local foo stty -echo @@ -324,11 +340,11 @@ di(){ } tb(){ - local tb=~/.my/tb - mkdir -p $tb + local tb="$HOME/.my/tb" + mkdir -p "$tb" for file in "$@" do - mv $file $tb + mv -t "$tb" "$file" done } diff --git a/emacs.el b/emacs.el index 006e07c..cf8f407 100644 --- a/emacs.el +++ b/emacs.el @@ -852,6 +852,13 @@ drill-instructor.el" (require 'git-command nil t) (define-key ctl-x-map "g" 'git-command)) +(and (dllib-if-unfound + "https://raw.github.com/10sr/emacs-lisp/master/smart-revert.el" + t) + (require 'smart-revert nil t) + (smart-revert-on) + ) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; term mode @@ -1269,7 +1276,7 @@ drill-instructor.el" (define-key dired-mode-map (kbd "") 'my-dired-scroll-down) (let ((file "._Icon\015")) (when nil (file-readable-p file) - (delete-file file))))) + (delete-file file))))) (and (dllib-if-unfound "https://raw.github.com/10sr/emacs-lisp/master/pack.el" t) @@ -1782,8 +1789,6 @@ when SEC is nil, stop auto save if enabled." ;; (redisplay t) (redraw-display) ;; (run-hooks 'window-configuration-change-hook) - (my-revert-buffer-if-needed) - ;; (revert-buffer t t) (keyboard-quit) (insert "insert me") (run-hooks 'after-keyboard-quit-hook)) @@ -1817,23 +1822,6 @@ this is test, does not rename files" (message file)) (message "not visiting file.")))) -(defvar my-revert-buffer-if-needed-last-buffer nil) - -(defun my-revert-buffer-if-needed () - "" - (interactive) - (unless (eq my-revert-buffer-if-needed-last-buffer (current-buffer)) - (setq my-revert-buffer-if-needed-last-buffer (current-buffer)) - (when (or (and (eq major-mode 'dired-mode) - (dired-directory-changed-p default-directory)) - (not (verify-visited-file-modtime (current-buffer)))) - (revert-buffer t t) - (message "%s reverted." (buffer-name)) - ))) - -(add-hook 'post-command-hook ; 'window-configuration-change-hook - 'my-revert-buffer-if-needed) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; forked from http://d.hatena.ne.jp/khiker/20100119/window_resize (define-key my-prefix-map (kbd "C-w") 'my-window-organizer) diff --git a/tmux.conf b/tmux.conf index 3a771d2..a81b049 100644 --- a/tmux.conf +++ b/tmux.conf @@ -20,9 +20,9 @@ set message-fg yellow set -g set-titles on set -g status-bg green -set -g status-fg black +set -g status-fg white if "test `hostname` = arch-aspireone" "set -g status-bg blue" if "test `hostname` = darwin-mba.local" "set -g status-bg yellow; set -g status-fg black" -if "test `hostname` = newkiwi" "set -g status-bg magenta" +if "test `hostname` = newkiwi" "set -g status-bg magenta; set -g status-fg white" if "test -f /opt/local/bin/reattach-to-user-namespace" "set-option -g default-command '/opt/local/bin/reattach-to-user-namespace bash'"