Skip to content

Instantly share code, notes, and snippets.

@xevrem
Last active March 1, 2023 12:06
Show Gist options
  • Select an option

  • Save xevrem/44d4eff77c9d1109891700cb7fedabc2 to your computer and use it in GitHub Desktop.

Select an option

Save xevrem/44d4eff77c9d1109891700cb7fedabc2 to your computer and use it in GitHub Desktop.
elpaca init
(setq-default inhibit-startup-message t ;; dont show startup message
ring-bell-function 'ignore ;; disable all visual and audible bells
indent-tabs-mode nil ;; uses spaces and not tabs
create-lockfiles nil ;; do not create lockfiles
truncate-lines nil ;; truncate lines by default
truncate-partial-width-windows nil
;; disable until we actually call it
recentf-auto-cleanup 'never
;; custo globals
custo/width 120
custo/height 35
custo/font "MesloLGL Nerd Font Mono"
custo/font-size 16
custo/variable-font "Arial"
custo/mode-line-font "FiraCode Nerd Font Mono"
custo/mode-line-size 18
custo/theme 'doom-tomorrow-night
custo/term "zsh"
;; ;; Resizing the Emacs frame can be a terribly expensive part of changing the
;; ;; font. By inhibiting this, we halve startup times, particularly when we use
;; ;; fonts that are larger than the system default (which would resize the frame).
;; frame-inhibit-implied-resize t
;; ;; Emacs "updates" its ui more often than it needs to, so slow it down slightly
;; idle-update-delay 1.0
;; Font compacting can be terribly expensive, especially for rendering icon
;; fonts on Windows. Whether disabling it has a notable affect on Linux and Mac
;; hasn't been determined, but do it there anyway, just in case. This increases
;; memory usage, however!
inhibit-compacting-font-caches nil
;; Introduced in Emacs HEAD (b2f8c9f), this inhibits fontification while
;; receiving input, which should help a little with scrolling performance.
redisplay-skip-fontification-on-input t
;; Reduce *Message* noise at startup. An empty scratch buffer (or the dashboard)
;; is more than enough.
inhibit-startup-screen t
inhibit-startup-echo-area-message user-login-name
inhibit-default-init t
;; Shave seconds off startup time by starting the scratch buffer in
;; `fundamental-mode', rather than, say, `org-mode' or `text-mode', which
;; pull in a ton of packages. `doom/open-scratch-buffer' provides a better
;; scratch buffer anyway.
initial-major-mode 'fundamental-mode
initial-scratch-message nil
help-window-select t
)
(set-fringe-mode 10) ;; 'breathing' room
;; better line info
(column-number-mode) ;; show column info
(menu-bar--display-line-numbers-mode-relative) ;; make those line numbers relative
(when (display-graphic-p)
;; set default font
(set-face-attribute 'default nil :font (font-spec :family custo/font :size custo/font-size :weight 'regular ))
;; Set the fixed pitch face
(set-face-attribute 'fixed-pitch nil :font (font-spec :family custo/font :size custo/font-size :weight 'regular :slant 'italic))
;; Set the variable pitch face
(set-face-attribute 'variable-pitch nil :font (font-spec :family custo/variable-font :size custo/font-size :weight 'regular))
;; Set the modeline face
(set-face-attribute 'mode-line nil :font (font-spec :family custo/mode-line-font :size custo/mode-line-size :weight 'regular))
;; after org-mode we want to adjust font sizes
;; (with-eval-after-load 'org
;; (dolist (face '((org-level-1 . 1.3)
;; (org-level-2 . 1.25)
;; (org-level-3 . 1.20)
;; (org-level-4 . 1.15)
;; (org-level-5 . 1.10)
;; (org-level-6 . 1.05)
;; (org-level-7 . 1.0)
;; (org-level-8 . 1.0)))
;; (set-face-attribute (car face) nil :font "Arial" :weight 'regular :height (cdr face))
;; )
;; ;; Ensure that anything that should be fixed-pitch in Org files appears that way
;; (set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
;; (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
;; (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
;; (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
;; (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
;; (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
;; (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
;; )
;; set current frame to 120x30 characters
(set-frame-width (frame-focus) custo/width)
(set-frame-height (frame-focus) custo/height)
;;(doom-modeline-refresh-font-width-cache)
)
(defvar elpaca-installer-version 0.2)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil
:files (:defaults (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(when-let ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
((add-to-list 'load-path (if (file-exists-p build) build repo)))
((not (file-exists-p repo))))
(condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-installer*"))
((zerop (call-process "git" nil buffer t "clone"
(plist-get order :repo) repo)))
(default-directory repo)
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)"))))
(progn (require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(require 'elpaca-autoloads)
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
;;(line-number-mode 1)
(elpaca atom-dark-theme)
(elpaca ayu-theme)
(elpaca base16-theme)
(elpaca catppuccin-theme)
(elpaca challenger-deep-theme)
(elpaca doom-themes)
(elpaca dracula-theme)
(elpaca monokai-theme)
(elpaca nano-theme)
(elpaca spacemacs-theme)
(elpaca snazzy-theme)
(elpaca zerodark-theme)
(elpaca which-key
(which-key-mode)
)
(elpaca vertico
(vertico-mode)
)
;; (elpaca recentf)
(elpaca consult)
(elpaca orderless
(setq completion-styles '(orderless partial-completion basic)
;; orderless-matching-styles
completion-category-defaults nil
completion-category-overrides '((file (styles orderless partial-completion))
(command (styles orderless))
(symbol (styles orderless))
(variable (styles orderless)))
orderless-component-separator #'orderless-escapable-split-on-space ;; allow escaping space with backslash!
)
)
(elpaca meow
(defun meow-setup ()
(setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
(meow-motion-overwrite-define-key
'("j" . meow-next)
'("k" . meow-prev)
'("<escape>" . ignore))
(meow-leader-define-key
;; SPC j/k will run the original command in MOTION state.
'("j" . "H-j")
'("k" . "H-k")
;; Use SPC (0-9) for digit arguments.
'("TAB" . meow-last-buffer)
'(":" . execute-extended-command)
'("1" . meow-digit-argument)
'("2" . meow-digit-argument)
'("3" . meow-digit-argument)
'("4" . meow-digit-argument)
'("5" . meow-digit-argument)
'("6" . meow-digit-argument)
'("7" . meow-digit-argument)
'("8" . meow-digit-argument)
'("9" . meow-digit-argument)
'("0" . meow-digit-argument)
'("/" . meow-keypad-describe-key)
'("?" . meow-cheatsheet)
'("b b" . consult-buffer)
'("f s" . save-buffer)
'("f f" . find-file)
'("a e" . elpaca-manager)
'("q q" . kill-emacs)
'("s s" . consult-line)
'("t T" . consult-theme)
)
(meow-normal-define-key
'("0" . meow-expand-0)
'("9" . meow-expand-9)
'("8" . meow-expand-8)
'("7" . meow-expand-7)
'("6" . meow-expand-6)
'("5" . meow-expand-5)
'("4" . meow-expand-4)
'("3" . meow-expand-3)
'("2" . meow-expand-2)
'("1" . meow-expand-1)
'("-" . negative-argument)
'(";" . meow-reverse)
'("," . meow-inner-of-thing)
'("." . meow-bounds-of-thing)
'("[" . meow-beginning-of-thing)
'("]" . meow-end-of-thing)
'("a" . meow-append)
'("A" . meow-open-below)
'("b" . meow-back-word)
'("B" . meow-back-symbol)
'("c" . meow-change)
'("d" . meow-delete)
'("D" . meow-backward-delete)
'("e" . meow-next-word)
'("E" . meow-next-symbol)
'("f" . meow-find)
'("g" . meow-cancel-selection)
'("G" . meow-grab)
'("h" . meow-left)
'("H" . meow-left-expand)
'("i" . meow-insert)
'("I" . meow-open-above)
'("j" . meow-next)
'("J" . meow-next-expand)
'("k" . meow-prev)
'("K" . meow-prev-expand)
'("l" . meow-right)
'("L" . meow-right-expand)
'("m" . meow-join)
'("n" . meow-search)
'("o" . meow-block)
'("O" . meow-to-block)
'("p" . meow-yank)
'("q" . meow-quit)
'("Q" . meow-goto-line)
'("r" . meow-replace)
'("R" . meow-swap-grab)
'("s" . meow-kill)
'("t" . meow-till)
'("u" . meow-undo)
'("U" . meow-undo-in-selection)
'("v" . meow-visit)
'("w" . meow-mark-word)
'("W" . meow-mark-symbol)
'("x" . meow-line)
'("X" . meow-goto-line)
'("y" . meow-save)
'("Y" . meow-sync-grab)
'("z" . meow-pop-selection)
'("'" . repeat)
'("<escape>" . ignore)))
(require 'meow)
(meow-setup)
(meow-global-mode 1)
)
(elpaca helpful
)
(when (and (fboundp 'treesit-available-p) (treesit-available-p))
(require 'treesit)
(setq treesit-language-source-alist
'(
(bash "https://github.com/tree-sitter/tree-sitter-bash")
(c "https://github.com/tree-sitter/tree-sitter-c")
(cmake "https://github.com/uyha/tree-sitter-cmake")
(common-lisp "https://github.com/theHamsta/tree-sitter-commonlisp")
(cpp "https://github.com/tree-sitter/tree-sitter-cpp")
(css "https://github.com/tree-sitter/tree-sitter-css")
(csharp "https://github.com/tree-sitter/tree-sitter-c-sharp")
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
(go "https://github.com/tree-sitter/tree-sitter-go")
(go-mod "https://github.com/camdencheek/tree-sitter-go-mod")
(html "https://github.com/tree-sitter/tree-sitter-html")
;; (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.19.0" "src"))
(javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "master" "src"))
(json "https://github.com/tree-sitter/tree-sitter-json")
(lua "https://github.com/Azganoth/tree-sitter-lua")
(make "https://github.com/alemuller/tree-sitter-make")
(markdown "https://github.com/ikatyang/tree-sitter-markdown")
(python "https://github.com/tree-sitter/tree-sitter-python")
(r "https://github.com/r-lib/tree-sitter-r")
(rust "https://github.com/tree-sitter/tree-sitter-rust")
(toml "https://github.com/tree-sitter/tree-sitter-toml")
(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src"))
(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src"))
(yaml "https://github.com/ikatyang/tree-sitter-yaml")
)
)
)
(elpaca-process-queues)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment