Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; early-init.el
- ;; Code:
- ;; Installing straight.el
- (defvar bootstrap-version)
- (let ((bootstrap-file
- (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
- (bootstrap-version 5))
- (unless (file-exists-p bootstrap-file)
- (with-current-buffer
- (url-retrieve-synchronously
- "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
- 'silent 'inhibit-cookies)
- (goto-char (point-max))
- (eval-print-last-sexp)))
- (load bootstrap-file nil 'nomessage))
- ;; Keep things clean, especially ~/.emacs.d
- (straight-use-package 'no-littering)
- (require 'no-littering)
- ;; Some tweaking.
- (setq gc-cons-threshold (* 100 1000 1000) ; Setting up garbage collection.
- read-process-output-max (* 1024 1024)
- comp-deferred-compilation t
- package-enable-at-startup nil ; Disable package.el in favor of straight.el.
- package-native-compile t
- inhibit-startup-message t ; Disable startup message, leave to *scratch* buffer.
- visible-bell nil ; Disable flashing of screen.
- frame-inhibit-implied-resize t) ; Resizing the Emacs frame can be a terribly expensive part of changing the font.
- ;; UI Tweaking.
- (setq frame-title-format
- (concat "Emacs"))
- (scroll-bar-mode -1) ; Disable visible scrollbar.
- (tool-bar-mode -1) ; Disable the toolbar.
- (tooltip-mode -1) ; Disable tooltips.
- (menu-bar-mode -1) ; Disable the menu bar.
- (global-visual-line-mode t)
- (global-auto-revert-mode t)
- (electric-pair-mode t)
- (auto-compression-mode t)
- (savehist-mode t)
- (show-paren-mode t)
- (recentf-mode t)
- (set-face-background 'show-paren-match "#262b36")
- (set-face-bold 'show-paren-match t)
- (set-face-foreground 'show-paren-match "#ffffff")
- ;; The alias to save life.
- (defalias 'yes-or-no-p 'y-or-n-p)
- ;; Keybindings for what we all used to.
- (define-key key-translation-map (kbd "ESC") (kbd "C-g"))
- (global-set-key (kbd "C-=") 'text-scale-increase)
- (global-set-key (kbd "C--") 'text-scale-decrease)
- ;; init.el
- ;; Code:
- (setq use-dialog-box nil
- compilation-scroll-output 'first-error
- default-frame-parameters '((inhibit-double-buffering . t))
- ad-redefinition-action 'accept
- create-locked nil
- native-comp-deferred-compilation t
- auto-revert-use-notify nil
- split-width-threshold nil
- electric-pair-preserve-balance nil)
- (setq-default auto-save-default nil
- create-lockfiles nil
- make-backup-files nil
- cursor-type 'bar
- truncate-lines t
- word-wrap t)
- (setq custom-file (concat user-emacs-directory "custom.el"))
- ;; Some basic things.
- (add-to-list 'default-frame-alist '(width . 72))
- (add-to-list 'default-frame-alist '(height . 35))
- ;; Set default font
- (set-face-attribute 'default nil
- :family "CascadiaCode"
- :height 115
- :weight 'normal
- :width 'normal)
- ;; Relative Line Numbers on side.
- (setq-default display-line-numbers-grow-only t
- display-line-numbers-type 'relative
- display-line-numbers-width 2)
- (global-display-line-numbers-mode)
- ;; Save life by automatically adding spaces between operators.
- (straight-use-package 'electric-operator)
- (add-hook 'prog-mode-hook 'electric-operator-mode)
- (add-hook 'emacs-lisp-mode-hook #'(lambda () (electric-operator-mode -1)))
- (add-hook 'sh-mode-hook #'(lambda () (electric-operator-mode -1)))
- ;; Major mode for Markdown text format.
- (straight-use-package 'markdown-mode)
- (setq markdown-command "multimarkdown")
- ;; Very powerful undo/redo system.
- (straight-use-package 'undo-tree)
- (global-undo-tree-mode)
- ;; Highlight your indentation to make things more simple.
- (straight-use-package 'highlight-indent-guides)
- (setq highlight-indent-guides-method 'character)
- (add-hook 'prog-mode 'highlight-indent-guides-mode)
- ;; Keep your code always indented. That's it.
- (straight-use-package 'aggressive-indent)
- (aggressive-indent-global-mode +1)
- ;; Higlight your Brackets...()
- (straight-use-package 'rainbow-delimiters)
- (add-hook 'prog-mode 'rainbow-delimiters-mode)
- ;; A easy-to-use project manager.
- (straight-use-package 'projectile)
- (projectile-mode +1)
- ;; Beautifying Emacs.
- ;; Using icons.
- (straight-use-package 'all-the-icons)
- (straight-use-package 'all-the-icons-completion)
- (all-the-icons-completion-mode)
- (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
- (straight-use-package 'all-the-icons-dired)
- (add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
- (put 'dired-find-alternate-file 'disabled nil)
- ;; A warm theme.
- (straight-use-package 'doom-themes)
- (load-theme 'doom-wilmersdorf t)
- ;; Perfect eyecandy modeline.
- (straight-use-package 'doom-modeline)
- (add-hook 'window-setup-hook #'doom-modeline-mode)
- (setq doom-modeline-buffer-encoding nil
- doom-modeline-buffer-file-name-style 'file-name
- doom-modeline-unicode-fallback t)
- ;; Very straight-forward dashboard.
- (straight-use-package 'dashboard)
- (setq dashboard-startup-banner (concat user-emacs-directory "logo.png"))
- (dashboard-setup-startup-hook)
- (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
- (setq dashboard-set-heading-icons t)
- (setq dashboard-set-file-icons t)
- (setq dashboard-set-navigator t)
- (setq dashboard-banner-logo-title "Welcome Back!🤵")
- (setq dashboard-center-content t)
- (setq dashboard-show-shortcuts t)
- (setq dashboard-items '((recents . 3)
- (bookmarks . 3)
- (projects . 3)))
- ;; Some UI improvements.
- ;; Popup that makes life easier.
- (straight-use-package 'which-key)
- (which-key-mode +1)
- ;; Easily select items.
- (straight-use-package 'vertico)
- (vertico-mode +1)
- ;; Emacs completion style enhancement.
- (straight-use-package 'orderless)
- (setq completion-styles '(orderless))
- ;; Enrich completion list with annotations.
- (straight-use-package 'marginalia)
- (marginalia-mode +1)
- ;; Text completion framework.
- (straight-use-package 'company)
- (add-hook 'after-init-hook 'global-company-mode)
- (setq company-minimum-prefix-length 1
- company-ideal-dealy 0.0
- company-tooltip-align-annotations t
- company-selection-wrap-around t)
- (company-tng-configure-default)
- ;; Displays current match and total matches information
- (straight-use-package 'anzu)
- (global-anzu-mode +1)
- ;; Ligatures
- (straight-use-package
- '(el-get :type git :host github :repo "mickeynp/ligature.el"))
- ;; Enable the "www" ligature in every possible major mode
- (ligature-set-ligatures 't '("www"))
- ;; Enable all Cascadia Code ligatures in programming modes
- (ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
- ":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
- "!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
- "<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
- "<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
- "..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
- "~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
- "[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
- ">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
- "<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
- "##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:"
- "?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
- "\\\\" "://"))
- ;; Enables ligature checks globally in all buffers.
- (global-ligature-mode t)
- ;; Emacs as IDE Setup.
- ;; Setup LSP.
- (straight-use-package 'eglot)
- (require 'eglot)
- ;; For C/C++ development.
- (add-to-list 'eglot-server-programs '((c-mode c++-mode). ("ccls")))
- (add-hook 'c-mode-hook 'eglot-ensure)
- (add-hook 'c++-mode-hook 'eglot-ensure)
- ;; For Python development.
- (add-to-list 'eglot-server-programs '((python-mode). ("pylsp")))
- (add-hook 'python-mode-hook 'eglot-ensure)
- ;; For Rust development.
- (straight-use-package 'rust-mode)
- (add-to-list 'eglot-server-programs '((rust-mode). ("rust-analyzer")))
- (add-hook 'rust-mode-hook 'eglot-ensure)
- ;; Format-on-save.
- (add-hook 'c-mode-hook (lambda () (add-hook 'before-save-hook 'eglot-format nil t)))
- (add-hook 'c++-mode-hook (lambda () (add-hook 'before-save-hook 'eglot-format nil t)))
- (add-hook 'python-mode-hook (lambda () (add-hook 'before-save-hook 'eglot-format nil t)))
- (add-hook 'rust-mode-hook (lambda () (add-hook 'before-save-hook 'eglot-format nil t)))
- ;; Get some fancy highlighting in your code.
- (straight-use-package 'tree-sitter)
- (straight-use-package 'tree-sitter-langs)
- (global-tree-sitter-mode)
- (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)
- ;; Docker is here.
- (straight-use-package 'dockerfile-mode)
- ;; Best GIT interface ever, Magit.
- (straight-use-package 'magit)
- ;; The most important tool for a developer, Terminal.
- (straight-use-package 'vterm)
- (straight-use-package 'vterm-toggle)
- (global-set-key [C-f2] 'vterm-toggle-cd)
- ;; Custom.el
- ~/.config/emacs ❯ cat custom.el
- (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.
- '(warning-suppress-log-types '((comp) (comp) (comp) (comp) (comp) (comp)))
- '(warning-suppress-types '((comp) (comp) (comp) (comp) (comp))))
- (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.
- )
- ~/.config/emacs ❯
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement