diff options
| -rw-r--r-- | lisp/ravi-init-cpp.el | 85 |
1 files changed, 62 insertions, 23 deletions
diff --git a/lisp/ravi-init-cpp.el b/lisp/ravi-init-cpp.el index dd60375..47e587e 100644 --- a/lisp/ravi-init-cpp.el +++ b/lisp/ravi-init-cpp.el @@ -106,6 +106,49 @@ (setq dummy-h-mode-default-major-mode 'c++-mode)) :ensure t) +;; Bind to f6 later; to do: pretty docstrings +(defhydra rtags-hydra (:color blue) + ("." rtags-find-symbol-at-point "find-symbol-at-point") + ("," rtags-find-references-at-point "find-references-at-point") + ("v" rtags-find-virtuals-at-point "find-virtuals-at-point") + ("V" rtags-print-enum-value-at-point "print-enum-value-at-point") + ("/" rtags-find-all-references-at-point "find-all-references-at-point") + ("Y" rtags-cycle-overlays-on-screen "cycle-overlays-on-screen") + (">" rtags-find-symbol "find-symbol") + ("<" rtags-find-references "find-references") + ("[" rtags-location-stack-back "location-stack-back") + ("]" rtags-location-stack-forward "location-stack-forward") + ("D" rtags-diagnostics "diagnostics") + ("C" rtags-compile-file "compile-file") + ("G" rtags-guess-function-at-point "guess-function-at-point") + ("p" rtags-dependency-tree "dependency-tree") + ("P" rtags-dependency-tree-all "dependency-tree-all") + ("e" rtags-reparse-file "reparse-file") + ("E" rtags-preprocess-file "preprocess-file") + ("R" rtags-rename-symbol "rename-symbol") + ("M" rtags-symbol-info "symbol-info") + ("S" rtags-display-summary "display-summary") + ("O" rtags-goto-offset "goto-offset") + (";" rtags-find-file "find-file") + ("F" rtags-fixit "fixit") + ("L" rtags-copy-and-print-current-location "copy-and-print-current-location") + ("X" rtags-fix-fixit-at-point "fix-fixit-at-point") + ("B" rtags-show-rtags-buffer "show-rtags-buffer") + ("I" rtags-imenu "imenu") + ("T" rtags-taglist "taglist") + ("h" rtags-print-class-hierarchy "print-class-hierarchy") + ("a" rtags-print-source-arguments "print-source-arguments")) +(defhydra hydra-cextra (:color blue) + "c extra" + ("i" hide-ifdef-block "hide ifdef") + ("C-i" show-ifdef-block "show ifdef") + ("b" hs-toggle-hiding "hide/show block") + ("o" ff-find-other-file "other file")) +(defhydra cextra-rtags-hydra (:inherit + (hydra-cextra/heads rtags-hydra/heads) + :color blue) + "rtags + cextra") + (use-package cc-mode :mode (("\\.h\\(h\\|xx\\|pp\\)\\'" . c++-mode) @@ -135,19 +178,6 @@ :diminish doxymacs-mode ) - (use-package rtags - :load-path (lambda () (ravi/emacs-file "site-lisp/rtags/src")) - :config - (progn - (setq rtags-path (ravi/emacs-file "site-lisp/rtags/bin")) - (rtags-enable-standard-keybindings c-mode-base-map) - - (use-package company-rtags - :config - (progn - (bind-key "C-<tab>" 'company-rtags c-mode-base-map) - (add-to-list 'company-backends 'company-rtags))))) - (defvar printf-index 0) (defun insert-counting-printf (arg) @@ -437,19 +467,28 @@ this to 3 makes header-protection define KIG_MISC_NEWTYPE_H for a file named (bind-key "]" 'ravi/insert-closing-delimiter c-mode-base-map) + (use-package rtags + :load-path (lambda () (ravi/emacs-file "site-lisp/rtags/src")) + :config + (progn + (setq use-rtags-hydra t) + (setq rtags-path (ravi/emacs-file "site-lisp/rtags/bin")) + + + (use-package company-rtags + :config + (progn + (bind-key "C-<tab>" 'company-rtags c-mode-base-map) + (add-to-list 'company-backends 'company-rtags))))) + (setq hide-ifdef-initially nil) - (defhydra hydra-cextra (:color blue) - "c extra" - ("i" hide-ifdef-block "hide ifdef") - ("C-i" show-ifdef-block "show ifdef") - ("b" hs-hide-block "hide block") - ("C-b" hs-show-block "show block") - ("o" ff-find-other-file "other file") - ) - (bind-key "<f6>" 'hydra-cextra/body c-mode-base-map) + + (if (bound-and-true-p use-rtags-hydra) + (progn + (bind-key "<f6>" 'cextra-rtags-hydra/body c-mode-base-map)) + (bind-key "<f6>" 'hydra-cextra/body c-mode-base-map)) (bind-key "<M-f8>" 'compile-dwim c-mode-base-map) - ;; (setq c-syntactic-indentation nil) ) ) |
