     (defun me:company-rtags-setup ()
       (require 'company-rtags)
       (add-to-list 'company-backends 'company-rtags))
+    (defun me:use-rtags (&optional useFileManager)
+      (and (rtags-executable-find "rc")
+          (cond ((and (not (eq major-mode 'c++-mode))
+                      (not (eq major-mode 'c-mode))) (rtags-has-filemanager))
+                (useFileManager (rtags-has-filemanager))
+                (t (rtags-is-indexed)))))
+    (defun me:tags-find-symbol-at-point (&optional prefix)
+      (interactive "P")
+      (if (or (not (rtags-find-symbol-at-point prefix)) rtags-last-request-not-indexed)
+          (call-interactively #'helm-gtags-dwim)))
+    (defun me:tags-find-references-at-point (&optional prefix)
+      (interactive "P")
+      (if (or (not (rtags-find-references-at-point prefix)) rtags-last-request-not-indexed)
+          (call-interactively #'helm-gtags-find-rtag)))
+    (defun me:tags-find-symbol ()
+      (interactive)
+      (call-interactively (if (me:use-rtags) #'rtags-find-symbol #'helm-gtags-find-symbol)))
+    (defun me:tags-find-references ()
+      (interactive)
+      (call-interactively (if (me:use-rtags) #'rtags-find-references #'helm-gtags-find-rtag)))
+    (defun me:tags-find-file ()
+      (interactive)
+      (call-interactively (if (me:use-rtags t) #'rtags-find-file #'helm-gtags-find-files)))
     (setq rtags-autostart-diagnostics t
           rtags-use-helm t
           rtags-process-flags "--config ~/.config/rtags/config"

    (add-hook 'after-init-hook #'global-company-mode))
  :diminish company-mode)

(use-package rtags
  :init
  (progn

    (rtags-enable-standard-keybindings))
  :diminish rtags-mode
  :bind
  (("<f6> <f6>" . me:tags-find-symbol-at-point)
   ("<f6> d"    . me:tags-find-symbol)
   ("<f6> r"    . me:tags-find-references-at-point)
   ("<f6> R"    . me:tags-find-references)
   ("<f6> f"    . me:tags-find-file)
   ("<f6> v"    . rtags-find-virtuals-at-point)
   ("<f6> c"    . rtags-rename-symbol)
   ("<f6> ["    . rtags-location-stack-back)
