diff --git a/bashrc b/bashrc index f305ecd..5fa705f 100755 --- a/bashrc +++ b/bashrc @@ -134,6 +134,8 @@ fi _timeformat_iso="%Y-%m-%dT%H:%M:%S%z" _timeformat_rfc2822="%a, %d %b %Y %T %z" +_timeformat_num="%Y%m%d%H%M%S" +alias datenum="date +$_timeformat_num" alias ls="ls -hCF${_coloroption}${_timeoption}" if ! with_coreutils @@ -232,6 +234,18 @@ null type pacmatic && { export PACMAN="pacmatic" } +_pacman_update_mirrorlist_with_reflector(){ + ml=/etc/pacman.d/mirrorlist + cmd="$(expr "$(grep reflector $ml)" : '# With: *\(.*\)')" + if test -z "$cmd" + then + cmd="reflector --verbose -l 5 --sort rate --save /etc/pacman.d/mirrorlist" + fi + sudo $cmd +} +null type reflector && test -f /etc/pacman.d/mirrorlist && \ + alias reflect_mirrorlist=_pacman_update_mirrorlist_with_reflector + null type apt-get && { alias aupgrade="sudo apt-get autoremove --yes && \ sudo apt-get update --yes && sudo apt-get upgrade --yes" diff --git a/emacs.el b/emacs.el index 07c3b48..c5202c5 100644 --- a/emacs.el +++ b/emacs.el @@ -898,10 +898,31 @@ found, otherwise returns nil." (define-key view-mode-map "?" 'isearch-backward-regexp) (define-key view-mode-map "n" 'isearch-repeat-forward) (define-key view-mode-map "N" 'isearch-repeat-backward) + (define-key view-mode-map (kbd "C-m") 'my-view-mode-search-word) )) (global-set-key "\M-r" 'view-mode) (setq view-read-only t) +(defun my-view-mode-search-word (word) + "Search for word current directory and subdirectories. +If called intearctively, find word at point." + (interactive (list (thing-at-point 'symbol))) + (if word + (if (and (require 'gtags nil t) + (gtags-get-rootpath)) + (gtags-goto-tag word "s") + (require 'grep) + (if (eq 0 + (shell-command "git rev-parse --git-dir")) + (compilation-start (format "git --no-pager grep -nH -e '%s'" + word) + 'grep-mode) + ;; TODO: handle ack + (grep (format "grep -nH -e '%s' -r ." + word)))) + (message "No word at point.") + nil)) + (add-hook 'Man-mode-hook (lambda () (view-mode 1) @@ -1805,7 +1826,7 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." ;; misc funcs (defun my-grep () - "Use git-grep if avaliable.." + "Use git-grep if avaliable. Only called interactively." (interactive) (require 'grep) (let ((--grep-command-bak grep-command)