Adding Calendar, eshell, and some formatting

This commit is contained in:
Chris Cochrun 2021-02-19 05:44:25 -06:00
parent b4c9e64328
commit ab3b1e014c
3 changed files with 393 additions and 144 deletions

137
init.el
View file

@ -19,12 +19,15 @@
(column-number-mode +1)
(if (string-equal (system-name) "chris-linuxlaptop")
(defvar chris/default-font-size 240)
(defvar chris/default-font-size 120))
(defvar chris/default-font-size 240)
(defvar chris/default-font-size 120))
(set-face-attribute 'default nil :font "VictorMono Nerd Font" :height chris/default-font-size)
(set-face-attribute 'fixed-pitch nil :font "VictorMono Nerd Font" :height chris/default-font-size)
(set-face-attribute 'variable-pitch nil :font "Cantarell" :height chris/default-font-size :weight 'regular)
(set-face-attribute 'default nil :font "VictorMono Nerd Font"
:height chris/default-font-size)
(set-face-attribute 'fixed-pitch nil :font "VictorMono Nerd Font"
:height chris/default-font-size)
(set-face-attribute 'variable-pitch nil :font "Cantarell"
:height chris/default-font-size :weight 'regular)
(setq display-line-numbers-type 'relative)
(display-line-numbers-mode +1)
@ -72,6 +75,11 @@
(use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode))
(use-package smartparens
:defer 1
:config
(smartparens-global-mode +1))
(use-package adaptive-wrap
:defer t)
@ -142,6 +150,7 @@
"n" '(:ignore t :which-key "notes")
"bs" '(consult-buffer :which-key "buffer search")
"bd" '(kill-this-buffer :which-key "kill buffer")
"bi" '(ibuffer :which-key "ibuffer")
"tt" '(consult-theme :which-key "choose theme")
"ff" '(find-file :which-key "find file")
"fr" '(consult-recent-file :which-key "recent file")
@ -150,7 +159,6 @@
"hv" '(helpful-variable :which-key "describe-variable")
"hk" '(helpful-key :which-key "describe-key")
"hi" '(info :which-key "info manual")
"od" '(dired-jump :which-key "dired jump")
"ss" '(consult-line :which-key "consult search")
"ww" '(other-window :which-key "other window")
"wd" '(delete-window :which-key "other window")
@ -238,12 +246,16 @@
(setq format-all-formatters '("Emacs Lisp" emacs-lisp))
:defer 1)
(chris/leader-keys
"od" '(dired-jump :which-key "open dired here"))
(general-def 'normal dired-mode-map
"h" 'dired-up-directory
"l" 'dired-find-file
"q" 'kill-this-buffer)
(use-package dired
:ensure nil
:straight nil
:general
(chris/leader-keys
"od" '(dired-jump :which-key "open dired here"))
(general-def 'normal dired-mode-map
"h" 'dired-up-directory
"l" 'dired-find-file
"q" 'kill-this-buffer))
(defun chris/org-mode-setup ()
(org-indent-mode +1)
@ -393,6 +405,33 @@
(add-hook 'org-roam-mode-hook org-roam-server-mode t)
(use-package calfw
:commands chris/calfw-calendar-open
:config
(defun chris/calfw-calendar-open ()
(interactive)
(cfw:open-calendar-buffer
:contents-sources
(list
(cfw:org-create-source "Cyan") ; org-agenda source
(cfw:ical-create-source "NV" "https://www.nvhuskies.org/vnews/display.v?ical" "Green") ; School Calendar
(cfw:ical-create-source "Outlook" "https://outlook.office365.com/owa/calendar/62a0d491bec4430e825822afd2fd1c01@tfcconnection.org/9acc5bc27ca24ce7a900c57284959f9d8242340735661296952/S-1-8-2197686000-2519837503-3687200543-3873966527/reachcalendar.ics" "Yellow") ; Outlook Calendar
)))
:general
(chris/leader-keys
"ac" 'chris/calfw-calendar-open)
(general-def cfw:calendar-mode-map
"q" 'kill-this-buffer
"RET" 'cfw:show-details-command)
(general-def cfw:details-mode-map
"q" 'cfw:details-kill-buffer-command))
(use-package calfw-org
:after calfw)
(use-package calfw-ical
:after calfw)
(use-package magit
:commands (magit-status magit-get-current-branch)
:general
@ -400,6 +439,80 @@
:custom
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
(use-package eshell
:ensure nil
:straight nil
:config
(require 'em-tramp)
(with-eval-after-load 'esh-module ;; REVIEW: It used to work, but now the early `provide' seems to backfire.
(unless (boundp 'eshell-modules-list)
(load "esh-module")) ;; Don't print the banner.
(push 'eshell-tramp eshell-modules-list))
(setq password-cache t
password-cache-expiry 3600)
(setq eshell-history-size 1024)
;;; Extra execution information
(defvar chris/eshell-status-p t
"If non-nil, display status before prompt.")
(defvar chris/eshell-status--last-command-time nil)
(make-variable-buffer-local 'chris/eshell-status--last-command-time)
(defvar chris/eshell-status-min-duration-before-display 0
"If a command takes more time than this, display its duration.")
(defun chris/eshell-status-display ()
(if chris/eshell-status--last-command-time
(let ((duration (time-subtract (current-time) chris/eshell-status--last-command-time)))
(setq chris/eshell-status--last-command-time nil)
(when (> (time-to-seconds duration) chris/eshell-status-min-duration-before-display)
(format "  %.3fs %s"
(time-to-seconds duration)
(format-time-string "| %F %T" (current-time)))))
(format "  0.000s")))
(defun chris/eshell-status-record ()
(setq chris/eshell-status--last-command-time (current-time)))
(add-hook 'eshell-pre-command-hook 'chris/eshell-status-record)
(setq eshell-prompt-function
(lambda nil
(let ((path (abbreviate-file-name (eshell/pwd))))
(concat
(if (or (string= system-name "archdesktop") (string= system-name "chris-linuxlaptop"))
nil
(format
(propertize "\n(%s@%s)" 'face '(:foreground "#606580"))
(propertize (user-login-name) 'face '(:inherit compilation-warning))
(propertize (system-name) 'face '(:inherit compilation-warning))))
(if (and (require 'magit nil t) (or (magit-get-current-branch) (magit-get-current-tag)))
(let* ((root (abbreviate-file-name (magit-rev-parse "--show-toplevel")))
(after-root (substring-no-properties path (min (length path) (1+ (length root))))))
(format
(propertize "\n[ %s | %s@%s ]" 'face font-lock-comment-face)
(propertize root 'face `(:inherit org-warning))
(propertize after-root 'face `(:inherit org-level-1))
(propertize (or (magit-get-current-branch) (magit-get-current-tag)) 'face `(:inherit org-macro))))
(format
(propertize "\n[%s]" 'face font-lock-comment-face)
(propertize path 'face `(:inherit org-level-1))))
(when chris/eshell-status-p
(propertize (or (chris/eshell-status-display) "") 'face font-lock-comment-face))
(propertize "\n" 'face '(:inherit org-todo :weight ultra-bold))
" "))))
;;; If the prompt spans over multiple lines, the regexp should match
;;; last line only.
(setq-default eshell-prompt-regexp "^ ")
:general
(chris/leader-keys
"oe" 'eshell)
(general-def '(normal insert) eshell-mode-map
"C-d" 'kill-this-buffer))
(use-package pdf-tools
:straight (:host github
:repo "flatwhatson/pdf-tools"