diff --git a/emacs.el b/emacs.el index 80b2bfe..9273975 100644 --- a/emacs.el +++ b/emacs.el @@ -999,8 +999,8 @@ found, otherwise returns nil." indent-tabs-mode nil) ;; (set-face-foreground 'font-lock-keyword-face "blue") (c-toggle-hungry-state -1) - (and (require 'gtags nil t) - (gtags-mode 1)) + ;; (and (require 'gtags nil t) + ;; (gtags-mode 1)) )) (when (fetch-library @@ -1048,22 +1048,22 @@ 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) + (define-key view-mode-map (kbd "C-m") 'my-rgrep-symbol-at-point) )) (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") - (my-rgrep word)) - (message "No word at point.") - nil)) +;; (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") +;; (my-rgrep word)) +;; (message "No word at point.") +;; nil)) (add-hook 'Man-mode-hook (lambda () @@ -1116,22 +1116,29 @@ If called intearctively, find word at point." (add-to-list 'load-path d))) -'(when (lazy-load-eval 'gtags '(gtags-mode)) +(when (lazy-load-eval 'gtags '(gtags-mode)) (add-hook 'gtags-mode-hook (lambda () + (view-mode gtags-mode) (setq gtags-select-buffer-single t) ;; (local-set-key "\M-t" 'gtags-find-tag) ;; (local-set-key "\M-r" 'gtags-find-rtag) ;; (local-set-key "\M-s" 'gtags-find-symbol) ;; (local-set-key "\C-t" 'gtags-pop-stack) - (define-key gtags-mode-map (kbd "C-x t h") 'gtags-find-tag-from-here) + (define-key gtags-mode-map (kbd "C-x t h") + 'gtags-find-tag-from-here) (define-key gtags-mode-map (kbd "C-x t t") 'gtags-find-tag) (define-key gtags-mode-map (kbd "C-x t r") 'gtags-find-rtag) (define-key gtags-mode-map (kbd "C-x t s") 'gtags-find-symbol) (define-key gtags-mode-map (kbd "C-x t p") 'gtags-find-pattern) - (define-key gtags-mdoe-map (kbd "C-x t f") 'gtags-find-file) + (define-key gtags-mode-map (kbd "C-x t f") 'gtags-find-file) (define-key gtags-mode-map (kbd "C-x t b") 'gtags-pop-stack) ;back - ))) + )) + (add-hook 'gtags-select-mode-hook + (lambda () + (define-key gtags-select-mode-map (kbd "C-m") 'gtags-select-tag) + )) + ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; term mode @@ -1999,6 +2006,10 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." "ack --nocolor --nogroup --nopager " "grep command for ack") +(defvar my-rgrep-global + "global --result grep " + "grep command for global") + (defvar my-rgrep-grep (concat "find . " "-path '*/.git' -prune -o " @@ -2009,14 +2020,17 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." (defun my-rgrep-grep-command () "Return recursive grep command for current directory." - (if (eq 0 - (shell-command "git rev-parse --git-dir")) - my-rgrep-gitgrep - (if (executable-find "ag") - my-rgrep-ag - (if (executable-find "ack") - my-rgrep-ack - my-rgrep-grep)))) + (if (and (require 'gtags nil t) + (gtags-get-rootpath)) + my-rgrep-global + (if (eq 0 + (shell-command "git rev-parse --git-dir")) + my-rgrep-gitgrep + (if (executable-find "ag") + my-rgrep-ag + (if (executable-find "ack") + my-rgrep-ack + my-rgrep-grep))))) (defun my-rgrep (command-args) "My recursive grep." @@ -2026,6 +2040,16 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." (compilation-start command-args 'grep-mode)) +(defun my-rgrep-symbol-at-point (command-args) + "My recursive grep." + (interactive (list (read-shell-command "grep command: " + (concat (my-rgrep-grep-command) + " " + (thing-at-point 'symbol)) + 'grep-find-history))) + (compilation-start command-args + 'grep-mode)) + (defun my-rgrep-ack (command-args) "My recursive grep." (interactive (list (read-shell-command "grep command: " @@ -2040,6 +2064,13 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." 'grep-find-history))) (my-rgrep command-args)) +(defun my-rgrep-global (command-args) + "My recursive grep by gnu global." + (interactive (list (read-shell-command "grep command: " + my-rgrep-global + 'grep-find-history))) + (my-rgrep command-args)) + (defun my-rgrep-grep (command-args) "My recursive grep." (interactive (list (read-shell-command "grep command: " diff --git a/setup.sh b/setup.sh index f5d3994..24c7626 100755 --- a/setup.sh +++ b/setup.sh @@ -154,8 +154,8 @@ setup_tmux(){ case "`hostname`" in arch-aspireone) - tmux_bg_color=blue - tmux_fg_color=white + tmux_bg_color=yellow + tmux_fg_color=black ;; darwin-mba.local) tmux_bg_color=cyan diff --git a/shrc b/shrc index e1382be..4a48e19 100755 --- a/shrc +++ b/shrc @@ -417,7 +417,8 @@ do test -f $f && alias vl=$f && break done -alias pa=pacapt +__safe_alias pa=pacman +__safe_alias pa=pacapt __safe_alias yt=yaourt __safe_alias cower="cower --color=auto" @@ -1177,7 +1178,7 @@ then # color for :: case "`hostname`" in arch-aspireone) - __my_c4="$__color_light_blue" + __my_c4="$__color_yellow" ;; darwin-mba.local) __my_c4="$__color_light_cyan"