From 8ced16020765c070aaebd990a41e5df1cbef106e Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Tue, 16 Jul 2024 21:31:03 +0200 Subject: [PATCH] working emacs --- hosts/vali/hermit/configuration.nix | 4 +-- modules/editors/default.nix | 2 +- modules/editors/emacs.nix | 4 --- modules/editors/kakoune/default.nix | 32 +++++++++++-------- modules/editors/kakoune/mappings.nix | 48 ++++++++++++++++++++++++++++ modules/editors/nvf/settings.nix | 4 +-- 6 files changed, 71 insertions(+), 23 deletions(-) diff --git a/hosts/vali/hermit/configuration.nix b/hosts/vali/hermit/configuration.nix index 2eb677c..d63df85 100644 --- a/hosts/vali/hermit/configuration.nix +++ b/hosts/vali/hermit/configuration.nix @@ -87,8 +87,8 @@ }; editors = { emacs = { - enable = false; - doom.enable = true; + enable = true; + doom.enable = false; }; helix.enable = true; kakoune.enable = true; diff --git a/modules/editors/default.nix b/modules/editors/default.nix index 4ae6df9..49ace18 100644 --- a/modules/editors/default.nix +++ b/modules/editors/default.nix @@ -1 +1 @@ -_: {imports = [./emacs.nix ./helix.nix ./kakoune.nix ./nvf];} +_: {imports = [./emacs.nix ./helix.nix ./kakoune ./nvf];} diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 611aa64..09f6e1f 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -48,10 +48,6 @@ in { # :tools editorconfig editorconfig-core-c # per-project style config # :tools lookup & :lang org +roam - sqlite - # :lang latex & :lang org (latex previews) - # :lang beancount - beancount ]; environment.variables.PATH = ["/home/vali/.config/emacs/bin"]; diff --git a/modules/editors/kakoune/default.nix b/modules/editors/kakoune/default.nix index 55c1958..a3cf646 100644 --- a/modules/editors/kakoune/default.nix +++ b/modules/editors/kakoune/default.nix @@ -2,17 +2,19 @@ config, lib, pkgs, + ... }: let inherit (config.modules.other.system) username; cfg = config.modules.editors.kakoune; inherit (lib) mkIf mkEnableOption; in { + imports = [./mappings.nix]; options.modules.editors.kakoune.enable = mkEnableOption "kakoune"; config.home-manager.users.${username}.programs.kakoune = mkIf cfg.enable { enable = true; config = { - autoComplete = true; - autoReload = true; + autoComplete = ["insert"]; + autoReload = "yes"; indentWidth = 4; tabStop = 4; incrementalSearch = false; @@ -27,24 +29,26 @@ in { lines = 4; columns = 4; }; + wrapLines = { + enable = true; + indent = true; + word = true; + }; + ui = { enableMouse = true; assistant = "none"; statusLine = "bottom"; - wrapLines = { - enable = true; - indent = true; - word = true; - }; }; - plugins = with pkgs.kakounePlugins; [ - auto-pairs-kak - fzf-kak - powerline-kak - byline-kak - kakoune-lsp - ]; }; + plugins = with pkgs.kakounePlugins; [ + auto-pairs-kak + fzf-kak + powerline-kak + byline-kak + kakoune-lsp + ]; + # extraConfig = ./kakrc; }; } diff --git a/modules/editors/kakoune/mappings.nix b/modules/editors/kakoune/mappings.nix index e69de29..59a0c99 100644 --- a/modules/editors/kakoune/mappings.nix +++ b/modules/editors/kakoune/mappings.nix @@ -0,0 +1,48 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (config.modules.other.system) username; +in { + config.home-manager.users.${username}.programs.kakoune.config.keyMappings = [ + { + mode = "normal"; + key = ""; + effect = ";,"; + docstring = "Press escape to clear highlighted text and collapse cursors"; + } + { + mode = "normal"; + key = ""; + effect = ":comment-line"; + docstring = "Comment a line with !"; + } + { + mode = "normal"; + key = "b"; + effect = ":db"; + docstring = "close current buffer"; + } + + { + mode = "normal"; + key = "n"; + effect = ":bp"; + docstring = "go to next buffer"; + } + { + mode = "normal"; + key = "m"; + effect = ":bn"; + docstring = "go to next buffer"; + } + { + mode = "normal"; + key = " f"; + effect = ":fzf-mode"; + docstring = "open fzf"; + } + ]; +} diff --git a/modules/editors/nvf/settings.nix b/modules/editors/nvf/settings.nix index 90e4e57..ffd99ca 100644 --- a/modules/editors/nvf/settings.nix +++ b/modules/editors/nvf/settings.nix @@ -66,8 +66,8 @@ in { additionalRuntimePaths = [ #(mkRuntimeDir "after") #(mkRuntimeDir "spell") - ./runtime/spell - ./runtime/after + ./runtime + ./runtime ]; # while I should be doing this in luaConfigRC below