Skip to content

Instantly share code, notes, and snippets.

@zeusdeux
Last active February 10, 2026 06:37
Show Gist options
  • Select an option

  • Save zeusdeux/32ff98e524317add81907288790cd14f to your computer and use it in GitHub Desktop.

Select an option

Save zeusdeux/32ff98e524317add81907288790cd14f to your computer and use it in GitHub Desktop.
Emacs config for steam deck
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes '(gruber-darker))
'(custom-safe-themes
'("e13beeb34b932f309fb2c360a04a460821ca99fe58f69e65557d6c1b10ba18c7" default))
'(package-selected-packages
'(multiple-cursors rainbow-delimiters gruber-darker-theme golden-ratio company zig-mode)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(setq gc-cons-threshold (* 100 (* 1000 1000)))
(setq-default indent-tabs-mode nil)
(setq require-final-newline t)
(setq inhibit-startup-screen t)
(set-face-attribute 'default nil :height 140)
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-hook 'before-save-hook 'delete-trailing-lines)
(require 'server)
(unless (server-running-p)
(server-start)
(message "Emacs daemon started!"))
;; PACKAGES
;; Initialize package repos and install required packages if absent
(defun gg/packages-init ()
(interactive)
(package-initialize)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-refresh-contents)
(defvar gg/package-list '(
aggressive-indent
;; auto completion
company
;; theming
gruber-darker
;; html
emmet-mode
;; linting
flycheck
flycheck-inline
;; auto window resizing
golden-ratio
;; interactivity
helm
helm-ag
helm-projectile
helm-swoop
json-mode
;; character based fast navigation
jump-char
;; version control
magit
markdown-mode
multiple-cursors
prettier-js
;; coloring matching braces
rainbow-mode
;; if not helm
smex
;; typescript support
tide
yaml-mode
;; code snippets
yasnippet
;; add package your want to install to this list
;; then M-x ggs/packages-init or restart Emacs
))
(mapc #'gg/package-install-if-absent gg/package-list))
(defun gg/package-install-if-absent (pkg)
(interactive "MPackage: ") ;; this lets you invoke this using M-x aka "interactively"
(if (not (package-installed-p pkg))
(progn
(message "Installing package %s" pkg)
(package-install pkg))
(message "%s already installed" pkg)))
(gg/packages-init) ;; invoke packages init upon startup
;; BASIC UI
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(fringe-mode -1)
(pending-delete-mode 1)
(rainbow-delimiters-mode 1)
(global-auto-revert-mode 1)
(golden-ratio-mode 1)
(winner-mode 1)
(global-display-line-numbers-mode 1)
(setq-default display-line-numbers-width 2)
(setq display-line-numbers-type 'visual)
(column-number-mode 1)
;; BASIC KEYBINDS
(unbind-key (kbd "s-b"))
(global-set-key (kbd "s-b") 'windmove-left)
(unbind-key (kbd "s-f"))
(global-set-key (kbd "s-f") 'windmove-right)
(unbind-key (kbd "s-p"))
(global-set-key (kbd "s-p") 'windmove-up)
(unbind-key (kbd "s-n"))
(global-set-key (kbd "s-n") 'windmove-down)
(global-set-key (kbd "C-;") 'comment-line)
(require 'hideshow)
(define-key hs-minor-mode-map (kbd "C-c C-p") 'hs-toggle-hiding)
(require 'multiple-cursors)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c d") 'mc/skip-to-next-like-this)
(global-set-key (kbd "C-c D") 'mc/skip-to-previous-like-this)
(global-set-key (kbd "C-c >") 'mc/mark-all-like-this-dwim)
;; AUTOCOMPLETE
(defun gg/autocomplete-init ()
(eval-after-load 'company
'(progn
(gg/company-vars-init)
(gg/company-keybinds-init)))
(global-company-mode))
(defun gg/company-keybinds-init ()
(progn
;; trigger auto completion on tab or indent based on context
(define-key company-mode-map (kbd "TAB") 'company-indent-or-complete-common)
(define-key company-mode-map (kbd "<tab>") 'company-indent-or-complete-common)
;; cycle through completions on hitting tab. No need to use arrows
(define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle)
(define-key company-active-map (kbd "<tab>") 'company-complete-common-or-cycle)
;; select previous completion on shift + tab
(define-key company-active-map (kbd "S-TAB") 'company-select-previous)
(define-key company-active-map (kbd "<backtab>") 'company-select-previous)))
(defun gg/company-vars-init ()
(progn
;; preview current completion inline
(setq company-frontends
'(company-pseudo-tooltip-unless-just-one-frontend
company-preview-frontend
company-echo-metadata-frontend))
;; cancel selections by typing non-matching characters
(setq company-require-match 'never)
;; keys like SPC do NOT finish completion (have to press enter to select completion)
(setq company-auto-complete nil)
;; delay before completion list is shown
(setq company-idle-delay 0.05)
;; wrap back to start once you hit end of completions and vice versa
(setq company-selection-wrap-around t)
;; trigger completion after minimum 2 chars
(setq company-minimum-prefix-length 2)
;; show dabbrev completion based on matching case of input and candidates
(setq company-dabbrev-ignore-case nil)
;; don't downcase candidates coming from dabbrev backend
(setq company-dabbrev-downcase nil)))
(gg/autocomplete-init)
;; LINTING
(defun gg/linting-init ()
(interactive)
(eval-after-load 'flycheck
'(progn
(setq flycheck-display-errors-delay 0.4)
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled))
(setq flycheck-highlighting-mode 'lines)
(add-hook 'flycheck-mode-hook 'flycheck-inline-mode))))
(gg/linting-init)
;; PROG MODE
(defun gg/prog-init ()
(interactive)
(add-hook 'prog-mode-hook #'(lambda ()
(electric-pair-mode 1)
(hs-minor-mode 1))))
(gg/prog-init)
;; EMACS LISP
(defun gg/elisp-init ()
(interactive)
(add-hook 'emacs-lisp-mode-hook #'(lambda ()
(company-mode 1)
(rainbow-delimiters-mode 1))))
(gg/elisp-init)
;; JS/TS
(defun gg/tide-init ()
(tide-setup)
(flycheck-mode 1)
(eldoc-mode 1)
(tide-hl-identifier-mode 1)
(company-mode 1)
(zdx/set-to-closest-tsserver-executable)
(setq typescript-indent-level 2)
;; double tide server max response size to handle big monorepos
;; this should also help with building imenu in large projects
;; which can be tested by running tide-imenu-index manually
(setq tide-server-max-response-length 204800)
(setq flycheck-check-syntax-automatically '(save idle-change mode-enabled))
(setq-local company-backends
'((company-tide :separate company-dabbrev-code company-yasnippet company-dabbrev company-keywords)))
;; aligns annotation to the right hand side
(setq company-tooltip-align-annotations t))
(defun gg/typescript-base-init ()
;; associate typescript-mode with all these extensions and not just .ts (default)
(add-to-list 'auto-mode-alist '("\\.js\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.mts\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.mjs\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.cjs\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.jsx\\'" . typescript-mode))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))
(local-set-key (kbd "C-c C-r") 'tide-rename-symbol)
(local-set-key (kbd "C-c C-f") 'tide-references)
(local-set-key (kbd "C-c C-d") 'tide-documentation-at-point)
(local-set-key (kbd "C-<tab>") 'yas-expand)
(zdx/use-prettier-if-in-node-modules)
(zdx/use-eslint-if-in-node-modules)
(zdx/use-aggressive-indent-mode-if-no-local-prettier))
(defun gg/typescript-init ()
(interactive)
(add-hook 'typescript-mode-hook #'(lambda ()
(ggs/tide-init)
(ggs/typescript-base-init))))
(gg/typescript-init)
;; ZIG
(defun gg/zig-init ()
(interactive)
(add-hook 'zig-mode-hook #'(lambda ()
(zig-format-on-save-mode -1)
(eglot-ensure)
(message "Zig ready!"))))
(gg/zig-init)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment