Created
January 20, 2023 18:09
-
-
Save umgefahren/303f9df36799cb7f68f62f599572b30f to your computer and use it in GitHub Desktop.
Current Emacs Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Define the init file | |
(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) | |
(when (file-exists-p custom-file) | |
(load custom-file)) | |
;; Define and initialize package repositories | |
(require 'package) | |
(setq package-archives '(("melpa" . "http://melpa.org/packages/") | |
("gnu" . "http://elpa.gnu.org/packages/"))) | |
(package-initialize) | |
(unless (package-installed-p 'use-package) | |
(package-refresh-contents) | |
(package-install 'use-package)) | |
(require 'use-package) | |
(setq use-package-always-ensure 't) | |
;; Keyboard-centric user interface | |
(setq inhibit-startup-message t) | |
(tool-bar-mode -1) | |
(menu-bar-mode -1) | |
(scroll-bar-mode -1) | |
(defalias 'yes-or-no-p 'y-or-n-p) | |
;; Set line numbers | |
(add-hook 'prog-mode-hook 'display-line-numbers-mode) | |
(setq display-line-numbers-type 'relative) | |
;; Theme | |
(use-package | |
dracula-theme | |
:config (load-theme 'dracula t)) | |
;; Set font | |
(add-to-list 'default-frame-alist '(font . "JetBrains Mono-12")) | |
;; enable ligatures | |
(use-package | |
ligature | |
:config | |
;; Enable all JetBrains Mono ligatures in programming modes | |
(ligature-set-ligatures 'prog-mode '("-|" "-~" "---" "-<<" "-<" "--" "->" "->>" "-->" "///" "/=" | |
"/==" "/>" "//" "/*" "*>" "***" "*/" "<-" "<<-" "<=>" "<=" | |
"<|" "<||" "<|||" "<|>" "<:" "<>" "<-<" "<<<" "<==" "<<=" | |
"<=<" "<==>" "<-|" "<<" "<~>" "<=|" "<~~" "<~" "<$>" "<$" | |
"<+>" "<+" "</>" "</" "<*" "<*>" "<->" "<!--" ":>" ":<" ":::" | |
"::" ":?" ":?>" ":=" "::=" "=>>" "==>" "=/=" "=!=" "=>" "===" | |
"=:=" "==" "!==" "!!" "!=" ">]" ">:" ">>-" ">>=" ">=>" ">>>" | |
">-" ">=" "&&&" "&&" "|||>" "||>" "|>" "|]" "|}" "|=>" "|->" | |
"|=" "||-" "|-" "||=" "||" ".." ".?" ".=" ".-" "..<" "..." | |
"+++" "+>" "++" "[||]" "[<" "[|" "{|" "??" "?." "?=" "?:" | |
"##" "###" "####" "#[" "#{" "#=" "#!" "#:" "#_(" "#_" "#?" | |
"#(" ";;" "_|_" "__" "~~" "~~>" "~>" "~-" "~@" "$>" "^=" | |
"]#")) | |
;; Enables ligature checks globally in all buffers. You can also do it | |
;; per mode with `ligature-mode'. | |
(global-ligature-mode t)) | |
(setq evil-want-keybinding nil) | |
;; Evil | |
(use-package | |
evil | |
:demand t | |
:init (setq evil-want-C-u-scroll t) | |
:bind (("<escape>" . keyboard-escape-quit)) | |
:config (evil-mode 1)) | |
;; Evil everywhere | |
(use-package | |
evil-collection | |
:after evil | |
:config (setq evil-want-integration t) | |
(evil-collection-init)) | |
;; all-the-icons | |
(use-package | |
all-the-icons | |
:if (display-graphic-p)) | |
;; treemacs | |
(use-package | |
treemacs | |
:ensure t | |
:defer t | |
:bind (:map global-map | |
("M-0" . treemacs-select-window) | |
("C-x t 1" . treemacs-delete-other-windows) | |
("C-x t t" . treemacs) | |
("C-x t d" . treemacs-select-directory) | |
("C-x t B" . treemacs-bookmark) | |
("C-x t C-t" . treemacs-find-file) | |
("C-x t M-t" . treemacs-find-tag))) | |
;; treemacs evil | |
(use-package | |
treemacs-evil | |
:after (treemacs evil) | |
:ensure t) | |
;; treemacs all the icons | |
(use-package | |
treemacs-all-the-icons | |
:after (treemacs all-the-icons) | |
:config (treemacs-load-theme "all-the-icons") | |
:ensure t) | |
;; Performance opt | |
(setq gc-cons-threshold (* 1024 1024 100)) | |
(setq read-process-output-max (* 1024 1024 3)) | |
;; Lsp mode | |
(use-package | |
lsp-mode | |
:init | |
;; set prefix for lsp-command-keymap | |
(setq lsp-keymap-prefix "C-c l") | |
:config (setq lsp-idle-delay 0.0) | |
:hook ((lsp-mode . lsp-enable-which-key-integration)) | |
((go-mode) . lsp) | |
:commands lsp) | |
;; company mode | |
(use-package | |
company | |
:ensure t | |
:custom-face | |
(company-tooltip-selection ((t (:background "black" :foreground "black")))) | |
:config | |
(setq company-idle-delay 0.0) | |
(setq company-minimum-prefix-length 0) | |
(global-company-mode t)) | |
;; company box mode | |
;; (use-package | |
;; company-box | |
;; :hook (company-mode . company-box-mode)) | |
;; flycheck | |
(use-package | |
flycheck | |
:ensure t | |
:init (global-flycheck-mode)) | |
;; install elisp format | |
(use-package | |
elisp-format) | |
;; Install rustic | |
(use-package | |
rustic) | |
;; Install go support | |
(use-package | |
go-mode) | |
(add-hook 'go-mode-hook #'lsp-deferred) | |
(defun lsp-go-install-save-hooks () | |
(add-hook 'before-save-hook #'lsp-format-buffer t t) | |
(add-hook 'before-save-hook #'lsp-organize-imports t t)) | |
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks) | |
(use-package | |
tree-sitter | |
:config (add-to-list 'tree-sitter-major-mode-language-alist '(rustic-mode . rust)) | |
:hook ((python-mode rustic-mode go-mode) . tree-sitter-hl-mode)) | |
(use-package | |
tree-sitter-langs | |
:init (global-tree-sitter-mode) | |
:after tree-sitter) | |
;; doomline | |
(use-package | |
doom-modeline | |
:ensure t | |
:hook (after-init . doom-modeline-mode)) | |
;; Configure org mode | |
(global-set-key (kbd "C-c l") #'org-store-link) | |
(global-set-key (kbd "C-c a") #'org-agenda) | |
(global-set-key (kbd "C-c c") #'org-capture) | |
;; Which key | |
(use-package | |
which-key | |
:config (which-key-mode)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment