project help in the dashboard, getting things setup for users

This commit is contained in:
Mike 'Fuzzy' Partin 2024-07-05 09:38:12 -07:00
parent 6e565ee542
commit a17138fc26
20 changed files with 259 additions and 22 deletions

40
init.el
View File

@ -48,27 +48,41 @@
(setq tab-width 2) (setq tab-width 2)
(setq indent-tabs-mode 1) (setq indent-tabs-mode 1)
;; The T.H.W.A.P. Map ;; Set the default help lines
;; This is the base starting point for the T.H.W.A.P. keybindings (setq thwap-help-lines '("--------------"
(define-prefix-command 'thwap-map) "All T.H.W.A.P. commands will start with 'C-c t'"
(global-set-key (kbd "C-t") 'thwap-map) ""
"Welcome to the T.H.W.A.P. Emacs Dashboard"))
;; thwap defaults
(require 'thwap-defaults)
;; theme configuration ;; theme configuration
(require 'thwap-theme) (require 'thwap-theme)
;; icon configuration
(require 'thwap-icons)
;; nerdtree configuration
(require 'thwap-nerdtree)
;; company configuration ;; company configuration
(require 'thwap-co) (require 'thwap-co)
;; LSP configuration ;; LSP configuration
(require 'thwap-lsp) (require 'thwap-lsp)
;; projectile configuration
(require 'thwap-projectile)
;; magit configuration
(require 'thwap-magit)
;; CoPilot configuration
(require 'thwap-copilot)
;; org configuration ;; org configuration
(require 'thwap-org) (require 'thwap-org)
;; golang configuration ;; golang configuration
(require 'thwap-go) (require 'thwap-go)
;; terraform configuration
(require 'thwap-tf)
;; python configuration
(require 'thwap-py)
;; yaml configuration
(require 'thwap-yaml)
;; yasnippet configuration
(require 'thwap-yas)
;; dashboard
(require 'thwap-dash)

BIN
lib/logo1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
lib/logo2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

BIN
lib/logo3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

BIN
lib/logo4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

14
lib/thwap-copilot.el Normal file
View File

@ -0,0 +1,14 @@
(straight-use-package 'dash)
(straight-use-package 'editorconfig)
(use-package copilot
:straight (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el"))
:ensure t)
;; you can utilize :map :hook and :config to customize copilot
(add-hook 'prog-mode-hook 'copilot-mode)
(define-key copilot-completion-map (kbd "<tab>") 'copilot-accept-completion)
(define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion)
(provide 'thwap-copilot)

51
lib/thwap-dash.el Normal file
View File

@ -0,0 +1,51 @@
;;
;; Helper functions for the dashboard
;;
(defun thwap/dashboard-insert-logo-title (banner)
"Insert BANNER into the dashboard buffer."
(insert "\n")
;; if banner is a single string, display it in the center
;; else if it is a list of strings, display them with line breaks
(if (stringp banner)
(insert (propertize banner 'face 'dashboard-banner-logo-title))
(dolist (line banner)
(insert (propertize line 'face 'dashboard-banner-logo-title))
(insert "\n"))))
(defun thwap/dashboard-build-logo-title (lst)
"Build a list of strings from LST to display as the banner."
(mapconcat 'identity (reverse lst) "\n"))
(defun thwap/random-string-from-list (strings)
(let ((index (random (length strings))))
(nth index strings)))
(straight-use-package 'dashboard)
(dashboard-setup-startup-hook)
(setq dashboard-banner-logo-title (thwap/dashboard-build-logo-title thwap-help-lines))
;; "Welcome to the T.H.W.A.P. Emacs Dashboard")
(setq dashboard-startup-banner (thwap/random-string-from-list '("~/.emacs.d/lib/logo1.png"
"~/.emacs.d/lib/logo2.png"
"~/.emacs.d/lib/logo3.png"
"~/.emacs.d/lib/logo4.png")))
(setq initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name)))
(setq dashboard-center-content t)
(setq dashboard-vertically-center-content t)
(setq dashboard-show-shortcuts t)
(setq dashboard-items '((recents . 7)
(projects . 7)
(agenda . 7)))
(setq dashboard-startupify-list '(dashboard-insert-banner
dashboard-insert-newline
dashboard-insert-banner-title
dashboard-insert-newline
dashboard-insert-navigator
dashboard-insert-newline
dashboard-insert-init-info
dashboard-insert-items
dashboard-insert-newline
dashboard-insert-footer))
(provide 'thwap-dash)

22
lib/thwap-defaults.el Normal file
View File

@ -0,0 +1,22 @@
;; Set up straight.el to use use-package
(straight-use-package 'use-package)
;; golden-ratio
(straight-use-package 'golden-ratio)
(golden-ratio-mode 1)
(setq golden-ratio-auto-scale t)
;; The T.H.W.A.P. Map
;; This is the base starting point for the T.H.W.A.P. keybindings
(define-prefix-command 'thwap-map)
(global-set-key (kbd "C-c t") 'thwap-map)
;; General emacs stuff
(define-key thwap-map (kbd "c") 'comment-or-uncomment-region)
(add-to-list 'thwap-help-lines "C-c t c : Comment or uncomment region")
(define-key thwap-map (kbd "e b") 'eval-buffer)
(add-to-list 'thwap-help-lines "C-c t e b : Eval buffer")
(provide 'thwap-defaults)

View File

@ -1,4 +1,3 @@
(require 'thwap-lsp)
(straight-use-package 'go-mode) (straight-use-package 'go-mode)
@ -6,3 +5,10 @@
(simplifycompositelit . :json-false))) (simplifycompositelit . :json-false)))
(when (executable-find "gopls")
(setq gofmt-command "goimports")
(add-hook 'go-mode-hook #'lsp-deferred)
(add-hook 'before-save-hook 'gofmt-before-save)
(add-hook 'go-mode-hook 'eglot-ensure))
(provide 'thwap-go)

14
lib/thwap-icons.el Normal file
View File

@ -0,0 +1,14 @@
(use-package all-the-icons
:ensure t
:straight t)
;; :if (display-graphic-p))
(use-package all-the-icons-completion
:ensure t
:straight t
:defer
;; :if (display-graphic-p)
:init
(all-the-icons-completion-mode 1))
(provide 'thwap-icons)

View File

@ -5,6 +5,7 @@
(setq read-process-output-max (* 1024 1024)) (setq read-process-output-max (* 1024 1024))
(define-key thwap-map (kbd "l") 'lsp-keymap-prefix) (define-key thwap-map (kbd "l") 'lsp-keymap-prefix)
(add-to-list 'thwap-help-lines "C-c t l : lsp-keymap-prefix")
;; (lsp-enable-which-key-integration t) ;; (lsp-enable-which-key-integration t)
(provide 'thwap-lsp) (provide 'thwap-lsp)

14
lib/thwap-magit.el Normal file
View File

@ -0,0 +1,14 @@
(straight-use-package 'magit)
;; Enable magit forge
(straight-use-package 'forge)
;; Enable magit-todos
(straight-use-package 'magit-todos)
;; Magit stuff
(define-key thwap-map (kbd "g s") 'magit-status)
(add-to-list 'thwap-help-lines "C-c t g s : magit-status")
(provide 'thwap-magit)

30
lib/thwap-nerdtree.el Normal file
View File

@ -0,0 +1,30 @@
(use-package neotree
:demand t
:straight t
:config
(global-set-key [f8] 'neotree-toggle))
(define-key thwap-map (kbd "C-n") 'neotree-toggle)
(add-to-list 'thwap-help-lines "C-c t C-n : Toggle Neotree")
;; (use-package treemacs
;; :straight t
;; :ensure t
;; :demand t
;; :config
;; (global-set-key [f8] 'treemacs)
;; (progn
;; (setq treemacs-follow-after-init t
;; treemacs-width 35
;; treemacs-indentation 2
;; treemacs-git-integration t
;; treemacs-collapse-dirs 3
;; treemacs-silent-refresh t
;; treemacs-change-root-without-asking t
;; treemacs-sorting 'alphabetic-desc
;; treemacs-show-hidden-files t
;; treemacs-never-persist nil
;; treemacs-is-never-other-window t
;; treemacs-goto-tag-strategy 'refetch-index)))
(provide 'thwap-nerdtree)

View File

@ -36,13 +36,6 @@
(push file files)) (push file files))
(nreverse files))) (nreverse files)))
;; (defun thwap/list-files-with-extension (dir extension)
;; "Recursively list all files in DIR with the given EXTENSION."
;; (let ((files '()))
;; (dolist (file (directory-files-recursively dir (concat "\\." extension "\\'")))
;; (push file files))
;; files))
(defun thwap/org-agenda-files-update () (defun thwap/org-agenda-files-update ()
"Update the org-agenda-files variable." "Update the org-agenda-files variable."
(setq org-agenda-files (thwap/list-files-with-extension "~/.org-agenda" "org")) (setq org-agenda-files (thwap/list-files-with-extension "~/.org-agenda" "org"))
@ -60,6 +53,7 @@
(setq org-log-done 'time (setq org-log-done 'time
org-startup-indented t org-startup-indented t
org-hide-leading-stars t org-hide-leading-stars t
org-support-shift-select t
org-directory "~/.org-agenda" org-directory "~/.org-agenda"
org-default-notes-file "~/.org-agenda/notes.org") org-default-notes-file "~/.org-agenda/notes.org")
@ -112,18 +106,28 @@
;; Org mode stuff ;; Org mode stuff
(define-key thwap-map (kbd "o l") 'org-store-link) (define-key thwap-map (kbd "o l") 'org-store-link)
(add-to-list 'thwap-help-lines "C-c t o l : Store a link to the current location in the kill ring.")
(define-key thwap-map (kbd "o C-l") 'org-toggle-link-display) (define-key thwap-map (kbd "o C-l") 'org-toggle-link-display)
(add-to-list 'thwap-help-lines "C-c t o C-l : Toggle the display of links.")
;; agenda stuff ;; agenda stuff
(define-key thwap-map (kbd "o n") 'org-capture) (define-key thwap-map (kbd "o n") 'org-capture)
(add-to-list 'thwap-help-lines "C-c t o n : Capture a new task.")
(define-key thwap-map (kbd "o a") 'org-agenda) (define-key thwap-map (kbd "o a") 'org-agenda)
(add-to-list 'thwap-help-lines "C-c t o a : Open the Org agenda.")
(define-key thwap-map (kbd "o t") 'org-todo-list) (define-key thwap-map (kbd "o t") 'org-todo-list)
(add-to-list 'thwap-help-lines "C-c t o t : Open the Org TODO list.")
;; time management stuff ;; time management stuff
(define-key thwap-map (kbd "o c i") 'org-clock-in) (define-key thwap-map (kbd "o c i") 'org-clock-in)
(add-to-list 'thwap-help-lines "C-c t o c i : Clock in to the current task.")
(define-key thwap-map (kbd "o c o") 'org-clock-out) (define-key thwap-map (kbd "o c o") 'org-clock-out)
(add-to-list 'thwap-help-lines "C-c t o c o : Clock out of the current task.")
(define-key thwap-map (kbd "o c r") 'org-clock-report) (define-key thwap-map (kbd "o c r") 'org-clock-report)
(add-to-list 'thwap-help-lines "C-c t o c r : Generate a clock report.")
;; refile stuff ;; refile stuff
(define-key thwap-map (kbd "o r") 'org-refile) (define-key thwap-map (kbd "o r") 'org-refile)
(add-to-list 'thwap-help-lines "C-c t o r : Refile the current task.")
;; export stuff ;; export stuff
(define-key thwap-map (kbd "o e") 'org-export-dispatch) (define-key thwap-map (kbd "o e") 'org-export-dispatch)
(add-to-list 'thwap-help-lines "C-c t o e : Export the current buffer.")
(provide 'thwap-org) (provide 'thwap-org)

8
lib/thwap-projectile.el Normal file
View File

@ -0,0 +1,8 @@
(straight-use-package 'projectile)
;; Projectile keybindings
(define-key thwap-map (kbd "p") 'projectile-command-map)
(add-to-list 'thwap-help-lines "C-c t p : Projectile commands")
(provide 'thwap-projectile)

15
lib/thwap-py.el Normal file
View File

@ -0,0 +1,15 @@
(add-hook 'python-mode-hook (lambda ()
(setq-local tab-width 2)))
(add-hook 'python-mode-hook #'lsp-deferred)
(when (executable-find "pylsp")
(add-hook 'python-mode-hook 'eglot-ensure))
(use-package python-black
:demand t
:straight t
:after python
:hook (python-mode . python-black-on-save-mode))
(provide 'thwap-py)

18
lib/thwap-tf.el Normal file
View File

@ -0,0 +1,18 @@
(use-package terraform-mode
:straight t
:demand t
:init
(custom-set-variables
'(terraform-indent-level 2)
'(terraform-format-on-save t))
(when (executable-find "terraform-ls")
(add-hook 'terraform-mode-hook 'eglot-ensure))
:config
(require 'eglot)
(add-to-list 'eglot-server-programs
`(terraform-mode . ("terraform-ls" "serve"))))
(add-hook 'terraform-mode-hook #'lsp-deferred)
(provide 'thwap-tf)

View File

@ -3,6 +3,7 @@
(straight-use-package 'modus-themes) (straight-use-package 'modus-themes)
(require 'modus-themes) (require 'modus-themes)
(load-theme 'modus-vivendi-tritanopia :no-confirm) ;; (load-theme 'modus-vivendi-tritanopia :no-confirm)
(load-theme 'modus-vivendi-tinted :no-confirm)
(provide 'thwap-theme) (provide 'thwap-theme)

5
lib/thwap-yaml.el Normal file
View File

@ -0,0 +1,5 @@
(use-package yaml-mode
:ensure t
:straight t)
(provide 'thwap-yaml)

20
lib/thwap-yas.el Normal file
View File

@ -0,0 +1,20 @@
(use-package yasnippet
:ensure t
:straight t
:config
(setq yas-snippet-dirs '("~/.emacs.d/snippets")))
;; (yas-global-mode 1))
(use-package yasnippet-snippets
:ensure t
:straight t
:after yasnippet
:config
(yas-reload-all)
(yas-global-mode 1))
;; yasnippet stuff
(define-key thwap-map (kbd "y n") 'yas-new-snippet)
(add-to-list 'thwap-help-lines "C-c t y n : create a new yasnippet")
(provide 'thwap-yas)