Skip to content

rayfdj/.emacs.d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Babelized Emacs User Initialization File

This is my portable Emacs configuration, to make it easy for me to have the same Emacs across machines, VMs, etc.

Initial Package Setup

Just for two things:

  • Adds MELPA to package-archives. Pretty much all the useful extra packages are there.
(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("melpa" . "https://melpa.org/packages/")))
(package-initialize)
  • Install use-package if it’s not already installed. Note the call to package-refresh-contents to make sure this works with freshly installed Emacs too.
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)

Common Configuration

Common configuration across all tasks.

Keys Re-mapping

To allow entering chars from non-English languages, map Meta to Command, and free up Option.

(when (eq system-type 'darwin)
  (setq mac-command-modifier 'meta
        mac-option-modifier 'none))

I really just want the equivalent of Ctrl+Tab and Ctrl+Shift+Tab. This one only needs you to shift your pinkies a bit.

(global-set-key (kbd "C-'") #'other-window)
(global-set-key (kbd "C-;") #'prev-window)
(defun prev-window ()
  (interactive)
  (other-window -1))

Separate Customize Settings

The settings written by Customize aren’t meant to be edited manually, so it’s better to separate them into another file. Also, create the custom.el file if it doesn’t already exist.

(defconst custom-file-path (expand-file-name "custom.el" user-emacs-directory))
(unless (file-exists-p custom-file-path)
  (write-region "" nil custom-file-path))
(setq custom-file custom-file-path)
(load custom-file)

Miscellaneous

Start in home directory.

(setq default-directory "~/")

Yes, when I quit, I do want to kill processes. No need to ask me.

(setq confirm-kill-processes nil)

Put backup and autosave files in the tmp dir

;; store all backup and autosave files in the tmp dir
(setq backup-directory-alist
      `((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
      `((".*" ,temporary-file-directory t)))

UI Settings

The Doom Themes are nice, modern looking.

(use-package doom-themes
  :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-one-light t)

  ;; Enable flashing mode-line on errors
  (doom-themes-visual-bell-config)
    
  ;; Corrects (and improves) org-mode's native fontification.
  (doom-themes-org-config))

Disable the startup screen.

(setq inhibit-startup-message t)

Disable the menu, scrollbar, and toolbar. They reset initial frame’s size so have to be done first.

(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)

Set initial frame to handle 160x48 characters, and center it on the screen.

;; Set initial frame size and position
(defun set-initial-frame (max-chars-per-line max-no-of-lines)
  (let* ((frame-width (* (window-font-width) max-chars-per-line))
	 (frame-height (* (window-font-height) max-no-of-lines))
	 (frame-left (truncate (/ (- (display-pixel-width) frame-width) 2)))
	 (frame-top (truncate (/ (- (display-pixel-height) frame-height) 2))))
    (set-frame-position (selected-frame) frame-left frame-top)
    (set-frame-size (selected-frame) frame-width frame-height t)))
(when (display-graphic-p)
  (setq frame-resize-pixelwise t)
  (set-initial-frame 160 51)) ; +3 lines for the title bar/mode line/minibuffer.

Line and column modes.

(column-number-mode 1)
(global-hl-line-mode t)
(global-linum-mode)

Org-mode configurations

Agenda and Capture settings

(setq org-directory "~/org")
(let ((default-directory (concat (file-name-as-directory org-directory) "gtd")))
  (setq gtd-inbox-file-path (expand-file-name "inbox.org"))
  (setq gtd-gtd-file-path (expand-file-name "gtd.org"))
  (setq gtd-tickler-file-path (expand-file-name "tickler.org"))
  (setq gtd-someday-file-path (expand-file-name "someday.org")))
(setq org-agenda-files (list gtd-inbox-file-path gtd-gtd-file-path gtd-tickler-file-path))
(setq org-refile-targets `((,gtd-gtd-file-path :maxlevel . 3)
                           (,gtd-someday-file-path :level . 1)
                           (,gtd-tickler-file-path :maxlevel . 2)))
(setq org-capture-templates '(("t" "Todo [inbox]" entry
                               (file+headline gtd-inbox-file-path "Tasks")
                               "* TODO %i%?")
                              ("T" "Tickler" entry
                               (file+headline gtd-tickler-file-path "Tickler")
                               "* %i%? \n %U")))
(global-set-key (kbd "C-c c") 'org-capture)

Customize TODO states.

(setq org-log-done 'time)
(setq org-todo-keywords
      '((sequence "TODO(t)" "ONGOING(o@/!)" "|" "DONE(d!)" "DELEGATED(e@)" "CANCELED(c@)")))

Don’t fold org files. Always open expanded.

(setq org-startup-folded nil)

Packages

Packages I want to install with every fresh Emacs.

(use-package exec-path-from-shell
  :if (memq window-system '(mac ns))
  :config
  (exec-path-from-shell-initialize))

(use-package magit)

(use-package company
  :config
  (add-hook 'after-init-hook 'global-company-mode))

(use-package counsel
  :after ivy
  :config (counsel-mode))

(use-package ivy
  :defer 0.1
  :diminish
  :bind (("C-c C-r" . ivy-resume)
	   ("C-x B" . ivy-switch-buffer-other-window))
  :custom
  (ivy-count-format "(%d/%d) ")
  (ivy-use-virtual-buffers t)
  :config (ivy-mode))

(use-package prescient)

(use-package ivy-prescient
  :after counsel ; see https://github.com/raxod502/prescient.el#usage
  :config (ivy-prescient-mode))

(use-package swiper
  :after ivy
  :bind (("C-s" . swiper)
	   ("C-r" . swiper)))

(use-package multiple-cursors
  :bind (("C-c m c" . mc/edit-lines)))

(use-package racket-mode)

(use-package projectile
  :init
  (projectile-mode +1)
  :config
  (setq projectile-project-search-path '("~/projectiles/")))

(use-package treemacs
  :defer t
  :init
  (with-eval-after-load 'winum
    (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
  :config
  (progn
    (setq treemacs-collapse-dirs                 (if treemacs-python-executable 3 0)
          treemacs-deferred-git-apply-delay      0.5
          treemacs-directory-name-transformer    #'identity
          treemacs-display-in-side-window        t
          treemacs-eldoc-display                 t
          treemacs-file-event-delay              5000
          treemacs-file-extension-regex          treemacs-last-period-regex-value
          treemacs-file-follow-delay             0.2
          treemacs-file-name-transformer         #'identity
          treemacs-follow-after-init             t
          treemacs-git-command-pipe              ""
          treemacs-goto-tag-strategy             'refetch-index
          treemacs-indentation                   2
          treemacs-indentation-string            " "
          treemacs-is-never-other-window         nil
          treemacs-max-git-entries               5000
          treemacs-missing-project-action        'ask
          treemacs-move-forward-on-expand        nil
          treemacs-no-png-images                 nil
          treemacs-no-delete-other-windows       t
          treemacs-project-follow-cleanup        nil
          treemacs-persist-file                  (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
          treemacs-position                      'left
          treemacs-read-string-input             'from-child-frame
          treemacs-recenter-distance             0.1
          treemacs-recenter-after-file-follow    nil
          treemacs-recenter-after-tag-follow     nil
          treemacs-recenter-after-project-jump   'always
          treemacs-recenter-after-project-expand 'on-distance
          treemacs-show-cursor                   nil
          treemacs-show-hidden-files             t
          treemacs-silent-filewatch              nil
          treemacs-silent-refresh                nil
          treemacs-sorting                       'alphabetic-asc
          treemacs-space-between-root-nodes      t
          treemacs-tag-follow-cleanup            t
          treemacs-tag-follow-delay              1.5
          treemacs-user-mode-line-format         nil
          treemacs-user-header-line-format       nil
          treemacs-width                         35
          treemacs-workspace-switch-cleanup      nil)

    ;; The default width and height of the icons is 22 pixels. If you are
    ;; using a Hi-DPI display, uncomment this to double the icon size.
    ;;(treemacs-resize-icons 44)

    (treemacs-follow-mode t)
    (treemacs-filewatch-mode t)
    (treemacs-fringe-indicator-mode 'always)
    (pcase (cons (not (null (executable-find "git")))
                 (not (null treemacs-python-executable)))
      (`(t . t)
       (treemacs-git-mode 'deferred))
      (`(t . _)
       (treemacs-git-mode 'simple))))
  :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 B"   . treemacs-bookmark)
        ("C-x t C-t" . treemacs-find-file)
        ("C-x t M-t" . treemacs-find-tag)))

(use-package treemacs-projectile
  :after (treemacs projectile))

(use-package treemacs-icons-dired
  :after (treemacs dired)
  :config (treemacs-icons-dired-mode))

(use-package treemacs-magit
  :after (treemacs magit))

(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
  :after (treemacs persp-mode) ;;or perspective vs. persp-mode
  :config (treemacs-set-scope-type 'Perspectives))

(use-package centaur-tabs
  :demand
  :config
  (centaur-tabs-mode t)
  :bind
  ("C-<prior>" . centaur-tabs-backward)
  ("C-<next>" . centaur-tabs-forward))

(use-package git-auto-commit-mode
  :custom
  (gac-automatically-push-p t)
  (gac-automatically-add-new-files-p nil))

(use-package solidity-mode)

(use-package vterm)

(use-package julia-snail
  :requires vterm
  :hook (julia-mode . julia-snail-mode))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published