@@ -103,7 +103,7 @@ _timeformat_rfc2822="%a, %d %b %Y %T %z" | |||||
alias ls="ls -hCF${_coloroption}${_timeoption}" | alias ls="ls -hCF${_coloroption}${_timeoption}" | ||||
# export GREP_OPTIONS="" | # export GREP_OPTIONS="" | ||||
alias grep="grep -n${_coloroption}" | |||||
alias gr="grep -n${_coloroption}" | |||||
iswindows && alias grep="grep -n" | iswindows && alias grep="grep -n" | ||||
# alias ll="ls -l" | # alias ll="ls -l" | ||||
# alias la="ls -A" | # alias la="ls -A" | ||||
@@ -118,7 +118,6 @@ alias psaux="ps auxww" | |||||
alias q=exit | alias q=exit | ||||
alias e3=e3em | alias e3=e3em | ||||
#alias dirs="dirs -v -l | \grep -v \$(printf '%s$' \$PWD)" | #alias dirs="dirs -v -l | \grep -v \$(printf '%s$' \$PWD)" | ||||
alias dirs="dirs -v -l" | |||||
alias po=popd | alias po=popd | ||||
alias pu=pushd | alias pu=pushd | ||||
alias sudo="sudo " # use aliases through sudo | alias sudo="sudo " # use aliases through sudo | ||||
@@ -187,7 +186,8 @@ null type pacmatic && { | |||||
null type apt-get && \ | null type apt-get && \ | ||||
alias aupgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" | alias aupgrade="sudo apt-get autoremove --yes && sudo apt-get update --yes && sudo apt-get upgrade --yes" | ||||
null type port && \ | 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 | if iscygwin; then | ||||
null type windate || alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'" | null type windate || alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'" | ||||
@@ -214,28 +214,44 @@ netwait(){ | |||||
cd(){ | cd(){ | ||||
if test $# -eq 0 | if test $# -eq 0 | ||||
then | then | ||||
pushd ~/ | |||||
pushd ~/ >/dev/null | |||||
elif test $1 = - | elif test $1 = - | ||||
then | then | ||||
local pwd="$PWD" | 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 | else | ||||
pushd "$@" | |||||
pushd "$1" >/dev/null | |||||
fi | 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(){ | input(){ | ||||
local foo | local foo | ||||
stty -echo | stty -echo | ||||
@@ -324,11 +340,11 @@ di(){ | |||||
} | } | ||||
tb(){ | tb(){ | ||||
local tb=~/.my/tb | |||||
mkdir -p $tb | |||||
local tb="$HOME/.my/tb" | |||||
mkdir -p "$tb" | |||||
for file in "$@" | for file in "$@" | ||||
do | do | ||||
mv $file $tb | |||||
mv -t "$tb" "$file" | |||||
done | done | ||||
} | } | ||||
@@ -852,6 +852,13 @@ drill-instructor.el" | |||||
(require 'git-command nil t) | (require 'git-command nil t) | ||||
(define-key ctl-x-map "g" 'git-command)) | (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 | ;; term mode | ||||
@@ -1269,7 +1276,7 @@ drill-instructor.el" | |||||
(define-key dired-mode-map (kbd "<right>") 'my-dired-scroll-down) | (define-key dired-mode-map (kbd "<right>") 'my-dired-scroll-down) | ||||
(let ((file "._Icon\015")) | (let ((file "._Icon\015")) | ||||
(when nil (file-readable-p file) | (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" | (and (dllib-if-unfound "https://raw.github.com/10sr/emacs-lisp/master/pack.el" | ||||
t) | t) | ||||
@@ -1782,8 +1789,6 @@ when SEC is nil, stop auto save if enabled." | |||||
;; (redisplay t) | ;; (redisplay t) | ||||
(redraw-display) | (redraw-display) | ||||
;; (run-hooks 'window-configuration-change-hook) | ;; (run-hooks 'window-configuration-change-hook) | ||||
(my-revert-buffer-if-needed) | |||||
;; (revert-buffer t t) | |||||
(keyboard-quit) | (keyboard-quit) | ||||
(insert "insert me") | (insert "insert me") | ||||
(run-hooks 'after-keyboard-quit-hook)) | (run-hooks 'after-keyboard-quit-hook)) | ||||
@@ -1817,23 +1822,6 @@ this is test, does not rename files" | |||||
(message file)) | (message file)) | ||||
(message "not visiting 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 | ;; forked from http://d.hatena.ne.jp/khiker/20100119/window_resize | ||||
(define-key my-prefix-map (kbd "C-w") 'my-window-organizer) | (define-key my-prefix-map (kbd "C-w") 'my-window-organizer) | ||||
@@ -20,9 +20,9 @@ set message-fg yellow | |||||
set -g set-titles on | set -g set-titles on | ||||
set -g status-bg green | 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` = 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` = 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'" | if "test -f /opt/local/bin/reattach-to-user-namespace" "set-option -g default-command '/opt/local/bin/reattach-to-user-namespace bash'" |