Skip to content
MiniApollo edited this page Feb 17, 2024 · 4 revisions

Welcome to the kickstart.emacs wiki!

Alternative packages

This wiki features additional information for alternative packages.

Lsp-mode

One alternative to Eglot is Lsp-mode.
Which is prettier, has more features, supports automatic language server installation, but is slower and more bloated.
If you want to use Lsp-mode don't forget to disable unnecessary features.
Example how to setup
My recommendation is Eglot!

    (use-package lsp-mode
      :custom
      (lsp-completion-provider :none) ;; we use Corfu!
      :init
      (defun my/lsp-mode-setup-completion ()
        (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
              '(flex))) ;; Configure flex (corfu)
      ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
      (setq lsp-keymap-prefix "C-c l")
      ;; To Disable features https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-off/
      :hook (;; Automatic Language Modes
             (prog-mode . lsp)
             ;; Which-key integration
             (lsp-mode . lsp-enable-which-key-integration)
             ;; Corfu
             (lsp-completion-mode . my/lsp-mode-setup-completion))
      :commands lsp)
    ;; optionally
    (use-package lsp-ui
      :commands lsp-ui-mode)
    ;; if you are ivy user
    (use-package lsp-ivy :commands lsp-ivy-workspace-symbol)

Advanced example

    (use-package lsp-mode
      :custom
      (lsp-completion-provider :none) ;; we use Corfu!
      ;; Disable unneeded features
      (lsp-lens-enable nil) ;; Disable references count 
      (lsp-headerline-breadcrumb-enable nil) ;; Disable Header line
      (lsp-ui-sideline-show-code-actions nil) ;; Hide right side code actions
      (lsp-ui-sideline-show-hover nil) ;; Hide right hover symbols
      (lsp-modeline-code-actions-enable nil) ;; Disable modeline code actions
      (lsp-eldoc-enable-hover nil) ;; Disable eldoc (echo area info)
      (lsp-modeline-diagnostics-enable nil) ;; Disable Modeline diagnostic status
      (lsp-signature-auto-activate nil) ;; Disable Signature help you could manually request them via `lsp-signature-activate`
      (lsp-completion-show-detail nil) ;; Disable Completion item detail
      :init
      ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
      (lsp-keymap-prefix "C-c l")
      (defun my/lsp-mode-setup-completion ()
        (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
              '(flex))) ;; Configure flex (corfu)
      
      :hook (;; Automatic Language Modes
             (prog-mode . lsp)
             (lsp-completion-mode . my/lsp-mode-setup-completion) ;; corfu completion
             ;; if you want which-key integration
             (lsp-mode . lsp-enable-which-key-integration))
      :commands lsp)
    ;; optionally
    (use-package lsp-ui 
      :commands lsp-ui-mode)
    ;; if you are ivy user
    (use-package lsp-ivy :commands lsp-ivy-workspace-symbol)

Flycheck

Modern on-the-fly syntax checking extension. Recommended for lsp-mode.

    (use-package flycheck
      :diminish
      :init (global-flycheck-mode))

Ivy and Counsel

Ivy: A completion “framework” that enhances the interface and adds special commands that provide a lot of additional behavior.
Ivy-rich: Allows us to add descriptions alongside commands in M-x.
Counsel: Collection of Ivy-enhanced versions of common Emacs commands.

We don't use it, because it has its own completion engine on top of Emacs.
Alternative to Vertico, Marginalia, Consult.

(use-package ivy
  :bind
  (("C-c C-r" . ivy-resume) ;; Resumes the last Ivy-based completion.
   ("C-x B" . ivy-switch-buffer-other-window))
  :diminish
  :custom
  (ivy-use-virtual-buffers t)
  (ivy-count-format "(%d/%d) ")
  (enable-recursive-minibuffers t)
  :config
  (ivy-mode))

(use-package ivy-rich ;; This gets us descriptions in M-x.
  :init (ivy-rich-mode 1))

(use-package nerd-icons-ivy-rich ;; Adds icons to M-x.
  :init (nerd-icons-ivy-rich-mode 1))

(use-package counsel
  :diminish
  :config (counsel-mode))
Clone this wiki locally