.s/.emacs.d/settings.org
2022-10-25 22:13:43 -06:00

6.9 KiB
Raw Blame History

Simponic's Settings

Packages

Melpa

  (require 'package)
  (add-to-list 'package-archives
               '("melpa" . "https://melpa.org/packages/") t)

use-package

  (dolist (package '(use-package))
    (unless (package-installed-p package)
      (package-install package)))

General emacs

Tab bar mode

  (defun my-tabbar-buffer-groups () ;; customize to show all normal files in one group
    (list (cond ((string-equal "*" (substring (buffer-name) 0 1)) "emacs")
                 ((eq major-mode 'dired-mode) "emacs")
                 (t "user"))))
  (setq tabbar-buffer-groups-function 'my-tabbar-buffer-groups)
  (tab-bar-mode)

Indentation

  (setq default-tab-width 2)
  (setq-default tab-width 2)
  (setq-default indent-tabs-mode nil)

Line numbers

  (setq display-line-numbers-type 'relative)
  (global-display-line-numbers-mode)

Filesystem stuff

  (setq auto-save-default nil)
  (setq make-backup-files nil)
  (setq create-lockfiles nil)
  (global-auto-revert-mode t) ;; Change files on disk as they are updated

GUI stuff

  (menu-bar-mode -1)
  (setq inhibit-startup-screen t) ;; Startup screen
  (if (display-graphic-p)
      (funcall (lambda ()
                 (tool-bar-mode -1) ;; System bar
                 (set-fringe-mode '(1 . 1)) ;; Minimize arrows before and after wrapped lines by setting fringe to 1px
                 (toggle-scroll-bar -1)))) ;; Scroll bar
  (setq frame-resize-pixelwise t) ;; Use 100% of window space

System path (macos)

  ;; Use system path on macos - needed for node
  (use-package exec-path-from-shell
    :ensure t
    :init
    (when (memq window-system '(mac ns x))
      (exec-path-from-shell-initialize)))

Theming

Highlight current line

  (global-hl-line-mode)

Font

  (let ((font "CozetteVector-14"))
    (set-face-attribute 'default nil :font font)
    (set-frame-font font nil t))

Doom-themes

  (use-package doom-themes
    :ensure t
    :config
    ;; Global settings (defaults)
    (setq doom-themes-enable-bold t    ; if nil, bold is universally disabled
          doom-themes-enable-italic t) ; if nil, italics is universally disabled
    (load-theme 'doom-gruvbox-light t)

    ;; Enable flashing mode-line on errors
    (doom-themes-visual-bell-config)
    ;; Enable custom neotree theme (all-the-icons must be installed!)
    (doom-themes-neotree-config)
    ;; or for treemacs users
    (setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme
    (doom-themes-treemacs-config)
    ;; Corrects (and improves) org-mode's native fontification.
    (doom-themes-org-config))

Doom-modeline

  (use-package doom-modeline
    :ensure t
    :init (doom-modeline-mode 1))

All the icons

  (use-package all-the-icons
    :ensure t)

Projectile

  (use-package projectile
    :bind ("C-c p" . 'projectile-command-map)
    :init (projectile-mode +1) (setq projectile-enable-caching t)
    :ensure t)

Swiper, Ivy

  (use-package counsel
    :ensure t
    :bind
    ("C-s" . 'swiper-isearch)
    ("M-x" . 'counsel-M-x)
    :init
    (setq ivy-use-virtual-buffers t)
    (setq enable-recursive-minibuffers t)
    (ivy-mode 1))

Neotree

  (use-package neotree
    :ensure t
    :bind ("C-c j" . 'neotree-toggle)
    :init
    ;; slow rendering
    (setq inhibit-compacting-font-caches t)

    ;; set icons theme
    (setq neo-theme (if (display-graphic-p) 'icons 'arrow))

    ;; Every time when the neotree window is opened, let it find current file and jump to node
    (setq neo-smart-open t)

    ;; When running projectile-switch-project (C-c p p), neotree will change root automatically
    (setq projectile-switch-project-action 'neotree-projectile-action)

    (setq neo-window-width 35)

    ;; show hidden files
    (setq-default neo-show-hidden-files t))

Org mode

General

  (setq org-startup-indented t)

Babel

  (org-babel-do-load-languages
   'org-babel-load-languages
   '((lisp . t)
     (python . t)))

org-bullets

  (use-package org-bullets
    :ensure t
    :init
    (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))

org-appear

  (use-package org-appear
    :ensure t
    :init
    (add-hook 'org-mode-hook 'org-appear-mode))

Development

Git

  (use-package magit :ensure t)

Company mode

  (use-package company
    :ensure t
    :init
    (global-company-mode t)
    :bind (:map company-active-map
                ("C-n" . company-select-next)
                ("C-p" . company-select-previous))
    :config
    (setq company-idle-delay 0.3))

LSP Mode

  (use-package lsp-mode
    :ensure t
    :init
    ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
    (setq lsp-keymap-prefix "C-c l")
    :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
           (elixir-mode . lsp)
           (rust-mode . lsp)
           (typescript-mode . lsp)
           ;; if you want which-key integration
           (lsp-mode . lsp-enable-which-key-integration))
    :commands lsp)

Languages

Common Lisp

Slime
  (use-package slime
    :ensure t
    :init
    (setq inferior-lisp-program "sbcl"))

Elixir

  (use-package elixir-mode
    :ensure t)

Rust

After installing the rust-analyzer program, the following can be used:

  (use-package rust-mode
    :ensure t)
  (setq lsp-rust-server 'rust-analyzer)

Web Stuff

Web Mode
  ;; web-mode
  (setq web-mode-markup-indent-offset 2)
  (setq web-mode-code-indent-offset 2)
  (setq web-mode-css-indent-offset 2)
  (use-package web-mode
    :ensure t
    :mode (("\\.js\\'" . web-mode)
           ("\\.jsx\\'" .  web-mode)
           ("\\.ts\\'" . web-mode)
           ("\\.tsx\\'" . web-mode)
           ("\\.html\\'" . web-mode))
    :commands web-mode)
Prettier
  (use-package prettier-js
    :ensure t)
  (add-hook 'web-mode-hook #'(lambda ()
                               (enable-minor-mode
                                '("\\.jsx?\\'" . prettier-js-mode))
                               (enable-minor-mode
                                '("\\.tsx?\\'" . prettier-js-mode))))