configurations: emacs, move config to org file

This commit is contained in:
Mateusz Słodkowicz 2024-11-10 11:50:21 +01:00
parent 8dbe62606b
commit c390ed0977
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
16 changed files with 481 additions and 421 deletions

View File

@ -17,7 +17,7 @@
enableTerminal = lib.mkDefault true;
enableTerminalExtra = lib.mkDefault true;
enableNixDevel = lib.mkDefault true;
editor.emacs.enable = false;
editor.emacs.enable = true;
editor.code.fhs.enable = true;
editor.code.fhs.packages = (ps: with ps; let llvmpkgs = llvmPackages_18; in [
llvmpkgs.clang

View File

@ -1,5 +1,21 @@
{ config, lib, pkgs, materusArg, ... }:
{ config, lib, pkgs, materusArg, materusCfg, ... }:
let
emacs-git =
materusCfg.configInputs.emacs-overlay.packages.x86_64-linux.emacs-git;
materus-config = e:
e.trivialBuild {
pname = "materus-config";
src = pkgs.writeText "materus-config.el" ''
(when (file-exists-p "${config.programs.emacs.package}/opt/emacs/buildtime")
(setq emacs-build-time (decode-time (seconds-to-time (string-to-number (with-temp-buffer
(insert-file-contents "${config.programs.emacs.package}/opt/emacs/buildtime")
(buffer-string)))))))
(provide 'materus-config)
'';
version = "1.0.0";
};
configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/";
inits = import ./init.nix {
path = configPath;
@ -7,66 +23,8 @@ let
};
packages = epkgs:
with epkgs; [
elcord
persp-mode
dashboard
magit
avy
corfu
vterm
projectile
company
clipetty
which-key
iedit
hideshowvis
evil
treemacs-evil
treemacs
treemacs-nerd-icons
treemacs-perspective
treemacs-icons-dired
treemacs-magit
treemacs-projectile
tree-edit
vertico
marginalia
nerd-icons
nerd-icons-completion
perspective
minions
telephone-line
rainbow-delimiters
use-package
cmake-mode
lsp-mode
lsp-java
lsp-jedi
lsp-haskell
lsp-ui
lsp-treemacs
dap-mode
d-mode
lua-mode
multiple-cursors
org
org-rainbow-tags
org-roam
org-roam-ui
org-review
csharp-mode
markdown-mode
json-mode
nix-mode
no-littering
right-click-context
dracula-theme
doom-themes
orderless
popper
undo-tree
bash-completion
consult
(materus-config epkgs)
treesit-grammars.with-all-grammars
];
default-config = ''
@ -77,6 +35,7 @@ let
emacsEnv = pkgs.buildEnv {
name = "emacs-env";
paths = with pkgs; [
nixfmt-classic
python3
lua
multimarkdown
@ -101,37 +60,71 @@ let
(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
{
in {
options.materus.profile.editor.emacs.enable =
materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
config = lib.mkIf cfg.enable {
home.activation.emacsCompile = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
mkdir -p ${config.xdg.configHome}/emacs/var/backups
mkdir -p ${config.xdg.configHome}/emacs/var/recovery
mkdir -p ${config.xdg.configHome}/emacs/etc
mkdir -p ${config.xdg.configHome}/emacs/var/backups
run ${config.programs.emacs.finalPackage}/bin/emacs --batch \
--eval '(setq warning-minimum-log-level :error)' \
--eval '(byte-recompile-directory "${config.xdg.configHome}/emacs/etc/materus" 0 t)' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/etc/materus/emacs-config.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")'
'';
xdg.configFile = {
"emacs/early-init.el".text = inits.earlyInitText;
"emacs/init.el".text = default-config;
"emacs/etc/materus" =
{
"emacs/etc/materus" = {
source = configPath + "etc/materus";
recursive = true;
};
};
xdg.desktopEntries.emacs = {
name = "Emacs";
genericName = "Edytor tekstu";
comment = "Edytuj tekst";
exec = ''env COLORTERM=truecolor emacsclient -a "" -c %F'';
icon = "emacs";
terminal = false;
type = "Application";
categories = [ "Development" "TextEditor" ];
mimeType = [
"text/english"
"text/plain"
"text/x-makefile"
"text/x-c++hdr"
"text/x-c++src"
"text/x-chdr"
"text/x-csrc"
"text/x-java"
"text/x-moc"
"text/x-pascal"
"text/x-tcl"
"text/x-tex"
"application/x-shellscript"
"text/x-c"
"text/x-c++"
"x-scheme-handler/org-protocol"
];
actions.new-window = {
exec = ''env COLORTERM=truecolor emacsclient -a "" -c %F'';
name = "Nowe okno";
};
actions.no-daemon = {
exec = "env COLORTERM=truecolor emacs %F";
name = "Instancja samodzielna";
};
};
programs.emacs = {
enable = true;
package =
lib.mkDefault (pkgs.emacs29.override {
package = lib.mkDefault ((emacs-git.override {
withSQLite3 = true;
withWebP = true;
withX = true;
@ -139,8 +132,13 @@ in
withAlsaLib = true;
withGconf = true;
withImageMagick = true;
withXwidgets = true;
});
}).overrideAttrs (f: p: {
postInstall = p.postInstall + ''
rm -fr $out/share/applications/*
mkdir -p $out/opt/emacs
date +%s | tr -d '\n' > $out/opt/emacs/buildtime
'';
}));
extraPackages = epkgs: (packages epkgs);
};

View File

@ -13,7 +13,7 @@ in
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
defaultEditor = lib.mkDefault false;
extraConfig = ''

View File

@ -1,3 +1,4 @@
{config, pkgs, lib, ...}:
{
imports = [
@ -6,4 +7,12 @@
./fish.nix
./starship.nix
];
home.sessionVariables = {
EDITOR = lib.mkDefault (if (config.materus.profile.editor.emacs.enable) then
lib.getBin (pkgs.writeShellScript "editor" ''${config.programs.emacs.finalPackage}/bin/emacsclient --alternate-editor= -c -nw $@'')
else "${pkgs.micro}/bin/micro");
VISUAL = lib.mkDefault (if (config.materus.profile.editor.emacs.enable) then
lib.getBin (pkgs.writeShellScript "editor-visual" ''exec env COLORTERM=truecolor ${config.programs.emacs.finalPackage}/bin/emacsclient --alternate-editor= -c $@'')
else "${pkgs.micro}/bin/micro");
};
}

View File

@ -1,21 +1,15 @@
(defvar materus/init-early t) ; Var to ensure early-init loaded
(setq materus/init-early t) ; Probably useless
(defvar materus/init-early t)
(setq materus/init-early t)
(when (boundp 'native-comp-eln-load-path)
(startup-redirect-eln-cache (expand-file-name "/var/eln-cache/" user-emacs-directory)))
(tool-bar-mode -1)
(setq initial-major-mode 'fundamental-mode)
(setq-default package-quickstart t)
(setq native-comp-async-report-warnings-errors nil)
(setq package-enable-at-startup nil)
(setq native-comp-speed 3)
(add-hook 'emacs-startup-hook (lambda () (package-initialize)
(setq gc-cons-threshold 100000000 ; ~100mb
gc-cons-percentage 0.1)
))
(setq package-enable-at-startup nil)
(unless (daemonp)
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
gc-cons-percentage 0.6)
@ -30,6 +24,9 @@
)
)
(when (boundp 'native-comp-eln-load-path) ; Change dir for eln-cache
(startup-redirect-eln-cache (expand-file-name "/var/eln-cache/" user-emacs-directory)))
(when (and (fboundp 'startup-redirect-eln-cache)
(fboundp 'native-comp-available-p)
(native-comp-available-p))
@ -39,6 +36,8 @@
(setq auto-save-default nil)
(setq backup-directory-alist
`((".*" . ,(concat user-emacs-directory "var/backups/"))))
`((".*" . ,(concat user-emacs-directory "var/backups/")))) ; Change backup and auto save dir to var dir
(setq auto-save-file-name-transforms
`((".*" ,(concat user-emacs-directory "var/recovery/") t)))
(setq auto-save-list-file-prefix (concat user-emacs-directory "var/auto-save/sessions/"))
(setq custom-file (concat user-emacs-directory "etc/custom.el"))

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,374 @@
(unless (file-exists-p (concat user-emacs-directory "etc/materus/emacs-config.elc"))
(byte-compile-file (concat user-emacs-directory "etc/materus/emacs-config.el")))
(unless (file-exists-p (concat user-emacs-directory "init.elc"))
(byte-compile-file (concat user-emacs-directory "init.el")))
(unless (file-exists-p (concat user-emacs-directory "early-init.elc"))
(byte-compile-file (concat user-emacs-directory "early-init.el")))
(require 'cl-lib)
(require 'package)
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))
(add-to-list 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(defvar materus/packages
'(
use-package
elcord
persp-mode
dashboard
magit
git-timemachine
avy
corfu
vterm
projectile
company
clipetty
which-key
iedit
hideshowvis
evil
treemacs-evil
treemacs
treemacs-nerd-icons
treemacs-perspective
treemacs-icons-dired
treemacs-magit
treemacs-projectile
tree-edit
vertico
marginalia
nerd-icons
nerd-icons-completion
perspective
minions
doom-modeline
rainbow-delimiters
rainbow-mode
use-package
cmake-mode
lsp-mode
lsp-java
lsp-jedi
lsp-haskell
lsp-ui
lsp-treemacs
gradle-mode
groovy-mode
kotlin-mode
dap-mode
d-mode
lua-mode
multiple-cursors
org
org-contrib
org-ql
org-rainbow-tags
org-roam
org-roam-ui
org-review
org-superstar
org-auto-tangle
visual-fill-column
csharp-mode
markdown-mode
json-mode
nix-mode
no-littering
right-click-context
dracula-theme
doom-themes
doom-modeline
orderless
popper
undo-tree
bash-completion
consult
eldoc-box
yasnippet
async
request
nix-ts-mode
markdown-ts-mode
llvm-ts-mode
treesit-fold
treesit-auto
tree-sitter-langs
eat
vlf
edit-indirect
zones
sudo-edit
toc-org
eshell-vterm
empv
volatile-highlights
)
"A list of packages to ensure are installed at launch.")
(defun materus/packages-installed-p ()
(cl-loop for p in materus/packages
when (not (package-installed-p p)) do (cl-return nil)
finally (cl-return t)))
(defun materus/install-packages ()
(unless (materus/packages-installed-p)
(package-refresh-contents)
(dolist (p materus/packages)
(when (not (package-installed-p p))
(package-install p)))))
(materus/install-packages)
(require 'recentf)
(use-package no-littering
:config
(add-to-list 'recentf-exclude
(recentf-expand-file-name no-littering-var-directory))
(add-to-list 'recentf-exclude
(recentf-expand-file-name no-littering-etc-directory)))
(context-menu-mode 1)
(setq mouse-wheel-follow-mouse 't)
(setq scroll-step 1)
(setq mouse-drag-and-drop-region t)
(xterm-mouse-mode 1)
(pixel-scroll-precision-mode 1)
(setq-default pixel-scroll-precision-large-scroll-height 10.0)
(setq frame-inhibit-implied-resize t)
(setq frame-resize-pixelwise t)
(setq window-resize-pixelwise t)
(when (display-graphic-p)
(set-frame-font "Hack Nerd Font" nil t)
)
(setq-default display-line-numbers-width 4)
(global-tab-line-mode 1)
(setq-default tab-width 4)
(tool-bar-mode -1)
(setq read-process-output-max (* 1024 1024 3))
(setq ring-bell-function 'ignore)
(setq-default cursor-type '(bar . 1))
;; Delimiters
(use-package rainbow-delimiters :hook
(prog-mode . rainbow-delimiters-mode)
:config
(custom-set-faces
'(rainbow-delimiters-depth-1-face ((t (:foreground "#FFFFFF"))))
'(rainbow-delimiters-depth-2-face ((t (:foreground "#FFFF00"))))
'(rainbow-delimiters-depth-5-face ((t (:foreground "#6A5ACD"))))
'(rainbow-delimiters-unmatched-face ((t (:foreground "#FF0000")))))
)
;; Nerd Icons
(use-package nerd-icons)
;; Theme
(use-package dracula-theme :config
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame (load-theme 'dracula t))))
(load-theme 'dracula t)))
(defun startup-screen-advice (orig-fun &rest args)
(when (= (seq-count #'buffer-file-name (buffer-list)) 0)
(apply orig-fun args)))
(advice-add 'display-startup-screen :around #'startup-screen-advice) ; Hide startup screen if started with file
(use-package dashboard
:after (nerd-icons)
:config
(setq dashboard-center-content t)
(setq dashboard-display-icons-p t)
(setq dashboard-icon-type 'nerd-icons)
(dashboard-setup-startup-hook)
(when (daemonp)
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) ; Show dashboard when emacs is running as daemon
)
)
(use-package doom-modeline
:init (setq doom-modeline-support-imenu t)
:hook (after-init . doom-modeline-mode)
:config
(setq doom-modeline-icon t)
(setq display-time-24hr-format t)
(display-time-mode 1))
(use-package minions
:hook (after-init . minions-mode))
(use-package org
:mode (("\\.org$" . org-mode))
:hook
((org-mode . org-indent-mode)
(org-mode . (lambda ()
(setq-local electric-pair-inhibit-predicate
`(lambda (c)
(if (char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))))
:config
(require 'org-mouse)
(require 'org-tempo))
(use-package org-superstar
:after (org)
:hook
(org-mode . org-superstar-mode))
:config
(setq org-superstar-leading-bullet " ")
(use-package org-auto-tangle
:after (org)
:hook (org-mode . org-auto-tangle-mode))
(use-package toc-org
:after (org)
:hook
((org-mode . toc-org-mode )
(markdown-mode . toc-org-mode)))
(use-package consult)
(use-package marginalia)
(use-package orderless)
(use-package which-key
:config
(which-key-mode 1))
(use-package vertico
:after (consult marginalia)
:config
(setq completion-in-region-function
(lambda (&rest args)
(apply (if vertico-mode
#'consult-completion-in-region
#'completion--in-region)
args)))
(vertico-mode 1)
(marginalia-mode 1))
(use-package company
:hook (after-init-hook . global-company-mode))
(electric-pair-mode 1)
(electric-indent-mode 0)
(defun materus/elcord-toggle (&optional _frame)
"Toggle elcord based on visible frames"
(if (> (length (frame-list)) 1)
(elcord-mode 1)
(elcord-mode -1))
)
(use-package elcord
:init (unless (daemonp) (elcord-mode 1))
:config
(add-hook 'after-delete-frame-functions 'materus/elcord-toggle)
(add-hook 'server-after-make-frame-hook 'materus/elcord-toggle))
(use-package undo-tree
:init (global-undo-tree-mode 1)
:config
(defvar materus/undo-tree-dir (concat user-emacs-directory "var/undo-tree/"))
(unless (file-exists-p materus/undo-tree-dir)
(make-directory materus/undo-tree-dir t))
(setq undo-tree-visualizer-diff t)
(setq undo-tree-history-directory-alist `(("." . ,materus/undo-tree-dir )))
(setq undo-tree-visualizer-timestamps t)
)
(use-package projectile)
(use-package treemacs)
(use-package treemacs-projectile
:after (projectile treemacs))
(use-package treemacs-nerd-icons
:after (nerd-icons treemacs))
(use-package lsp-mode)
(use-package lsp-ui)
(use-package dap-mode)
(use-package dap-lldb)
(use-package dap-gdb-lldb)
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
(or
(when (equal (following-char) ?#)
(let ((bytecode (read (current-buffer))))
(when (byte-code-function-p bytecode)
(funcall bytecode))))
(apply old-fn args)))
(advice-add (if (progn (require 'json)
(fboundp 'json-parse-buffer))
'json-parse-buffer
'json-read)
:around
#'lsp-booster--advice-json-parse)
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
"Prepend emacs-lsp-booster command to lsp CMD."
(let ((orig-result (funcall old-fn cmd test?)))
(if (and (not test?) ;; for check lsp-server-present?
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
lsp-use-plists
(not (functionp 'json-rpc-connection)) ;; native json-rpc
(executable-find "emacs-lsp-booster"))
(progn
(when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
(setcar orig-result command-from-exec-path))
(message "Using emacs-lsp-booster for %s!" orig-result)
(cons "emacs-lsp-booster" orig-result))
orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
(with-eval-after-load 'lsp-mode
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "nixd")
:major-modes '(nix-mode)
:priority 0
:server-id 'nixd)))
(setq lsp-nix-nixd-formatting-command "nixfmt")
(add-hook 'nix-mode-hook 'lsp-deferred)
(add-hook 'nix-mode-hook 'display-line-numbers-mode)
(add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode)
(add-hook 'emacs-lisp-mode-hook 'company-mode)
(add-hook 'c-mode-hook 'lsp-deferred)
(add-hook 'c-mode-hook 'display-line-numbers-mode)
(add-hook 'c++-mode-hook 'lsp-deferred)
(add-hook 'c++-mode-hook 'display-line-numbers-mode)
(add-hook 'java-mode-hook 'lsp-deferred)
;; 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 "C-<iso-lefttab>" #'indent-rigidly-left-to-tab-stop)
(keymap-set global-map "C-<tab>" #'indent-rigidly-right-to-tab-stop)
(define-key key-translation-map (kbd "<XF86Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "<Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "") 'event-apply-hyper-modifier )
(global-set-key (kbd "C-H-t") 'treemacs)
(cua-mode 1)
;;; (global-set-key (kbd "C-∇") (kbd "C-H"))
;;; (global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207)))
;;; (setq completion-styles '(orderless basic)
;;; completion-category-defaults nil
;;; completion-category-overrides '((file (styles partial-completion))))

View File

@ -1,59 +0,0 @@
(require 'recentf)
(require 'no-littering)
(add-to-list 'recentf-exclude
(recentf-expand-file-name no-littering-var-directory))
(add-to-list 'recentf-exclude
(recentf-expand-file-name no-littering-etc-directory))
(setq native-comp-async-report-warnings-errors nil)
(setq package-enable-at-startup nil)
(setq frame-inhibit-implied-resize t)
(defvar materus/init-early nil)
(unless materus/init-early
(tool-bar-mode -1)
(setq initial-major-mode 'fundamental-mode)
(setq-default package-quickstart t)
(setq native-comp-speed 3)
(add-hook 'emacs-startup-hook (lambda () (package-initialize)
(setq gc-cons-threshold 100000000 ; ~100mb
gc-cons-percentage 0.1)
))
(unless (daemonp)
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
gc-cons-percentage 0.6)
(setq package-enable-at-startup nil)
(advice-add #'tty-run-terminal-initialization :override #'ignore)
(add-hook 'window-setup-hook
(lambda ()
(advice-remove #'tty-run-terminal-initialization #'ignore)
(tty-run-terminal-initialization (selected-frame) nil t)
)
)
)
)
(setq custom-file (concat user-emacs-directory "etc/custom.el"))
;;. Graphical
(setq frame-resize-pixelwise t)
(setq window-resize-pixelwise t)
(when (display-graphic-p)
(set-frame-font "Hack Nerd Font" nil t)
)
(xterm-mouse-mode 1)
(setq read-process-output-max (* 1024 1024 3))
(setq ring-bell-function 'ignore)

View File

@ -1,5 +0,0 @@
(add-hook 'c-mode-hook 'lsp-deferred)
(add-hook 'c-mode-hook 'display-line-numbers-mode)
(add-hook 'c++-mode-hook 'lsp-deferred)
(add-hook 'c++-mode-hook 'display-line-numbers-mode)

View File

@ -1,52 +0,0 @@
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
(or
(when (equal (following-char) ?#)
(let ((bytecode (read (current-buffer))))
(when (byte-code-function-p bytecode)
(funcall bytecode))))
(apply old-fn args)))
(advice-add (if (progn (require 'json)
(fboundp 'json-parse-buffer))
'json-parse-buffer
'json-read)
:around
#'lsp-booster--advice-json-parse)
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
"Prepend emacs-lsp-booster command to lsp CMD."
(let ((orig-result (funcall old-fn cmd test?)))
(if (and (not test?) ;; for check lsp-server-present?
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
lsp-use-plists
(not (functionp 'json-rpc-connection)) ;; native json-rpc
(executable-find "emacs-lsp-booster"))
(progn
(when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
(setcar orig-result command-from-exec-path))
(message "Using emacs-lsp-booster for %s!" orig-result)
(cons "emacs-lsp-booster" orig-result))
orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
(require 'lsp-mode)
(require 'lsp-ui)
(require 'dap-lldb)
(require 'dap-gdb-lldb)
(with-eval-after-load 'lsp-mode
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "nixd")
:major-modes '(nix-mode)
:priority 0
:server-id 'nixd)))
(load (concat materus/cfg "/lsp/cpp"))
(load (concat materus/cfg "/lsp/java"))
(load (concat materus/cfg "/lsp/nix"))
(load (concat materus/cfg "/lsp/lisp"))

View File

@ -1 +0,0 @@
(add-hook 'java-mode-hook 'lsp-deferred)

View File

@ -1,2 +0,0 @@
(add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode)
(add-hook 'emacs-lisp-mode-hook 'company-mode)

View File

@ -1,2 +0,0 @@
(add-hook 'nix-mode-hook 'lsp-deferred)
(add-hook 'nix-mode-hook 'display-line-numbers-mode)

View File

@ -1,78 +0,0 @@
(defvar bootstrap-version)
(defvar straight-base-dir)
(setq straight-base-dir (concat user-emacs-directory "var/" ))
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'elcord)
(straight-use-package 'persp-mode)
(straight-use-package 'dashboard)
(straight-use-package 'magit)
(straight-use-package 'avy)
(straight-use-package 'corfu)
(straight-use-package 'vterm)
(straight-use-package 'centaur-tabs)
(straight-use-package 'projectile)
(straight-use-package 'company)
(straight-use-package 'clipetty)
(straight-use-package 'which-key)
(straight-use-package 'iedit)
(straight-use-package 'hideshowvis)
(straight-use-package 'evil)
(straight-use-package 'treemacs-evil)
(straight-use-package 'treemacs)
(straight-use-package 'treemacs-nerd-icons)
(straight-use-package 'treemacs-perspective)
(straight-use-package 'treemacs-icons-dired)
(straight-use-package 'treemacs-magit)
(straight-use-package 'treemacs-projectile)
(straight-use-package 'tree-edit)
(straight-use-package 'vertico)
(straight-use-package 'marginalia)
(straight-use-package 'nerd-icons)
(straight-use-package 'nerd-icons-completion)
(straight-use-package 'perspective)
(straight-use-package 'minions)
(straight-use-package 'telephone-line)
(straight-use-package 'rainbow-delimiters)
(straight-use-package 'use-package)
(straight-use-package 'cmake-mode)
(straight-use-package 'lsp-mode)
(straight-use-package 'lsp-java)
(straight-use-package 'lsp-jedi)
(straight-use-package 'lsp-haskell)
(straight-use-package 'lsp-ui)
(straight-use-package 'lsp-treemacs)
(straight-use-package 'dap-mode)
(straight-use-package 'd-mode)
(straight-use-package 'lua-mode)
(straight-use-package 'multiple-cursors)
(straight-use-package 'org)
(straight-use-package 'org-rainbow-tags)
(straight-use-package 'org-roam)
(straight-use-package 'org-roam-ui)
(straight-use-package 'org-review)
(straight-use-package 'csharp-mode)
(straight-use-package 'markdown-mode)
(straight-use-package 'json-mode)
(straight-use-package 'nix-mode)
(straight-use-package 'no-littering)
(straight-use-package 'right-click-context)
(straight-use-package 'dracula-theme)
(straight-use-package 'doom-themes)
(straight-use-package 'orderless)
(straight-use-package 'undo-tree)
(straight-use-package 'bash-completion)
(straight-use-package 'consult)

View File

@ -1,118 +0,0 @@
(defvar materus/cfg nil)
(setq materus/cfg (concat user-emacs-directory "etc/materus"))
; Load packages
(require 'telephone-line)
(require 'elcord)
(require 'dashboard)
(require 'minions)
(require 'dracula-theme)
(require 'nerd-icons)
(require 'projectile)
(require 'treemacs)
(require 'treemacs-projectile)
(require 'treemacs-nerd-icons)
(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 "<backtab>" #'indent-rigidly-left-to-tab-stop)
(keymap-set global-map "C-<tab>" #'indent-for-tab-commandn)
(keymap-set vertico-map "TAB" #'vertico-insert)
(define-key key-translation-map (kbd "<XF86Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "<Calculator>") '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 'dracula t))))
(load-theme 'dracula t))
(setq-default cursor-type '(bar . 1))
(pixel-scroll-precision-mode 1)
(context-menu-mode 1)
(setq mouse-wheel-follow-mouse 't)
(setq scroll-step 1)
(setq mouse-drag-and-drop-region t)
(telephone-line-mode 1)
(setq-default pixel-scroll-precision-large-scroll-height 10.0)
(minions-mode 1)
(unless (daemonp)
(elcord-mode 1))
;Hide startup screen if started with file
(defun startup-screen-advice (orig-fun &rest args)
(when (= (seq-count #'buffer-file-name (buffer-list)) 0)
(apply orig-fun args)))
(advice-add 'display-startup-screen :around #'startup-screen-advice)
;Enable dashboard
(setq dashboard-center-content t)
(setq dashboard-display-icons-p t)
(setq dashboard-icon-type 'nerd-icons)
(dashboard-setup-startup-hook)
(when (daemonp)
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) ; Show dashboard when emacs is running as daemon
)
(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))))
(electric-pair-mode 1)
(global-undo-tree-mode 1)
(global-tab-line-mode 1)
(setq-default tab-width 4)
(load (concat materus/cfg "/lsp/default"))

View File

@ -1,9 +1,5 @@
(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"))
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
(cua-mode 0) ; To load cua variables/functions but not set it up yet
(load (concat user-emacs-directory "etc/materus/emacs-config"))
(when (file-exists-p custom-file)
(load custom-file))