From ec15512b0ed1a6d4943edd0d4517cc7a5f2310bb Mon Sep 17 00:00:00 2001 From: materus Date: Sun, 3 Nov 2024 14:03:17 +0100 Subject: [PATCH] configurations: emacs --- .../Old-materusPC/home/materus/default.nix | 2 +- .../profile/home/editor/emacs/default.nix | 8 ++- extraFiles/config/emacs/early-init.el | 6 ++ .../config/emacs/etc/materus/internals.el | 9 ++- .../config/emacs/etc/materus/packages.el | 7 +- extraFiles/config/emacs/etc/materus/start.el | 65 ++++++++++++------- extraFiles/config/emacs/init.el | 5 ++ 7 files changed, 68 insertions(+), 34 deletions(-) diff --git a/configurations/host/Old-materusPC/home/materus/default.nix b/configurations/host/Old-materusPC/home/materus/default.nix index b853dfd..158a94d 100644 --- a/configurations/host/Old-materusPC/home/materus/default.nix +++ b/configurations/host/Old-materusPC/home/materus/default.nix @@ -170,7 +170,7 @@ dub ]); - editor.emacs.enable = false; + editor.emacs.enable = true; }; xdg.desktopEntries.brave-browser = diff --git a/configurations/profile/home/editor/emacs/default.nix b/configurations/profile/home/editor/emacs/default.nix index 06d88e8..9109ce2 100644 --- a/configurations/profile/home/editor/emacs/default.nix +++ b/configurations/profile/home/editor/emacs/default.nix @@ -14,7 +14,6 @@ let avy corfu vterm - centaur-tabs projectile company clipetty @@ -61,9 +60,13 @@ let nix-mode no-littering right-click-context - moe-theme + dracula-theme doom-themes orderless + popper + undo-tree + bash-completion + consult ]; default-config = '' @@ -96,6 +99,7 @@ let (setenv "PATH" (concat (getenv "PATH") ":${emacsEnv}/bin")) (setq exec-path (append exec-path '("${emacsEnv}/bin"))) (call-process-shell-command "${pkgs.xorg.xmodmap}/bin/xmodmap -e \"keycode 148 = Hyper_L\" -e \"remove Mod4 = Hyper_L\" -e \"add Mod3 = Hyper_L\" &" nil 0) + (call-process-shell-command "${pkgs.xorg.xmodmap}/bin/xmodmap -e \"keycode 66 = Hyper_L\" -e \"remove Mod4 = Hyper_L\" -e \"add Mod3 = Hyper_L\" &" nil 0) ''; in { diff --git a/extraFiles/config/emacs/early-init.el b/extraFiles/config/emacs/early-init.el index 2273798..51a7a26 100644 --- a/extraFiles/config/emacs/early-init.el +++ b/extraFiles/config/emacs/early-init.el @@ -36,3 +36,9 @@ (startup-redirect-eln-cache (convert-standard-filename (expand-file-name "var/eln-cache/" user-emacs-directory)))) + +(setq auto-save-default nil) +(setq backup-directory-alist + `((".*" . ,(concat user-emacs-directory "var/backups/")))) +(setq auto-save-file-name-transforms + `((".*" ,(concat user-emacs-directory "var/recovery/") t))) \ No newline at end of file diff --git a/extraFiles/config/emacs/etc/materus/internals.el b/extraFiles/config/emacs/etc/materus/internals.el index e2b551c..29a2228 100644 --- a/extraFiles/config/emacs/etc/materus/internals.el +++ b/extraFiles/config/emacs/etc/materus/internals.el @@ -37,16 +37,15 @@ (setq custom-file (concat user-emacs-directory "etc/custom.el")) -(setq auto-save-default nil) -(setq backup-directory-alist - `((".*" . ,(concat user-emacs-directory "var/backups/")))) -(setq auto-save-file-name-transforms - `((".*" ,(concat user-emacs-directory "var/recovery/") t))) + + ;;. Graphical (setq frame-resize-pixelwise t) +(setq window-resize-pixelwise t) + (when (display-graphic-p) (set-frame-font "Hack Nerd Font" nil t) ) diff --git a/extraFiles/config/emacs/etc/materus/packages.el b/extraFiles/config/emacs/etc/materus/packages.el index 2dd32c6..ffc9740 100644 --- a/extraFiles/config/emacs/etc/materus/packages.el +++ b/extraFiles/config/emacs/etc/materus/packages.el @@ -70,6 +70,9 @@ (straight-use-package 'nix-mode) (straight-use-package 'no-littering) (straight-use-package 'right-click-context) -(straight-use-package 'moe-theme) +(straight-use-package 'dracula-theme) (straight-use-package 'doom-themes) -(straight-use-package 'orderless) \ No newline at end of file +(straight-use-package 'orderless) +(straight-use-package 'undo-tree) +(straight-use-package 'bash-completion) +(straight-use-package 'consult) \ No newline at end of file diff --git a/extraFiles/config/emacs/etc/materus/start.el b/extraFiles/config/emacs/etc/materus/start.el index 2f900f8..7cd0156 100644 --- a/extraFiles/config/emacs/etc/materus/start.el +++ b/extraFiles/config/emacs/etc/materus/start.el @@ -6,9 +6,8 @@ (require 'elcord) (require 'dashboard) (require 'minions) -(require 'doom-themes) +(require 'dracula-theme) (require 'nerd-icons) -(require 'centaur-tabs) (require 'projectile) (require 'treemacs) (require 'treemacs-projectile) @@ -16,20 +15,43 @@ (require 'vertico) (require 'orderless) (require 'marginalia) +(require 'undo-tree) +(require 'consult) + +(cua-mode 0) + +;Keybinds +(keymap-set cua--cua-keys-keymap "C-z" 'undo-tree-undo) +(keymap-set cua--cua-keys-keymap "C-y" 'undo-tree-redo) +(keymap-set global-map "TAB" #'indent-rigidly-right-to-tab-stop) +(keymap-set global-map "" #'indent-rigidly-left-to-tab-stop) +(keymap-set global-map "C-" #'indent-for-tab-commandn) +(keymap-set vertico-map "TAB" #'vertico-insert) +(define-key key-translation-map (kbd "") 'event-apply-hyper-modifier ) +(define-key key-translation-map (kbd "") 'event-apply-hyper-modifier ) +(define-key key-translation-map (kbd "∇") 'event-apply-hyper-modifier ) +(global-set-key (kbd "C-H-t") 'treemacs) + +(setq completion-in-region-function + (lambda (&rest args) + (apply (if vertico-mode + #'consult-completion-in-region + #'completion--in-region) + args))) (tool-bar-mode -1) (if (daemonp) (add-hook 'after-make-frame-functions (lambda (frame) - (with-selected-frame frame (load-theme 'doom-horizon t)))) - (load-theme 'doom-horizon t)) + (with-selected-frame frame (load-theme 'dracula t)))) + (load-theme 'dracula t)) (setq-default cursor-type '(bar . 1)) @@ -64,38 +86,33 @@ (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) ; Show dashboard when emacs is running as daemon ) -;Enable Centaur tabs -(centaur-tabs-mode t) -(setq centaur-tabs-set-bar 'over) -(setq centaur-tabs-set-modified-marker t) -;(setq centaur-tabs-modified-marker "*") -;Enable treemacs -(global-set-key (kbd "C-H-t") 'treemacs) +(setq-default display-line-numbers-width 4) + + + + + +(cua-mode 1) + + +;(global-set-key (kbd "C-∇") (kbd "C-H")) +;(global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207))) ;; Enable vertico (vertico-mode 1) (marginalia-mode 1) - ;(setq completion-styles '(orderless basic) ; completion-category-defaults nil ; completion-category-overrides '((file (styles partial-completion)))) -;CUA -(cua-mode 1) -(global-set-key (kbd "C-y") 'undo-redo) +(electric-pair-mode 1) -(global-set-key (kbd "C-") 'indent-rigidly-right-to-tab-stop) -(global-set-key (kbd "") 'indent-rigidly-left-to-tab-stop) +(global-undo-tree-mode 1) +(global-tab-line-mode 1) +(setq-default tab-width 4) -(define-key key-translation-map (kbd "") 'event-apply-hyper-modifier ) -(define-key key-translation-map (kbd "") 'event-apply-hyper-modifier ) -(define-key key-translation-map (kbd "∇") 'event-apply-hyper-modifier ) - -;(global-set-key (kbd "C-∇") (kbd "C-H")) -;(global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207))) - (load (concat materus/cfg "/lsp/default")) diff --git a/extraFiles/config/emacs/init.el b/extraFiles/config/emacs/init.el index a565857..1e2306f 100644 --- a/extraFiles/config/emacs/init.el +++ b/extraFiles/config/emacs/init.el @@ -1,4 +1,9 @@ (setq-default materus/nix-packages (require 'evil nil 'noerror)) + + + (unless materus/nix-packages (load (concat user-emacs-directory "etc/materus/packages"))) (load (concat user-emacs-directory "etc/materus/internals")) (load (concat user-emacs-directory "etc/materus/start")) +(when (file-exists-p custom-file) + (load custom-file))