From e4cd19c45a47a8cab4c9644e3279c48f82e6553d Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Mon, 11 Nov 2024 17:06:31 -0500 Subject: [PATCH] Using where-am-i --- flake.lock | 139 +++++++++++++++-------- flake.nix | 7 +- system/with/user/me.nix | 2 +- system/with/user/with/program/nixvim.nix | 100 ++++++++-------- system/with/user/with/program/stylix.nix | 2 +- 5 files changed, 154 insertions(+), 96 deletions(-) diff --git a/flake.lock b/flake.lock index 2a277ba..54c805d 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1729889373, - "narHash": "sha256-IppwheMAL+8TSZ/QtThBabXf6vsv/iC9NTbpoDxxMiI=", + "lastModified": 1731020776, + "narHash": "sha256-eAuIONpT6QZkXBqjfhH2cUD7MELp9TfGqV5k4zJfhLI=", "owner": "addisonbeck", "repo": "d", - "rev": "82f048c98af850fa32e26aae0865f235adfe323b", + "rev": "c56b8460ceaa30c4758736062686852b1c5fbf51", "type": "github" }, "original": { @@ -228,11 +228,11 @@ ] }, "locked": { - "lastModified": 1727826117, - "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", "type": "github" }, "original": { @@ -331,11 +331,11 @@ ] }, "locked": { - "lastModified": 1729104314, - "narHash": "sha256-pZRZsq5oCdJt3upZIU4aslS9XwFJ+/nVtALHIciX/BI=", + "lastModified": 1730814269, + "narHash": "sha256-fWPHyhYE6xvMI1eGY3pwBTq85wcy1YXqdzTZF+06nOg=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6", + "rev": "d70155fdc00df4628446352fc58adc640cd705c2", "type": "github" }, "original": { @@ -433,11 +433,11 @@ ] }, "locked": { - "lastModified": 1729716953, - "narHash": "sha256-FbRKGRRd0amsk/WS/UV9ukJ8jT1dZ2pJBISxkX+uq6A=", + "lastModified": 1731235328, + "narHash": "sha256-NjavpgE9/bMe/ABvZpyHIUeYF1mqR5lhaep3wB79ucs=", "owner": "nix-community", "repo": "home-manager", - "rev": "a4353cc43d1b4dd6bdeacea90eb92a8b7b78a9d7", + "rev": "60bb110917844d354f3c18e05450606a435d2d10", "type": "github" }, "original": { @@ -481,16 +481,16 @@ ] }, "locked": { - "lastModified": 1729544999, - "narHash": "sha256-YcyJLvTmN6uLEBGCvYoMLwsinblXMkoYkNLEO4WnKus=", + "lastModified": 1729958008, + "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", "owner": "NuschtOS", "repo": "ixx", - "rev": "65c207c92befec93e22086da9456d3906a4e999c", + "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", "type": "github" }, "original": { "owner": "NuschtOS", - "ref": "v0.0.5", + "ref": "v0.0.6", "repo": "ixx", "type": "github" } @@ -502,11 +502,11 @@ ] }, "locked": { - "lastModified": 1729826725, - "narHash": "sha256-w3WNlYxqWYsuzm/jgFPyhncduoDNjot28aC8j39TW0U=", + "lastModified": 1731153869, + "narHash": "sha256-3Ftf9oqOypcEyyrWJ0baVkRpvQqroK/SVBFLvU3nPuc=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "7840909b00fbd5a183008a6eb251ea307fe4a76e", + "rev": "5c74ab862c8070cbf6400128a1b56abb213656da", "type": "github" }, "original": { @@ -523,11 +523,11 @@ ] }, "locked": { - "lastModified": 1729757100, - "narHash": "sha256-x+8uGaX66V5+fUBHY23Q/OQyibQ38nISzxgj7A7Jqds=", + "lastModified": 1731153869, + "narHash": "sha256-3Ftf9oqOypcEyyrWJ0baVkRpvQqroK/SVBFLvU3nPuc=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "04193f188e4144d7047f83ad1de81d6034d175cd", + "rev": "5c74ab862c8070cbf6400128a1b56abb213656da", "type": "github" }, "original": { @@ -545,11 +545,11 @@ ] }, "locked": { - "lastModified": 1729734363, - "narHash": "sha256-qSAmcOBaCadTe9VkoNHUmgzJoYy42RE9tSgbGIDQ34M=", + "lastModified": 1731203397, + "narHash": "sha256-Po7NGTYW07z8XrCJxak+lo66RCKHeeyQljaszfV8E3E=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "f3795fcc37f37ae8c488e70e2cf8a85e43043722", + "rev": "3a7942190a3048cf944367148b0d62c3e333f645", "type": "github" }, "original": { @@ -560,11 +560,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729665710, - "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", + "lastModified": 1731139594, + "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", + "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", "type": "github" }, "original": { @@ -576,11 +576,11 @@ }, "nixpkgs-forked": { "locked": { - "lastModified": 1728271760, - "narHash": "sha256-rz+E/AqL60HEv9GeJf5+n7TVt9pGVOz4SGFn+KpQn5M=", + "lastModified": 1730088660, + "narHash": "sha256-qLOhmCxkI6moaPrwTGKzoDkc8SuaV4FmtJxnGHwRvCU=", "owner": "addisonbeck", "repo": "nixpkgs", - "rev": "7ced8c9fea54609fe7716c5fc5ad857f6ea9caa6", + "rev": "3ebad8b9cd491f43607ad5e875867307b55ceb8a", "type": "github" }, "original": { @@ -604,11 +604,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1729791159, - "narHash": "sha256-i5TKYCs9tJ2qaYTsjQh3WwExmj4O0EU+L1jq6ZBVMfM=", + "lastModified": 1731351074, + "narHash": "sha256-7Teo6ccHpbjqWgrg8nSUpFnujI4fUl/QnogalULY+24=", "owner": "nix-community", "repo": "nixvim", - "rev": "4726334e4413ff55f1db3768c8d08722abbf09cf", + "rev": "a92339d83bdc47f6d42998a5ac96020f9dd7c2d6", "type": "github" }, "original": { @@ -627,11 +627,11 @@ ] }, "locked": { - "lastModified": 1729763753, - "narHash": "sha256-M8WAUgKFBU5TvFt92g/dHBtGJmBP33LHird+solHt0g=", + "lastModified": 1731060242, + "narHash": "sha256-43yLsOm/wxBbfYSNDWVJeVv5Ij+23X3BIjFUfsdx/6M=", "owner": "NuschtOS", "repo": "search", - "rev": "bedc2f2ada220815a98a896e10f5e61bfc329bfc", + "rev": "ef493352f9e1f051e01a55c062731503a6b36b4e", "type": "github" }, "original": { @@ -652,7 +652,8 @@ "nixpkgs-forked": "nixpkgs-forked", "nixvim": "nixvim", "stylix": "stylix", - "treefmt-nix": "treefmt-nix_2" + "treefmt-nix": "treefmt-nix_2", + "where-am-i-nvim": "where-am-i-nvim" } }, "stylix": { @@ -674,11 +675,11 @@ "tinted-tmux": "tinted-tmux" }, "locked": { - "lastModified": 1729380793, - "narHash": "sha256-TV6NYBUqTHI9t5fqNu4Qyr4BZUD2yGxAn3E+d5/mqaI=", + "lastModified": 1731090365, + "narHash": "sha256-ti3gXhgVpIUL/7w6zDJuH+hOnyTZqxrIX/yYqALmiEI=", "owner": "danth", "repo": "stylix", - "rev": "fb9399b7e2c855f42dae76a363bab28d4f24aa8d", + "rev": "6863412636c8f2cb3b7360f747fbd020fbfddf68", "type": "github" }, "original": { @@ -750,16 +751,17 @@ "tinted-foot": { "flake": false, "locked": { - "lastModified": 1696725948, - "narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=", + "lastModified": 1726913040, + "narHash": "sha256-+eDZPkw7efMNUf3/Pv0EmsidqdwNJ1TaOum6k7lngDQ=", "owner": "tinted-theming", "repo": "tinted-foot", - "rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce", + "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", "type": "github" }, "original": { "owner": "tinted-theming", "repo": "tinted-foot", + "rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4", "type": "github" } }, @@ -804,11 +806,11 @@ ] }, "locked": { - "lastModified": 1729613947, - "narHash": "sha256-XGOvuIPW1XRfPgHtGYXd5MAmJzZtOuwlfKDgxX5KT3s=", + "lastModified": 1730321837, + "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "aac86347fb5063960eccb19493e0cadcdb4205ca", + "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", "type": "github" }, "original": { @@ -836,6 +838,49 @@ "repo": "treefmt-nix", "type": "github" } + }, + "treefmt-nix_3": { + "inputs": { + "nixpkgs": [ + "where-am-i-nvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701958734, + "narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=", + "owner": "semnix", + "repo": "treefmt-nix", + "rev": "e8cea581dd2b7c9998c1e6662db2c1dc30e7fdb0", + "type": "github" + }, + "original": { + "owner": "semnix", + "repo": "treefmt-nix", + "type": "github" + } + }, + "where-am-i-nvim": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix_3" + }, + "locked": { + "lastModified": 1731355541, + "narHash": "sha256-WsrhcnBE801C2a5QIn5Iyy/rcOrzW4qBN64p631qRqU=", + "owner": "addisonbeck", + "repo": "where-am-i.nvim", + "rev": "fdede0ead8aa72f36e825be612b06783f186d4d8", + "type": "github" + }, + "original": { + "owner": "addisonbeck", + "ref": "main", + "repo": "where-am-i.nvim", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 282a3f3..f481a09 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,9 @@ nix-minecraft.url = "github:Infinidoge/nix-minecraft"; nix-minecraft.inputs.nixpkgs.follows = "nixpkgs"; + + where-am-i-nvim.url = "github:addisonbeck/where-am-i.nvim/main"; + where-am-i-nvim.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { @@ -132,13 +135,13 @@ (pkgs.writeScriptBin "check" '' if [ "$1" == "formatting" ]; then echo "Checking formatting..." - treefmt --fail-on-change + treefmt --fail-on-change --no-cache fi '') (pkgs.writeScriptBin "apply" '' if [ "$1" == "formatting" ]; then echo "Applying formatting..." - treefmt + treefmt --no-cache fi '') ]; diff --git a/system/with/user/me.nix b/system/with/user/me.nix index 3556aec..1a36613 100644 --- a/system/with/user/me.nix +++ b/system/with/user/me.nix @@ -47,7 +47,7 @@ ./with/program/nixvim.nix ./with/program/lazygit.nix #./with/program/nixfmt.nix - ./with/program/raycast.nix + #./with/program/raycast.nix ./with/program/dotnet.nix ./with/program/nuke-docker.nix ./with/program/homebrew.nix diff --git a/system/with/user/with/program/nixvim.nix b/system/with/user/with/program/nixvim.nix index 23cabef..debde68 100644 --- a/system/with/user/with/program/nixvim.nix +++ b/system/with/user/with/program/nixvim.nix @@ -2,6 +2,7 @@ { pkgs, lib, + inputs, ... }: let # Command definitions are written as raw lua functions to force the @@ -132,7 +133,7 @@ vimKeymapBinding = { modes = ["n" "v" "i"]; - key = ""; + key = ""; silent = true; } ; @@ -259,7 +260,7 @@ vimKeymapBinding = { modes = ["n" "v" "i"]; - key = ""; + key = ""; silent = true; } ; @@ -338,7 +339,13 @@ ; action.__raw = '' function() - vim.cmd.normal('let @+ = expand(%:p:.\')') + require("where-am-i.commands").copy_file_name({ + content = { + file_path = { + format = "present_working_dir_path" + } + } + }); end ''; @@ -357,7 +364,13 @@ ; action.__raw = '' function() - vim.cmd.normal('let @+ = expand(\'%:p\')') + require("where-am-i.commands").copy_file_name({ + content = { + file_path = { + format = "system_path" + } + } + }); end ''; }; @@ -375,7 +388,13 @@ ; action.__raw = '' function() - vim.cmd.normal('let @+ = expand(\'%:t\')') + require("where-am-i.commands").copy_file_name({ + content = { + file_path = { + format = "filename_only" + } + } + }); end ''; }; @@ -853,38 +872,6 @@ end ''; }; - goToPreviousBuffer = { - description = '' - Navigate one buffer up in the buffer list - ''; - vimCommandName = "GoToPreviousBuffer"; - vimKeymapBinding = { - key = ""; - modes = ["n" "v" "i"]; - silent = true; - }; - action.__raw = '' - function() - vim.cmd("bprevious"); - end - ''; - }; - goToNextBuffer = { - description = '' - Navigate one buffer down in the buffer list - ''; - vimCommandName = "GoToNextBuffer"; - vimKeymapBinding = { - key = ""; - modes = ["n" "v" "i"]; - silent = true; - }; - action.__raw = '' - function() - vim.cmd("bnext"); - end - ''; - }; }; mkVimKeymap = key: command: { @@ -897,7 +884,7 @@ }; }; - mkVimKeymaps = lib.attrValues (lib.mapAttrs mkVimKeymap commands); + mkVimKeymaps = commandList: lib.attrValues (lib.mapAttrs mkVimKeymap commandList); mkVimUserCommand = key: command: { ${command.vimCommandName} = { @@ -905,12 +892,13 @@ desc = command.description; }; }; - mkVimUserCommands = lib.concatMapAttrs mkVimUserCommand commands; + + mkVimUserCommands = commandList: lib.concatMapAttrs mkVimUserCommand commandList; in { programs.nixvim = { enable = true; vimAlias = true; - opts.background = "dark"; + opts.background = "light"; highlight.SignColumn.bg = "none"; highlight.SignColumn.ctermbg = "none"; colorschemes.gruvbox.enable = true; @@ -985,6 +973,16 @@ in { plugins.telescope.settings.defaults.show_all_buffers = true; plugins.telescope.settings.defaults.cache_picker.num_pickers = 20; plugins.telescope.settings.defaults.cache_picker.ignore_empty_prompt = true; + plugins.auto-session.enable = true; + plugins.auto-session.settings.auto_create = true; + plugins.auto-session.settings.auto_restore = true; + plugins.auto-session.settings.auto_save = true; + plugins.auto-session.settings.use_git_branch = true; + plugins.auto-session.settings.suppressed_dirs = [ + "/" + "~/" + "~/Downloads" + ]; extraConfigVim = '' set laststatus=0 @@ -1005,6 +1003,7 @@ in { plugins.lsp.servers.eslint.enable = true; plugins.lsp.servers.sqls.enable = true; plugins.lsp.servers.rust_analyzer.enable = true; + plugins.lsp.servers.lua_ls.enable = true; # Cargo should probably be installed by a devshell # Maybe vim should too plugins.lsp.servers.rust_analyzer.installCargo = false; @@ -1019,8 +1018,8 @@ in { plugins.trouble.settings.win.position = "right"; plugins.trouble.settings.win.size.width = 60; plugins.noice.enable = false; - plugins.fidget.enable = true; - plugins.fidget.notification.overrideVimNotify = true; + #plugins.fidget.enable = true; + #plugins.fidget.notification.overrideVimNotify = true; # local prettier = { # formatCommand = 'prettierd "${INPUT}"', # formatStdin = true, @@ -1079,6 +1078,7 @@ in { hash = "sha256-WVOYouiEFeLkQBe1Ptazw/mIfzxmaQmOuEK8KlfMYoQ="; }; }) + inputs.where-am-i-nvim.packages.${pkgs.system}.default ]; plugins.telescope.enabledExtensions = ["live_grep_args"]; plugins.markdown-preview.enable = true; @@ -1411,7 +1411,17 @@ in { ''}"; extraConfigLua = '' - require('satellite').setup({ + require('where-am-i').setup({ + features = { + user_commands = { + enable = true; + }, + keymaps = { + enable = true; + }, + } + }) + require('satellite').setup({ current_only = false, winblend = 0, zindex = 40, @@ -1633,11 +1643,11 @@ in { keymaps = [ # Custom keymaps can be added here if needed, but I stick to using # `mkVimKeymaps` and the `commands` data structure it references. - ] ++ mkVimKeymaps; + ] ++ mkVimKeymaps commands; userCommands = { # Custom commands can be added here if needed, but I stick to using # `mkVimUserCommand` and the `commands` data structure it references. - } // mkVimUserCommands; + } // mkVimUserCommands commands; }; } diff --git a/system/with/user/with/program/stylix.nix b/system/with/user/with/program/stylix.nix index 51b7d86..87ba567 100644 --- a/system/with/user/with/program/stylix.nix +++ b/system/with/user/with/program/stylix.nix @@ -1,7 +1,7 @@ {pkgs, ...}: { stylix.enable = true; stylix.image = ../wallpaper/empty.png; - stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; + stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-light-hard.yaml"; stylix.fonts = { serif = {