diff --git a/contrib/gtags/README.md b/contrib/gtags/README.md
index 1e73f768b..5837d4194 100644
--- a/contrib/gtags/README.md
+++ b/contrib/gtags/README.md
@@ -119,4 +119,3 @@ Since these modes have better Eldoc integration already.
SPC m g s | select any tag in a project retrieved by gtags
SPC m g S | show stack of visited locations
SPC m g u | manually update tag database
-
diff --git a/contrib/gtags/packages.el b/contrib/gtags/packages.el
index dfa61bfa0..2111c836c 100644
--- a/contrib/gtags/packages.el
+++ b/contrib/gtags/packages.el
@@ -48,40 +48,32 @@ which require an initialization must be listed explicitly in the list.")
:defer t
:init
(progn
- ;; add to Dired so we can select tag in Dired buffer
- ;; with helm-gtags-select
- ;; so is eshell
(add-hook 'prog-mode-hook 'helm-gtags-mode)
(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-pulse-at-cursor t)
+
+ (defun spacemacs/gtags-define-keys-for-mode (mode)
+ "Define key bindings for the specific MODE."
+ (evil-leader/set-key-for-mode mode
+ "mgc" 'helm-gtags-create-tags
+ "mgd" 'helm-gtags-find-tag
+ "mgf" 'helm-gtags-select-path
+ "mgg" 'helm-gtags-dwim
+ "mgi" 'helm-gtags-tags-in-this-function
+ "mgl" 'helm-gtags-parse-file
+ "mgn" 'helm-gtags-next-history
+ "mgp" 'helm-gtags-previous-history
+ "mgr" 'helm-gtags-find-rtag
+ "mgR" 'helm-gtags-resume
+ "mgs" 'helm-gtags-select
+ "mgS" 'helm-gtags-show-stack
+ "mgu" 'helm-gtags-update-tags)))
:config
(progn
;; if anyone uses helm-gtags, they would want to use these key bindings
(define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
(define-key helm-gtags-mode-map (kbd "C-x 4 .") 'helm-gtags-find-tag-other-window)
(define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)
- (define-key helm-gtags-mode-map (kbd "M-*") 'pop-tag-mark)
-
- (let ((l (if (eq dotspacemacs-editing-style 'emacs)
- dotspacemacs-major-mode-emacs-leader-key
- dotspacemacs-major-mode-leader-key)))
- (define-key helm-gtags-mode-map (kbd (concat l " gc")) 'helm-gtags-create-tags)
- (define-key helm-gtags-mode-map (kbd (concat l " gd")) 'helm-gtags-find-tag)
- (define-key helm-gtags-mode-map (kbd (concat l " gf")) 'helm-gtags-select-path)
- (define-key helm-gtags-mode-map (kbd (concat l " gg")) 'helm-gtags-dwim)
- (define-key helm-gtags-mode-map (kbd (concat l " gn")) 'helm-gtags-next-history)
- (define-key helm-gtags-mode-map (kbd (concat l " gp")) ''helm-gtags-previous-history)
- (define-key helm-gtags-mode-map (kbd (concat l " gr")) 'helm-gtags-find-rtag)
- (define-key helm-gtags-mode-map (kbd (concat l " gR")) 'helm-gtags-resume)
- (define-key helm-gtags-mode-map (kbd (concat l " gi")) 'helm-gtags-tags-in-this-function)
- (define-key helm-gtags-mode-map (kbd (concat l " gl")) 'helm-gtags-parse-file)
- (define-key helm-gtags-mode-map (kbd (concat l " gs")) 'helm-gtags-select)
- (define-key helm-gtags-mode-map (kbd (concat l " gS")) 'helm-gtags-show-stack)
- (define-key helm-gtags-mode-map (kbd (concat l " gu")) helm-gtags-update-tags)
- ))
- ;; Often the body of an initialize function uses `use-package'
- ;; For more info on `use-package', see readme:
- ;; https://github.com/jwiegley/use-package
- ))
+ (define-key helm-gtags-mode-map (kbd "M-*") 'pop-tag-mark))))
diff --git a/contrib/lang/c-c++/packages.el b/contrib/lang/c-c++/packages.el
index 34af7cf3c..2e3c2ca2f 100644
--- a/contrib/lang/c-c++/packages.el
+++ b/contrib/lang/c-c++/packages.el
@@ -17,6 +17,7 @@
company
company-c-headers
flycheck
+ helm-gtags
stickyfunc-enhance
)
"List of all packages to install and/or initialize. Built-in packages
@@ -55,6 +56,10 @@ which require an initialization must be listed explicitly in the list.")
(defun c-c++/post-init-flycheck ()
(add-to-hooks 'flycheck-mode '(c-mode-hook c++-mode-hook)))
+(defun c-c++/post-init-helm-gtags ()
+ (spacemacs/gtags-define-keys-for-mode 'c-mode)
+ (spacemacs/gtags-define-keys-for-mode 'c++-mode))
+
(defun c-c++/init-srefactor ()
(use-package srefactor
:defer t