Skip to content

Instantly share code, notes, and snippets.

@Mercerenies
Created April 26, 2025 03:03
Show Gist options
  • Select an option

  • Save Mercerenies/1b9295c91d714f2a7ece638ae4d6b646 to your computer and use it in GitHub Desktop.

Select an option

Save Mercerenies/1b9295c91d714f2a7ece638ae4d6b646 to your computer and use it in GitHub Desktop.
;; Minor mode for codeium.el in Emacs
;;
;; The official codeium.el docs just tell you to set Codeium up
;; in completion-at-point-functions. But I personally like to be
;; able to turn it on and off in different buffers. There are a lot
;; of buffers I like it in, but sometimes I have something open that
;; I'd rather keep private.
;;
;; This defines a minor mode codeium-mode and a global variant
;; codeium-global-mode which will enable/disable Codeium in
;; particular buffers.
;;
;; This snippet can be dropped directly in your .emacs file. It
;; does NOT install Codeium. You still need to download and setup
;; the official codeium.el package. This is merely an add-on.
(add-to-list 'load-path "~/.emacs.d/codeium.el")
(require 'codeium)
(define-minor-mode codeium-mode
"Minor mode for Codeium completion."
:lighter " Codeium"
(set (make-local-variable 'completion-at-point-functions) completion-at-point-functions)
(if codeium-mode
(add-to-list 'completion-at-point-functions #'codeium-completion-at-point)
(setq-local completion-at-point-functions (remove 'codeium-completion-at-point completion-at-point-functions))))
(defun codeium-mode-on ()
(when (derived-mode-p 'prog-mode)
(codeium-mode 1)))
(define-globalized-minor-mode codeium-global-mode codeium-mode codeium-mode-on)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment