diff --git a/init.el b/init.el index d53b54c..612e423 100644 --- a/init.el +++ b/init.el @@ -48,27 +48,41 @@ (setq tab-width 2) (setq indent-tabs-mode 1) -;; 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-t") 'thwap-map) +;; Set the default help lines +(setq thwap-help-lines '("--------------" + "All T.H.W.A.P. commands will start with 'C-c t'" + "" + "Welcome to the T.H.W.A.P. Emacs Dashboard")) +;; thwap defaults +(require 'thwap-defaults) ;; theme configuration - (require 'thwap-theme) - +;; icon configuration +(require 'thwap-icons) +;; nerdtree configuration +(require 'thwap-nerdtree) ;; company configuration - (require 'thwap-co) - ;; LSP configuration - (require 'thwap-lsp) - +;; projectile configuration +(require 'thwap-projectile) +;; magit configuration +(require 'thwap-magit) +;; CoPilot configuration +(require 'thwap-copilot) ;; org configuration - (require 'thwap-org) - ;; golang configuration - (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) diff --git a/lib/logo1.png b/lib/logo1.png new file mode 100644 index 0000000..22c53b4 Binary files /dev/null and b/lib/logo1.png differ diff --git a/lib/logo2.png b/lib/logo2.png new file mode 100644 index 0000000..4e5af46 Binary files /dev/null and b/lib/logo2.png differ diff --git a/lib/logo3.png b/lib/logo3.png new file mode 100644 index 0000000..f4d4a31 Binary files /dev/null and b/lib/logo3.png differ diff --git a/lib/logo4.png b/lib/logo4.png new file mode 100644 index 0000000..4c208d0 Binary files /dev/null and b/lib/logo4.png differ diff --git a/lib/thwap-copilot.el b/lib/thwap-copilot.el new file mode 100644 index 0000000..7058ba2 --- /dev/null +++ b/lib/thwap-copilot.el @@ -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 "") 'copilot-accept-completion) +(define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion) + +(provide 'thwap-copilot) diff --git a/lib/thwap-dash.el b/lib/thwap-dash.el new file mode 100644 index 0000000..4ac9164 --- /dev/null +++ b/lib/thwap-dash.el @@ -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) diff --git a/lib/thwap-defaults.el b/lib/thwap-defaults.el new file mode 100644 index 0000000..864b7ee --- /dev/null +++ b/lib/thwap-defaults.el @@ -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) diff --git a/lib/thwap-go.el b/lib/thwap-go.el index 09acd62..c3f8fe1 100644 --- a/lib/thwap-go.el +++ b/lib/thwap-go.el @@ -1,4 +1,3 @@ -(require 'thwap-lsp) (straight-use-package 'go-mode) @@ -6,3 +5,10 @@ (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) diff --git a/lib/thwap-icons.el b/lib/thwap-icons.el new file mode 100644 index 0000000..b936735 --- /dev/null +++ b/lib/thwap-icons.el @@ -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) diff --git a/lib/thwap-lsp.el b/lib/thwap-lsp.el index 145c2cc..353cc3c 100644 --- a/lib/thwap-lsp.el +++ b/lib/thwap-lsp.el @@ -5,6 +5,7 @@ (setq read-process-output-max (* 1024 1024)) (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) (provide 'thwap-lsp) diff --git a/lib/thwap-magit.el b/lib/thwap-magit.el new file mode 100644 index 0000000..7d25f4a --- /dev/null +++ b/lib/thwap-magit.el @@ -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) diff --git a/lib/thwap-nerdtree.el b/lib/thwap-nerdtree.el new file mode 100644 index 0000000..fb234a1 --- /dev/null +++ b/lib/thwap-nerdtree.el @@ -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) diff --git a/lib/thwap-org.el b/lib/thwap-org.el index 5c4b078..8c09577 100644 --- a/lib/thwap-org.el +++ b/lib/thwap-org.el @@ -36,13 +36,6 @@ (push file 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 () "Update the org-agenda-files variable." (setq org-agenda-files (thwap/list-files-with-extension "~/.org-agenda" "org")) @@ -60,6 +53,7 @@ (setq org-log-done 'time org-startup-indented t org-hide-leading-stars t + org-support-shift-select t org-directory "~/.org-agenda" org-default-notes-file "~/.org-agenda/notes.org") @@ -112,18 +106,28 @@ ;; Org mode stuff (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) +(add-to-list 'thwap-help-lines "C-c t o C-l : Toggle the display of links.") ;; agenda stuff (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) +(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) +(add-to-list 'thwap-help-lines "C-c t o t : Open the Org TODO list.") ;; time management stuff (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) +(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) +(add-to-list 'thwap-help-lines "C-c t o c r : Generate a clock report.") ;; refile stuff (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 (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) diff --git a/lib/thwap-projectile.el b/lib/thwap-projectile.el new file mode 100644 index 0000000..2892be7 --- /dev/null +++ b/lib/thwap-projectile.el @@ -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) diff --git a/lib/thwap-py.el b/lib/thwap-py.el new file mode 100644 index 0000000..d7313a1 --- /dev/null +++ b/lib/thwap-py.el @@ -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) diff --git a/lib/thwap-tf.el b/lib/thwap-tf.el new file mode 100644 index 0000000..6eb749b --- /dev/null +++ b/lib/thwap-tf.el @@ -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) diff --git a/lib/thwap-theme.el b/lib/thwap-theme.el index a4b35d3..313d748 100644 --- a/lib/thwap-theme.el +++ b/lib/thwap-theme.el @@ -3,6 +3,7 @@ (straight-use-package '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) diff --git a/lib/thwap-yaml.el b/lib/thwap-yaml.el new file mode 100644 index 0000000..aec97be --- /dev/null +++ b/lib/thwap-yaml.el @@ -0,0 +1,5 @@ +(use-package yaml-mode + :ensure t + :straight t) + +(provide 'thwap-yaml) diff --git a/lib/thwap-yas.el b/lib/thwap-yas.el new file mode 100644 index 0000000..5b1e212 --- /dev/null +++ b/lib/thwap-yas.el @@ -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)