From 59bffd03b1f896d1f6422c4a7d954e9d6523704d Mon Sep 17 00:00:00 2001 From: Matt Nish-Lapidus Date: Tue, 7 Mar 2023 14:46:47 -0500 Subject: [PATCH] organizing things --- bindings.el | 332 ++++++++++++++++++++++++++++++++++++++++++ config.el | 411 +++++++--------------------------------------------- 2 files changed, 383 insertions(+), 360 deletions(-) create mode 100644 bindings.el diff --git a/bindings.el b/bindings.el new file mode 100644 index 0000000..595c700 --- /dev/null +++ b/bindings.el @@ -0,0 +1,332 @@ +;;; bindings.el -*- lexical-binding: t; -*- + +(setq doom-localleader-alt-key "C-SPC") + +(map! :leader + "`" nil + (:prefix-map ("!" . "checkers")) ; bound by flycheck + + :desc "M-x" ":" #'execute-extended-command + :desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer + :desc "Universal argument" "u" #'universal-argument + + (:prefix-map ("w" . "window") + :desc "ace-window" "w" #'ace-window + :desc "split horizontally" "h" #'split-window-below + :desc "split vertically" "v" #'split-window-below + :desc "make taller" "+" #'enlarge-window + :desc "make taller" "-" #'shrink-window + :desc "make wider" ">" #'enlarge-window-horizontally + :desc "make narrower" "<" #'shrink-window-horizontally + :desc "delete current window" "d" #'delete-window) + + :desc "help" "h" help-map + :desc "Toggle last popup" "~" #'+popup/toggle + :desc "Find file" "." #'find-file + :desc "Switch buffer" "," #'switch-to-buffer + :desc "Switch workspace buffer" "," #'persp-switch-to-buffer + :desc "Switch buffer" "<" #'switch-to-buffer + :desc "Resume last search" "'" #'vertico-repeat + + :desc "Search for symbol in project" "*" #'+default/search-project-for-symbol-at-point + :desc "Search project" "/" #'+default/search-project + + :desc "Find file in project" "SPC" #'projectile-find-file + :desc "Jump to bookmark" "RET" #'bookmark-jump + + (:prefix-map ("TAB" . "workspace") + :desc "Display tab bar" "TAB" #'+workspace/display + :desc "Switch workspace" "." #'+workspace/switch-to + :desc "Switch to last workspace" "`" #'+workspace/other + :desc "New workspace" "n" #'+workspace/new + :desc "New named workspace" "N" #'+workspace/new-named + :desc "Load workspace from file" "l" #'+workspace/load + :desc "Save workspace to file" "s" #'+workspace/save + :desc "Delete session" "x" #'+workspace/kill-session + :desc "Delete this workspace" "d" #'+workspace/delete + :desc "Rename workspace" "r" #'+workspace/rename + :desc "Restore last session" "R" #'+workspace/restore-last-session + :desc "Next workspace" "]" #'+workspace/switch-right + :desc "Previous workspace" "[" #'+workspace/switch-left + :desc "Switch to 1st workspace" "1" #'+workspace/switch-to-0 + :desc "Switch to 2nd workspace" "2" #'+workspace/switch-to-1 + :desc "Switch to 3rd workspace" "3" #'+workspace/switch-to-2 + :desc "Switch to 4th workspace" "4" #'+workspace/switch-to-3 + :desc "Switch to 5th workspace" "5" #'+workspace/switch-to-4 + :desc "Switch to 6th workspace" "6" #'+workspace/switch-to-5 + :desc "Switch to 7th workspace" "7" #'+workspace/switch-to-6 + :desc "Switch to 8th workspace" "8" #'+workspace/switch-to-7 + :desc "Switch to 9th workspace" "9" #'+workspace/switch-to-8 + :desc "Switch to final workspace" "0" #'+workspace/switch-to-final) + + (:prefix-map ("f" . "file") + :desc "Open project editorconfig" "c" #'editorconfig-find-current-editorconfig + :desc "Copy this file" "C" #'doom/copy-this-file + :desc "Find directory" "d" #'+default/dired + :desc "Delete this file" "D" #'doom/delete-this-file + :desc "Find file in emacs.d" "e" #'doom/find-file-in-emacsd + :desc "Browse emacs.d" "E" #'doom/browse-in-emacsd + :desc "Find file" "f" #'find-file + :desc "Find file from here" "F" #'+default/find-file-under-here + :desc "Locate file" "l" #'locate + :desc "Find file in private config" "p" #'doom/find-file-in-private-config + :desc "Browse private config" "P" #'doom/open-private-config + :desc "Recent files" "r" #'recentf-open-files + :desc "Rename/move file" "R" #'doom/move-this-file + :desc "Save file" "s" #'save-buffer + :desc "Save file as..." "S" #'write-file + :desc "Sudo find file" "u" #'doom/sudo-find-file + :desc "Sudo this file" "U" #'doom/sudo-this-file + :desc "Yank file path" "y" #'+default/yank-buffer-path + :desc "Yank file path from project" "Y" #'+default/yank-buffer-path-relative-to-project) + + (:prefix-map ("p" . "project") + :desc "Browse project" "." #'+default/browse-project + :desc "Browse other project" ">" #'doom/browse-in-other-project + :desc "Run cmd in project root" "!" #'projectile-run-shell-command-in-root + :desc "Async cmd in project root" "&" #'projectile-run-async-shell-command-in-root + :desc "Add new project" "a" #'projectile-add-known-project + :desc "Switch to project buffer" "b" #'projectile-switch-to-buffer + :desc "Compile in project" "c" #'projectile-compile-project + :desc "Repeat last command" "C" #'projectile-repeat-last-command + :desc "Remove known project" "d" #'projectile-remove-known-project + :desc "Discover projects in folder" "D" #'+default/discover-projects + :desc "Edit project .dir-locals" "e" #'projectile-edit-dir-locals + :desc "Find file in project" "f" #'projectile-find-file + :desc "Find file in other project" "F" #'doom/find-file-in-other-project + :desc "Configure project" "g" #'projectile-configure-project + :desc "Invalidate project cache" "i" #'projectile-invalidate-cache + :desc "Kill project buffers" "k" #'projectile-kill-buffers + :desc "Find other file" "o" #'projectile-find-other-file + :desc "Switch project" "p" #'projectile-switch-project + :desc "Find recent project files" "r" #'projectile-recentf + :desc "Run project" "R" #'projectile-run-project + :desc "Save project files" "s" #'projectile-save-project-buffers + :desc "List project todos" "t" #'magit-todos-list + :desc "Test project" "T" #'projectile-test-project + :desc "Pop up scratch buffer" "x" #'doom/open-project-scratch-buffer + :desc "Switch to scratch buffer" "X" #'doom/switch-to-project-scratch-buffer + (:when (and (modulep! :tools taskrunner) + (or (modulep! :completion ivy) + (modulep! :completion helm))) + :desc "List project tasks" "z" #'+taskrunner/project-tasks)) + + ;;; s --- search + (:prefix-map ("s" . "search") + :desc "Search buffer" "b" #'+default/search-buffer + :desc "Search all open buffers" "B" (cmd!! #'consult-line-multi 'all-buffers) + :desc "Search current directory" "d" #'+default/search-cwd + :desc "Search other directory" "D" #'+default/search-other-cwd + :desc "Search .emacs.d" "e" #'+default/search-emacsd + :desc "Locate file" "f" #'locate + :desc "Jump to symbol" "i" #'imenu + :desc "Jump to visible link" "l" #'link-hint-open-link + :desc "Jump to link" "L" #'ffap-menu + :desc "Jump to bookmark" "m" #'bookmark-jump + :desc "Look up online" "o" #'+lookup/online + :desc "Look up online (w/ prompt)" "O" #'+lookup/online-select + :desc "Look up in local docsets" "k" #'+lookup/in-docsets + :desc "Look up in all docsets" "K" #'+lookup/in-all-docsets + :desc "Search project" "p" #'+default/search-project + :desc "Search other project" "P" #'+default/search-other-project + :desc "Search buffer" "s" #'+default/search-buffer + :desc "Search buffer for thing at point" "S" #'+vertico/search-symbol-at-point + :desc "Dictionary" "t" #'+lookup/dictionary-definition + :desc "Thesaurus" "T" #'+lookup/synonyms) + + + ;;; t --- toggle + (:prefix-map ("t" . "toggle") + :desc "Big mode" "b" #'doom-big-font-mode + :desc "Fill Column Indicator" "c" #'global-display-fill-column-indicator-mode + :desc "Flymake" "f" #'flymake-mode + (:when (modulep! :checkers syntax) + :desc "Flycheck" "f" #'flycheck-mode) + :desc "Frame fullscreen" "F" #'toggle-frame-fullscreen + ;; :desc "Evil goggles" "g" #'evil-goggles-mode + (:when (modulep! :ui indent-guides) + :desc "Indent guides" "i" #'highlight-indent-guides-mode) + :desc "Indent style" "I" #'doom/toggle-indent-style + :desc "Line numbers" "l" #'doom/toggle-line-numbers + (:when (modulep! :ui minimap) + :desc "Minimap" "m" #'minimap-mode) + (:when (modulep! :lang org +present) + :desc "org-tree-slide mode" "p" #'org-tree-slide-mode) + :desc "Read-only mode" "r" #'read-only-mode + (:when (and (modulep! :checkers spell) (not (modulep! :checkers spell +flyspell))) + :desc "Spell checker" "s" #'spell-fu-mode) + (:when (modulep! :checkers spell +flyspell) + :desc "Spell checker" "s" #'flyspell-mode) + (:when (modulep! :lang org +pomodoro) + :desc "Pomodoro timer" "t" #'org-pomodoro) + :desc "Visible mode" "v" #'visible-mode + :desc "Soft line wrapping" "w" #'visual-line-mode + (:when (modulep! :editor word-wrap) + :desc "Soft line wrapping" "w" #'+word-wrap-mode) + (:when (modulep! :ui zen) + :desc "Zen mode" "z" #'+zen/toggle + :desc "Zen mode (fullscreen)" "Z" #'+zen/toggle-fullscreen)) + + (:prefix-map ("o" . "open") + :desc "Start debugger" "d" #'+debugger/start + :desc "New frame" "f" #'make-frame + :desc "Select frame" "F" #'select-frame-by-name + :desc "REPL" "r" #'+eval/open-repl-other-window + :desc "REPL (same window)" "R" #'+eval/open-repl-same-window + :desc "Dired" "-" #'dired-jump + (:when (modulep! :ui neotree) + :desc "Project sidebar" "p" #'+neotree/open + :desc "Find file in project sidebar" "P" #'+neotree/find-this-file) + (:when (modulep! :ui treemacs) + :desc "Project sidebar" "p" #'+treemacs/toggle + :desc "Find file in project sidebar" "P" #'treemacs-find-file) + (:when (modulep! :term shell) + :desc "Toggle shell popup" "t" #'+shell/toggle + :desc "Open shell here" "T" #'+shell/here) + (:when (modulep! :term term) + :desc "Toggle terminal popup" "t" #'+term/toggle + :desc "Open terminal here" "T" #'+term/here) + (:when (modulep! :term vterm) + :desc "Toggle vterm popup" "t" #'+vterm/toggle + :desc "Open vterm here" "T" #'+vterm/here) + (:when (modulep! :term eshell) + :desc "Toggle eshell popup" "e" #'+eshell/toggle + :desc "Open eshell here" "E" #'+eshell/here) + (:when (modulep! :os macos) + :desc "Reveal in Finder" "o" #'+macos/reveal-in-finder + :desc "Reveal project in Finder" "O" #'+macos/reveal-project-in-finder + :desc "Send to Transmit" "u" #'+macos/send-to-transmit + :desc "Send project to Transmit" "U" #'+macos/send-project-to-transmit + :desc "Send to Launchbar" "l" #'+macos/send-to-launchbar + :desc "Send project to Launchbar" "L" #'+macos/send-project-to-launchbar + :desc "Open in iTerm" "i" #'+macos/open-in-iterm + :desc "Open in new iTerm window" "I" #'+macos/open-in-iterm-new-window) + (:when (modulep! :tools docker) + :desc "Docker" "D" #'docker) + (:when (modulep! :email mu4e) + :desc "mu4e" "m" #'=mu4e) + (:when (modulep! :email notmuch) + :desc "notmuch" "m" #'=notmuch) + (:when (modulep! :email wanderlust) + :desc "wanderlust" "m" #'=wanderlust)) + + (:prefix-map ("n" . "notes") + :desc "Search notes for symbol" "*" #'+default/search-notes-for-symbol-at-point + (:when (modulep! :tools biblio) + :desc "Bibliographic notes" "b" #'citar-open-notes) + + :desc "Find file in notes" "f" #'+default/find-in-notes + :desc "Browse notes" "F" #'+default/browse-notes) + + (:prefix-map ("g" . "git") + :desc "Revert file" "R" #'vc-revert + :desc "Copy link to remote" "y" #'+vc/browse-at-remote-kill + :desc "Copy link to homepage" "Y" #'+vc/browse-at-remote-kill-homepage + (:when (modulep! :ui vc-gutter) + :desc "Revert hunk at point" "r" #'+vc-gutter/revert-hunk + :desc "stage hunk at point" "s" #'+vc-gutter/stage-hunk + :desc "Git time machine" "t" #'git-timemachine-toggle + :desc "Jump to next hunk" "]" #'+vc-gutter/next-hunk + :desc "Jump to previous hunk" "[" #'+vc-gutter/previous-hunk) + (:when (modulep! :tools magit) + :desc "Magit dispatch" "/" #'magit-dispatch + :desc "Magit file dispatch" "." #'magit-file-dispatch + :desc "Forge dispatch" "'" #'forge-dispatch + :desc "Magit switch branch" "b" #'magit-branch-checkout + :desc "Magit status" "g" #'magit-status + :desc "Magit status here" "G" #'magit-status-here + :desc "Magit file delete" "D" #'magit-file-delete + :desc "Magit blame" "B" #'magit-blame-addition + :desc "Magit clone" "C" #'magit-clone + :desc "Magit fetch" "F" #'magit-fetch + :desc "Magit buffer log" "L" #'magit-log-buffer-file + :desc "Git stage file" "S" #'magit-stage-file + :desc "Git unstage file" "U" #'magit-unstage-file + (:prefix ("f" . "find") + :desc "Find file" "f" #'magit-find-file + :desc "Find gitconfig file" "g" #'magit-find-git-config-file + :desc "Find commit" "c" #'magit-show-commit + :desc "Find issue" "i" #'forge-visit-issue + :desc "Find pull request" "p" #'forge-visit-pullreq) + (:prefix ("o" . "open in browser") + :desc "Browse file or region" "o" #'+vc/browse-at-remote + :desc "Browse homepage" "h" #'+vc/browse-at-remote-homepage + :desc "Browse remote" "r" #'forge-browse-remote + :desc "Browse commit" "c" #'forge-browse-commit + :desc "Browse an issue" "i" #'forge-browse-issue + :desc "Browse a pull request" "p" #'forge-browse-pullreq + :desc "Browse issues" "I" #'forge-browse-issues + :desc "Browse pull requests" "P" #'forge-browse-pullreqs) + (:prefix ("l" . "list") + (:when (modulep! :tools gist) + :desc "List gists" "g" #'+gist:list) + :desc "List repositories" "r" #'magit-list-repositories + :desc "List submodules" "s" #'magit-list-submodules + :desc "List issues" "i" #'forge-list-issues + :desc "List pull requests" "p" #'forge-list-pullreqs + :desc "List notifications" "n" #'forge-list-notifications) + (:prefix ("c" . "create") + :desc "Initialize repo" "r" #'magit-init + :desc "Clone repo" "R" #'magit-clone + :desc "Commit" "c" #'magit-commit-create + :desc "Fixup" "f" #'magit-commit-fixup + :desc "Branch" "b" #'magit-branch-and-checkout + :desc "Issue" "i" #'forge-create-issue + :desc "Pull request" "p" #'forge-create-pullreq))) + + (:prefix-map ("c" . "code") + (:when (and (modulep! :tools lsp) (not (modulep! :tools lsp +eglot))) + :desc "LSP Execute code action" "a" #'lsp-execute-code-action + :desc "LSP Organize imports" "o" #'lsp-organize-imports + :desc "Jump to symbol in current workspace" "j" #'consult-lsp-symbols + :desc "Jump to symbol in any workspace" "J" (cmd!! #'consult-lsp-symbols 'all-workspaces) + (:when (modulep! :ui treemacs +lsp) + :desc "Errors list" "X" #'lsp-treemacs-errors-list + :desc "Incoming call hierarchy" "y" #'lsp-treemacs-call-hierarchy + :desc "Outgoing call hierarchy" "Y" (cmd!! #'lsp-treemacs-call-hierarchy t) + :desc "References tree" "R" (cmd!! #'lsp-treemacs-references t) + :desc "Symbols" "S" #'lsp-treemacs-symbols) + :desc "LSP" "l" #'+default/lsp-command-map + :desc "LSP Rename" "r" #'lsp-rename) + (:when (modulep! :tools lsp +eglot) + :desc "LSP Execute code action" "a" #'eglot-code-actions + :desc "LSP Rename" "r" #'eglot-rename + :desc "LSP Find declaration" "j" #'eglot-find-declaration + (:when (modulep! :completion vertico) + :desc "Jump to symbol in current workspace" "j" #'consult-eglot-symbols)) + :desc "Compile" "c" #'compile + :desc "Recompile" "C" #'recompile + :desc "Jump to definition" "d" #'+lookup/definition + :desc "Jump to references" "D" #'+lookup/references + :desc "Evaluate buffer/region" "e" #'+eval/buffer-or-region + :desc "Evaluate & replace region" "E" #'+eval:replace-region + :desc "Format buffer/region" "f" #'+format/region-or-buffer + :desc "Find implementations" "i" #'+lookup/implementations + :desc "Jump to documentation" "k" #'+lookup/documentation + :desc "Send to repl" "s" #'+eval/send-region-to-repl + :desc "Find type definition" "t" #'+lookup/type-definition + :desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace + :desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines + :desc "List errors" "x" #'+default/diagnostics) + ) + +(map! "s-c" #'kill-ring-save + "s-v" #'yank + "s-x" #'kill-region + "s-a" #'mark-whole-buffer + "s-z" #'undo + "s-w" #'kill-buffer + "s-f" #'+default/search-buffer + "M-s-]" #'next-window-any-frame + "M-s-[" #'previous-window-any-frame + ;; "M-s-" #'backward-paragraph + ;; "M-s-" #'forward-paragraph + "s-" #'beginning-of-buffer + "s-" #'end-of-buffer + "M-s-v" #'consult-yank-from-kill-ring) + +(after! which-key + (let ((prefix-re (regexp-opt (list doom-leader-key doom-leader-alt-key)))) + (cl-pushnew `((,(format "\\`\\(?:C-w\\|%s w\\) m\\'" prefix-re)) + nil . "maximize") + which-key-replacement-alist))) diff --git a/config.el b/config.el index 9685f48..40fd478 100644 --- a/config.el +++ b/config.el @@ -24,6 +24,10 @@ (setq display-line-numbers-type t) (setq scroll-preserve-screen-position t) +;; quick function for removing all blank lines in a buffer +(defun mnl/remove-all-blank-lines () + (flush-lines "^$")) + ;; Modeline ;; - add current workspace name ;; - add major mode icon @@ -31,341 +35,35 @@ (setq doom-modeline-persp-name t doom-modeline-major-mode-icon t)) -(setq doom-localleader-alt-key "C-SPC") +;; fixing compat issue for corfu in emacs28 +(defalias 'compat-string-width 'string-width) -(map! :leader "`" nil) +;; some global settings +(setq tab-always-indent t) ; don't autocomplete with tab +(+global-word-wrap-mode +1) ; default to soft word wrap +(delete-selection-mode 1) ; delete stuff! +(setq delete-active-region t) ; delete selected stuff! +;; remove org agenda from the splash screen +(assoc-delete-all "Open org-agenda" +doom-dashboard-menu-sections) + +(setq +tree-sitter-hl-enabled-modes t) ; TODO highlight using tree-sitter ... maybe? still testing + +;; nicer resizing +(cond + ((string-equal system-type "darwin") + (setq frame-resize-pixelwise t + window-resize-pixelwise t))) + +;; tabs! i like them +(setq-default indent-tabs-mode t) +(setq-default tab-width 2) + +;; import all my customized keybindings based on doom evil mode, but without evil. +(load! "bindings.el") + +;; Lispy mode (setq aw-dispatch-always t) - -(map! :leader - - (:prefix-map ("!" . "checkers")) ; bound by flycheck - - :desc "M-x" ":" #'execute-extended-command - :desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer - :desc "Universal argument" "u" #'universal-argument - - (:prefix-map ("w" . "window") - :desc "ace-window" "w" #'ace-window - :desc "split horizontally" "h" #'split-window-below - :desc "split vertically" "v" #'split-window-below - :desc "make taller" "+" #'enlarge-window - :desc "make taller" "-" #'shrink-window - :desc "make wider" ">" #'enlarge-window-horizontally - :desc "make narrower" "<" #'shrink-window-horizontally - :desc "delete current window" "d" #'delete-window) - - :desc "help" "h" help-map - :desc "Toggle last popup" "~" #'+popup/toggle - :desc "Find file" "." #'find-file - :desc "Switch buffer" "," #'switch-to-buffer - :desc "Switch workspace buffer" "," #'persp-switch-to-buffer - :desc "Switch buffer" "<" #'switch-to-buffer - :desc "Resume last search" "'" #'vertico-repeat - - :desc "Search for symbol in project" "*" #'+default/search-project-for-symbol-at-point - :desc "Search project" "/" #'+default/search-project - - :desc "Find file in project" "SPC" #'projectile-find-file - :desc "Jump to bookmark" "RET" #'bookmark-jump - - (:prefix-map ("TAB" . "workspace") - :desc "Display tab bar" "TAB" #'+workspace/display - :desc "Switch workspace" "." #'+workspace/switch-to - :desc "Switch to last workspace" "`" #'+workspace/other - :desc "New workspace" "n" #'+workspace/new - :desc "New named workspace" "N" #'+workspace/new-named - :desc "Load workspace from file" "l" #'+workspace/load - :desc "Save workspace to file" "s" #'+workspace/save - :desc "Delete session" "x" #'+workspace/kill-session - :desc "Delete this workspace" "d" #'+workspace/delete - :desc "Rename workspace" "r" #'+workspace/rename - :desc "Restore last session" "R" #'+workspace/restore-last-session - :desc "Next workspace" "]" #'+workspace/switch-right - :desc "Previous workspace" "[" #'+workspace/switch-left - :desc "Switch to 1st workspace" "1" #'+workspace/switch-to-0 - :desc "Switch to 2nd workspace" "2" #'+workspace/switch-to-1 - :desc "Switch to 3rd workspace" "3" #'+workspace/switch-to-2 - :desc "Switch to 4th workspace" "4" #'+workspace/switch-to-3 - :desc "Switch to 5th workspace" "5" #'+workspace/switch-to-4 - :desc "Switch to 6th workspace" "6" #'+workspace/switch-to-5 - :desc "Switch to 7th workspace" "7" #'+workspace/switch-to-6 - :desc "Switch to 8th workspace" "8" #'+workspace/switch-to-7 - :desc "Switch to 9th workspace" "9" #'+workspace/switch-to-8 - :desc "Switch to final workspace" "0" #'+workspace/switch-to-final) - - (:prefix-map ("f" . "file") - :desc "Open project editorconfig" "c" #'editorconfig-find-current-editorconfig - :desc "Copy this file" "C" #'doom/copy-this-file - :desc "Find directory" "d" #'+default/dired - :desc "Delete this file" "D" #'doom/delete-this-file - :desc "Find file in emacs.d" "e" #'doom/find-file-in-emacsd - :desc "Browse emacs.d" "E" #'doom/browse-in-emacsd - :desc "Find file" "f" #'find-file - :desc "Find file from here" "F" #'+default/find-file-under-here - :desc "Locate file" "l" #'locate - :desc "Find file in private config" "p" #'doom/find-file-in-private-config - :desc "Browse private config" "P" #'doom/open-private-config - :desc "Recent files" "r" #'recentf-open-files - :desc "Rename/move file" "R" #'doom/move-this-file - :desc "Save file" "s" #'save-buffer - :desc "Save file as..." "S" #'write-file - :desc "Sudo find file" "u" #'doom/sudo-find-file - :desc "Sudo this file" "U" #'doom/sudo-this-file - :desc "Yank file path" "y" #'+default/yank-buffer-path - :desc "Yank file path from project" "Y" #'+default/yank-buffer-path-relative-to-project) - - (:prefix-map ("p" . "project") - :desc "Browse project" "." #'+default/browse-project - :desc "Browse other project" ">" #'doom/browse-in-other-project - :desc "Run cmd in project root" "!" #'projectile-run-shell-command-in-root - :desc "Async cmd in project root" "&" #'projectile-run-async-shell-command-in-root - :desc "Add new project" "a" #'projectile-add-known-project - :desc "Switch to project buffer" "b" #'projectile-switch-to-buffer - :desc "Compile in project" "c" #'projectile-compile-project - :desc "Repeat last command" "C" #'projectile-repeat-last-command - :desc "Remove known project" "d" #'projectile-remove-known-project - :desc "Discover projects in folder" "D" #'+default/discover-projects - :desc "Edit project .dir-locals" "e" #'projectile-edit-dir-locals - :desc "Find file in project" "f" #'projectile-find-file - :desc "Find file in other project" "F" #'doom/find-file-in-other-project - :desc "Configure project" "g" #'projectile-configure-project - :desc "Invalidate project cache" "i" #'projectile-invalidate-cache - :desc "Kill project buffers" "k" #'projectile-kill-buffers - :desc "Find other file" "o" #'projectile-find-other-file - :desc "Switch project" "p" #'projectile-switch-project - :desc "Find recent project files" "r" #'projectile-recentf - :desc "Run project" "R" #'projectile-run-project - :desc "Save project files" "s" #'projectile-save-project-buffers - :desc "List project todos" "t" #'magit-todos-list - :desc "Test project" "T" #'projectile-test-project - :desc "Pop up scratch buffer" "x" #'doom/open-project-scratch-buffer - :desc "Switch to scratch buffer" "X" #'doom/switch-to-project-scratch-buffer - (:when (and (modulep! :tools taskrunner) - (or (modulep! :completion ivy) - (modulep! :completion helm))) - :desc "List project tasks" "z" #'+taskrunner/project-tasks)) - - ;;; s --- search - (:prefix-map ("s" . "search") - :desc "Search buffer" "b" #'+default/search-buffer - :desc "Search all open buffers" "B" (cmd!! #'consult-line-multi 'all-buffers) - :desc "Search current directory" "d" #'+default/search-cwd - :desc "Search other directory" "D" #'+default/search-other-cwd - :desc "Search .emacs.d" "e" #'+default/search-emacsd - :desc "Locate file" "f" #'locate - :desc "Jump to symbol" "i" #'imenu - :desc "Jump to visible link" "l" #'link-hint-open-link - :desc "Jump to link" "L" #'ffap-menu - :desc "Jump to bookmark" "m" #'bookmark-jump - :desc "Look up online" "o" #'+lookup/online - :desc "Look up online (w/ prompt)" "O" #'+lookup/online-select - :desc "Look up in local docsets" "k" #'+lookup/in-docsets - :desc "Look up in all docsets" "K" #'+lookup/in-all-docsets - :desc "Search project" "p" #'+default/search-project - :desc "Search other project" "P" #'+default/search-other-project - :desc "Search buffer" "s" #'+default/search-buffer - :desc "Search buffer for thing at point" "S" #'+vertico/search-symbol-at-point - :desc "Dictionary" "t" #'+lookup/dictionary-definition - :desc "Thesaurus" "T" #'+lookup/synonyms) - - - ;;; t --- toggle - (:prefix-map ("t" . "toggle") - :desc "Big mode" "b" #'doom-big-font-mode - :desc "Fill Column Indicator" "c" #'global-display-fill-column-indicator-mode - :desc "Flymake" "f" #'flymake-mode - (:when (modulep! :checkers syntax) - :desc "Flycheck" "f" #'flycheck-mode) - :desc "Frame fullscreen" "F" #'toggle-frame-fullscreen - ;; :desc "Evil goggles" "g" #'evil-goggles-mode - (:when (modulep! :ui indent-guides) - :desc "Indent guides" "i" #'highlight-indent-guides-mode) - :desc "Indent style" "I" #'doom/toggle-indent-style - :desc "Line numbers" "l" #'doom/toggle-line-numbers - (:when (modulep! :ui minimap) - :desc "Minimap" "m" #'minimap-mode) - (:when (modulep! :lang org +present) - :desc "org-tree-slide mode" "p" #'org-tree-slide-mode) - :desc "Read-only mode" "r" #'read-only-mode - (:when (and (modulep! :checkers spell) (not (modulep! :checkers spell +flyspell))) - :desc "Spell checker" "s" #'spell-fu-mode) - (:when (modulep! :checkers spell +flyspell) - :desc "Spell checker" "s" #'flyspell-mode) - (:when (modulep! :lang org +pomodoro) - :desc "Pomodoro timer" "t" #'org-pomodoro) - :desc "Visible mode" "v" #'visible-mode - :desc "Soft line wrapping" "w" #'visual-line-mode - (:when (modulep! :editor word-wrap) - :desc "Soft line wrapping" "w" #'+word-wrap-mode) - (:when (modulep! :ui zen) - :desc "Zen mode" "z" #'+zen/toggle - :desc "Zen mode (fullscreen)" "Z" #'+zen/toggle-fullscreen)) - - (:prefix-map ("o" . "open") - :desc "Start debugger" "d" #'+debugger/start - :desc "New frame" "f" #'make-frame - :desc "Select frame" "F" #'select-frame-by-name - :desc "REPL" "r" #'+eval/open-repl-other-window - :desc "REPL (same window)" "R" #'+eval/open-repl-same-window - :desc "Dired" "-" #'dired-jump - (:when (modulep! :ui neotree) - :desc "Project sidebar" "p" #'+neotree/open - :desc "Find file in project sidebar" "P" #'+neotree/find-this-file) - (:when (modulep! :ui treemacs) - :desc "Project sidebar" "p" #'+treemacs/toggle - :desc "Find file in project sidebar" "P" #'treemacs-find-file) - (:when (modulep! :term shell) - :desc "Toggle shell popup" "t" #'+shell/toggle - :desc "Open shell here" "T" #'+shell/here) - (:when (modulep! :term term) - :desc "Toggle terminal popup" "t" #'+term/toggle - :desc "Open terminal here" "T" #'+term/here) - (:when (modulep! :term vterm) - :desc "Toggle vterm popup" "t" #'+vterm/toggle - :desc "Open vterm here" "T" #'+vterm/here) - (:when (modulep! :term eshell) - :desc "Toggle eshell popup" "e" #'+eshell/toggle - :desc "Open eshell here" "E" #'+eshell/here) - (:when (modulep! :os macos) - :desc "Reveal in Finder" "o" #'+macos/reveal-in-finder - :desc "Reveal project in Finder" "O" #'+macos/reveal-project-in-finder - :desc "Send to Transmit" "u" #'+macos/send-to-transmit - :desc "Send project to Transmit" "U" #'+macos/send-project-to-transmit - :desc "Send to Launchbar" "l" #'+macos/send-to-launchbar - :desc "Send project to Launchbar" "L" #'+macos/send-project-to-launchbar - :desc "Open in iTerm" "i" #'+macos/open-in-iterm - :desc "Open in new iTerm window" "I" #'+macos/open-in-iterm-new-window) - (:when (modulep! :tools docker) - :desc "Docker" "D" #'docker) - (:when (modulep! :email mu4e) - :desc "mu4e" "m" #'=mu4e) - (:when (modulep! :email notmuch) - :desc "notmuch" "m" #'=notmuch) - (:when (modulep! :email wanderlust) - :desc "wanderlust" "m" #'=wanderlust)) - - (:prefix-map ("n" . "notes") - :desc "Search notes for symbol" "*" #'+default/search-notes-for-symbol-at-point - (:when (modulep! :tools biblio) - :desc "Bibliographic notes" "b" #'citar-open-notes) - - :desc "Find file in notes" "f" #'+default/find-in-notes - :desc "Browse notes" "F" #'+default/browse-notes) - - (:prefix-map ("g" . "git") - :desc "Revert file" "R" #'vc-revert - :desc "Copy link to remote" "y" #'+vc/browse-at-remote-kill - :desc "Copy link to homepage" "Y" #'+vc/browse-at-remote-kill-homepage - (:when (modulep! :ui vc-gutter) - :desc "Revert hunk at point" "r" #'+vc-gutter/revert-hunk - :desc "stage hunk at point" "s" #'+vc-gutter/stage-hunk - :desc "Git time machine" "t" #'git-timemachine-toggle - :desc "Jump to next hunk" "]" #'+vc-gutter/next-hunk - :desc "Jump to previous hunk" "[" #'+vc-gutter/previous-hunk) - (:when (modulep! :tools magit) - :desc "Magit dispatch" "/" #'magit-dispatch - :desc "Magit file dispatch" "." #'magit-file-dispatch - :desc "Forge dispatch" "'" #'forge-dispatch - :desc "Magit switch branch" "b" #'magit-branch-checkout - :desc "Magit status" "g" #'magit-status - :desc "Magit status here" "G" #'magit-status-here - :desc "Magit file delete" "D" #'magit-file-delete - :desc "Magit blame" "B" #'magit-blame-addition - :desc "Magit clone" "C" #'magit-clone - :desc "Magit fetch" "F" #'magit-fetch - :desc "Magit buffer log" "L" #'magit-log-buffer-file - :desc "Git stage file" "S" #'magit-stage-file - :desc "Git unstage file" "U" #'magit-unstage-file - (:prefix ("f" . "find") - :desc "Find file" "f" #'magit-find-file - :desc "Find gitconfig file" "g" #'magit-find-git-config-file - :desc "Find commit" "c" #'magit-show-commit - :desc "Find issue" "i" #'forge-visit-issue - :desc "Find pull request" "p" #'forge-visit-pullreq) - (:prefix ("o" . "open in browser") - :desc "Browse file or region" "o" #'+vc/browse-at-remote - :desc "Browse homepage" "h" #'+vc/browse-at-remote-homepage - :desc "Browse remote" "r" #'forge-browse-remote - :desc "Browse commit" "c" #'forge-browse-commit - :desc "Browse an issue" "i" #'forge-browse-issue - :desc "Browse a pull request" "p" #'forge-browse-pullreq - :desc "Browse issues" "I" #'forge-browse-issues - :desc "Browse pull requests" "P" #'forge-browse-pullreqs) - (:prefix ("l" . "list") - (:when (modulep! :tools gist) - :desc "List gists" "g" #'+gist:list) - :desc "List repositories" "r" #'magit-list-repositories - :desc "List submodules" "s" #'magit-list-submodules - :desc "List issues" "i" #'forge-list-issues - :desc "List pull requests" "p" #'forge-list-pullreqs - :desc "List notifications" "n" #'forge-list-notifications) - (:prefix ("c" . "create") - :desc "Initialize repo" "r" #'magit-init - :desc "Clone repo" "R" #'magit-clone - :desc "Commit" "c" #'magit-commit-create - :desc "Fixup" "f" #'magit-commit-fixup - :desc "Branch" "b" #'magit-branch-and-checkout - :desc "Issue" "i" #'forge-create-issue - :desc "Pull request" "p" #'forge-create-pullreq))) - - (:prefix-map ("c" . "code") - (:when (and (modulep! :tools lsp) (not (modulep! :tools lsp +eglot))) - :desc "LSP Execute code action" "a" #'lsp-execute-code-action - :desc "LSP Organize imports" "o" #'lsp-organize-imports - :desc "Jump to symbol in current workspace" "j" #'consult-lsp-symbols - :desc "Jump to symbol in any workspace" "J" (cmd!! #'consult-lsp-symbols 'all-workspaces) - (:when (modulep! :ui treemacs +lsp) - :desc "Errors list" "X" #'lsp-treemacs-errors-list - :desc "Incoming call hierarchy" "y" #'lsp-treemacs-call-hierarchy - :desc "Outgoing call hierarchy" "Y" (cmd!! #'lsp-treemacs-call-hierarchy t) - :desc "References tree" "R" (cmd!! #'lsp-treemacs-references t) - :desc "Symbols" "S" #'lsp-treemacs-symbols) - :desc "LSP" "l" #'+default/lsp-command-map - :desc "LSP Rename" "r" #'lsp-rename) - (:when (modulep! :tools lsp +eglot) - :desc "LSP Execute code action" "a" #'eglot-code-actions - :desc "LSP Rename" "r" #'eglot-rename - :desc "LSP Find declaration" "j" #'eglot-find-declaration - (:when (modulep! :completion vertico) - :desc "Jump to symbol in current workspace" "j" #'consult-eglot-symbols)) - :desc "Compile" "c" #'compile - :desc "Recompile" "C" #'recompile - :desc "Jump to definition" "d" #'+lookup/definition - :desc "Jump to references" "D" #'+lookup/references - :desc "Evaluate buffer/region" "e" #'+eval/buffer-or-region - :desc "Evaluate & replace region" "E" #'+eval:replace-region - :desc "Format buffer/region" "f" #'+format/region-or-buffer - :desc "Find implementations" "i" #'+lookup/implementations - :desc "Jump to documentation" "k" #'+lookup/documentation - :desc "Send to repl" "s" #'+eval/send-region-to-repl - :desc "Find type definition" "t" #'+lookup/type-definition - :desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace - :desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines - :desc "List errors" "x" #'+default/diagnostics) - ) - -(after! which-key - (let ((prefix-re (regexp-opt (list doom-leader-key doom-leader-alt-key)))) - (cl-pushnew `((,(format "\\`\\(?:C-w\\|%s w\\) m\\'" prefix-re)) - nil . "maximize") - which-key-replacement-alist))) - -(map! "s-c" #'kill-ring-save - "s-v" #'yank - "s-x" #'kill-region - "s-a" #'mark-whole-buffer - "s-z" #'undo - "s-w" #'kill-buffer - "s-f" #'+default/search-buffer - "M-s-]" #'next-window-any-frame - "M-s-[" #'previous-window-any-frame - ;; "M-s-" #'backward-paragraph - ;; "M-s-" #'forward-paragraph - "s-" #'beginning-of-buffer - "s-" #'end-of-buffer - "M-s-v" #'consult-yank-from-kill-ring) - (map! :map lispy-mode-map "M-" nil "M-" nil) @@ -373,22 +71,15 @@ "M-" nil "M-" nil) -(cond - ((string-equal system-type "darwin") - (setq frame-resize-pixelwise t - window-resize-pixelwise t))) - -(setq treemacs-follow-mode t) -(setq treemacs-project-follow-mode t) - -(setq-default indent-tabs-mode t) -(setq-default tab-width 2) - -(defalias 'compat-string-width 'string-width) +;; treemacs -- NOTE i'm not using this right now, switched back to neotree for now +;; (setq treemacs-follow-mode t) +;; (setq treemacs-project-follow-mode t) +;; smart tabs set modes (after! smart-tabs-mode (smart-tabs-insinuate 'c 'javascript 'python)) +;; lsp mode config to work with corfu/cape (after! lsp-mode (setq lsp-completion-provider :none) (setq lsp-signature-render-documentation nil) @@ -396,25 +87,28 @@ (defun my/lsp-mode-setup-completion () (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) - '(orderless))) ;; Configure orderless + '(orderless))) (add-hook! lsp-completion-mode 'my/lsp-mode-setup-completion)) -(setq! citar-bibliography '("/Users/emenel/Zotero/lib.bib")) - (after! lisp-mode (setq lsp-completion-provider :none)) +;; bibliography file location +(setq! citar-bibliography '("/Users/emenel/Zotero/lib.bib")) + ;; svelte support (add-to-list 'auto-mode-alist '("\\.svelte\\'" . web-mode)) (setq web-mode-engines-alist '(("svelte" . "\\.svelte\\'"))) +;; custom keybind for adding html closing tag because i have muscle memory from sublime (after! web-mode (map! :map web-mode-map "M-s-." 'web-mode-element-close)) (add-hook! web-mode (web-mode-use-tabs) (setq indent-tabs-mode t)) +;; fix centaur tabs to show at the right times and add my muscle memory keybind (after! centaur-tabs (setq centaur-tabs-set-bar 'right) (setq centaur-tabs-cycle-scope 'tabs) @@ -422,6 +116,7 @@ "s-M-" 'centaur-tabs-forward "s-M-" 'centaur-tabs-backward)) +;; configure moom for easy frame management (use-package! moom :load-path "/Users/emenel/Source/_src/moom" :after-call doom-after-init-hook @@ -432,8 +127,10 @@ (setq moom-command-with-centering '(single double delete split)) (when (display-graphic-p) (defun my-moom-default-frame-size () (set-frame-width (selected-frame) 150) (set-frame-height (selected-frame) 48) (moom-move-frame-to-center)) (add-hook! 'moom-mode-hook #'my-moom-default-frame-size) (moom-mode 1))) +;; use kitty for terminal-here (setq terminal-here-mac-terminal-command '("kitty")) +;; set project paths and ignore buffers (setq projectile-project-search-path '(("~/Source" . 2))) (setq projectile-globally-ignored-buffers '("*scratch*" @@ -448,19 +145,21 @@ "gnus-.*-mode" "occur-mode")) +;; configure obsidian integration for note taking fun times (use-package! obsidian :config (obsidian-specify-path "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Primary") (setq obsidian-inbox-directory "_Inbox") (global-obsidian-mode t) (map! :map obsidian-mode-map - ;; Replace C-c C-o with Obsidian.el's implementation. It's ok to use another key binding. + ;; Replace C-c C-o with Obsidian.el's implementation. "C-c C-o" #'obsidian-follow-link-at-point ;; Jump to backlinks "C-c C-b" #'obsidian-backlink-jump ;; If you prefer you can use `obsidian-insert-link' "C-c C-l" #'obsidian-insert-wikilink)) +;; custom quick capture template for obsidian daily note (defun mnl/obsidian-capture () "Create new obsidian note. In the `obsidian-inbox-directory' if set otherwise in `obsidian-directory' root." (interactive) @@ -497,14 +196,16 @@ (setq org-directory "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Primary/org/") +;; mouse support for vertico buffers (after! vertico (vertico-mouse-mode)) +;; better completions for sly (after! sly (setq sly-complete-symbol-function 'sly-flex-completions)) +;; make esc close completion from corfu (map! :map corfu-map [escape] 'corfu-quit) -(setq tab-always-indent t) ;; cl-collider cl-patterns emacs helpers TODO: test this (after! lisp-mode @@ -520,6 +221,7 @@ ;; (define-key sly-doc-map (kbd "s") 'cl-patterns-supercollider-documentation)) (add-hook 'sly-connected-hook 'cl-patterns-helpers-load))) +;; tidal cycles! (setq tidal-boot-script-path "~/.cabal/share/aarch64-osx-ghc-9.4.2/tidal-1.9.3/BootTidal.hs") ;; TODO update this for sly to use ciel by default @@ -528,14 +230,3 @@ ;; (ciel-sbcl ("sbcl" "--core" "/path/to/ciel/ciel-core" "--eval" "(in-package :ciel-user)")))) ;; (setq slime-default-lisp 'ciel-sbcl) -(defun mnl/remove-all-blank-lines () - (flush-lines "^$")) - -(+global-word-wrap-mode +1) -(delete-selection-mode 1) -(setq delete-active-region t) - -;; remove org agenda from the splash screen -(assoc-delete-all "Open org-agenda" +doom-dashboard-menu-sections) - -(setq +tree-sitter-hl-enabled-modes t)