   )
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; eglot ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(define-prefix-command 'harmsway-eglot-keymap)
+(global-set-key "\C-c'" 'harmsway-eglot-keymap)
+(defun harmsway-customize-eglot (&rest _)
+  "Customize `eglot'."
+  (interactive)
+  (when eglot--managed-mode
+    (setq-local company-smart-backend 'company-capf)
+    (setq-local company-backends
+                (list (delq 'company-capf (car company-backends))))
+    (remove-hook 'completion-at-point-functions #'eglot-completion-at-point t)
+    ))
+(advice-add #'eglot--managed-mode :after #'harmsway-customize-eglot)
+
 (use-package eglot
+             :bind ((:map harmsway-eglot-keymap
+                          ("'" . eglot)
+                          ("a" . eglot-code-actions)
+                          ("r" . eglot-rename)
+                          ))
   :commands eglot
-  :bind ("C-c '" . eglot)
-  :init
-  (setq eglot-stay-out-of '(company))
+  :init
+  (setq eglot-stay-out-of '(company-backends))
   )
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; lsp-mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

       company-mode
       #'company-complete-common))

(defun harmsway-company-capf-workaround (completion-functions)
  "Ensure `harmsway-company-at-point' is not a member of COMPLETION-FUNCTIONS.
This is a workaround for `company-capf' so that harmsway's
completion at point mechanism does not interfere with `completion-at-point-functions'."
  (if (listp completion-functions)
      (remq 'harmsway-company-at-point completion-functions)
    completion-functions))

(advice-add 'company--capf-workaround :filter-return 'harmsway-company-capf-workaround)

;; Smart completion
(defvar-local company-smart-backend #'company-etags

                           (copy-tree
                            (car company-backends)))))
              (setq-local company-smart-backend 'company-shell)
              (add-hook 'completion-at-point-functions 'harmsway-company-at-point nil t)
              ))
  :config
  (setq sh-basic-offset 4)
