Skip to content

Latest commit

 

History

History
450 lines (364 loc) · 12.5 KB

File metadata and controls

450 lines (364 loc) · 12.5 KB

Run org-babel-tangle to bootstrap and commit config.

Packages and bootstrap

;; load package manager, add the Melpa package registry
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(package-initialize)

;; bootstrap use-package
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(require 'use-package)

;; load evil
;; (use-package evil
;;   :ensure t ;; install the evil package if not installed
;;   :init ;; tweak evil's configuration before loading it
;;   (setq evil-search-module 'evil-search)
;;   (setq evil-ex-complete-emacs-commands nil)
;;   (setq evil-vsplit-window-right t)
;;   (setq evil-split-window-below t)
;;   (setq evil-shift-round nil)
;;   (setq evil-want-C-u-scroll t)
;;   :config ;; tweak evil after loading it
;;   (evil-mode)
;;   (define-prefix-command 'my-leader-map)
;;   (keymap-set evil-motion-state-map "SPC" 'my-leader-map)
;;   (keymap-set evil-normal-state-map "SPC" 'my-leader-map)
;;   ;; example how to map a command in normal mode (called 'normal state' in evil)
;;   (define-key evil-normal-state-map (kbd ", w") 'evil-window-vsplit)
;;   ;; insert mode
;;   ;; leader maps
;;   (evil-define-key nil my-leader-map
;;     "." 'execute-extended-command
;;     "ff" 'find-file))

Key Maps

Global

(global-set-key (kbd "C-x p f") 'project-find-file)
(global-set-key (kbd "C-c r") 'project-find-regexp)
(global-set-key (kbd "C-v") 'scroll-half-page-down)
(global-set-key (kbd "M-v") 'scroll-half-page-up)
(global-set-key (kbd "C-c C-.") #'hippie-expand)


(defun scroll-half-page-down ()
  "scroll up half a page"
  (interactive)
  (scroll-down (/ (window-body-height) 2)))

(defun scroll-half-page-up ()
  "scroll up half a page"
  (interactive)
  (scroll-up (/ (window-body-height) 2)))

Theme

;; Setting font like this should be better for use with daemon
(setq default-frame-alist
          '((font . "JetbrainsMonoNL Nerd FontMono 7")))

(setq modus-vivendi-tinted-palette-overrides
      '((fringe bg-main)
	(border-mode-line-active bg-main)
	(border-mode-line-inactive bg-main)))

(load-theme 'catppuccin t)

Emacs Everywhere

(autoload 'emacs-everywhere "emacs-everywhere" "emacs everywhere" t)

General

;; Set correct tab stuff
(setq default-tab-width 4)

;; Get rid of all the gui stuff
(tool-bar-mode -1)
(scroll-bar-mode -1)
(menu-bar-mode -1)

;; don't show the menubar
(add-to-list 'default-frame-alist '(undecorated . t))

;; fido does not work with embark
;; better commandline comepletion
(icomplete-mode 1)
(icomplete-vertical-mode)
(keymap-unset icomplete-minibuffer-map "C-." 'remove)
(use-package icomplete
:bind (:map icomplete-minibuffer-map
            ("C-n" . icomplete-forward-completions)
            ("C-p" . icomplete-backward-completions)
            ("RET" . icomplete-force-complete-and-exit))
:hook
(after-init . (lambda ()
                (fido-mode -1)
                (icomplete-mode 1)
                ;; (icomplete-vertical-mode 1)
                ))
:config
(setq tab-always-indent 'complete)  ;; Starts completion with TAB
(setq icomplete-delay-completions-threshold 0)
(setq icomplete-compute-delay 0)
(setq icomplete-show-matches-on-no-input t)
(setq icomplete-hide-common-prefix t)
(setq icomplete-prospects-height 10)
(setq icomplete-with-completion-tables t)
(setq icomplete-in-buffer t)
(setq icomplete-max-delay-chars 0)
(setq icompqlete-scroll t))

;; consult
(use-package consult
  :ensure t
  :bind
  (("C-c f g" . consult-ripgrep)
   ("C-c f f" . consult-find)
   ("C-x b" . consult-buffer))
  :init
  (add-hook `eshell-mode-hook
	    (lambda ()
	      (define-key eshell-mode-map (kbd "C-c C-h") #'consult-history))))



(use-package avy
  :ensure t
  :bind (("M-s a" . avy-goto-char-timer))
  :init (add-hook 'isearch-mode-hook
		  (lambda ()
		    (define-key isearch-mode-map (kbd "C-a") #'avy-isearch))))

Completion

;;corfu

(use-package corfu
    :ensure t
    :custom
    (corfu-auto t)
    (corfu-auto-prefix 5)
    (corfu-auto-delay 0.20)
    (corfu-popupinfo-delay 0.2)
    :bind (:map corfu-map
                ("C-c i" . corfu-info-documentation))
    :hook ((prog-mode . corfu-mode)
           (eshell-mode . corfu-mode)))

(use-package corfu-terminal
  :ensure t)

(unless (display-graphic-p)
  (corfu-terminal-mode +1))

;; orderless completion style 
(use-package orderless
  :ensure t
  :config
  (setq completion-styles '(orderless)))


;; general completion settings 
(setq completion-cycle-threshold 3)
(setq completion-show-help t)


;; anotations in minibuffer
(use-package marginalia
  :ensure t
  :init
  (marginalia-mode))


;; key chord completion
(use-package which-key
  :ensure t
  :init
  (which-key-mode))

magit

(use-package magit
      :ensure t
      :commands magit
  )

Org-mode

(use-package org
  :init
  (setq-default org-startup-indented t
              org-startup-folded t 
              org-pretty-entities t
              org-use-sub-superscripts "{}"
              org-hide-emphasis-markers t
              org-startup-with-inline-images t
              org-image-actual-width '(300)
              org-enforce-todo-dependencies t
              org-agenda-todo-list-sublevels t
              org-startup-with-inline-images t)

  ;; Capture templates 
  (setq org-capture-templates
        '(("t" "Todo" entry (file+headline "~/org/inbox.org" "Tasks")
           "* TODO  %? %^G\n")
          ("n" "Note" entry (file+datetree "~/org/notes.org")
           "* %?\nEntered on %U")
	  ("j" "Journal Entry" entry (file+datetree "~/org/journal.org") "* %T %?")))
  
  (setq org-clock-sound t)
  (setq org-agenda-files '("~/org"))
  :config
  (global-set-key (kbd "C-c c") 'org-capture)
  (global-set-key (kbd "C-c a") 'org-agenda)
  (add-hook 'org-mode-hook #'visual-line-mode))

(setq org-refile-targets
      '((nil :maxlevel . 3)
        (org-agenda-files :maxlevel . 3)))

elisp

(add-hook 'emacs-lisp-mode-hook (lambda ()
				  (electric-pair-local-mode -1) ;; electric pair mode is hella annoying for edditing lisp
				  (define-key emacs-lisp-mode-map (kbd "M-.") 'find-function-at-point)))

Action Alist

display-buffer-alist

Eshell

(add-to-list 'display-buffer-alist
             '("\\*eshell\\*"
               (display-buffer-reuse-window)
               (display-buffer-below-selected)
               (window-height . 12)
               ))

Email

(use-package mu4e
  :ensure nil
  :commands mu4e
  :load-path "/usr/share/emacs/site-lisp/mu4e/"
  ;; :defer 20 Wait until 20 seconds after startup
  :config

  ;; This is set to 't' to avoid mail syncing issues when using mbsync
  (setq mu4e-change-filenames-when-moving t)

  ;; Refresh mail using isync every 10 minutes
  (setq mu4e-update-interval (* 10 60))
  (setq mu4e-get-mail-command "mbsync -a")
  (setq mu4e-maildir "~/Mail")

  (setq mu4e-drafts-folder "/[Gmail]/Drafts")
  (setq mu4e-sent-folder   "/[Gmail]/Sent Mail")
  (setq mu4e-refile-folder "/[Gmail]/All Mail")
  (setq mu4e-trash-folder  "/[Gmail]/Trash")
  (setq smtpmail-stream-type 'starttls)
  (setq user-mail-address "ameier42@gmail.com")
  (setq user-full-name "Alex Meier")
  (setq smtpmail-default-smtp-server "smtp.gmail.com")
  (setq smtpmail-smtp-server "smtp.gmail.com")
  (setq smtpmail-smtp-service 587)
  (setq message-send-mail-function 'smtpmail-send-it)
  (auth-source-pass-enable)
  (setq auth-sources '(password-store))
  (setq auth-source-debug t)
  (setq auth-source-do-cache nil)
  (setq mail-user-agent 'mu4e-user-agent)
  (setq mu4e-user-mail-address-list '("ameier42@gmail.com"))
  (setq smtpmail-cred-user "ameier42@gmail.com")
  (make-mu4e-context
   :name "gmail"
   :match-func
   (lambda (msg)
     (when msg
       (string-prefix-p "~/Mail"(mu4e-message-field msg :maildir))))
   :vars '((user-mail-address . "ameier42@gmail.com")
           (user-full-name . "Alex Meier")
	   (smtpmail-cred-user . "ameier42@gmail.com")
           (smtpmail-smtp-server . "smtp.gmail.com")
           (smtpmail-stream-type . 'starttls)
           (smtpmail-smtp-service . 587)
           (mu4e-drafts-folder . "~/Mail/[Gmail]/Drafts")
           (mu4e-sent-folder . "~/Mail/[Gmail]/Sent Mail")
           (mu4e-refile-folder . "~/Mail/[Gmail]/All Mail")
           (mu4e-trash-folder . "~/Mail/[Gmail]/Trash")))


  ;; Configure the function to use for sending mail
  (setq message-send-mail-function 'smtpmail-send-it))


  • This one is probably temporary. Pulled directly from their help doc so I don’t fully get it yet
    (use-package embark
      :ensure t
    
      :bind
      (("C-." . embark-act)         ;; pick some comfortable binding
       ("C-;" . embark-dwim)        ;; good alternative: M-.
       ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
    
      :init
    
      ;; Optionally replace the key help with a completing-read interface
      (setq prefix-help-command #'embark-prefix-help-command)
    
      ;; Show the Embark target at point via Eldoc. You may adjust the
      ;; Eldoc strategy, if you want to see the documentation from
      ;; multiple providers. Beware that using this can be a little
      ;; jarring since the message shown in the minibuffer can be more
      ;; than one line, causing the modeline to move up and down:
    
    
      ;; (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
      ;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
    
      ;; Add Embark to the mouse context menu. Also enable `context-menu-mode'.
      ;; (context-menu 1)
      ;; (add-hook 'context-menu-functions #'embark-context-menu 100)
    
      :config
    
      ;; Hide the mode line of the Embark live/completions buffers
      (add-to-list 'display-buffer-alist
                   '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
                     nil
                     (window-parameters (mode-line-format . none)))))
    
         ;; Consult users will also want the embark-consult package.
    (use-package embark-consult
      :ensure t ; only need to install it, embark loads it after consult if found
      :hook
      (embark-collect-mode . consult-preview-at-point-mode))
        

eshell

(defun my-term-handle-exit (&optional process-name msg)
  (kill-buffer))

(advice-add 'term-handle-exit :after 'my-term-handle-exit)

Path

(use-package exec-path-from-shell
  :ensure t
  :defer t)