另一种安装helm-gtags的方法,以及helm的键位绑定和一些小技巧

1.首先备份自己的~/.emacs.d

2.安装helm-gtags

git clone https://github.com/tuhdo/emacs-c-ide-demo ~/.emacs.d

3.修改~/.emacs.d/init.el添加行号显示和光标所在行有下划线

;;行番号表示 
(global-linum-mode t)
;;下划线
(setq hl-line-face 'underline)
(global-hl-line-mode) 

4.给helm-gtags定义绑定按键,修改文件 /custom/package-config/setup-helm-gtags.el

内容如下

(require 'helm-gtags)

(setq
helm-gtags-ignore-case t
helm-gtags-auto-update t
helm-gtags-use-input-at-cursor t
helm-gtags-pulse-at-cursor t
helm-gtags-suggested-key-mapping t
)

;; Enable helm-gtags-mode in Dired so you can jump to any tag
;; when navigate project tree with Dired
(add-hook 'dired-mode-hook 'helm-gtags-mode)

;; Enable helm-gtags-mode in Eshell for the same reason as above
(add-hook 'eshell-mode-hook 'helm-gtags-mode)

;; Enable helm-gtags-mode in languages that GNU Global supports
(add-hook 'c-mode-hook 'helm-gtags-mode)
(add-hook 'c++-mode-hook 'helm-gtags-mode)
(add-hook 'java-mode-hook 'helm-gtags-mode)
(add-hook 'asm-mode-hook 'helm-gtags-mode)

;; key bindings

(define-key helm-gtags-mode-map (kbd "C-j d") 'helm-gtags-dwim)
(define-key helm-gtags-mode-map (kbd "C-j f") 'helm-gtags-find-tag-from-here)

(define-key helm-gtags-mode-map (kbd "C-j r") 'helm-gtags-find-rtag)
(define-key helm-gtags-mode-map (kbd "C-j s") 'helm-gtags-find-symbol)

(define-key helm-gtags-mode-map (kbd "C-j h s") 'helm-gtags-select)
(define-key helm-gtags-mode-map (kbd "C-j h f") 'helm-gtags-tags-in-this-function)
(define-key helm-gtags-mode-map (kbd "C-j h i") 'helm-semantic-or-imenu)

(define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)

(define-key helm-gtags-mode-map (kbd "C-j p") 'helm-gtags-previous-history)
(define-key helm-gtags-mode-map (kbd "C-j n") 'helm-gtags-next-history)



(provide 'setup-helm-gtags) 

5.小技巧

搜索工具 M + x helm-occur
查看所有按键绑定 M + x describe-bindings