Restore emacs and magit keybind w zed

This commit is contained in:
Emmet 2025-12-05 14:52:53 -06:00
parent d91cdb6f93
commit e3ac21a61d
3 changed files with 173 additions and 117 deletions

View file

@ -1,8 +1,15 @@
{ config, lib, pkgs, pkgs-stable, ... }: {
config,
lib,
pkgs,
pkgs-stable,
...
}:
let let
cfg = config.userSettings.emacs; cfg = config.userSettings.emacs;
in { in
{
options = { options = {
userSettings.emacs = { userSettings.emacs = {
enable = lib.mkEnableOption "Enable emacs"; enable = lib.mkEnableOption "Enable emacs";
@ -15,132 +22,161 @@ in {
}; };
## THIS IS BROKEN BECAUSE THEY CHANGED EMACS IN NIXPKGS I THINK ## THIS IS BROKEN BECAUSE THEY CHANGED EMACS IN NIXPKGS I THINK
config = lib.mkIf false { #config = lib.mkIf false {
#config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
(pkgs.emacsWithPackagesFromUsePackage { (pkgs.emacsWithPackagesFromUsePackage {
config = ./init.el; config = ./init.el;
package = pkgs.emacs-pgtk; package = pkgs.emacs-pgtk;
alwaysEnsure = false; alwaysEnsure = false;
extraEmacsPackages = epkgs: with epkgs; [ extraEmacsPackages =
org-modern olivetti epkgs: with epkgs; [
command-log-mode org-modern
vertico corfu hotfuzz orderless olivetti
evil evil-collection evil-snipe evil-owl evil-vimish-fold command-log-mode
dashboard doom-themes doom-modeline vertico
nerd-icons nerd-icons-dired nerd-icons-corfu corfu
nerd-icons-ibuffer nerd-icons-completion hotfuzz
yasnippet shackle orderless
projectile treemacs treemacs-projectile evil
treemacs-evil treemacs-nerd-icons evil-collection
treesit-grammars.with-all-grammars evil-snipe
git-timemachine wgrep evil-owl
magit magit-todos evil-vimish-fold
undo-fu undo-fu-session dashboard
org-roam org-node org-node-fakeroam doom-themes
vterm vterm-toggle sudo-edit doom-modeline
direnv nerd-icons
svelte-mode nerd-icons-dired
typescript-mode nerd-icons-corfu
sass-mode nerd-icons-ibuffer
rainbow-mode nerd-icons-completion
default-text-scale yasnippet
(epkgs.callPackage ( shackle
{ lib, trivialBuild }: projectile
treemacs
treemacs-projectile
treemacs-evil
treemacs-nerd-icons
treesit-grammars.with-all-grammars
git-timemachine
wgrep
magit
magit-todos
undo-fu
undo-fu-session
org-roam
org-node
org-node-fakeroam
vterm
vterm-toggle
sudo-edit
direnv
svelte-mode
typescript-mode
sass-mode
rainbow-mode
default-text-scale
(epkgs.callPackage (
{ lib, trivialBuild }:
trivialBuild { trivialBuild {
pname = "web-mode"; pname = "web-mode";
version = "17.3.20"; version = "17.3.20";
src = builtins.fetchGit { src = builtins.fetchGit {
url = "https://github.com/fxbois/web-mode.git"; url = "https://github.com/fxbois/web-mode.git";
rev = "0c83581d1e93d1d802c730a1d5e90cd1c740e1b2"; rev = "0c83581d1e93d1d802c730a1d5e90cd1c740e1b2";
ref = "main"; ref = "main";
}; };
meta = with lib; { meta = with lib; {
description = "web template editing mode for emacs"; description = "web template editing mode for emacs";
homepage = "https://web-mode.org/"; homepage = "https://web-mode.org/";
license = licenses.gpl3; license = licenses.gpl3;
platforms = platforms.all; platforms = platforms.all;
}; };
} }
) {}) ) { })
gdscript-mode gdscript-mode
nix-mode nix-mode
python python-mode python
lsp-mode flycheck lsp-ui lsp-treemacs python-mode
# fix ultra-scroll lsp-mode
(epkgs.callPackage ( flycheck
{ lib, trivialBuild }: lsp-ui
lsp-treemacs
# fix ultra-scroll
(epkgs.callPackage (
{ lib, trivialBuild }:
trivialBuild { trivialBuild {
pname = "ultra-scroll"; pname = "ultra-scroll";
version = "0.2.0"; version = "0.2.0";
src = builtins.fetchGit { src = builtins.fetchGit {
url = "https://github.com/jdtsmith/ultra-scroll.git"; url = "https://github.com/jdtsmith/ultra-scroll.git";
rev = "64ad7be02e11317576498dabb15c92cf31e2c04c"; rev = "64ad7be02e11317576498dabb15c92cf31e2c04c";
ref = "main"; ref = "main";
}; };
meta = with lib; { meta = with lib; {
description = "scroll Emacs like lightning"; description = "scroll Emacs like lightning";
homepage = "https://github.com/jdtsmith/ultra-scroll"; homepage = "https://github.com/jdtsmith/ultra-scroll";
license = licenses.gpl3; license = licenses.gpl3;
platforms = platforms.all; platforms = platforms.all;
}; };
} }
) {}) ) { })
(epkgs.callPackage ( (epkgs.callPackage (
{ lib, trivialBuild }: { lib, trivialBuild }:
trivialBuild { trivialBuild {
pname = "lsp-treemacs-nerd-icons"; pname = "lsp-treemacs-nerd-icons";
version = "2efa09a-unstable"; version = "2efa09a-unstable";
src = builtins.fetchGit { src = builtins.fetchGit {
url = "https://github.com/Velnbur/lsp-treemacs-nerd-icons.git"; url = "https://github.com/Velnbur/lsp-treemacs-nerd-icons.git";
rev = "2efa09a701b8b455bfb66529454f27c30f7462dc"; rev = "2efa09a701b8b455bfb66529454f27c30f7462dc";
ref = "master"; ref = "master";
}; };
buildInputs = with pkgs.emacsPackages; [ buildInputs = with pkgs.emacsPackages; [
lsp-treemacs lsp-treemacs
treemacs treemacs
nerd-icons nerd-icons
]; ];
meta = with lib; { meta = with lib; {
description = "Use nerd icons for lsp-mode and lsp-treemacs"; description = "Use nerd icons for lsp-mode and lsp-treemacs";
homepage = "https://github.com/Velnbur/lsp-treemacs-nerd-icons"; homepage = "https://github.com/Velnbur/lsp-treemacs-nerd-icons";
license = licenses.gpl3; license = licenses.gpl3;
platforms = platforms.all; platforms = platforms.all;
}; };
} }
) {}) ) { })
(epkgs.callPackage ( (epkgs.callPackage (
{ lib, trivialBuild }: { lib, trivialBuild }:
trivialBuild { trivialBuild {
pname = "scratch-plus"; pname = "scratch-plus";
version = "2efa09a-unstable"; version = "2efa09a-unstable";
src = builtins.fetchGit { src = builtins.fetchGit {
url = "https://git.sr.ht/~swflint/scratch-plus"; url = "https://git.sr.ht/~swflint/scratch-plus";
rev = "b794901f968000f6e338808307385b683b79ec8b"; rev = "b794901f968000f6e338808307385b683b79ec8b";
ref = "main"; ref = "main";
}; };
meta = with lib; { meta = with lib; {
description = "Better scratch buffers"; description = "Better scratch buffers";
homepage = "https://git.sr.ht/~swflint/scratch-plus"; homepage = "https://git.sr.ht/~swflint/scratch-plus";
license = licenses.gpl3; license = licenses.gpl3;
platforms = platforms.all; platforms = platforms.all;
}; };
} }
) {}) ) { })
]; ];
}) })
fira-code fira-code
nerd-fonts.fira-code nerd-fonts.fira-code
@ -148,8 +184,8 @@ in {
home.file.".config/emacs/init.el".source = ./init.el; home.file.".config/emacs/init.el".source = ./init.el;
home.file.".config/emacs/lib".source = ./lib; home.file.".config/emacs/lib".source = ./lib;
home.file.".config/emacs/themes/doom-stylix-theme.el".source = config.lib.stylix.colors { home.file.".config/emacs/themes/doom-stylix-theme.el".source = config.lib.stylix.colors {
template = builtins.readFile ./lib/doom-stylix-theme.el.mustache; template = builtins.readFile ./lib/doom-stylix-theme.el.mustache;
extension = ".el"; extension = ".el";
}; };
home.file.".config/emacs/sysvars.el".text = '' home.file.".config/emacs/sysvars.el".text = ''
;;; sysvars.el --- imported variables from nixos config -*- lexical-binding: t; no-byte-compile: t; -*- ;;; sysvars.el --- imported variables from nixos config -*- lexical-binding: t; no-byte-compile: t; -*-
@ -166,6 +202,8 @@ in {
;;; sysvars.el ends here ;;; sysvars.el ends here
''; '';
wayland.windowManager.hyprland.settings.exec-once = lib.optionals config.wayland.windowManager.hyprland.enable [ "emacs --daemon" ]; wayland.windowManager.hyprland.settings.exec-once =
lib.optionals config.wayland.windowManager.hyprland.enable
[ "emacs --daemon" ];
}; };
} }

View file

@ -452,13 +452,14 @@
;; Enable corfu ;; Enable corfu
(use-package corfu (use-package corfu
:custom :custom
(corfu-auto t)
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous' (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
;; (corfu-preview-current nil) ;; Disable current candidate preview (corfu-preview-current t) ;; Disable current candidate preview
(corfu-preselect 'prompt) ;; Preselect the prompt (corfu-preselect 'prompt) ;; Preselect the prompt
(corfu-on-exact-match 'insert) ;; Configure handling of exact matches (corfu-on-exact-match 'insert) ;; Configure handling of exact matches
(corfu-auto nil) ;; auto complete (corfu-auto-delay 0.15) ;; wait half a second though
(corfu-auto-delay 1.2) ;; wait half a second though (corfu-auto-prefix 2) ;; also only for words 2 or more
(corfu-auto-prefix 5) ;; also only for words 3 or more (corfu-min-width 120)
(defun corfu-lsp-setup () (defun corfu-lsp-setup ()
(setq-local completion-styles '(orderless flex hotfuzz) (setq-local completion-styles '(orderless flex hotfuzz)
completion-category-defaults nil)) completion-category-defaults nil))
@ -1094,5 +1095,7 @@ Made for `org-tab-first-hook' in evil-mode."
(use-package rainbow-mode) (use-package rainbow-mode)
(set-frame-font "FiraCode Nerd Font")
(provide 'init) (provide 'init)
;;; init.el ends here ;;; init.el ends here

View file

@ -128,6 +128,12 @@ in
"task_name" = "gitu"; "task_name" = "gitu";
} }
]; ];
"space g G" = [
"task::Spawn"
{
"task_name" = "magit";
}
];
"space o d" = [ "space o d" = [
"task::Spawn" "task::Spawn"
{ {
@ -221,6 +227,15 @@ in
use_new_terminal = false; use_new_terminal = false;
hide = "on_success"; hide = "on_success";
} }
{
label = "magit";
command = "emacsclient -c --eval '(magit-status)' &> /dev/null & disown; exit;";
reveal = "always";
reveal_target = "center";
allow_concurrent_runs = false;
use_new_terminal = false;
hide = "on_success";
}
{ {
label = "yazi"; label = "yazi";
command = "yazi"; command = "yazi";