不備があったので種々修正
Descritpion
-
対象環境
- Mac Sierra
- python 2.x.x
- 対象言語 : ruby / python / go
- Emacs 24 or higher.
- helm 1.7.7 or higher (helm設定済みとする)
- GNU Global 6.2.3 or higher
-
helm-gtagとは
- 関数定義へ M-g などで飛べる (関連箇所の list up)
install
console
# pythonはinstall済みとする
brew install ctags
brew install global --with-exuberant-ctags --with-pygments
tag作成
console
sudo cp /usr/local/share/gtags/gtags.conf /etc/
cd [project root] # gtagを作成するdirへ移動
# gtags -v --gtagslabel=exuberant-ctags --gtagsconf=/usr/local/share/gtags/gtags.conf
gtags -v --gtagslabel=pygments --gtagsconf=/usr/local/share/gtags/gtags.conf
global -x -t ignore_missing
console
# 検索テスト
global -ax -t [関数名]
install emacs package
emacs_packages
# package install
helm-gtags
exec-path-from-shell
init.el
init.el
# 以下書き込み
(exec-path-from-shell-initialize)
(require 'helm-gtags)
;; Enable helm-gtags-mode
(add-hook 'go-mode-hook (lambda () (helm-gtags-mode)))
(add-hook 'python-mode-hook (lambda () (helm-gtags-mode)))
(add-hook 'ruby-mode-hook (lambda () (helm-gtags-mode)))
;; gtag setting
(setq helm-gtags-path-style 'root)
(setq helm-gtags-auto-update t)
;; key bind
(add-hook 'helm-gtags-mode-hook
'(lambda ()
(local-set-key (kbd "M-g") 'helm-gtags-dwim)
(local-set-key (kbd "M-s") 'helm-gtags-show-stack)
(local-set-key (kbd "M-p") 'helm-gtags-previous-history)
(local-set-key (kbd "M-n") 'helm-gtags-next-history)))
以上
Jump
- 当該directoryの何らかのfileを開く
- 任意のsymbolの上にカーソルをのせ, M-gで関数定義箇所へ飛ぶ. (もしくは, list up)
補足
tagはfile保存時に自動で再生成される (はず)
helm-gtag readme / 参考記事
https://github.com/syohex/emacs-helm-gtags
http://emacs-jp.github.io/packages/helm/helm-gtags.html
http://qiita.com/sonatard/items/672df1259a76f082ce42
http://qiita.com/5t111111/items/c14ac68f762ce71a7760