From 309c858862d063915a31c5b1d2f44e4f72a16574 Mon Sep 17 00:00:00 2001 From: mat ess Date: Thu, 21 Jul 2022 00:38:26 -0400 Subject: [PATCH] More kakoune tweaks --- darwin/homebrew.nix | 8 +++--- flake.lock | 19 ++++++++++++- flake.nix | 7 ++++- home/git.nix | 4 +-- home/kakoune.nix | 61 ++++++++++++++++++++++++++++++++++------- home/shells.nix | 9 ++++-- pkgs/tokyonight-kak.nix | 18 ++++++++++++ 7 files changed, 105 insertions(+), 21 deletions(-) create mode 100644 pkgs/tokyonight-kak.nix diff --git a/darwin/homebrew.nix b/darwin/homebrew.nix index 55bfe7b..4d81f83 100644 --- a/darwin/homebrew.nix +++ b/darwin/homebrew.nix @@ -60,15 +60,15 @@ in "jitsi-meet" "knockknock" "lulu" - "mullvadvpn" + # "mullvadvpn" "origin" "rectangle" "signal" "steam" "transmission" - "twitch" - "utm" - "zoom" + # "twitch" + # "utm" + # "zoom" ]; # Configuration related to casks diff --git a/flake.lock b/flake.lock index 055543f..fb68150 100644 --- a/flake.lock +++ b/flake.lock @@ -163,7 +163,24 @@ "luar-src": "luar-src", "nixpkgs": "nixpkgs", "nixpkgs-master": "nixpkgs-master", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgs-unstable": "nixpkgs-unstable", + "tokyonight-kak-src": "tokyonight-kak-src" + } + }, + "tokyonight-kak-src": { + "flake": false, + "locked": { + "lastModified": 1636104069, + "narHash": "sha256-dFe1iGLDuSGlpdI4AxR613KjhIGjbvKbrK/TPrpMJ4Y=", + "owner": "HeavyRain266", + "repo": "tokyonight.kak", + "rev": "f7ebeea07818df8ee7ea8e71b4dbfd3c0afdc05b", + "type": "github" + }, + "original": { + "owner": "HeavyRain266", + "repo": "tokyonight.kak", + "type": "github" } }, "utils": { diff --git a/flake.nix b/flake.nix index 515f8c6..a6319e9 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,11 @@ url = github:gustavo-hms/luar; flake = false; }; + + tokyonight-kak-src = { + url = github:HeavyRain266/tokyonight.kak; + flake = false; + }; }; outputs = { self, darwin, nixpkgs, home-manager, flake-utils, ... }@inputs: @@ -53,7 +58,7 @@ final.callPackage (./. + "/pkgs/${name}.nix") { "${name}-src" = inputs."${name}-src"; }; - pkgs = [ "dark-mode-notify" "luar" ]; + pkgs = [ "dark-mode-notify" "luar" "tokyonight-kak" ]; in genAttrs pkgs buildPkg // optionalAttrs (prev.stdenv.system == "aarch64-darwin") diff --git a/home/git.nix b/home/git.nix index 6c9b6fb..e2dee13 100644 --- a/home/git.nix +++ b/home/git.nix @@ -24,7 +24,5 @@ programs.git.delta.enable = true; # Gitea CLI - home.packages = with pkgs; [ - tea - ]; + home.packages = [ pkgs.tea ]; } diff --git a/home/kakoune.nix b/home/kakoune.nix index cdd01eb..47aae3f 100644 --- a/home/kakoune.nix +++ b/home/kakoune.nix @@ -1,16 +1,55 @@ { pkgs, ... }: { + home.packages = [ pkgs.kak-lsp ]; programs.kakoune = { enable = true; + config = { - numberLines = { - enable = true; - highlightCursor = true; - relative = true; - }; - ui = { - enableMouse = true; - }; + autoReload = "yes"; + + colorScheme = "tokyonight"; + + keyMappings = [ + { + key = ""; + effect = ": fzf-mode"; + mode = "normal"; + docstring = "Open fzf-mode with ctrl-alt-p"; + } + { + key = ""; + effect = ": fzf-modef"; + mode = "normal"; + docstring = "Open fzf-mode file dialog with ctrl-p"; + } + ]; + + hooks = [ + { + name = "WinSetOption"; + option = "filetype=(haskell)"; + commands = '' + lsp-enable-window + ''; + } + ]; + + numberLines.enable = true; + numberLines.highlightCursor = true; + numberLines.relative = true; + + scrollOff.columns = 4; + scrollOff.lines = 2; + + showMatching = true; + + ui.enableMouse = true; }; + + extraConfig = '' + eval %sh{${pkgs.kak-lsp}/bin/kak-lsp --kakoune -s $kak_session} + powerline-start + ''; + plugins = with pkgs.kakounePlugins; [ active-window-kak auto-pairs-kak @@ -19,9 +58,11 @@ kakboard kakoune-state-save kakoune-vertical-selection + powerline-kak + pkgs.tokyonight-kak # needs luar - pkgs.luar - tabs-kak + # pkgs.luar + # tabs-kak ]; }; } diff --git a/home/shells.nix b/home/shells.nix index dcdb077..388c021 100644 --- a/home/shells.nix +++ b/home/shells.nix @@ -152,13 +152,18 @@ programs.fish.shellAliases = let nixConfigDir = "${config.home.homeDirectory}/dotfiles.nix"; + inNix = cmd: "pushd ${nixConfigDir}/; ${cmd}; popd"; in with pkgs; { # Nix related - drb = "pushd ${nixConfigDir}/; darwin-rebuild build --flake ${nixConfigDir}/; popd"; - drs = "pushd ${nixConfigDir}/; darwin-rebuild switch --flake ${nixConfigDir}/; popd"; + # drb = "pushd ${nixConfigDir}/; darwin-rebuild build --flake ${nixConfigDir}/; popd"; + drb = inNix "darwin-rebuild flake --flake ${nixConfigDir}/"; + # drs = "pushd ${nixConfigDir}/; darwin-rebuild switch --flake ${nixConfigDir}/; popd"; + drs = inNix "darwin-rebuild switch --flake ${nixConfigDir}/"; drc = "codium ${nixConfigDir}"; drv = "vim ${nixConfigDir}"; + # drk = "pushd ${nixConfigDir}/; kak ./flake.nix; popd"; + drk = inNix "kak flake.nix"; flakeup = "nix flake update ${nixConfigDir}/"; nb = "nix build"; nd = "nix develop"; diff --git a/pkgs/tokyonight-kak.nix b/pkgs/tokyonight-kak.nix new file mode 100644 index 0000000..e6191c5 --- /dev/null +++ b/pkgs/tokyonight-kak.nix @@ -0,0 +1,18 @@ +{ stdenv, tokyonight-kak-src, ... }: + +let + colorsPath = "share/kak/colors"; +in + +stdenv.mkDerivation rec { + name = "tokyonight"; + src = tokyonight-kak-src; + + installPhase = '' + runHook preInstall + target=$out/${colorsPath} + mkdir -p $target + cp -r colors/*.kak $target + runHook postInstall + ''; +}