From 24186358facc1225ec0001bc0c84d62266e759a8 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 09:08:32 +0000 Subject: [PATCH 001/100] Add initial testfiles for home manager --- flake.lock | 48 +++++++++++++++++++++++++++++++++ flake.nix | 62 +++++++++++++++++++++++++++++++++++++++++++ nix/home.nix | 5 ++++ nix/local_machine.nix | 11 ++++++++ 4 files changed, 126 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nix/home.nix create mode 100644 nix/local_machine.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..70dfcf5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1736785676, + "narHash": "sha256-TY0jUwR3EW0fnS0X5wXMAVy6h4Z7Y6a3m+Yq++C9AyE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "fc52a210b60f2f52c74eac41a8647c1573d2071d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1736883708, + "narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eb62e6aa39ea67e0b8018ba8ea077efe65807dc8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..dfc9638 --- /dev/null +++ b/flake.nix @@ -0,0 +1,62 @@ +{ + description = "LarssonMartin1998's dotfiles configured with Home Manager"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, home-manager, ... }: + let + lib = nixpkgs.lib; + + # supportedSystems = [ + # "x86_64-linux" + # "aarch64-linux" + # "aarch64-darwin" + # ]; + + makeHomeConfig = { + name, + system, + extraModules ? [] + }: + home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { inherit system; }; + modules = [ + ./nix/home.nix + ./nix/local_machine.nix + ] + ++ extraModules + ++ lib.optional (builtins.match ".*-darwin$" system != null) ./nix/darwin.nix + ++ lib.optional (builtins.match ".*-linux$" system != null) ./nix/linux.nix; + }; + in { + homeConfigurations = { + "wsl" = makeHomeConfig { + name = "wsl"; + system = "x86_64-linux"; + extraModules = [ ./nix/wsl.nix ]; + }; + + "linux-x86" = makeHomeConfig { + name = "linux-x86"; + system = "x86_64-linux"; + }; + + "linux-aarch64" = makeHomeConfig { + name = "linux-aarch64"; + system = "aarch64-linux"; + }; + + "darwin-aarch64" = makeHomeConfig { + name = "darwin-aarch64"; + system = "aarch64-darwin"; + }; + }; + }; +} diff --git a/nix/home.nix b/nix/home.nix new file mode 100644 index 0000000..a27beb8 --- /dev/null +++ b/nix/home.nix @@ -0,0 +1,5 @@ +{ ... }: { + home = { + stateVersion = "24.05"; + }; +} diff --git a/nix/local_machine.nix b/nix/local_machine.nix new file mode 100644 index 0000000..bae0eda --- /dev/null +++ b/nix/local_machine.nix @@ -0,0 +1,11 @@ +{ ... }: { + # local-machine.nix + # This is a template file that is committed to git with minimal changes. + # In order to use this and remain pure, each machine needs to create a local branch, i.e `machine-wsl` and set these variables + # accordingly, and then commit it. + home = { + # Stub values for demonstration. Override these in local branch. + username = "nixos"; + homeDirectory = "/home/nixos"; + }; +} From f1efe05c49d0347190b60be9b249fd420fcf593c Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 09:10:18 +0000 Subject: [PATCH 002/100] Add empty wsl.nix file --- nix/wsl.nix | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 nix/wsl.nix diff --git a/nix/wsl.nix b/nix/wsl.nix new file mode 100644 index 0000000..4b2c5c4 --- /dev/null +++ b/nix/wsl.nix @@ -0,0 +1,2 @@ +{ ... }: { +} From 697975792640acf42b453ab00e51bb041051173c Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 09:11:53 +0000 Subject: [PATCH 003/100] Add empty files for linux.nix and darwin.nix --- nix/darwin.nix | 2 ++ nix/linux.nix | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 nix/darwin.nix create mode 100644 nix/linux.nix diff --git a/nix/darwin.nix b/nix/darwin.nix new file mode 100644 index 0000000..4b2c5c4 --- /dev/null +++ b/nix/darwin.nix @@ -0,0 +1,2 @@ +{ ... }: { +} diff --git a/nix/linux.nix b/nix/linux.nix new file mode 100644 index 0000000..4b2c5c4 --- /dev/null +++ b/nix/linux.nix @@ -0,0 +1,2 @@ +{ ... }: { +} From 9d30f58fe9ebbc6548e664736812eccdb2773f01 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 22:51:39 +0000 Subject: [PATCH 004/100] Add neovim to home-manager --- nix/home.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nix/home.nix b/nix/home.nix index a27beb8..c442a09 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -1,5 +1,8 @@ -{ ... }: { +{ pkgs, ... }: { home = { stateVersion = "24.05"; + home.packages = with pkgs; [ + neovim + ]; }; } From b2be8749ffc7ebfcff318e325f965b68ba9f10e0 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 22:52:39 +0000 Subject: [PATCH 005/100] Fix double home --- nix/home.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/home.nix b/nix/home.nix index c442a09..b82f13a 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -1,7 +1,7 @@ { pkgs, ... }: { home = { stateVersion = "24.05"; - home.packages = with pkgs; [ + packages = with pkgs; [ neovim ]; }; From d4e1e4b891ecb1afca7840fca6b14516350f1397 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 23:09:16 +0000 Subject: [PATCH 006/100] Add lots of programs to HM --- nix/home.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nix/home.nix b/nix/home.nix index b82f13a..a1259f2 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -3,6 +3,19 @@ stateVersion = "24.05"; packages = with pkgs; [ neovim + fzf + bat + git + yazi + zsh + tmux + eza + curl + wget + ripgrep + fd + jq + starship ]; }; } From 8aecd29d5823a9fa1376b04aa35705731a9cd733 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 23:27:18 +0000 Subject: [PATCH 007/100] Set zsh as the shell and symlink zshrc --- nix/home.nix | 9 ++++++++- {home => zsh}/.zshrc | 0 2 files changed, 8 insertions(+), 1 deletion(-) rename {home => zsh}/.zshrc (100%) diff --git a/nix/home.nix b/nix/home.nix index a1259f2..8942e64 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -1,13 +1,17 @@ { pkgs, ... }: { home = { stateVersion = "24.05"; + programs = { + zsh = { + enable = true; + }; + }; packages = with pkgs; [ neovim fzf bat git yazi - zsh tmux eza curl @@ -17,5 +21,8 @@ jq starship ]; + file = { + ".zshrc".source = zsh/.zshrc; + }; }; } diff --git a/home/.zshrc b/zsh/.zshrc similarity index 100% rename from home/.zshrc rename to zsh/.zshrc From 9a0e018b1861d86d66fcbc740717ace4930d892f Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 23:29:35 +0000 Subject: [PATCH 008/100] Fix so programs isn't inside home --- nix/home.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nix/home.nix b/nix/home.nix index 8942e64..5a2a4db 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -1,11 +1,11 @@ { pkgs, ... }: { + programs = { + zsh = { + enable = true; + }; + }; home = { stateVersion = "24.05"; - programs = { - zsh = { - enable = true; - }; - }; packages = with pkgs; [ neovim fzf From 10bab010b73f7fcdafdb7b8d69d7695ce2b68f44 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 23:31:51 +0000 Subject: [PATCH 009/100] Fix path for zshrc --- nix/home.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/home.nix b/nix/home.nix index 5a2a4db..1f6aa00 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -22,7 +22,7 @@ starship ]; file = { - ".zshrc".source = zsh/.zshrc; + ".zshrc".source = ../zsh/.zshrc; }; }; } From fb2adb45471816d8b96385f4af312ab776e8f640 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 16 Jan 2025 23:49:38 +0000 Subject: [PATCH 010/100] Move files out of their respective fs structure into program dirs in root and symlink dotfils using HM. --- {home/.config/bat => bat}/config | 0 .../bat => bat}/themes/Catppuccin Macchiato.tmTheme | 0 {home/.config/bat => bat}/themes/ayu_mirage.tmTheme | 0 .../.config/confutils => confutils}/get-battery.sh | 0 {home/.config/ghostty => ghostty}/config | 0 {home => ideavim}/.ideavimrc | 0 {home/.config/neomutt => neomutt}/neomuttrc | 0 nix/home.nix | 9 +++++++++ {home/.config/nvim => nvim}/.luarc.json | 0 {home/.config/nvim => nvim}/init.lua | 0 {home/.config/nvim => nvim}/lazy-lock.json | 0 .../nvim => nvim}/lua/dap/adapters/codelldb.lua | 0 .../nvim => nvim}/lua/dap/adapters/debugpy.lua | 0 {home/.config/nvim => nvim}/lua/dap/setup.lua | 0 {home/.config/nvim => nvim}/lua/format_handler.lua | 0 .../nvim => nvim}/lua/inlay_hints_handler.lua | 0 {home/.config/nvim => nvim}/lua/keymaps.lua | 0 {home/.config/nvim => nvim}/lua/lazy_init.lua | 0 .../nvim => nvim}/lua/lsp/servers/clangd.lua | 0 .../.config/nvim => nvim}/lua/lsp/servers/cmake.lua | 0 .../.config/nvim => nvim}/lua/lsp/servers/gopls.lua | 0 .../nvim => nvim}/lua/lsp/servers/lua_ls.lua | 0 .../nvim => nvim}/lua/lsp/servers/pyright.lua | 0 {home/.config/nvim => nvim}/lua/lsp/setup.lua | 0 .../nvim => nvim}/lua/lualine_extension_lspsaga.lua | 0 {home/.config/nvim => nvim}/lua/plugs/arrow.lua | 0 .../nvim => nvim}/lua/plugs/auto_session.lua | 0 {home/.config/nvim => nvim}/lua/plugs/ayu.lua | 0 {home/.config/nvim => nvim}/lua/plugs/blink.lua | 0 .../nvim => nvim}/lua/plugs/codecompanion.lua | 0 {home/.config/nvim => nvim}/lua/plugs/codesnap.lua | 0 {home/.config/nvim => nvim}/lua/plugs/colorizer.lua | 0 {home/.config/nvim => nvim}/lua/plugs/copilot.lua | 0 {home/.config/nvim => nvim}/lua/plugs/devicons.lua | 0 {home/.config/nvim => nvim}/lua/plugs/fzf.lua | 0 {home/.config/nvim => nvim}/lua/plugs/incline.lua | 0 .../nvim => nvim}/lua/plugs/indent_blankline.lua | 0 {home/.config/nvim => nvim}/lua/plugs/leap.lua | 0 {home/.config/nvim => nvim}/lua/plugs/lspsaga.lua | 0 {home/.config/nvim => nvim}/lua/plugs/lualine.lua | 0 {home/.config/nvim => nvim}/lua/plugs/mason.lua | 0 {home/.config/nvim => nvim}/lua/plugs/neogit.lua | 0 {home/.config/nvim => nvim}/lua/plugs/neorg.lua | 0 {home/.config/nvim => nvim}/lua/plugs/noice.lua | 0 {home/.config/nvim => nvim}/lua/plugs/nvim-dap.lua | 0 {home/.config/nvim => nvim}/lua/plugs/plenary.lua | 0 .../nvim => nvim}/lua/plugs/rustaceanvim.lua | 0 {home/.config/nvim => nvim}/lua/plugs/surround.lua | 0 .../lua/plugs/tiny-inline-diagnostics.lua | 0 .../.config/nvim => nvim}/lua/plugs/treesitter.lua | 0 {home/.config/nvim => nvim}/lua/terminal.lua | 0 {home/.config/nvim => nvim}/lua/utils.lua | 0 {home/.config/nvim => nvim}/lua/vim_opt.lua | 0 .../.config/nvim => nvim}/lua/window_management.lua | 0 {home/.config => starship}/starship.toml | 0 {home => tmux}/.tmux.conf | 0 {home/.config/tmux => tmux}/tmux-create-session.sh | 0 .../tmux => tmux}/tmux-fuzzy-find-session.sh | 0 {home/.config/tmux => tmux}/tmux-move-pane.sh | 0 {home/.config/tmux => tmux}/tmux-rename-window.sh | 0 {home/.config/tmux => tmux}/tmux-set-resize-mode.sh | 0 {home/.config/tmux => tmux}/tmux-status-right.sh | 0 .../.config/wallpapers => wallpapers}/Clearday.jpg | Bin .../.config/wallpapers => wallpapers}/Cloudsday.jpg | Bin .../catppuccin/astronout.png | Bin .../catppuccin/cloudsnight.jpg | Bin .../catppuccin/dino_landscape.jpg | Bin .../catppuccin/home_water.jpeg | Bin .../catppuccin/lonely-fish.png | Bin .../catppuccin/samurai_water.webp | Bin .../tokyonight/Rainnight.jpg | Bin {home/.config/yazi => yazi}/yazi.toml | 0 72 files changed, 9 insertions(+) rename {home/.config/bat => bat}/config (100%) rename {home/.config/bat => bat}/themes/Catppuccin Macchiato.tmTheme (100%) rename {home/.config/bat => bat}/themes/ayu_mirage.tmTheme (100%) rename {home/.config/confutils => confutils}/get-battery.sh (100%) rename {home/.config/ghostty => ghostty}/config (100%) rename {home => ideavim}/.ideavimrc (100%) rename {home/.config/neomutt => neomutt}/neomuttrc (100%) rename {home/.config/nvim => nvim}/.luarc.json (100%) rename {home/.config/nvim => nvim}/init.lua (100%) rename {home/.config/nvim => nvim}/lazy-lock.json (100%) rename {home/.config/nvim => nvim}/lua/dap/adapters/codelldb.lua (100%) rename {home/.config/nvim => nvim}/lua/dap/adapters/debugpy.lua (100%) rename {home/.config/nvim => nvim}/lua/dap/setup.lua (100%) rename {home/.config/nvim => nvim}/lua/format_handler.lua (100%) rename {home/.config/nvim => nvim}/lua/inlay_hints_handler.lua (100%) rename {home/.config/nvim => nvim}/lua/keymaps.lua (100%) rename {home/.config/nvim => nvim}/lua/lazy_init.lua (100%) rename {home/.config/nvim => nvim}/lua/lsp/servers/clangd.lua (100%) rename {home/.config/nvim => nvim}/lua/lsp/servers/cmake.lua (100%) rename {home/.config/nvim => nvim}/lua/lsp/servers/gopls.lua (100%) rename {home/.config/nvim => nvim}/lua/lsp/servers/lua_ls.lua (100%) rename {home/.config/nvim => nvim}/lua/lsp/servers/pyright.lua (100%) rename {home/.config/nvim => nvim}/lua/lsp/setup.lua (100%) rename {home/.config/nvim => nvim}/lua/lualine_extension_lspsaga.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/arrow.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/auto_session.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/ayu.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/blink.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/codecompanion.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/codesnap.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/colorizer.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/copilot.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/devicons.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/fzf.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/incline.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/indent_blankline.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/leap.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/lspsaga.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/lualine.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/mason.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/neogit.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/neorg.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/noice.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/nvim-dap.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/plenary.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/rustaceanvim.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/surround.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/tiny-inline-diagnostics.lua (100%) rename {home/.config/nvim => nvim}/lua/plugs/treesitter.lua (100%) rename {home/.config/nvim => nvim}/lua/terminal.lua (100%) rename {home/.config/nvim => nvim}/lua/utils.lua (100%) rename {home/.config/nvim => nvim}/lua/vim_opt.lua (100%) rename {home/.config/nvim => nvim}/lua/window_management.lua (100%) rename {home/.config => starship}/starship.toml (100%) rename {home => tmux}/.tmux.conf (100%) rename {home/.config/tmux => tmux}/tmux-create-session.sh (100%) rename {home/.config/tmux => tmux}/tmux-fuzzy-find-session.sh (100%) rename {home/.config/tmux => tmux}/tmux-move-pane.sh (100%) rename {home/.config/tmux => tmux}/tmux-rename-window.sh (100%) rename {home/.config/tmux => tmux}/tmux-set-resize-mode.sh (100%) rename {home/.config/tmux => tmux}/tmux-status-right.sh (100%) rename {home/.config/wallpapers => wallpapers}/Clearday.jpg (100%) rename {home/.config/wallpapers => wallpapers}/Cloudsday.jpg (100%) rename {home/.config/wallpapers => wallpapers}/catppuccin/astronout.png (100%) rename {home/.config/wallpapers => wallpapers}/catppuccin/cloudsnight.jpg (100%) rename {home/.config/wallpapers => wallpapers}/catppuccin/dino_landscape.jpg (100%) rename {home/.config/wallpapers => wallpapers}/catppuccin/home_water.jpeg (100%) rename {home/.config/wallpapers => wallpapers}/catppuccin/lonely-fish.png (100%) rename {home/.config/wallpapers => wallpapers}/catppuccin/samurai_water.webp (100%) rename {home/.config/wallpapers => wallpapers}/tokyonight/Rainnight.jpg (100%) rename {home/.config/yazi => yazi}/yazi.toml (100%) diff --git a/home/.config/bat/config b/bat/config similarity index 100% rename from home/.config/bat/config rename to bat/config diff --git a/home/.config/bat/themes/Catppuccin Macchiato.tmTheme b/bat/themes/Catppuccin Macchiato.tmTheme similarity index 100% rename from home/.config/bat/themes/Catppuccin Macchiato.tmTheme rename to bat/themes/Catppuccin Macchiato.tmTheme diff --git a/home/.config/bat/themes/ayu_mirage.tmTheme b/bat/themes/ayu_mirage.tmTheme similarity index 100% rename from home/.config/bat/themes/ayu_mirage.tmTheme rename to bat/themes/ayu_mirage.tmTheme diff --git a/home/.config/confutils/get-battery.sh b/confutils/get-battery.sh similarity index 100% rename from home/.config/confutils/get-battery.sh rename to confutils/get-battery.sh diff --git a/home/.config/ghostty/config b/ghostty/config similarity index 100% rename from home/.config/ghostty/config rename to ghostty/config diff --git a/home/.ideavimrc b/ideavim/.ideavimrc similarity index 100% rename from home/.ideavimrc rename to ideavim/.ideavimrc diff --git a/home/.config/neomutt/neomuttrc b/neomutt/neomuttrc similarity index 100% rename from home/.config/neomutt/neomuttrc rename to neomutt/neomuttrc diff --git a/nix/home.nix b/nix/home.nix index 1f6aa00..47b143c 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -20,9 +20,18 @@ fd jq starship + fastfetch ]; file = { ".zshrc".source = ../zsh/.zshrc; + ".config/nvim".source = ../nvim; + ".config/yazi".source = ../yazi; + ".config/starship.toml".source = ../starship/starship.toml; + ".tmux.conf".source = ../tmux/.tmux.conf; + ".config/tmux".source = ../tmux; + ".config/bat".source = ../bat; + ".config/ghostty".source = ../ghostty; + ".config/confutils".source = ../confutils; }; }; } diff --git a/home/.config/nvim/.luarc.json b/nvim/.luarc.json similarity index 100% rename from home/.config/nvim/.luarc.json rename to nvim/.luarc.json diff --git a/home/.config/nvim/init.lua b/nvim/init.lua similarity index 100% rename from home/.config/nvim/init.lua rename to nvim/init.lua diff --git a/home/.config/nvim/lazy-lock.json b/nvim/lazy-lock.json similarity index 100% rename from home/.config/nvim/lazy-lock.json rename to nvim/lazy-lock.json diff --git a/home/.config/nvim/lua/dap/adapters/codelldb.lua b/nvim/lua/dap/adapters/codelldb.lua similarity index 100% rename from home/.config/nvim/lua/dap/adapters/codelldb.lua rename to nvim/lua/dap/adapters/codelldb.lua diff --git a/home/.config/nvim/lua/dap/adapters/debugpy.lua b/nvim/lua/dap/adapters/debugpy.lua similarity index 100% rename from home/.config/nvim/lua/dap/adapters/debugpy.lua rename to nvim/lua/dap/adapters/debugpy.lua diff --git a/home/.config/nvim/lua/dap/setup.lua b/nvim/lua/dap/setup.lua similarity index 100% rename from home/.config/nvim/lua/dap/setup.lua rename to nvim/lua/dap/setup.lua diff --git a/home/.config/nvim/lua/format_handler.lua b/nvim/lua/format_handler.lua similarity index 100% rename from home/.config/nvim/lua/format_handler.lua rename to nvim/lua/format_handler.lua diff --git a/home/.config/nvim/lua/inlay_hints_handler.lua b/nvim/lua/inlay_hints_handler.lua similarity index 100% rename from home/.config/nvim/lua/inlay_hints_handler.lua rename to nvim/lua/inlay_hints_handler.lua diff --git a/home/.config/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua similarity index 100% rename from home/.config/nvim/lua/keymaps.lua rename to nvim/lua/keymaps.lua diff --git a/home/.config/nvim/lua/lazy_init.lua b/nvim/lua/lazy_init.lua similarity index 100% rename from home/.config/nvim/lua/lazy_init.lua rename to nvim/lua/lazy_init.lua diff --git a/home/.config/nvim/lua/lsp/servers/clangd.lua b/nvim/lua/lsp/servers/clangd.lua similarity index 100% rename from home/.config/nvim/lua/lsp/servers/clangd.lua rename to nvim/lua/lsp/servers/clangd.lua diff --git a/home/.config/nvim/lua/lsp/servers/cmake.lua b/nvim/lua/lsp/servers/cmake.lua similarity index 100% rename from home/.config/nvim/lua/lsp/servers/cmake.lua rename to nvim/lua/lsp/servers/cmake.lua diff --git a/home/.config/nvim/lua/lsp/servers/gopls.lua b/nvim/lua/lsp/servers/gopls.lua similarity index 100% rename from home/.config/nvim/lua/lsp/servers/gopls.lua rename to nvim/lua/lsp/servers/gopls.lua diff --git a/home/.config/nvim/lua/lsp/servers/lua_ls.lua b/nvim/lua/lsp/servers/lua_ls.lua similarity index 100% rename from home/.config/nvim/lua/lsp/servers/lua_ls.lua rename to nvim/lua/lsp/servers/lua_ls.lua diff --git a/home/.config/nvim/lua/lsp/servers/pyright.lua b/nvim/lua/lsp/servers/pyright.lua similarity index 100% rename from home/.config/nvim/lua/lsp/servers/pyright.lua rename to nvim/lua/lsp/servers/pyright.lua diff --git a/home/.config/nvim/lua/lsp/setup.lua b/nvim/lua/lsp/setup.lua similarity index 100% rename from home/.config/nvim/lua/lsp/setup.lua rename to nvim/lua/lsp/setup.lua diff --git a/home/.config/nvim/lua/lualine_extension_lspsaga.lua b/nvim/lua/lualine_extension_lspsaga.lua similarity index 100% rename from home/.config/nvim/lua/lualine_extension_lspsaga.lua rename to nvim/lua/lualine_extension_lspsaga.lua diff --git a/home/.config/nvim/lua/plugs/arrow.lua b/nvim/lua/plugs/arrow.lua similarity index 100% rename from home/.config/nvim/lua/plugs/arrow.lua rename to nvim/lua/plugs/arrow.lua diff --git a/home/.config/nvim/lua/plugs/auto_session.lua b/nvim/lua/plugs/auto_session.lua similarity index 100% rename from home/.config/nvim/lua/plugs/auto_session.lua rename to nvim/lua/plugs/auto_session.lua diff --git a/home/.config/nvim/lua/plugs/ayu.lua b/nvim/lua/plugs/ayu.lua similarity index 100% rename from home/.config/nvim/lua/plugs/ayu.lua rename to nvim/lua/plugs/ayu.lua diff --git a/home/.config/nvim/lua/plugs/blink.lua b/nvim/lua/plugs/blink.lua similarity index 100% rename from home/.config/nvim/lua/plugs/blink.lua rename to nvim/lua/plugs/blink.lua diff --git a/home/.config/nvim/lua/plugs/codecompanion.lua b/nvim/lua/plugs/codecompanion.lua similarity index 100% rename from home/.config/nvim/lua/plugs/codecompanion.lua rename to nvim/lua/plugs/codecompanion.lua diff --git a/home/.config/nvim/lua/plugs/codesnap.lua b/nvim/lua/plugs/codesnap.lua similarity index 100% rename from home/.config/nvim/lua/plugs/codesnap.lua rename to nvim/lua/plugs/codesnap.lua diff --git a/home/.config/nvim/lua/plugs/colorizer.lua b/nvim/lua/plugs/colorizer.lua similarity index 100% rename from home/.config/nvim/lua/plugs/colorizer.lua rename to nvim/lua/plugs/colorizer.lua diff --git a/home/.config/nvim/lua/plugs/copilot.lua b/nvim/lua/plugs/copilot.lua similarity index 100% rename from home/.config/nvim/lua/plugs/copilot.lua rename to nvim/lua/plugs/copilot.lua diff --git a/home/.config/nvim/lua/plugs/devicons.lua b/nvim/lua/plugs/devicons.lua similarity index 100% rename from home/.config/nvim/lua/plugs/devicons.lua rename to nvim/lua/plugs/devicons.lua diff --git a/home/.config/nvim/lua/plugs/fzf.lua b/nvim/lua/plugs/fzf.lua similarity index 100% rename from home/.config/nvim/lua/plugs/fzf.lua rename to nvim/lua/plugs/fzf.lua diff --git a/home/.config/nvim/lua/plugs/incline.lua b/nvim/lua/plugs/incline.lua similarity index 100% rename from home/.config/nvim/lua/plugs/incline.lua rename to nvim/lua/plugs/incline.lua diff --git a/home/.config/nvim/lua/plugs/indent_blankline.lua b/nvim/lua/plugs/indent_blankline.lua similarity index 100% rename from home/.config/nvim/lua/plugs/indent_blankline.lua rename to nvim/lua/plugs/indent_blankline.lua diff --git a/home/.config/nvim/lua/plugs/leap.lua b/nvim/lua/plugs/leap.lua similarity index 100% rename from home/.config/nvim/lua/plugs/leap.lua rename to nvim/lua/plugs/leap.lua diff --git a/home/.config/nvim/lua/plugs/lspsaga.lua b/nvim/lua/plugs/lspsaga.lua similarity index 100% rename from home/.config/nvim/lua/plugs/lspsaga.lua rename to nvim/lua/plugs/lspsaga.lua diff --git a/home/.config/nvim/lua/plugs/lualine.lua b/nvim/lua/plugs/lualine.lua similarity index 100% rename from home/.config/nvim/lua/plugs/lualine.lua rename to nvim/lua/plugs/lualine.lua diff --git a/home/.config/nvim/lua/plugs/mason.lua b/nvim/lua/plugs/mason.lua similarity index 100% rename from home/.config/nvim/lua/plugs/mason.lua rename to nvim/lua/plugs/mason.lua diff --git a/home/.config/nvim/lua/plugs/neogit.lua b/nvim/lua/plugs/neogit.lua similarity index 100% rename from home/.config/nvim/lua/plugs/neogit.lua rename to nvim/lua/plugs/neogit.lua diff --git a/home/.config/nvim/lua/plugs/neorg.lua b/nvim/lua/plugs/neorg.lua similarity index 100% rename from home/.config/nvim/lua/plugs/neorg.lua rename to nvim/lua/plugs/neorg.lua diff --git a/home/.config/nvim/lua/plugs/noice.lua b/nvim/lua/plugs/noice.lua similarity index 100% rename from home/.config/nvim/lua/plugs/noice.lua rename to nvim/lua/plugs/noice.lua diff --git a/home/.config/nvim/lua/plugs/nvim-dap.lua b/nvim/lua/plugs/nvim-dap.lua similarity index 100% rename from home/.config/nvim/lua/plugs/nvim-dap.lua rename to nvim/lua/plugs/nvim-dap.lua diff --git a/home/.config/nvim/lua/plugs/plenary.lua b/nvim/lua/plugs/plenary.lua similarity index 100% rename from home/.config/nvim/lua/plugs/plenary.lua rename to nvim/lua/plugs/plenary.lua diff --git a/home/.config/nvim/lua/plugs/rustaceanvim.lua b/nvim/lua/plugs/rustaceanvim.lua similarity index 100% rename from home/.config/nvim/lua/plugs/rustaceanvim.lua rename to nvim/lua/plugs/rustaceanvim.lua diff --git a/home/.config/nvim/lua/plugs/surround.lua b/nvim/lua/plugs/surround.lua similarity index 100% rename from home/.config/nvim/lua/plugs/surround.lua rename to nvim/lua/plugs/surround.lua diff --git a/home/.config/nvim/lua/plugs/tiny-inline-diagnostics.lua b/nvim/lua/plugs/tiny-inline-diagnostics.lua similarity index 100% rename from home/.config/nvim/lua/plugs/tiny-inline-diagnostics.lua rename to nvim/lua/plugs/tiny-inline-diagnostics.lua diff --git a/home/.config/nvim/lua/plugs/treesitter.lua b/nvim/lua/plugs/treesitter.lua similarity index 100% rename from home/.config/nvim/lua/plugs/treesitter.lua rename to nvim/lua/plugs/treesitter.lua diff --git a/home/.config/nvim/lua/terminal.lua b/nvim/lua/terminal.lua similarity index 100% rename from home/.config/nvim/lua/terminal.lua rename to nvim/lua/terminal.lua diff --git a/home/.config/nvim/lua/utils.lua b/nvim/lua/utils.lua similarity index 100% rename from home/.config/nvim/lua/utils.lua rename to nvim/lua/utils.lua diff --git a/home/.config/nvim/lua/vim_opt.lua b/nvim/lua/vim_opt.lua similarity index 100% rename from home/.config/nvim/lua/vim_opt.lua rename to nvim/lua/vim_opt.lua diff --git a/home/.config/nvim/lua/window_management.lua b/nvim/lua/window_management.lua similarity index 100% rename from home/.config/nvim/lua/window_management.lua rename to nvim/lua/window_management.lua diff --git a/home/.config/starship.toml b/starship/starship.toml similarity index 100% rename from home/.config/starship.toml rename to starship/starship.toml diff --git a/home/.tmux.conf b/tmux/.tmux.conf similarity index 100% rename from home/.tmux.conf rename to tmux/.tmux.conf diff --git a/home/.config/tmux/tmux-create-session.sh b/tmux/tmux-create-session.sh similarity index 100% rename from home/.config/tmux/tmux-create-session.sh rename to tmux/tmux-create-session.sh diff --git a/home/.config/tmux/tmux-fuzzy-find-session.sh b/tmux/tmux-fuzzy-find-session.sh similarity index 100% rename from home/.config/tmux/tmux-fuzzy-find-session.sh rename to tmux/tmux-fuzzy-find-session.sh diff --git a/home/.config/tmux/tmux-move-pane.sh b/tmux/tmux-move-pane.sh similarity index 100% rename from home/.config/tmux/tmux-move-pane.sh rename to tmux/tmux-move-pane.sh diff --git a/home/.config/tmux/tmux-rename-window.sh b/tmux/tmux-rename-window.sh similarity index 100% rename from home/.config/tmux/tmux-rename-window.sh rename to tmux/tmux-rename-window.sh diff --git a/home/.config/tmux/tmux-set-resize-mode.sh b/tmux/tmux-set-resize-mode.sh similarity index 100% rename from home/.config/tmux/tmux-set-resize-mode.sh rename to tmux/tmux-set-resize-mode.sh diff --git a/home/.config/tmux/tmux-status-right.sh b/tmux/tmux-status-right.sh similarity index 100% rename from home/.config/tmux/tmux-status-right.sh rename to tmux/tmux-status-right.sh diff --git a/home/.config/wallpapers/Clearday.jpg b/wallpapers/Clearday.jpg similarity index 100% rename from home/.config/wallpapers/Clearday.jpg rename to wallpapers/Clearday.jpg diff --git a/home/.config/wallpapers/Cloudsday.jpg b/wallpapers/Cloudsday.jpg similarity index 100% rename from home/.config/wallpapers/Cloudsday.jpg rename to wallpapers/Cloudsday.jpg diff --git a/home/.config/wallpapers/catppuccin/astronout.png b/wallpapers/catppuccin/astronout.png similarity index 100% rename from home/.config/wallpapers/catppuccin/astronout.png rename to wallpapers/catppuccin/astronout.png diff --git a/home/.config/wallpapers/catppuccin/cloudsnight.jpg b/wallpapers/catppuccin/cloudsnight.jpg similarity index 100% rename from home/.config/wallpapers/catppuccin/cloudsnight.jpg rename to wallpapers/catppuccin/cloudsnight.jpg diff --git a/home/.config/wallpapers/catppuccin/dino_landscape.jpg b/wallpapers/catppuccin/dino_landscape.jpg similarity index 100% rename from home/.config/wallpapers/catppuccin/dino_landscape.jpg rename to wallpapers/catppuccin/dino_landscape.jpg diff --git a/home/.config/wallpapers/catppuccin/home_water.jpeg b/wallpapers/catppuccin/home_water.jpeg similarity index 100% rename from home/.config/wallpapers/catppuccin/home_water.jpeg rename to wallpapers/catppuccin/home_water.jpeg diff --git a/home/.config/wallpapers/catppuccin/lonely-fish.png b/wallpapers/catppuccin/lonely-fish.png similarity index 100% rename from home/.config/wallpapers/catppuccin/lonely-fish.png rename to wallpapers/catppuccin/lonely-fish.png diff --git a/home/.config/wallpapers/catppuccin/samurai_water.webp b/wallpapers/catppuccin/samurai_water.webp similarity index 100% rename from home/.config/wallpapers/catppuccin/samurai_water.webp rename to wallpapers/catppuccin/samurai_water.webp diff --git a/home/.config/wallpapers/tokyonight/Rainnight.jpg b/wallpapers/tokyonight/Rainnight.jpg similarity index 100% rename from home/.config/wallpapers/tokyonight/Rainnight.jpg rename to wallpapers/tokyonight/Rainnight.jpg diff --git a/home/.config/yazi/yazi.toml b/yazi/yazi.toml similarity index 100% rename from home/.config/yazi/yazi.toml rename to yazi/yazi.toml From b69de0413defae00deef46b4a93645ea28d1a86d Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 19:10:29 +0000 Subject: [PATCH 011/100] Update gitignore to exclude result (build output from nix) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a275df3..17735df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store home/.config/lazygit/state.yml neomuttrc.local +result From 2ff063d95bbdcee36bee49306f1736d17fd4450f Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 19:11:14 +0000 Subject: [PATCH 012/100] Remove shebang from tmux scripts, they're sourced anyway. --- tmux/tmux-create-session.sh | 2 -- tmux/tmux-fuzzy-find-session.sh | 2 -- tmux/tmux-move-pane.sh | 2 -- tmux/tmux-rename-window.sh | 1 - tmux/tmux-set-resize-mode.sh | 2 -- 5 files changed, 9 deletions(-) diff --git a/tmux/tmux-create-session.sh b/tmux/tmux-create-session.sh index 19265b7..eb06e79 100755 --- a/tmux/tmux-create-session.sh +++ b/tmux/tmux-create-session.sh @@ -1,5 +1,3 @@ -#!/bin/zsh - session_name=$1 tmux new-session -d -s $session_name tmux switch-client -t $session_name diff --git a/tmux/tmux-fuzzy-find-session.sh b/tmux/tmux-fuzzy-find-session.sh index 3851bad..0744dc5 100755 --- a/tmux/tmux-fuzzy-find-session.sh +++ b/tmux/tmux-fuzzy-find-session.sh @@ -1,5 +1,3 @@ -#!/bin/zsh - # Run fzf-tmux in the background and serialize the input ( current_session=$(tmux display-message -p '#S') diff --git a/tmux/tmux-move-pane.sh b/tmux/tmux-move-pane.sh index 8115fbf..d83dd82 100755 --- a/tmux/tmux-move-pane.sh +++ b/tmux/tmux-move-pane.sh @@ -1,5 +1,3 @@ -#!/bin/zsh - source_pane=$(tmux display-message -p '#{pane_id}') target_window=$1 diff --git a/tmux/tmux-rename-window.sh b/tmux/tmux-rename-window.sh index 437e930..c675173 100755 --- a/tmux/tmux-rename-window.sh +++ b/tmux/tmux-rename-window.sh @@ -1,4 +1,3 @@ -#!/bin/zsh # program blacklist # program=$( # ps -o comm= -t "$(tmux display-message -p '#{pane_tty}')" 2>/dev/null \ diff --git a/tmux/tmux-set-resize-mode.sh b/tmux/tmux-set-resize-mode.sh index 388e7b7..529d666 100755 --- a/tmux/tmux-set-resize-mode.sh +++ b/tmux/tmux-set-resize-mode.sh @@ -1,5 +1,3 @@ -#!/bin/zsh - desired_state=$1 current_state=$(tmux show-environment -g @resize_mode 2>/dev/null | cut -d '=' -f 2) From 5067747fc586d3451f70ddb00f0f9d6ca5091e72 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 19:11:49 +0000 Subject: [PATCH 013/100] Remove mason, rely on nixpkgs for systemwide tooling instead --- nvim/lua/plugs/mason.lua | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 nvim/lua/plugs/mason.lua diff --git a/nvim/lua/plugs/mason.lua b/nvim/lua/plugs/mason.lua deleted file mode 100644 index 71707b7..0000000 --- a/nvim/lua/plugs/mason.lua +++ /dev/null @@ -1,36 +0,0 @@ -return { - "williamboman/mason.nvim", - dependencies = { "WhoIsSethDaniel/mason-tool-installer.nvim" }, - config = function() - require("mason").setup({}) - require("mason-tool-installer").setup({ - ensure_installed = { - -- LLVM debugger - "codelldb", - - -- C and C++ - "clangd", - "clang-format", - - -- Rust - "rust-analyzer", - - -- Go - "gopls", - "golangci-lint", - "delve", - - -- Lua - "lua-language-server", - - -- CMake - "cmake-language-server", - "cmakelang", - - -- Python - "debugpy", - "pyright", - }, - }) - end -} From d9091a23ae241e9cf40655892b4871d9ad8141ae Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 19:13:18 +0000 Subject: [PATCH 014/100] Add vim to globals, add settings for preloading files --- nvim/lua/lsp/servers/lua_ls.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nvim/lua/lsp/servers/lua_ls.lua b/nvim/lua/lsp/servers/lua_ls.lua index e86b233..4a9f57a 100644 --- a/nvim/lua/lsp/servers/lua_ls.lua +++ b/nvim/lua/lsp/servers/lua_ls.lua @@ -11,6 +11,12 @@ return { "selene.yml", ".git" }, + settings = { + Lua = { + maxPreload = 100000, + preloadFileSize = 10000, + }, + }, on_init = function(client) local path = vim.tbl_get(client, "workspace_folders", 1, "name") if not path then @@ -23,6 +29,9 @@ return { runtime = { version = "LuaJIT" }, + diagnostics = { + globals = { "vim" }, + }, -- Make the server aware of Neovim runtime files workspace = { checkThirdParty = false, From beb700f3fe1d48f136c81f446aba567742b22723 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 19:27:31 +0000 Subject: [PATCH 015/100] Add nil and zls LSP's --- nvim/lua/lsp/servers/nil.lua | 15 +++++++++++++++ nvim/lua/lsp/servers/zls.lua | 10 ++++++++++ 2 files changed, 25 insertions(+) create mode 100644 nvim/lua/lsp/servers/nil.lua create mode 100644 nvim/lua/lsp/servers/zls.lua diff --git a/nvim/lua/lsp/servers/nil.lua b/nvim/lua/lsp/servers/nil.lua new file mode 100644 index 0000000..c5e65f2 --- /dev/null +++ b/nvim/lua/lsp/servers/nil.lua @@ -0,0 +1,15 @@ +return { + cmd = { "nil" }, + filetypes = { "nix" }, + root_markers = { + "flake.nix", + ".git" + }, + settings = { + ["nil"] = { + formatting = { + command = { "nixfmt" }, + }, + }, + }, +} diff --git a/nvim/lua/lsp/servers/zls.lua b/nvim/lua/lsp/servers/zls.lua new file mode 100644 index 0000000..cce39b7 --- /dev/null +++ b/nvim/lua/lsp/servers/zls.lua @@ -0,0 +1,10 @@ +return { + cmd = { "zls" }, + on_new_config = function(new_config, new_root_dir) + if vim.fn.filereadable(vim.fs.joinpath(new_root_dir, "zls.json")) ~= 0 then + new_config.cmd = { "zls", "--config-path", "zls.json" } + end + end, + filetypes = { "zig", "zir" }, + root_markers = {"zls.json", "build.zig", ".git"}, +} From b695b07c215818e1abe69913923f9434705561f3 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 19:30:52 +0000 Subject: [PATCH 016/100] Add lots of packages to home manager, and include neovim derivation for building source from a specific commit on dev branch. --- flake.lock | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 19 ++++++++------- nix/home.nix | 29 +++++++++++++++++++--- 3 files changed, 104 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 70dfcf5..5232ce3 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -20,7 +38,39 @@ "type": "github" } }, + "neovim": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1737307637, + "narHash": "sha256-lfx4/4SEtpybaHj5iIFl05XEuFyem7zTReE5pK5F8Bo=", + "path": "/home/nixos/dev/git/neovim-flake", + "type": "path" + }, + "original": { + "path": "/home/nixos/dev/git/neovim-flake", + "type": "path" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1737110817, + "narHash": "sha256-DSenga8XjPaUV5KUFW/i3rNkN7jm9XmguW+qQ1ZJTR4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "041c867bad68dfe34b78b2813028a2e2ea70a23c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1736883708, "narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=", @@ -39,7 +89,23 @@ "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "neovim": "neovim", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index dfc9638..c7e1ec4 100644 --- a/flake.nix +++ b/flake.nix @@ -8,18 +8,16 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + + neovim = { + url = "path:/home/nixos/dev/git/neovim-flake"; + }; }; - outputs = { nixpkgs, home-manager, ... }: + outputs = { nixpkgs, home-manager, neovim, ... }: let lib = nixpkgs.lib; - # supportedSystems = [ - # "x86_64-linux" - # "aarch64-linux" - # "aarch64-darwin" - # ]; - makeHomeConfig = { name, system, @@ -29,11 +27,16 @@ pkgs = import nixpkgs { inherit system; }; modules = [ ./nix/home.nix - ./nix/local_machine.nix + ./nix/local_machine.nix ] ++ extraModules ++ lib.optional (builtins.match ".*-darwin$" system != null) ./nix/darwin.nix ++ lib.optional (builtins.match ".*-linux$" system != null) ./nix/linux.nix; + + # Pass neovim-flake to all modules + extraSpecialArgs = { + neovim-flake = neovim; + }; }; in { homeConfigurations = { diff --git a/nix/home.nix b/nix/home.nix index 47b143c..f0edd57 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -1,13 +1,14 @@ -{ pkgs, ... }: { +{ pkgs, neovim-flake, ... }: { programs = { zsh = { enable = true; }; }; + home = { - stateVersion = "24.05"; + stateVersion = "24.05"; packages = with pkgs; [ - neovim + neovim-flake.packages.${system}.neovim fzf bat git @@ -21,6 +22,28 @@ jq starship fastfetch + clang + clang-tools + nixfmt-rfc-style + luajit + zoxide + rustup + zig + zls + nil + lldb + gopls + delve + golangci-lint + cmake + cmake-language-server + cmake-format + cmake-lint + python313Packages.debugpy + pyright + lua-language-server + gnumake + ninja ]; file = { ".zshrc".source = ../zsh/.zshrc; From 86af5f25c9c6ada22c3a07fd60baf0e8ca0ca644 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 22:54:58 +0000 Subject: [PATCH 017/100] Enable some font features, graphical control chars and slashesd zero --- ghostty/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ghostty/config b/ghostty/config index 9751c72..0cf10c4 100644 --- a/ghostty/config +++ b/ghostty/config @@ -11,6 +11,8 @@ font-style-bold = Bold font-style-italic = Italic font-style-bold-italic = Bold Italic font-feature = ss01 +font-feature = ss19 +font-feature = ss20 font-feature = -calt scrollback-limit = 100000 From cc24488f29ecf0daec304b68eaf88ac17956d5fa Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 23:26:58 +0000 Subject: [PATCH 018/100] Remove old outdated config variables from blink. --- nvim/lua/plugs/blink.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nvim/lua/plugs/blink.lua b/nvim/lua/plugs/blink.lua index 0b73641..2fb01f8 100644 --- a/nvim/lua/plugs/blink.lua +++ b/nvim/lua/plugs/blink.lua @@ -6,11 +6,6 @@ return { ---@type blink.cmp.Config opts = { keymap = { preset = "super-tab" }, - - -- highlight = { - -- use_nvim_cmp_as_default = true, - -- }, - -- nerd_font_variant = "mono", }, -- allows extending the enabled_providers array elsewhere in your config -- without having to redefining it From 913d98e3897854e5ab51524acb75db05ed72efcc Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 23:27:46 +0000 Subject: [PATCH 019/100] Remove outcommented code that no longer will have any use in the future --- nvim/lua/plugs/codecompanion.lua | 1 - nvim/lua/plugs/noice.lua | 2 -- 2 files changed, 3 deletions(-) diff --git a/nvim/lua/plugs/codecompanion.lua b/nvim/lua/plugs/codecompanion.lua index 6cad3f4..033cf67 100644 --- a/nvim/lua/plugs/codecompanion.lua +++ b/nvim/lua/plugs/codecompanion.lua @@ -3,7 +3,6 @@ return { dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", - -- "hrsh7th/nvim-cmp", { 'echasnovski/mini.diff', version = false }, { "stevearc/dressing.nvim", opts = {} }, }, diff --git a/nvim/lua/plugs/noice.lua b/nvim/lua/plugs/noice.lua index abd847c..e15c16a 100644 --- a/nvim/lua/plugs/noice.lua +++ b/nvim/lua/plugs/noice.lua @@ -16,11 +16,9 @@ return { }, opts = { lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** override = { ["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.stylize_markdown"] = true, - -- ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp }, }, presets = { From eea01d081217089fa68f55bab2444aed9482ee5d Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 23:28:05 +0000 Subject: [PATCH 020/100] Rewrite highlights to neovim api and update colors of tiny-inline-diagnostics to match ayu color scheme. --- nvim/lua/plugs/tiny-inline-diagnostics.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/nvim/lua/plugs/tiny-inline-diagnostics.lua b/nvim/lua/plugs/tiny-inline-diagnostics.lua index dfe67dd..29a7d4a 100644 --- a/nvim/lua/plugs/tiny-inline-diagnostics.lua +++ b/nvim/lua/plugs/tiny-inline-diagnostics.lua @@ -9,11 +9,19 @@ return { virtual_text = false, }) - vim.cmd [[ - highlight DiagnosticUnderlineError gui=undercurl guisp=#ff0000 " Red for error - highlight DiagnosticUnderlineWarn gui=undercurl guisp=#ffaa00 " Yellow/Orange for warning - highlight DiagnosticUnderlineHint gui=undercurl guisp=#00ffff " Cyan for hint - highlight DiagnosticUnderlineInfo gui=undercurl guisp=#0000ff " Blue for info - ]] + local colors = require("ayu.colors") + colors.generate(true) + -- These are not apart of the Ayu color theme, however, I needed these + -- colors while still fitting in with the rest + local ayu_turquoise = "#5CCFE6" + local ayu_dark_blue = "#3A7BD5" + for _, highlight in ipairs({ + { "DiagnosticUnderlineError", { undercurl = true, sp = colors.error } }, + { "DiagnosticUnderlineWarn", { undercurl = true, sp = colors.warning } }, + { "DiagnosticUnderlineHint", { undercurl = true, sp = ayu_turquoise } }, + { "DiagnosticUnderlineInfo", { undercurl = true, sp = ayu_dark_blue } }, + }) do + vim.api.nvim_set_hl(0, highlight[1], highlight[2]) + end end } From 8cb53fd6bddfbbcc4d0234a7c810e7515cc02481 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 19 Jan 2025 23:28:31 +0000 Subject: [PATCH 021/100] Update annoyances to include plugins for daps and lspconfigs. I want all done without any pluginbloat. --- nvim/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/init.lua b/nvim/init.lua index c7b8971..81a15de 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -45,4 +45,5 @@ setup_yank_highlight() -- 1. codelldb doesn't terminate C++ program after debugging. : Don't know how to fix, have asked for help. -- 2. Sometimes very seldomly the cursor stops rendering, the only fix I found is to restsart Neovim. -- 3. Add PR to lspsaga so you can add keybindings for closing hover_doc, rename, finder, incoming_calls, and code actions using many configurable keybindings. I'm after "" and "q". +-- 4. Remove usage of dap-go, dap-python, and rustaceanvim. These are really just providing DAP/LSP configs which I prefer to have without plugin bloat. However, they require more to setup than your average conf. --]] From ef5a1892d83156a18f55496bf78cc628773b3190 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 23 Jan 2025 16:55:30 +0100 Subject: [PATCH 022/100] Move sway from linux_home to nix style dir in root --- {linux_home/.config/sway => sway}/ayu_mirage | 0 {linux_home/.config/sway => sway}/catppuccin_macchiato | 0 {linux_home/.config/sway => sway}/config | 0 {linux_home/.config/sway => sway}/dim_inactive.windows.py | 0 {linux_home/.config/sway => sway}/idle.sh | 0 {linux_home/.config/sway => sway}/status.sh | 0 {linux_home/.config/sway => sway}/toggle_keyboard_layout.sh | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename {linux_home/.config/sway => sway}/ayu_mirage (100%) rename {linux_home/.config/sway => sway}/catppuccin_macchiato (100%) rename {linux_home/.config/sway => sway}/config (100%) rename {linux_home/.config/sway => sway}/dim_inactive.windows.py (100%) rename {linux_home/.config/sway => sway}/idle.sh (100%) rename {linux_home/.config/sway => sway}/status.sh (100%) rename {linux_home/.config/sway => sway}/toggle_keyboard_layout.sh (100%) diff --git a/linux_home/.config/sway/ayu_mirage b/sway/ayu_mirage similarity index 100% rename from linux_home/.config/sway/ayu_mirage rename to sway/ayu_mirage diff --git a/linux_home/.config/sway/catppuccin_macchiato b/sway/catppuccin_macchiato similarity index 100% rename from linux_home/.config/sway/catppuccin_macchiato rename to sway/catppuccin_macchiato diff --git a/linux_home/.config/sway/config b/sway/config similarity index 100% rename from linux_home/.config/sway/config rename to sway/config diff --git a/linux_home/.config/sway/dim_inactive.windows.py b/sway/dim_inactive.windows.py similarity index 100% rename from linux_home/.config/sway/dim_inactive.windows.py rename to sway/dim_inactive.windows.py diff --git a/linux_home/.config/sway/idle.sh b/sway/idle.sh similarity index 100% rename from linux_home/.config/sway/idle.sh rename to sway/idle.sh diff --git a/linux_home/.config/sway/status.sh b/sway/status.sh similarity index 100% rename from linux_home/.config/sway/status.sh rename to sway/status.sh diff --git a/linux_home/.config/sway/toggle_keyboard_layout.sh b/sway/toggle_keyboard_layout.sh similarity index 100% rename from linux_home/.config/sway/toggle_keyboard_layout.sh rename to sway/toggle_keyboard_layout.sh From 369a7656c3497a6dade49022da1326ab6d3e3f50 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 23 Jan 2025 16:57:33 +0100 Subject: [PATCH 023/100] Move aerospace from machome to root --- {mac_home/.config/aerospace => aerospace}/aerospace.toml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {mac_home/.config/aerospace => aerospace}/aerospace.toml (100%) diff --git a/mac_home/.config/aerospace/aerospace.toml b/aerospace/aerospace.toml similarity index 100% rename from mac_home/.config/aerospace/aerospace.toml rename to aerospace/aerospace.toml From 4e4361be5da64e7f43c1dc2d3181d495235c2257 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 23 Jan 2025 16:58:32 +0100 Subject: [PATCH 024/100] Set ghostty theme to ayu mirage --- ghostty/config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ghostty/config b/ghostty/config index 0cf10c4..bee9560 100644 --- a/ghostty/config +++ b/ghostty/config @@ -22,8 +22,7 @@ clipboard-paste-protection = false window-decoration = false shell-integration = zsh -background = #1F2430 -# Transparency +theme = Ayu Mirage background-opacity = 0.95 background-blur-radius = 20 From 4b1a5df3d879a4f989c032fb06529d218be1463a Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 23 Jan 2025 17:15:51 +0100 Subject: [PATCH 025/100] Change neovim flake to repo rather than path, include sway config in linux module. --- flake.lock | 15 ++++++----- flake.nix | 38 ++++++++++++++++++--------- nix/home.nix | 73 ++++++++++++++++++++++++++------------------------- nix/linux.nix | 9 ++++++- 4 files changed, 79 insertions(+), 56 deletions(-) diff --git a/flake.lock b/flake.lock index 5232ce3..8c272eb 100644 --- a/flake.lock +++ b/flake.lock @@ -44,14 +44,17 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1737307637, - "narHash": "sha256-lfx4/4SEtpybaHj5iIFl05XEuFyem7zTReE5pK5F8Bo=", - "path": "/home/nixos/dev/git/neovim-flake", - "type": "path" + "lastModified": 1737305661, + "narHash": "sha256-Y8JhBrvP3eRERJPkcBp/SkPoK3myWmx4etCug/zjeY0=", + "owner": "LarssonMartin1998", + "repo": "neovim-flake", + "rev": "35f8497440ae4702f9b772eab03d63f443875c15", + "type": "github" }, "original": { - "path": "/home/nixos/dev/git/neovim-flake", - "type": "path" + "owner": "LarssonMartin1998", + "repo": "neovim-flake", + "type": "github" } }, "nixpkgs": { diff --git a/flake.nix b/flake.nix index c7e1ec4..d5737e6 100644 --- a/flake.nix +++ b/flake.nix @@ -10,35 +10,44 @@ }; neovim = { - url = "path:/home/nixos/dev/git/neovim-flake"; + url = "github:LarssonMartin1998/neovim-flake"; }; }; - outputs = { nixpkgs, home-manager, neovim, ... }: + outputs = + { + nixpkgs, + home-manager, + neovim, + ... + }: let lib = nixpkgs.lib; - makeHomeConfig = { + makeHomeConfig = + { name, system, - extraModules ? [] + extraModules ? [ ], }: - home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { inherit system; }; - modules = [ + home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { inherit system; }; + modules = + [ ./nix/home.nix ./nix/local_machine.nix - ] + ] ++ extraModules ++ lib.optional (builtins.match ".*-darwin$" system != null) ./nix/darwin.nix ++ lib.optional (builtins.match ".*-linux$" system != null) ./nix/linux.nix; - # Pass neovim-flake to all modules - extraSpecialArgs = { - neovim-flake = neovim; - }; + # Pass neovim-flake to all modules + extraSpecialArgs = { + neovim-flake = neovim; }; - in { + }; + in + { homeConfigurations = { "wsl" = makeHomeConfig { name = "wsl"; @@ -49,16 +58,19 @@ "linux-x86" = makeHomeConfig { name = "linux-x86"; system = "x86_64-linux"; + extraModules = [ ./nix/linux.nix ]; }; "linux-aarch64" = makeHomeConfig { name = "linux-aarch64"; system = "aarch64-linux"; + extraModules = [ ./nix/linux.nix ]; }; "darwin-aarch64" = makeHomeConfig { name = "darwin-aarch64"; system = "aarch64-darwin"; + extraModules = [ ./nix/darwin.nix ]; }; }; }; diff --git a/nix/home.nix b/nix/home.nix index f0edd57..c6a5a63 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -9,42 +9,42 @@ stateVersion = "24.05"; packages = with pkgs; [ neovim-flake.packages.${system}.neovim - fzf - bat - git - yazi - tmux - eza - curl - wget - ripgrep - fd - jq - starship - fastfetch - clang - clang-tools - nixfmt-rfc-style - luajit - zoxide - rustup - zig - zls - nil - lldb - gopls - delve - golangci-lint - cmake - cmake-language-server - cmake-format - cmake-lint - python313Packages.debugpy - pyright - lua-language-server - gnumake - ninja - ]; + fzf + bat + git + yazi + tmux + eza + curl + wget + ripgrep + fd + jq + starship + fastfetch + clang + clang-tools + nixfmt-rfc-style + luajit + zoxide + rustup + zig + zls + nil + lldb + gopls + delve + golangci-lint + cmake + cmake-language-server + cmake-format + cmake-lint + python313Packages.debugpy + pyright + lua-language-server + gnumake + ninja + ]; file = { ".zshrc".source = ../zsh/.zshrc; ".config/nvim".source = ../nvim; @@ -55,6 +55,7 @@ ".config/bat".source = ../bat; ".config/ghostty".source = ../ghostty; ".config/confutils".source = ../confutils; + ".config/wallpapers".source = ../wallpapers; }; }; } diff --git a/nix/linux.nix b/nix/linux.nix index 4b2c5c4..77273d3 100644 --- a/nix/linux.nix +++ b/nix/linux.nix @@ -1,2 +1,9 @@ -{ ... }: { +{ pkgs, ... }: +{ + home = { + stateVersion = "24.05"; + file = { + ".config/sway".source = ../sway; + }; + }; } From f989eefaa43a28badef7786ffc4bd85a0d500c0c Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 23 Jan 2025 17:16:50 +0100 Subject: [PATCH 026/100] Remove stateVersion from linux module --- nix/linux.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nix/linux.nix b/nix/linux.nix index 77273d3..4719e13 100644 --- a/nix/linux.nix +++ b/nix/linux.nix @@ -1,7 +1,5 @@ -{ pkgs, ... }: -{ +{ pkgs, ... }: { home = { - stateVersion = "24.05"; file = { ".config/sway".source = ../sway; }; From ddfe25b8587cffed517b470011eab79c4de3b440 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 23 Jan 2025 22:43:56 +0000 Subject: [PATCH 027/100] Add nodejs --- nix/home.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/home.nix b/nix/home.nix index c6a5a63..19a9b23 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -44,6 +44,7 @@ lua-language-server gnumake ninja + nodejs ]; file = { ".zshrc".source = ../zsh/.zshrc; From 532276488158ef7548dfe9ee37af13431ddeb0c3 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Sat, 25 Jan 2025 14:10:18 +0100 Subject: [PATCH 028/100] Add ghostty to darwin systems, add nix darwin as an input --- flake.nix | 8 +++++--- nix/darwin.nix | 11 ++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index d5737e6..fbf0845 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,8 @@ home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; + nix-darwin.url = "github:LnL7/nix-darwin/master"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; }; neovim = { @@ -58,19 +60,19 @@ "linux-x86" = makeHomeConfig { name = "linux-x86"; system = "x86_64-linux"; - extraModules = [ ./nix/linux.nix ]; + extraModules = []; }; "linux-aarch64" = makeHomeConfig { name = "linux-aarch64"; system = "aarch64-linux"; - extraModules = [ ./nix/linux.nix ]; + extraModules = []; }; "darwin-aarch64" = makeHomeConfig { name = "darwin-aarch64"; system = "aarch64-darwin"; - extraModules = [ ./nix/darwin.nix ]; + extraModules = []; }; }; }; diff --git a/nix/darwin.nix b/nix/darwin.nix index 4b2c5c4..62143aa 100644 --- a/nix/darwin.nix +++ b/nix/darwin.nix @@ -1,2 +1,11 @@ -{ ... }: { +{ pkgs, ... }: { + home = { + packages = with pkgs; [ + ghostty + + ]; + file = { + ".config/ghostty".source = ../ghostty; + }; + }; } From f0f8aeb7b8c9ce8edf3943e7ec1068ef5047d644 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Sun, 26 Jan 2025 00:29:25 +0100 Subject: [PATCH 029/100] Setup nix flake to work with darwin, wsl and linux system configuration. This has ONLY been tested on Darwin so far. --- flake.lock | 162 ++++++++++++++++++++++++++++- flake.nix | 190 ++++++++++++++++++++++++----------- nix/darwin.nix | 11 -- nix/home.nix | 61 ----------- nix/local_home.nix | 12 +++ nix/local_machine.nix | 11 -- nix/local_system.nix | 14 +++ nix/pkgs/darwin.nix | 10 ++ nix/pkgs/home.nix | 68 +++++++++++++ nix/{ => pkgs}/linux.nix | 0 nix/{ => pkgs}/wsl.nix | 0 nix/system/darwin.nix | 58 +++++++++++ nix/system/linux.nix | 2 + nix/system/wsl.nix | 7 ++ nvim/lua/lsp/servers/nil.lua | 6 ++ 15 files changed, 468 insertions(+), 144 deletions(-) delete mode 100644 nix/darwin.nix delete mode 100644 nix/home.nix create mode 100644 nix/local_home.nix delete mode 100644 nix/local_machine.nix create mode 100644 nix/local_system.nix create mode 100644 nix/pkgs/darwin.nix create mode 100644 nix/pkgs/home.nix rename nix/{ => pkgs}/linux.nix (100%) rename nix/{ => pkgs}/wsl.nix (100%) create mode 100644 nix/system/darwin.nix create mode 100644 nix/system/linux.nix create mode 100644 nix/system/wsl.nix diff --git a/flake.lock b/flake.lock index 8c272eb..b178f67 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,38 @@ { "nodes": { + "brew-src": { + "flake": false, + "locked": { + "lastModified": 1731323744, + "narHash": "sha256-SxUQm4cTHcaoPQHoXe26ZV8cZiMWBGow8MjE4L+MckM=", + "owner": "Homebrew", + "repo": "brew", + "rev": "254bf3fe9d8fa2e1b2fb55dbcf535b2d870180c4", + "type": "github" + }, + "original": { + "owner": "Homebrew", + "ref": "4.4.5", + "repo": "brew", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -57,6 +90,85 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737504076, + "narHash": "sha256-/B4XJnzYU/6K1ZZOBIgsa3K4pqDJrnC2579c44c+4rI=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "65cc1fa8e36ceff067daf6cfb142331f02f524d3", + "type": "github" + }, + "original": { + "owner": "LnL7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-darwin_2": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1716329735, + "narHash": "sha256-ap51w+VqG21vuzyQ04WrhI2YbWHd3UGz0e7dc/QQmoA=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "eac4f25028c1975a939c8f8fba95c12f8a25e01c", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-homebrew": { + "inputs": { + "brew-src": "brew-src", + "nix-darwin": "nix-darwin_2", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1736041957, + "narHash": "sha256-Kk/cVtkxwfHNoB6nINUarMLTtyAEvH+ohzxKBptMzzg=", + "owner": "zhaofengli-wip", + "repo": "nix-homebrew", + "rev": "a6d99cc7436fc18c097b3536d9c45c0548c694c8", + "type": "github" + }, + "original": { + "owner": "zhaofengli-wip", + "repo": "nix-homebrew", + "type": "github" + } + }, + "nixos-wsl": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1736095716, + "narHash": "sha256-csysw/Szu98QDiA2lhWk9seYOyCebeVEWL89zh1cduM=", + "owner": "nix-community", + "repo": "NixOS-WSL", + "rev": "63c3b4ed1712a3a0621002cd59bfdc80875ecbb0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "main", + "repo": "NixOS-WSL", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1737110817, @@ -74,6 +186,51 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1687274257, + "narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=", + "path": "/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source", + "rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1716330097, + "narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1733384649, + "narHash": "sha256-K5DJ2LpPqht7K76bsxetI+YHhGGRyVteTPRQaIIKJpw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "190c31a89e5eec80dd6604d7f9e5af3802a58a13", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1736883708, "narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=", @@ -93,7 +250,10 @@ "inputs": { "home-manager": "home-manager", "neovim": "neovim", - "nixpkgs": "nixpkgs_2" + "nix-darwin": "nix-darwin", + "nix-homebrew": "nix-homebrew", + "nixos-wsl": "nixos-wsl", + "nixpkgs": "nixpkgs_5" } }, "systems": { diff --git a/flake.nix b/flake.nix index fbf0845..5fb5769 100644 --- a/flake.nix +++ b/flake.nix @@ -1,79 +1,149 @@ { - description = "LarssonMartin1998's dotfiles configured with Home Manager"; + description = "LarssonMartin1998's dotfiles configured with Home Manager"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - nix-darwin.url = "github:LnL7/nix-darwin/master"; - nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; - }; - - neovim = { - url = "github:LarssonMartin1998/neovim-flake"; - }; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = + nix-darwin = { + url = "github:LnL7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; + neovim.url = "github:LarssonMartin1998/neovim-flake"; + nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; + }; + + outputs = { - nixpkgs, - home-manager, - neovim, - ... + self, + nixpkgs, + home-manager, + nix-darwin, + nixos-wsl, + neovim, + nix-homebrew, + ... }: let - lib = nixpkgs.lib; + lib = nixpkgs.lib; - makeHomeConfig = + makeSystemConfig = { - name, - system, - extraModules ? [ ], + name, + system, + builder, + extraModules ? [ ], + specialArgs ? { }, + }: + builder { + inherit system; + pkgs = import nixpkgs { inherit system; }; + modules = [ + { + nix.settings.experimental-features = "nix-command flakes"; + } + ./nix/local_system.nix + ] ++ extraModules; + + specialArgs = specialArgs; + }; + + makeHomeConfig = + { + name, + system, + extraModules ? [ ], }: home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { inherit system; }; - modules = - [ - ./nix/home.nix - ./nix/local_machine.nix - ] - ++ extraModules - ++ lib.optional (builtins.match ".*-darwin$" system != null) ./nix/darwin.nix - ++ lib.optional (builtins.match ".*-linux$" system != null) ./nix/linux.nix; + pkgs = import nixpkgs { inherit system; }; + modules = [ + ./nix/pkgs/home.nix + ./nix/local_home.nix + ] ++ extraModules; - # Pass neovim-flake to all modules - extraSpecialArgs = { - neovim-flake = neovim; - }; + # Pass neovim-flake to all modules + extraSpecialArgs = { + neovim-flake = neovim; + }; }; in { - homeConfigurations = { - "wsl" = makeHomeConfig { - name = "wsl"; - system = "x86_64-linux"; - extraModules = [ ./nix/wsl.nix ]; - }; - - "linux-x86" = makeHomeConfig { - name = "linux-x86"; - system = "x86_64-linux"; - extraModules = []; - }; - - "linux-aarch64" = makeHomeConfig { - name = "linux-aarch64"; - system = "aarch64-linux"; - extraModules = []; - }; - - "darwin-aarch64" = makeHomeConfig { - name = "darwin-aarch64"; - system = "aarch64-darwin"; - extraModules = []; - }; + nixosConfigurations = { + "wsl" = makeSystemConfig { + name = "wsl"; + system = "x86_64-linux"; + builder = lib.nixosSystem; + extraModules = [ ./nix/system/wsl.nix ]; + specialArgs = { + nixos-wsl = nixos-wsl; + }; }; + + "linux-x86" = makeSystemConfig { + name = "linux-x86"; + system = "x86_64-linux"; + builder = lib.nixosSystem; + extraModules = [ ./nix/system/linux.nix ]; + }; + + "linux-aarch" = makeSystemConfig { + name = "linux-aarch"; + system = "aarch64-linux"; + builder = lib.nixosSystem; + extraModules = [ ./nix/system/linux.nix ]; + }; + }; + + darwinConfigurations."darwin" = makeSystemConfig { + name = "darwin"; + system = "aarch64-darwin"; + builder = nix-darwin.lib.darwinSystem; + extraModules = [ + ./nix/system/darwin.nix + nix-homebrew.darwinModules.nix-homebrew + { + nix-homebrew = { + enable = true; + enableRosetta = true; + }; + } + ]; + specialArgs = { + self = self; + nix-homebrew = nix-homebrew; + }; + }; + + homeConfigurations = { + "wsl" = makeHomeConfig { + name = "wsl"; + system = "x86_64-linux"; + extraModules = [ ./nix/pkgs/wsl.nix ]; + }; + + "linux-x86" = makeHomeConfig { + name = "linux-x86"; + system = "x86_64-linux"; + extraModules = [ ./nix/pkgs/linux.nix ]; + }; + + "linux-aarch" = makeHomeConfig { + name = "linux-aarch"; + system = "aarch64-linux"; + extraModules = [ ./nix/pkgs/linux.nix ]; + }; + + "darwin" = makeHomeConfig { + name = "darwin"; + system = "aarch64-darwin"; + extraModules = [ ./nix/pkgs/darwin.nix ]; + }; + }; }; } diff --git a/nix/darwin.nix b/nix/darwin.nix deleted file mode 100644 index 62143aa..0000000 --- a/nix/darwin.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: { - home = { - packages = with pkgs; [ - ghostty - - ]; - file = { - ".config/ghostty".source = ../ghostty; - }; - }; -} diff --git a/nix/home.nix b/nix/home.nix deleted file mode 100644 index c6a5a63..0000000 --- a/nix/home.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ pkgs, neovim-flake, ... }: { - programs = { - zsh = { - enable = true; - }; - }; - - home = { - stateVersion = "24.05"; - packages = with pkgs; [ - neovim-flake.packages.${system}.neovim - fzf - bat - git - yazi - tmux - eza - curl - wget - ripgrep - fd - jq - starship - fastfetch - clang - clang-tools - nixfmt-rfc-style - luajit - zoxide - rustup - zig - zls - nil - lldb - gopls - delve - golangci-lint - cmake - cmake-language-server - cmake-format - cmake-lint - python313Packages.debugpy - pyright - lua-language-server - gnumake - ninja - ]; - file = { - ".zshrc".source = ../zsh/.zshrc; - ".config/nvim".source = ../nvim; - ".config/yazi".source = ../yazi; - ".config/starship.toml".source = ../starship/starship.toml; - ".tmux.conf".source = ../tmux/.tmux.conf; - ".config/tmux".source = ../tmux; - ".config/bat".source = ../bat; - ".config/ghostty".source = ../ghostty; - ".config/confutils".source = ../confutils; - ".config/wallpapers".source = ../wallpapers; - }; - }; -} diff --git a/nix/local_home.nix b/nix/local_home.nix new file mode 100644 index 0000000..6331a1d --- /dev/null +++ b/nix/local_home.nix @@ -0,0 +1,12 @@ +{ ... }: +{ + # local_home.nix + # This is a template file that is committed to git with minimal changes. + # In order to use this and remain pure, each machine needs to create a local branch, i.e `machine-wsl` and set these variables + # accordingly, and then commit it. + home = { + # Stub values for demonstration. Override these in local branch. + username = "JohnDoe"; + homeDirectory = "/home/johndoe"; + }; +} diff --git a/nix/local_machine.nix b/nix/local_machine.nix deleted file mode 100644 index bae0eda..0000000 --- a/nix/local_machine.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: { - # local-machine.nix - # This is a template file that is committed to git with minimal changes. - # In order to use this and remain pure, each machine needs to create a local branch, i.e `machine-wsl` and set these variables - # accordingly, and then commit it. - home = { - # Stub values for demonstration. Override these in local branch. - username = "nixos"; - homeDirectory = "/home/nixos"; - }; -} diff --git a/nix/local_system.nix b/nix/local_system.nix new file mode 100644 index 0000000..cab669e --- /dev/null +++ b/nix/local_system.nix @@ -0,0 +1,14 @@ +{ + pkgs, + config, + self, + nix-homebrew, + ... +}: +{ + system = { + stateVersion = 5; + }; + + nix-homebrew.user = "larssonmartin1998-mac"; +} diff --git a/nix/pkgs/darwin.nix b/nix/pkgs/darwin.nix new file mode 100644 index 0000000..623d679 --- /dev/null +++ b/nix/pkgs/darwin.nix @@ -0,0 +1,10 @@ +{ pkgs, homebrew, ... }: +{ + home = { + packages = with pkgs; [ + gawk + ]; + file = { + }; + }; +} diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix new file mode 100644 index 0000000..3262a1a --- /dev/null +++ b/nix/pkgs/home.nix @@ -0,0 +1,68 @@ +{ + pkgs, + neovim-flake, + ... +}: +{ + programs = { + zsh = { + enable = true; + }; + }; + + home = { + stateVersion = "24.05"; + packages = with pkgs; [ + neovim-flake.packages.${system}.neovim + fzf + bat + git + yazi + tmux + eza + curl + wget + ripgrep + fd + jq + starship + fastfetch + clang + clang-tools + nixfmt-rfc-style + luajit + zoxide + rustup + zig + zls + nil + lldb + gopls + delve + golangci-lint + cmake + cmake-language-server + cmake-format + cmake-lint + python313Packages.debugpy + pyright + lua-language-server + gnumake + ninja + tldr + nerd-fonts.caskaydia-mono + ]; + file = { + ".zshrc".source = ../../zsh/.zshrc; + ".config/nvim".source = ../../nvim; + ".config/yazi".source = ../../yazi; + ".config/starship.toml".source = ../../starship/starship.toml; + ".tmux.conf".source = ../../tmux/.tmux.conf; + ".config/tmux".source = ../../tmux; + ".config/bat".source = ../../bat; + ".config/ghostty".source = ../../ghostty; + ".config/confutils".source = ../../confutils; + ".config/wallpapers".source = ../../wallpapers; + }; + }; +} diff --git a/nix/linux.nix b/nix/pkgs/linux.nix similarity index 100% rename from nix/linux.nix rename to nix/pkgs/linux.nix diff --git a/nix/wsl.nix b/nix/pkgs/wsl.nix similarity index 100% rename from nix/wsl.nix rename to nix/pkgs/wsl.nix diff --git a/nix/system/darwin.nix b/nix/system/darwin.nix new file mode 100644 index 0000000..0d745fd --- /dev/null +++ b/nix/system/darwin.nix @@ -0,0 +1,58 @@ +{ + pkgs, + config, + self, + ... +}: +{ + system.configurationRevision = self.rev or self.dirtyRev or null; + + environment.systemPackages = with pkgs; [ + home-manager + mkalias + ]; + + homebrew = { + enable = true; + casks = [ + "ghostty" + ]; + brews = [ + "mas" + ]; + masApps = { }; + onActivation.cleanup = "zap"; + onActivation.autoUpdate = true; + onActivation.upgrade = true; + }; + + system.defaults = { + dock.autohide = true; + finder.FXPreferredViewStyle = "clmv"; + loginwindow.GuestEnabled = false; + NSGlobalDomain.AppleICUForce24HourTime = true; + NSGlobalDomain.AppleInterfaceStyle = "Dark"; + NSGlobalDomain.KeyRepeat = 2; + }; + + system.activationScripts.applications.text = + let + env = pkgs.buildEnv { + name = "system-applications"; + paths = config.environment.systemPackages; + pathsToLink = "/Applications"; + }; + in + pkgs.lib.mkForce '' + # Set up applications + echo "setting up /Applications..." >&2 + rm -rf /Applications/Nix\ Apps + mkdir -p /Applications/Nix\ Apps + find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + | + while read -r src; do + app_name=$(basename "$src") + echo "copying $src" >&2 + ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name" + done + ''; +} diff --git a/nix/system/linux.nix b/nix/system/linux.nix new file mode 100644 index 0000000..4b2c5c4 --- /dev/null +++ b/nix/system/linux.nix @@ -0,0 +1,2 @@ +{ ... }: { +} diff --git a/nix/system/wsl.nix b/nix/system/wsl.nix new file mode 100644 index 0000000..db28fae --- /dev/null +++ b/nix/system/wsl.nix @@ -0,0 +1,7 @@ +{ nixos-wsl, ... }: { + imports = [ + nixosWSL.nixosModules.default + ]; + + wsl.enable = true; +} diff --git a/nvim/lua/lsp/servers/nil.lua b/nvim/lua/lsp/servers/nil.lua index c5e65f2..4286aa2 100644 --- a/nvim/lua/lsp/servers/nil.lua +++ b/nvim/lua/lsp/servers/nil.lua @@ -12,4 +12,10 @@ return { }, }, }, + on_attach = function(_, bufnr) + vim.notify("TJENA BBY") + vim.bo[bufnr].tabstop = 2 + vim.bo[bufnr].shiftwidth = 2 + vim.bo[bufnr].softtabstop = 2 + end } From 7be365b419cf5d866f884fc1ca7a4fe7f405075d Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Sun, 26 Jan 2025 00:30:51 +0100 Subject: [PATCH 030/100] Add local home values --- nix/local_home.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/local_home.nix b/nix/local_home.nix index 6331a1d..7882628 100644 --- a/nix/local_home.nix +++ b/nix/local_home.nix @@ -6,7 +6,7 @@ # accordingly, and then commit it. home = { # Stub values for demonstration. Override these in local branch. - username = "JohnDoe"; - homeDirectory = "/home/johndoe"; + username = "larssonmartin1998-mac"; + homeDirectory = "/Users/larssonmartin1998-mac"; }; } From 97e2caa7bba558478d10895be67ee30e3a19cec2 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Sun, 26 Jan 2025 00:31:48 +0100 Subject: [PATCH 031/100] Remove notify --- nvim/lua/lsp/servers/nil.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/nvim/lua/lsp/servers/nil.lua b/nvim/lua/lsp/servers/nil.lua index 4286aa2..7bead9f 100644 --- a/nvim/lua/lsp/servers/nil.lua +++ b/nvim/lua/lsp/servers/nil.lua @@ -13,7 +13,6 @@ return { }, }, on_attach = function(_, bufnr) - vim.notify("TJENA BBY") vim.bo[bufnr].tabstop = 2 vim.bo[bufnr].shiftwidth = 2 vim.bo[bufnr].softtabstop = 2 From 4b5cdbc6ce3430d4259de107f079b5319139f23a Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Sun, 26 Jan 2025 00:35:35 +0100 Subject: [PATCH 032/100] Clean up some unused code, perform formatting --- nix/local_system.nix | 8 +++----- nix/pkgs/darwin.nix | 2 +- nix/pkgs/linux.nix | 11 ++++++----- nix/pkgs/wsl.nix | 3 ++- nix/system/linux.nix | 3 ++- nix/system/wsl.nix | 11 ++++++----- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/nix/local_system.nix b/nix/local_system.nix index cab669e..5be8266 100644 --- a/nix/local_system.nix +++ b/nix/local_system.nix @@ -1,14 +1,12 @@ { - pkgs, - config, - self, - nix-homebrew, ... }: { system = { + # Just a stub value, change this to whatever your system requiers. stateVersion = 5; }; - nix-homebrew.user = "larssonmartin1998-mac"; + # Just a stub value, change this to whatever your system requiers. + nix-homebrew.user = "JohnDoe"; } diff --git a/nix/pkgs/darwin.nix b/nix/pkgs/darwin.nix index 623d679..89babf7 100644 --- a/nix/pkgs/darwin.nix +++ b/nix/pkgs/darwin.nix @@ -1,4 +1,4 @@ -{ pkgs, homebrew, ... }: +{ pkgs, ... }: { home = { packages = with pkgs; [ diff --git a/nix/pkgs/linux.nix b/nix/pkgs/linux.nix index 4719e13..078556e 100644 --- a/nix/pkgs/linux.nix +++ b/nix/pkgs/linux.nix @@ -1,7 +1,8 @@ -{ pkgs, ... }: { - home = { - file = { - ".config/sway".source = ../sway; - }; +{ pkgs, ... }: +{ + home = { + file = { + ".config/sway".source = ../sway; }; + }; } diff --git a/nix/pkgs/wsl.nix b/nix/pkgs/wsl.nix index 4b2c5c4..52c14b8 100644 --- a/nix/pkgs/wsl.nix +++ b/nix/pkgs/wsl.nix @@ -1,2 +1,3 @@ -{ ... }: { +{ ... }: +{ } diff --git a/nix/system/linux.nix b/nix/system/linux.nix index 4b2c5c4..52c14b8 100644 --- a/nix/system/linux.nix +++ b/nix/system/linux.nix @@ -1,2 +1,3 @@ -{ ... }: { +{ ... }: +{ } diff --git a/nix/system/wsl.nix b/nix/system/wsl.nix index db28fae..4df1c79 100644 --- a/nix/system/wsl.nix +++ b/nix/system/wsl.nix @@ -1,7 +1,8 @@ -{ nixos-wsl, ... }: { - imports = [ - nixosWSL.nixosModules.default - ]; +{ nixos-wsl, ... }: +{ + imports = [ + nixos-wsl.nixosModules.default + ]; - wsl.enable = true; + wsl.enable = true; } From 3c2604ff880ed568dd85ab6fc08a7e9d5b47efb1 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Sun, 26 Jan 2025 00:36:34 +0100 Subject: [PATCH 033/100] Fix local_machine username value --- nix/local_system.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nix/local_system.nix b/nix/local_system.nix index 5be8266..fd440f0 100644 --- a/nix/local_system.nix +++ b/nix/local_system.nix @@ -3,10 +3,8 @@ }: { system = { - # Just a stub value, change this to whatever your system requiers. stateVersion = 5; }; - # Just a stub value, change this to whatever your system requiers. - nix-homebrew.user = "JohnDoe"; + nix-homebrew.user = "larssonmartin1998-mac"; } From bdf42672e00ab73a64ecdbe775d25ee980cfab7e Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Sun, 26 Jan 2025 00:50:35 +0100 Subject: [PATCH 034/100] Add trackpad gestures for mac --- nix/system/darwin.nix | 71 +++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/nix/system/darwin.nix b/nix/system/darwin.nix index 0d745fd..e5ad627 100644 --- a/nix/system/darwin.nix +++ b/nix/system/darwin.nix @@ -5,7 +5,6 @@ ... }: { - system.configurationRevision = self.rev or self.dirtyRev or null; environment.systemPackages = with pkgs; [ home-manager @@ -26,33 +25,47 @@ onActivation.upgrade = true; }; - system.defaults = { - dock.autohide = true; - finder.FXPreferredViewStyle = "clmv"; - loginwindow.GuestEnabled = false; - NSGlobalDomain.AppleICUForce24HourTime = true; - NSGlobalDomain.AppleInterfaceStyle = "Dark"; - NSGlobalDomain.KeyRepeat = 2; - }; - - system.activationScripts.applications.text = - let - env = pkgs.buildEnv { - name = "system-applications"; - paths = config.environment.systemPackages; - pathsToLink = "/Applications"; + system = { + configurationRevision = self.rev or self.dirtyRev or null; + defaults = { + dock.autohide = true; + finder.FXPreferredViewStyle = "clmv"; + loginwindow.GuestEnabled = false; + NSGlobalDomain = { + AppleICUForce24HourTime = true; + AppleInterfaceStyle = "Dark"; + KeyRepeat = 2; }; - in - pkgs.lib.mkForce '' - # Set up applications - echo "setting up /Applications..." >&2 - rm -rf /Applications/Nix\ Apps - mkdir -p /Applications/Nix\ Apps - find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + | - while read -r src; do - app_name=$(basename "$src") - echo "copying $src" >&2 - ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name" - done - ''; + trackpad = { + Clicking = true; + TrackpadThreeFingerDrag = true; + TrackpadThreeFingerTapGesture = true; + }; + }; + keyboard = { + enableKeyMapping = true; + remapCapsLockToEscape = true; + swapLeftCtrlAndFn = true; + }; + activationScripts.applications.text = + let + env = pkgs.buildEnv { + name = "system-applications"; + paths = config.environment.systemPackages; + pathsToLink = "/Applications"; + }; + in + pkgs.lib.mkForce '' + # Set up applications + echo "setting up /Applications..." >&2 + rm -rf /Applications/Nix\ Apps + mkdir -p /Applications/Nix\ Apps + find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + | + while read -r src; do + app_name=$(basename "$src") + echo "copying $src" >&2 + ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name" + done + ''; + }; } From 699c93db790f8dc32652dcec8f4690756028b74c Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Sun, 26 Jan 2025 01:14:35 +0100 Subject: [PATCH 035/100] Add darwin system options for dock, finder, keyboard stuff and controlcenter. --- nix/system/darwin.nix | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/nix/system/darwin.nix b/nix/system/darwin.nix index e5ad627..fe0d9aa 100644 --- a/nix/system/darwin.nix +++ b/nix/system/darwin.nix @@ -28,8 +28,22 @@ system = { configurationRevision = self.rev or self.dirtyRev or null; defaults = { - dock.autohide = true; - finder.FXPreferredViewStyle = "clmv"; + dock = { + autohide = true; + persistent-apps = [ ]; + persistent-others = [ ]; + show-recents = false; + static-only = true; + }; + finder = { + _FXShowPosixPathInTitle = true; + _FXSortFoldersFirst = true; + AppleShowAllFiles = true; + AppleShowAllExtensions = true; + ShowPathbar = true; + ShowStatusBar = true; + FXPreferredViewStyle = "clmv"; + }; loginwindow.GuestEnabled = false; NSGlobalDomain = { AppleICUForce24HourTime = true; @@ -39,8 +53,11 @@ trackpad = { Clicking = true; TrackpadThreeFingerDrag = true; - TrackpadThreeFingerTapGesture = true; }; + controlcenter = { + BatteryShowPercentage = true; + }; + hitoolbox.AppleFnUsageType = "Show Emoji & Symbols"; }; keyboard = { enableKeyMapping = true; From afba9ff5c3c6fe66c9860f0d614f8307ca819ade Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Sun, 26 Jan 2025 14:53:57 +0100 Subject: [PATCH 036/100] Add zen browser from homebrew --- nix/system/darwin.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/system/darwin.nix b/nix/system/darwin.nix index fe0d9aa..3069bf2 100644 --- a/nix/system/darwin.nix +++ b/nix/system/darwin.nix @@ -15,6 +15,7 @@ enable = true; casks = [ "ghostty" + "zen-browser" ]; brews = [ "mas" From f5e7488f6ee29b43f07c94c80a2ea87a9538d3d8 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Wed, 29 Jan 2025 18:43:58 +0100 Subject: [PATCH 037/100] Add aerospace to darwin config --- nix/pkgs/darwin.nix | 4 +++- nix/system/darwin.nix | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nix/pkgs/darwin.nix b/nix/pkgs/darwin.nix index 89babf7..3c257cb 100644 --- a/nix/pkgs/darwin.nix +++ b/nix/pkgs/darwin.nix @@ -1,10 +1,12 @@ -{ pkgs, ... }: +{ pkgs, config, ... }: { home = { packages = with pkgs; [ gawk ]; file = { + ".config/aerospace/aerospace.toml".source = + config.lib.file.mkOutOfStoreSymlink ../../aerospace/aerospace.toml; }; }; } diff --git a/nix/system/darwin.nix b/nix/system/darwin.nix index 3069bf2..2712978 100644 --- a/nix/system/darwin.nix +++ b/nix/system/darwin.nix @@ -16,6 +16,7 @@ casks = [ "ghostty" "zen-browser" + "nikitabobko/tap/aerospace" ]; brews = [ "mas" From 5bcc348893619fb6fda83bf1e46eac7f99f1d9d9 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Wed, 29 Jan 2025 18:44:17 +0100 Subject: [PATCH 038/100] use remapTilde for non us keyboard on nix darwin --- nix/system/darwin.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/system/darwin.nix b/nix/system/darwin.nix index 2712978..6a8eed8 100644 --- a/nix/system/darwin.nix +++ b/nix/system/darwin.nix @@ -63,6 +63,7 @@ }; keyboard = { enableKeyMapping = true; + nonUS.remapTilde = true; remapCapsLockToEscape = true; swapLeftCtrlAndFn = true; }; From 31ff307bfd439b3df88385c5a52592f9b3a1be94 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Wed, 29 Jan 2025 18:45:00 +0100 Subject: [PATCH 039/100] Fix symlinks which arent tied to store for dotfiles. This means we can change them without rebuilding. Additionally, this means that lazy lock works. --- nix/pkgs/home.nix | 69 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix index 3262a1a..9f4cf1c 100644 --- a/nix/pkgs/home.nix +++ b/nix/pkgs/home.nix @@ -1,8 +1,63 @@ { pkgs, + config, neovim-flake, ... }: +let + dotfiles = [ + [ + ".zshrc" + "zsh/.zshrc" + ] + [ + ".config/nvim" + "nvim" + ] + [ + ".config/yazi" + "yazi" + ] + [ + ".config/starship.toml" + "starship/starship.toml" + ] + [ + ".tmux.conf" + "tmux/.tmux.conf" + ] + [ + ".config/tmux" + "tmux" + ] + [ + ".config/bat" + "bat" + ] + [ + ".config/ghostty" + "ghostty" + ] + [ + ".config/confutils" + "confutils" + ] + [ + ".config/wallpapers" + "wallpapers" + ] + ]; + + symlinkFiles = builtins.listToAttrs ( + map (file: { + name = builtins.elemAt file 0; + value = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dev/git/.dotfiles/${builtins.elemAt file 1}"; + }; + + }) dotfiles + ); +in { programs = { zsh = { @@ -52,17 +107,7 @@ tldr nerd-fonts.caskaydia-mono ]; - file = { - ".zshrc".source = ../../zsh/.zshrc; - ".config/nvim".source = ../../nvim; - ".config/yazi".source = ../../yazi; - ".config/starship.toml".source = ../../starship/starship.toml; - ".tmux.conf".source = ../../tmux/.tmux.conf; - ".config/tmux".source = ../../tmux; - ".config/bat".source = ../../bat; - ".config/ghostty".source = ../../ghostty; - ".config/confutils".source = ../../confutils; - ".config/wallpapers".source = ../../wallpapers; - }; + + file = symlinkFiles; }; } From ac18c36a31140c987160ade2ecbef4c3a5bd8055 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Thu, 30 Jan 2025 20:51:14 +0100 Subject: [PATCH 040/100] Treat option as alt on mac os in ghostty --- ghostty/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ghostty/config b/ghostty/config index bee9560..461adc8 100644 --- a/ghostty/config +++ b/ghostty/config @@ -32,6 +32,8 @@ link-url = true mouse-hide-while-typing = true window-vsync = true +macos-option-as-alt=true + keybind = ctrl+comma=unbind keybind = alt+one=unbind keybind = alt+two=unbind From 865ee21b8fcf2bc431797b2233e854f5bbc4d1cc Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Thu, 30 Jan 2025 20:51:30 +0100 Subject: [PATCH 041/100] Change keybinds to they work for colemak and qwerty hjkl usage --- tmux/.tmux.conf | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 3f590ef..5fde9a2 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -6,6 +6,10 @@ bind-key -n M-Left select-pane -L bind-key -n M-Down select-pane -D bind-key -n M-Up select-pane -U bind-key -n M-Right select-pane -R +bind-key -n M-h select-pane -L +bind-key -n M-j select-pane -D +bind-key -n M-k select-pane -U +bind-key -n M-l select-pane -R # Resize mode set -g @tmux_resize_mode 0 @@ -20,14 +24,18 @@ bind-key -n Up if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -U" "send-keys bind-key -n Down if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -D" "send-keys Down" bind-key -n Left if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -L" "send-keys Left" bind-key -n Right if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -R" "send-keys Right" +bind-key -n k if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -U" "send-keys k" +bind-key -n j if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -D" "send-keys j" +bind-key -n h if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -L" "send-keys h" +bind-key -n l if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -R" "send-keys l" bind-key -n M-p display-message "#{@tmux_resize_mode}" bind-key -n M-d run-shell "~/.config/tmux/tmux-fuzzy-find-session.sh" # Split window, change keybindings to match vim concept of splits -bind-key -n M-v split-window -h -bind-key -n M-h split-window -v +bind-key -n M-V split-window -h +bind-key -n M-H split-window -v bind-key -n M-q kill-pane bind-key -n M-f resize-pane -Z bind-key -n M-s command-prompt -p "New session: " "run-shell '~/.config/tmux/tmux-create-session.sh '%%''" From 04e06142c2b3d34ac72b5ec006d651e658220f5c Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Thu, 30 Jan 2025 20:51:49 +0100 Subject: [PATCH 042/100] Fix so definition and diagnostic lsp actions in nvim has reuse_win = true --- nvim/lua/lsp/setup.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nvim/lua/lsp/setup.lua b/nvim/lua/lsp/setup.lua index 68d7467..717d2dc 100644 --- a/nvim/lua/lsp/setup.lua +++ b/nvim/lua/lsp/setup.lua @@ -26,9 +26,12 @@ local function global_on_attach(client, bufnr) utils.add_keymaps({ n = { + ["gd"] = { cmd = function() - vim.lsp.buf.definition() + vim.lsp.buf.definition({ + reuse_win = true, + }) end, opts = { noremap = true, @@ -38,7 +41,9 @@ local function global_on_attach(client, bufnr) }, ["gD"] = { cmd = function() - vim.lsp.buf.declaration() + vim.lsp.buf.declaration({ + reuse_win = true, + }) end, opts = { noremap = true, From c2b057b4730e5311a85540f5851d84365c11b262 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Thu, 30 Jan 2025 20:52:12 +0100 Subject: [PATCH 043/100] Add discord to darwin pkgs --- nix/pkgs/darwin.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/pkgs/darwin.nix b/nix/pkgs/darwin.nix index 3c257cb..d5d9079 100644 --- a/nix/pkgs/darwin.nix +++ b/nix/pkgs/darwin.nix @@ -3,6 +3,7 @@ home = { packages = with pkgs; [ gawk + discord ]; file = { ".config/aerospace/aerospace.toml".source = From 97012c034cd30e358179771d1900d4fbd5b937f7 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Thu, 30 Jan 2025 20:58:05 +0100 Subject: [PATCH 044/100] Allow unfree nixpkgs for systems and home manager --- flake.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 5fb5769..da950d7 100644 --- a/flake.nix +++ b/flake.nix @@ -43,7 +43,12 @@ }: builder { inherit system; - pkgs = import nixpkgs { inherit system; }; + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + }; modules = [ { nix.settings.experimental-features = "nix-command flakes"; @@ -61,7 +66,12 @@ extraModules ? [ ], }: home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { inherit system; }; + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + }; modules = [ ./nix/pkgs/home.nix ./nix/local_home.nix From 77e2a2e8f1e71fd84bb455c24c6824559b6cb68e Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Thu, 30 Jan 2025 20:58:34 +0100 Subject: [PATCH 045/100] Update flake --- flake.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index b178f67..306370d 100644 --- a/flake.lock +++ b/flake.lock @@ -58,11 +58,11 @@ ] }, "locked": { - "lastModified": 1736785676, - "narHash": "sha256-TY0jUwR3EW0fnS0X5wXMAVy6h4Z7Y6a3m+Yq++C9AyE=", + "lastModified": 1738266157, + "narHash": "sha256-nUfADd/h6YwGQWQB9pmT8dVkkQpfPG+gU6PVwCZmGzE=", "owner": "nix-community", "repo": "home-manager", - "rev": "fc52a210b60f2f52c74eac41a8647c1573d2071d", + "rev": "bf2a029bcde2e223db10a0a3fb9a94dc9e833d75", "type": "github" }, "original": { @@ -77,11 +77,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1737305661, - "narHash": "sha256-Y8JhBrvP3eRERJPkcBp/SkPoK3myWmx4etCug/zjeY0=", + "lastModified": 1738266384, + "narHash": "sha256-bElFR0jR2qRg0SrwWlm0CJJKGgPRLSoPN1N/26H4DNQ=", "owner": "LarssonMartin1998", "repo": "neovim-flake", - "rev": "35f8497440ae4702f9b772eab03d63f443875c15", + "rev": "75c20106d069de3f38b7c0c420e1836ac4681b18", "type": "github" }, "original": { @@ -97,11 +97,11 @@ ] }, "locked": { - "lastModified": 1737504076, - "narHash": "sha256-/B4XJnzYU/6K1ZZOBIgsa3K4pqDJrnC2579c44c+4rI=", + "lastModified": 1738033138, + "narHash": "sha256-qlIM8A3bdL9c6PexhpS+QyZLO9y/8a3V75HVyJgDE5Q=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "65cc1fa8e36ceff067daf6cfb142331f02f524d3", + "rev": "349a74c66c596ef97ee97b4d80a3ca61227b6120", "type": "github" }, "original": { @@ -232,11 +232,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1736883708, - "narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=", + "lastModified": 1738142207, + "narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "eb62e6aa39ea67e0b8018ba8ea077efe65807dc8", + "rev": "9d3ae807ebd2981d593cddd0080856873139aa40", "type": "github" }, "original": { From bcd0bb9a718d113784771a46667adf1b154ad922 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Tue, 4 Feb 2025 23:31:23 +0100 Subject: [PATCH 046/100] Add dartls --- nvim/lua/lsp/servers/dartls.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 nvim/lua/lsp/servers/dartls.lua diff --git a/nvim/lua/lsp/servers/dartls.lua b/nvim/lua/lsp/servers/dartls.lua new file mode 100644 index 0000000..3032515 --- /dev/null +++ b/nvim/lua/lsp/servers/dartls.lua @@ -0,0 +1,18 @@ +return { + cmd = { "dart", "language-server", "--protocol=lsp" }, + filetypes = { "dart" }, + root_markers = { "pubspec.yaml" }, + init_options = { + onlyAnalyzeProjectsWithOpenFiles = true, + suggestFromUnimportedLibraries = true, + closingLabels = true, + outline = true, + flutterOutline = true, + }, + settings = { + dart = { + completeFunctionCalls = true, + showTodos = true, + }, + }, +} From b77dfc5ab7363264c75a19048100519098c41bfd Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Tue, 4 Feb 2025 23:31:45 +0100 Subject: [PATCH 047/100] Remove alt keybinds from ghostty --- ghostty/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ghostty/config b/ghostty/config index 461adc8..9c7c69b 100644 --- a/ghostty/config +++ b/ghostty/config @@ -44,3 +44,5 @@ keybind = alt+six=unbind keybind = alt+seven=unbind keybind = alt+eight=unbind keybind = alt+nine=unbind +keybind = alt+left=unbind +keybind = alt+right=unbind From 0143d949a25f4fdc5599acd844e7df481a4aea50 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Tue, 4 Feb 2025 23:32:00 +0100 Subject: [PATCH 048/100] Add dart and go to nix home --- flake.lock | 12 ++++++------ nix/pkgs/home.nix | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 306370d..53c2949 100644 --- a/flake.lock +++ b/flake.lock @@ -58,11 +58,11 @@ ] }, "locked": { - "lastModified": 1738266157, - "narHash": "sha256-nUfADd/h6YwGQWQB9pmT8dVkkQpfPG+gU6PVwCZmGzE=", + "lastModified": 1738275749, + "narHash": "sha256-PM+cGduJ05EZ+YXulqAwUFjvfKpPmW080mcuN6R1POw=", "owner": "nix-community", "repo": "home-manager", - "rev": "bf2a029bcde2e223db10a0a3fb9a94dc9e833d75", + "rev": "a8159195bfaef3c64df75d3b1e6a68d49d392be9", "type": "github" }, "original": { @@ -97,11 +97,11 @@ ] }, "locked": { - "lastModified": 1738033138, - "narHash": "sha256-qlIM8A3bdL9c6PexhpS+QyZLO9y/8a3V75HVyJgDE5Q=", + "lastModified": 1738277753, + "narHash": "sha256-iyFcCOk0mmDiv4ut9mBEuMxMZIym3++0qN1rQBg8FW0=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "349a74c66c596ef97ee97b4d80a3ca61227b6120", + "rev": "49b807fa7c37568d7fbe2aeaafb9255c185412f9", "type": "github" }, "original": { diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix index 9f4cf1c..c1f1de8 100644 --- a/nix/pkgs/home.nix +++ b/nix/pkgs/home.nix @@ -87,6 +87,8 @@ in nixfmt-rfc-style luajit zoxide + dart + go rustup zig zls From f542125e9270f4fdd43e8f0a65bd15618a05c852 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Tue, 4 Feb 2025 23:32:29 +0100 Subject: [PATCH 049/100] Remove inlay hints from gopls, theyre not as needed in go as other languages, and they work poorly as well. --- nvim/lua/lsp/servers/gopls.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nvim/lua/lsp/servers/gopls.lua b/nvim/lua/lsp/servers/gopls.lua index d59bc8e..f20cc50 100644 --- a/nvim/lua/lsp/servers/gopls.lua +++ b/nvim/lua/lsp/servers/gopls.lua @@ -5,11 +5,6 @@ return { filetypes = { "go", "gomod", "gowork", "gotmpl" }, settings = { gopls = { - ["ui.inlayhints.hints"] = { - compositeLiteralFields = true, - constantValues = true, - parameterNames = true, - }, analyses = { unusedparams = true, }, From 9417ccf85815f98fb4e07c4bea552bd390e187a0 Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Tue, 4 Feb 2025 23:32:49 +0100 Subject: [PATCH 050/100] Remove the is_mirage var from ayu impl. It's not necessarily bad, however, it's inconsistent since I'm already using it hardcoded in other places where I need the colors generated and I cba to implement a dedicated handle for it. --- nvim/lua/plugs/ayu.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nvim/lua/plugs/ayu.lua b/nvim/lua/plugs/ayu.lua index ca7edb6..aca05ec 100644 --- a/nvim/lua/plugs/ayu.lua +++ b/nvim/lua/plugs/ayu.lua @@ -26,11 +26,9 @@ end return { "Shatur/neovim-ayu", config = function() - local is_mirage = true - local ayu = require("ayu") local colors = require("ayu.colors") - colors.generate(is_mirage) + colors.generate(true) local overrides = { global_variable = { @@ -56,8 +54,8 @@ return { } ayu.setup({ - mirage = is_mirage, -- Set to `true` to use `mirage` variant instead of `dark` for dark background. - terminal = false, -- Set to `false` to let terminal manage its own colors. + mirage = true, + terminal = false, overrides = { -- TRANSPARENCY Normal = { bg = "none" }, From 3fa4d50d74fe1eb2f05dc4ff6cd4c2920a339f3a Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Tue, 4 Feb 2025 23:36:30 +0100 Subject: [PATCH 051/100] Update ibl to set a different highlight for current scope --- nvim/lua/plugs/indent_blankline.lua | 33 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/nvim/lua/plugs/indent_blankline.lua b/nvim/lua/plugs/indent_blankline.lua index b068bc9..e009902 100644 --- a/nvim/lua/plugs/indent_blankline.lua +++ b/nvim/lua/plugs/indent_blankline.lua @@ -2,10 +2,31 @@ return { "lukas-reineke/indent-blankline.nvim", main = "ibl", event = "BufRead", - opts = { - debounce = 100, - scope = { - enabled = false - }, - } + config = function() + local ibl = require("ibl") + ibl.setup({ + debounce = 100, + indent = { + char = "▏", + }, + scope = { + enabled = true, + char = "▏", + show_start = false, + show_end = false, + highlight = { "IblScope" }, + }, + }) + + local colors = require("ayu.colors") + colors.generate(true) + local highlights = { + { "IblScope", { fg = colors.keyword } }, + { "@ibl.scope.char.1", { fg = colors.keyword } }, + } + + for _, hl in ipairs(highlights) do + vim.api.nvim_set_hl(0, hl[1], hl[2]) + end + end } From e0462c4cfbadb5d6fcffe06ac6feabd30b11407a Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 9 Feb 2025 13:39:58 +0000 Subject: [PATCH 052/100] Add home manager to wsl system --- nix/system/wsl.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nix/system/wsl.nix b/nix/system/wsl.nix index 4df1c79..09e975b 100644 --- a/nix/system/wsl.nix +++ b/nix/system/wsl.nix @@ -1,8 +1,12 @@ -{ nixos-wsl, ... }: +{ nixos-wsl, pkgs, ... }: { imports = [ nixos-wsl.nixosModules.default ]; wsl.enable = true; + + environment.systemPackages = with pkgs; [ + home-manager + ]; } From 863b5399e4fb7655ae59a803bef5460cabe2eef0 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 9 Feb 2025 15:35:59 +0000 Subject: [PATCH 053/100] Enable zsh for wsl systems --- nix/system/wsl.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nix/system/wsl.nix b/nix/system/wsl.nix index 09e975b..f4752eb 100644 --- a/nix/system/wsl.nix +++ b/nix/system/wsl.nix @@ -9,4 +9,14 @@ environment.systemPackages = with pkgs; [ home-manager ]; + + programs = { + zsh = { + enable = true; + }; + }; + + users.users.nixos = { + shell = pkgs.zsh; + }; } From 37661ca5138a7da7c37632dcb6a9541a9f7186af Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Wed, 12 Feb 2025 23:59:01 +0000 Subject: [PATCH 054/100] New tmux windows now start in the same working directory --- tmux/.tmux.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 5fde9a2..f457b5f 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -34,12 +34,12 @@ bind-key -n M-p display-message "#{@tmux_resize_mode}" bind-key -n M-d run-shell "~/.config/tmux/tmux-fuzzy-find-session.sh" # Split window, change keybindings to match vim concept of splits -bind-key -n M-V split-window -h -bind-key -n M-H split-window -v +bind-key -n M-V split-window -h -c "#{pane_current_path}" +bind-key -n M-H split-window -v -c "#{pane_current_path}" bind-key -n M-q kill-pane bind-key -n M-f resize-pane -Z bind-key -n M-s command-prompt -p "New session: " "run-shell '~/.config/tmux/tmux-create-session.sh '%%''" -bind-key -n M-w new-window +bind-key -n M-w new-window -c "#{pane_current_path}" bind-key -n M-r command-prompt -p "Rename window:" "rename-window '%%'" bind-key -n M-R command-prompt -p "Rename session:" "rename-session '%%'" From 51097e4aaec14a12fa9fff1054796274e7df79f6 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 13 Feb 2025 00:14:03 +0000 Subject: [PATCH 055/100] Remove session name from end of right status panel in tmux --- tmux/.tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index f457b5f..da44145 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -126,7 +126,7 @@ setw -g window-status-format "#[bg=#171B24,fg=#CCCAC2] #[bold]#I #[default] #[fg setw -g window-status-current-format "#[bg=#757B84,fg=#EFEDE7] #[bold]#I #[default] #[fg=#FFAD66]#W #[default]" # Set the right status: Battery, date and time, session name -set -g status-right "#($HOME/.config/tmux/tmux-status-right.sh) | #S#[default]" +set -g status-right "#($HOME/.config/tmux/tmux-status-right.sh)" set -g status-bg "#171B24" set -g status-style bold From fd811cbfb3877ce2debbcf13a0531f45069e37e7 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 13 Feb 2025 00:14:25 +0000 Subject: [PATCH 056/100] Battery info is not included in tmux right status if on a desktop without battery. --- tmux/tmux-status-right.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tmux/tmux-status-right.sh b/tmux/tmux-status-right.sh index b8eed96..cf6c7ad 100755 --- a/tmux/tmux-status-right.sh +++ b/tmux/tmux-status-right.sh @@ -9,7 +9,11 @@ battery_result=$($HOME/.config/confutils/get-battery.sh) space=" " session=$(format_for_tmux "#S") -battery=$(format_for_tmux "$battery_result") calendar=$(format_for_tmux " $(date +"%a %b %d")") -echo $session$space$battery$space$calendar +if [ -n "$battery_result" ]; then + battery=$(format_for_tmux "$battery_result") + echo $session$space$battery$space$calendar +else + echo $session$space$calendar +fi From 41d1a71cac0cbf61ec9d845ac97fba30f319d846 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 13 Feb 2025 00:15:04 +0000 Subject: [PATCH 057/100] Add wslu to pkgs/wsl.nix --- nix/pkgs/wsl.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nix/pkgs/wsl.nix b/nix/pkgs/wsl.nix index 52c14b8..6df1c82 100644 --- a/nix/pkgs/wsl.nix +++ b/nix/pkgs/wsl.nix @@ -1,3 +1,8 @@ -{ ... }: +{ pkgs, ... }: { + home = { + packages = with pkgs; [ + wslu + ]; + }; } From 9be43da63a5ff82fe4178697234771cc2b709bbe Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Fri, 14 Feb 2025 12:44:48 +0000 Subject: [PATCH 058/100] Group clangtools together, also add nodejs for copilot in neovim --- nix/pkgs/home.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix index c1f1de8..a8cfd36 100644 --- a/nix/pkgs/home.nix +++ b/nix/pkgs/home.nix @@ -82,8 +82,6 @@ in jq starship fastfetch - clang - clang-tools nixfmt-rfc-style luajit zoxide @@ -93,7 +91,6 @@ in zig zls nil - lldb gopls delve golangci-lint @@ -108,6 +105,10 @@ in ninja tldr nerd-fonts.caskaydia-mono + clang + clang-tools + lldb + nodejs ]; file = symlinkFiles; From 1e166c632be70acf344352b18625982fe64b3bc8 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Fri, 14 Feb 2025 12:45:06 +0000 Subject: [PATCH 059/100] Build bat cache on home manager rebuild. --- nix/pkgs/home.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix index a8cfd36..d8f123c 100644 --- a/nix/pkgs/home.nix +++ b/nix/pkgs/home.nix @@ -1,6 +1,7 @@ { pkgs, config, + lib, neovim-flake, ... }: @@ -112,5 +113,8 @@ in ]; file = symlinkFiles; + activation.batCache = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run ${pkgs.bat}/bin/bat cache --build + ''; }; } From 3d3de5d221f96f4182a69892a4461517968d6b4d Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Mon, 17 Feb 2025 18:00:18 +0000 Subject: [PATCH 060/100] Add smear cursor plugin to neovim --- nvim/lua/plugs/smear_cursor.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 nvim/lua/plugs/smear_cursor.lua diff --git a/nvim/lua/plugs/smear_cursor.lua b/nvim/lua/plugs/smear_cursor.lua new file mode 100644 index 0000000..88ad75e --- /dev/null +++ b/nvim/lua/plugs/smear_cursor.lua @@ -0,0 +1,19 @@ +return { + "sphamba/smear-cursor.nvim", + opts = { + smear_between_buffers = true, + + min_horizontal_distance_smear = 3, + min_vertical_distance_smear = 2, + + scroll_buffer_space = true, + smear_insert_mode = false, + + cursor_color = "#d3cdc3", + transparent_bg_fallback_color = "#303030", + + stiffness = 0.85, + trailing_stiffness = 0.7, + distance_stop_animating = 0.5, + }, +} From 9cb58fb978f9a89f2df088c5de8355d0116d7c4d Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Tue, 18 Feb 2025 12:46:35 +0100 Subject: [PATCH 061/100] Change opacity values, fix formatting, change cursor color --- ghostty/config | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ghostty/config b/ghostty/config index 9c7c69b..9dd5f43 100644 --- a/ghostty/config +++ b/ghostty/config @@ -23,14 +23,16 @@ window-decoration = false shell-integration = zsh theme = Ayu Mirage -background-opacity = 0.95 -background-blur-radius = 20 +background-opacity = 0.90 +background-blur-radius = 7 -bold-is-bright = true -cursor-invert-fg-bg = true -link-url = true -mouse-hide-while-typing = true -window-vsync = true +bold-is-bright = true +cursor-invert-fg-bg = false +link-url = true +mouse-hide-while-typing = true +window-vsync = true +cursor-click-to-move = false +cursor-text = #000000 macos-option-as-alt=true From aa526204b50fcc91f14b51012f72d18f69a525cd Mon Sep 17 00:00:00 2001 From: Martin Lasson Date: Tue, 18 Feb 2025 12:47:10 +0100 Subject: [PATCH 062/100] Fix so smear cursor matches the color of the cursor in the terminal --- nvim/lua/plugs/smear_cursor.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/plugs/smear_cursor.lua b/nvim/lua/plugs/smear_cursor.lua index 88ad75e..63984b1 100644 --- a/nvim/lua/plugs/smear_cursor.lua +++ b/nvim/lua/plugs/smear_cursor.lua @@ -9,7 +9,7 @@ return { scroll_buffer_space = true, smear_insert_mode = false, - cursor_color = "#d3cdc3", + cursor_color = "#FFCC66", transparent_bg_fallback_color = "#303030", stiffness = 0.85, From e2161427832543df7e5ac057bfd6f043116ed6f1 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Wed, 19 Feb 2025 00:05:31 +0000 Subject: [PATCH 063/100] Update signcolumn, show diagnostics colored line numbers, remove diagnostics signs from column. Remove tiny inline diagnostics and re-enable virtual text with a circle icon instead of a box icon. from c --- nvim/init.lua | 5 ++- nvim/lua/diagnostics.lua | 37 ++++++++++++++++++++++ nvim/lua/lsp/setup.lua | 7 ---- nvim/lua/plugs/tiny-inline-diagnostics.lua | 27 ---------------- nvim/lua/vim_opt.lua | 4 +-- 5 files changed, 42 insertions(+), 38 deletions(-) create mode 100644 nvim/lua/diagnostics.lua delete mode 100644 nvim/lua/plugs/tiny-inline-diagnostics.lua diff --git a/nvim/init.lua b/nvim/init.lua index 81a15de..738893f 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -16,7 +16,7 @@ end -- Load keymaps before loading any plugins require("keymaps") --- change and personalize native vim settings +-- Change and personalize native vim settings vim.opt = require("vim_opt") -- Initialize Lazy package manager @@ -40,6 +40,9 @@ require("dap/setup") -- See ":help vim.highlight.on_yank()" setup_yank_highlight() +-- Change built in settings related to diagnostics +require("diagnostics") + --[[ -- Annoyances in Neovim environment: -- 1. codelldb doesn't terminate C++ program after debugging. : Don't know how to fix, have asked for help. diff --git a/nvim/lua/diagnostics.lua b/nvim/lua/diagnostics.lua new file mode 100644 index 0000000..8bbfc18 --- /dev/null +++ b/nvim/lua/diagnostics.lua @@ -0,0 +1,37 @@ +local colors = require("ayu.colors") +colors.generate(true) +-- These are not apart of the Ayu color theme, however, I needed these +-- colors while still fitting in with the rest +local ayu_turquoise = "#5CCFE6" +local ayu_dark_blue = "#3A7BD5" +for _, highlight in ipairs({ + { "DiagnosticUnderlineError", { undercurl = true, sp = colors.error } }, + { "DiagnosticUnderlineWarn", { undercurl = true, sp = colors.warning } }, + { "DiagnosticUnderlineHint", { undercurl = true, sp = ayu_turquoise } }, + { "DiagnosticUnderlineInfo", { undercurl = true, sp = ayu_dark_blue } }, +}) do + vim.api.nvim_set_hl(0, highlight[1], highlight[2]) +end + +local sev = vim.diagnostic.severity +vim.diagnostic.config({ + underline = true, + virtual_text = { + prefix = "●", + }, + update_in_insert = true, + signs = { + text = { + [sev.ERROR] = "", + [sev.WARN] = "", + [sev.INFO] = "", + [sev.HINT] = "", + }, + numhl = { + [sev.WARN] = "WarningMsg", + [sev.ERROR] = "ErrorMsg", + [sev.INFO] = "DiagnosticInfo", + [sev.HINT] = "DiagnosticHint", + }, + }, +}) diff --git a/nvim/lua/lsp/setup.lua b/nvim/lua/lsp/setup.lua index 717d2dc..73f85b5 100644 --- a/nvim/lua/lsp/setup.lua +++ b/nvim/lua/lsp/setup.lua @@ -58,13 +58,6 @@ end local global_capabilities = require("blink.cmp").get_lsp_capabilities() global_capabilities.offsetEncoding = { "utf-16" } -vim.diagnostic.config({ - underline = true, -- Underline diagnostic errors - virtual_text = false, -- Disable inline text messages - signs = true, -- Show icons in the sign column - update_in_insert = true, -- Update diagnostics during insert mode -}) - vim.lsp.config("*", { capabilities = global_capabilities, handlers = { diff --git a/nvim/lua/plugs/tiny-inline-diagnostics.lua b/nvim/lua/plugs/tiny-inline-diagnostics.lua deleted file mode 100644 index 29a7d4a..0000000 --- a/nvim/lua/plugs/tiny-inline-diagnostics.lua +++ /dev/null @@ -1,27 +0,0 @@ -return { - "rachartier/tiny-inline-diagnostic.nvim", - event = "VeryLazy", - priority = 1000, - config = function() - require("tiny-inline-diagnostic").setup() - - vim.diagnostic.config({ - virtual_text = false, - }) - - local colors = require("ayu.colors") - colors.generate(true) - -- These are not apart of the Ayu color theme, however, I needed these - -- colors while still fitting in with the rest - local ayu_turquoise = "#5CCFE6" - local ayu_dark_blue = "#3A7BD5" - for _, highlight in ipairs({ - { "DiagnosticUnderlineError", { undercurl = true, sp = colors.error } }, - { "DiagnosticUnderlineWarn", { undercurl = true, sp = colors.warning } }, - { "DiagnosticUnderlineHint", { undercurl = true, sp = ayu_turquoise } }, - { "DiagnosticUnderlineInfo", { undercurl = true, sp = ayu_dark_blue } }, - }) do - vim.api.nvim_set_hl(0, highlight[1], highlight[2]) - end - end -} diff --git a/nvim/lua/vim_opt.lua b/nvim/lua/vim_opt.lua index 56440a7..80c2924 100644 --- a/nvim/lua/vim_opt.lua +++ b/nvim/lua/vim_opt.lua @@ -22,7 +22,7 @@ opt.softtabstop = 4 opt.shortmess:append("sI") -- Signcolumn -opt.signcolumn = "yes:2" -- Adds a spacing to the left which can contain gutter icons +opt.signcolumn = "yes:1" -- Adds a spacing to the left which can contain gutter icons opt.fillchars = { eob = " " } -- Remove the fill character for empty lines which defaults to: "~" -- Search @@ -66,8 +66,6 @@ opt.termsync = true opt.scrolloff = 4 -- Whitespaces --- opt.listchars = { tab = "→\"", trail = "·", nbsp = "␣" } --- opt.list = true opt.list = false return opt From c48a4789a73181606d3f710585e693a054df0b9f Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Wed, 19 Feb 2025 00:08:51 +0000 Subject: [PATCH 064/100] Aerospace now opens ghostty and not alacritty --- aerospace/aerospace.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aerospace/aerospace.toml b/aerospace/aerospace.toml index 080e1b0..e547b2e 100644 --- a/aerospace/aerospace.toml +++ b/aerospace/aerospace.toml @@ -69,7 +69,7 @@ cmd-alt-h = [] # Disable "hide others" # All possible modifiers: cmd, alt, ctrl, shift # All possible commands: https://nikitabobko.github.io/AeroSpace/commands -cmd-enter = 'exec-and-forget open -n /Applications/Alacritty.app' +cmd-enter = 'exec-and-forget open -n /Applications/Ghostty.app' # See: https://nikitabobko.github.io/AeroSpace/commands#layout # alt-slash = 'layout tiles horizontal vertical' From 204119eb2b90b2706bb2cfe272e48f18ea7ba355 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 20 Feb 2025 00:36:36 +0000 Subject: [PATCH 065/100] Remove neorg --- nvim/lua/plugs/neorg.lua | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 nvim/lua/plugs/neorg.lua diff --git a/nvim/lua/plugs/neorg.lua b/nvim/lua/plugs/neorg.lua deleted file mode 100644 index f1e27b2..0000000 --- a/nvim/lua/plugs/neorg.lua +++ /dev/null @@ -1,18 +0,0 @@ -return { - "nvim-neorg/neorg", - opts = { - load = { - ["core.defaults"] = {}, - ["core.dirman"] = { - config = { - workspaces = { - my_workspace = "~/.neorg", - }, - }, - }, - ["core.concealer"] = {}, - }, - }, - event = "VeryLazy", - lazy = true, -} From c9d7fc0b13c8a81540db7ef60533d24d45787ae4 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 20 Feb 2025 00:36:57 +0000 Subject: [PATCH 066/100] Add markview to neovim (deps on tree sitter cli, and tree sitter parsers: latex & typst) --- nix/pkgs/home.nix | 1 + nvim/lua/plugs/markview.lua | 4 ++++ nvim/lua/plugs/treesitter.lua | 2 ++ 3 files changed, 7 insertions(+) create mode 100644 nvim/lua/plugs/markview.lua diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix index d8f123c..ae22cb7 100644 --- a/nix/pkgs/home.nix +++ b/nix/pkgs/home.nix @@ -110,6 +110,7 @@ in clang-tools lldb nodejs + tree-sitter ]; file = symlinkFiles; diff --git a/nvim/lua/plugs/markview.lua b/nvim/lua/plugs/markview.lua new file mode 100644 index 0000000..85129d0 --- /dev/null +++ b/nvim/lua/plugs/markview.lua @@ -0,0 +1,4 @@ +return { + "OXY2DEV/markview.nvim", + lazy = false +} diff --git a/nvim/lua/plugs/treesitter.lua b/nvim/lua/plugs/treesitter.lua index dbed89d..1ca9ac1 100644 --- a/nvim/lua/plugs/treesitter.lua +++ b/nvim/lua/plugs/treesitter.lua @@ -47,6 +47,8 @@ return { "dap_repl", "muttrc", "python", + "latex", + "typst", }, sync_install = false, -- This can be updated to a list of languages instead of defaulting to true From e14ad3ddcc5b040406d3bcc08f01fff4dbe72047 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 20 Feb 2025 00:37:37 +0000 Subject: [PATCH 067/100] Change merge tools view to one window in diffview --- nvim/lua/plugs/neogit.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/nvim/lua/plugs/neogit.lua b/nvim/lua/plugs/neogit.lua index 04595f1..8707296 100644 --- a/nvim/lua/plugs/neogit.lua +++ b/nvim/lua/plugs/neogit.lua @@ -1,11 +1,18 @@ return { "NeogitOrg/neogit", dependencies = { - "sindrets/diffview.nvim", + { + "sindrets/diffview.nvim", + opts = { + view = { + merge_tool = { + layout = "diff1_plain", + }, + }, + }, + } }, event = "VeryLazy", lazy = true, - config = function() - require("neogit").setup() - end + opts = {}, } From 069cf3e7719099f4b9fa53f020abdc35dd0f481e Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 20 Feb 2025 00:38:03 +0000 Subject: [PATCH 068/100] Add sway and wl-copy to linux --- nix/pkgs/linux.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nix/pkgs/linux.nix b/nix/pkgs/linux.nix index 078556e..b22dbc4 100644 --- a/nix/pkgs/linux.nix +++ b/nix/pkgs/linux.nix @@ -1,6 +1,10 @@ { pkgs, ... }: { home = { + packages = with pkgs; [ + wl-clipboard-rs + sway + ]; file = { ".config/sway".source = ../sway; }; From 406d801b6db0ac8ca70e24c4bd3d8dfff44acb6e Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 20 Feb 2025 00:45:22 +0000 Subject: [PATCH 069/100] Remove keybinds for gitsigns which I never used, add keybind for neogit --- nvim/lua/plugs/incline.lua | 6 ------ nvim/lua/plugs/neogit.lua | 13 ++++++++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/nvim/lua/plugs/incline.lua b/nvim/lua/plugs/incline.lua index 7bd5f7f..3557bf1 100644 --- a/nvim/lua/plugs/incline.lua +++ b/nvim/lua/plugs/incline.lua @@ -82,12 +82,6 @@ return { require("utils").add_keymaps({ n = { - ["gh"] = { - cmd = gitsigns.preview_hunk - }, - ["gb"] = { - cmd = gitsigns.toggle_current_line_blame - }, ["[g"] = { cmd = function() gitsigns.nav_hunk("prev") end }, diff --git a/nvim/lua/plugs/neogit.lua b/nvim/lua/plugs/neogit.lua index 8707296..a655912 100644 --- a/nvim/lua/plugs/neogit.lua +++ b/nvim/lua/plugs/neogit.lua @@ -14,5 +14,16 @@ return { }, event = "VeryLazy", lazy = true, - opts = {}, + config = function() + local neogit = require("neogit") + neogit.setup() + + require("utils").add_keymaps({ + n = { + ["g"] = { + cmd = function() neogit.open({ kind = "vsplit" }) end, + }, + } + }) + end } From 269d540212bb7e4c00abf89fee6b1ac66a27e1b4 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Thu, 20 Feb 2025 22:56:48 +0000 Subject: [PATCH 070/100] Add diagnostics to lualine --- nvim/lua/diagnostics.lua | 22 +++++++++++++++++----- nvim/lua/plugs/lualine.lua | 11 ++++++++++- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/nvim/lua/diagnostics.lua b/nvim/lua/diagnostics.lua index 8bbfc18..754b5eb 100644 --- a/nvim/lua/diagnostics.lua +++ b/nvim/lua/diagnostics.lua @@ -1,14 +1,26 @@ -local colors = require("ayu.colors") -colors.generate(true) +local theme_colors = require("ayu.colors") +theme_colors.generate(true) -- These are not apart of the Ayu color theme, however, I needed these -- colors while still fitting in with the rest local ayu_turquoise = "#5CCFE6" local ayu_dark_blue = "#3A7BD5" + +local colors = { + info = ayu_dark_blue, + hint = ayu_turquoise, + warning = theme_colors.warning, + error = theme_colors.error, +} + for _, highlight in ipairs({ - { "DiagnosticUnderlineError", { undercurl = true, sp = colors.error } }, + { "DiagnosticUnderlineInfo", { undercurl = true, sp = colors.info } }, + { "DiagnosticUnderlineHint", { undercurl = true, sp = colors.hint } }, { "DiagnosticUnderlineWarn", { undercurl = true, sp = colors.warning } }, - { "DiagnosticUnderlineHint", { undercurl = true, sp = ayu_turquoise } }, - { "DiagnosticUnderlineInfo", { undercurl = true, sp = ayu_dark_blue } }, + { "DiagnosticUnderlineError", { undercurl = true, sp = colors.error } }, + { "DiagnosticInfo", { fg = colors.info } }, + { "DiagnosticHint", { fg = colors.hint } }, + { "DiagnosticWarn", { fg = colors.warning } }, + { "DiagnosticError", { fg = colors.error } }, }) do vim.api.nvim_set_hl(0, highlight[1], highlight[2]) end diff --git a/nvim/lua/plugs/lualine.lua b/nvim/lua/plugs/lualine.lua index 62df061..502b6e1 100644 --- a/nvim/lua/plugs/lualine.lua +++ b/nvim/lua/plugs/lualine.lua @@ -31,7 +31,16 @@ return { }, sections = { lualine_a = { "mode" }, - lualine_b = { "branch", resize_mode }, + lualine_b = { + "branch", + { + "diagnostics", + sources = { "nvim_lsp", "nvim_diagnostic", }, + sections = { "error", "warn", "info", "hint" }, + update_in_insert = false, + }, + resize_mode, + }, lualine_c = { "buffers" }, lualine_x = { "encoding", "fileformat", "filetype" }, lualine_y = { "progress" }, From a8d998a545e126e40439f43a7fac45489f520c67 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Fri, 21 Feb 2025 00:32:51 +0000 Subject: [PATCH 071/100] Remove nvim_diagnostic from lualine diagnostic sources as it was double counting the number of diagnostics with nvim_lsp --- nvim/lua/plugs/lualine.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/plugs/lualine.lua b/nvim/lua/plugs/lualine.lua index 502b6e1..d7c19bd 100644 --- a/nvim/lua/plugs/lualine.lua +++ b/nvim/lua/plugs/lualine.lua @@ -35,7 +35,7 @@ return { "branch", { "diagnostics", - sources = { "nvim_lsp", "nvim_diagnostic", }, + sources = { "nvim_lsp" }, sections = { "error", "warn", "info", "hint" }, update_in_insert = false, }, From f1e18ce6b1ba4271f1292ef6712570c3b93aae46 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sat, 22 Feb 2025 16:41:28 +0000 Subject: [PATCH 072/100] Migrate to snacks nvim --- nvim/lua/plugs/fzf.lua | 71 ----------------------------- nvim/lua/plugs/indent_blankline.lua | 32 ------------- nvim/lua/plugs/noice.lua | 9 ---- nvim/lua/plugs/smear_cursor.lua | 19 -------- nvim/lua/plugs/snacks.lua | 63 +++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 131 deletions(-) delete mode 100644 nvim/lua/plugs/fzf.lua delete mode 100644 nvim/lua/plugs/indent_blankline.lua delete mode 100644 nvim/lua/plugs/smear_cursor.lua create mode 100644 nvim/lua/plugs/snacks.lua diff --git a/nvim/lua/plugs/fzf.lua b/nvim/lua/plugs/fzf.lua deleted file mode 100644 index 3aa8088..0000000 --- a/nvim/lua/plugs/fzf.lua +++ /dev/null @@ -1,71 +0,0 @@ -return { - "ibhagwan/fzf-lua", - dependencies = { "nvim-tree/nvim-web-devicons" }, - opts = { - "telescope", - winopts = { - preview = { - default = "bat" - } - }, - lsp = { - workspace_symbols = { - symbol_kinds = { "Variable", "Function", "Method", "Class", "Struct", "Interface" }, - }, - }, - previewers = { - builtin = { - -- turn off syntax highlighting for files with more than 100KB - -- this avoid hanging when previewing large files (due to treesitter parsing on minified files) - syntax_limit_b = 1024 * 100, -- 100KB - } - } - }, - config = function() - local fzf = require("fzf-lua") - local pickers = { - { - mapping = "o", - action = function() - fzf.files({ - git_icons = false, - }) - end - }, - { - mapping = "a", - action = function() - fzf.live_grep_native({ - git_icons = false, - rg_opts = "--hidden --column --line-number --no-heading --color=always --smart-case", - fzf_opts = { - ['--exact'] = false, -- Disable exact matching - }, - }) - end - }, - { - mapping = "g", - action = function() - fzf.git_bcommits({}) - end - }, - { - mapping = "s", - action = function() - fzf.lsp_live_workspace_symbols({}) - end - } - } - - local keymaps = {} - keymaps.n = {} - for _, picker in ipairs(pickers) do - keymaps.n["t" .. picker.mapping] = { - cmd = picker.action - } - end - - require("utils").add_keymaps(keymaps) - end -} diff --git a/nvim/lua/plugs/indent_blankline.lua b/nvim/lua/plugs/indent_blankline.lua deleted file mode 100644 index e009902..0000000 --- a/nvim/lua/plugs/indent_blankline.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - "lukas-reineke/indent-blankline.nvim", - main = "ibl", - event = "BufRead", - config = function() - local ibl = require("ibl") - ibl.setup({ - debounce = 100, - indent = { - char = "▏", - }, - scope = { - enabled = true, - char = "▏", - show_start = false, - show_end = false, - highlight = { "IblScope" }, - }, - }) - - local colors = require("ayu.colors") - colors.generate(true) - local highlights = { - { "IblScope", { fg = colors.keyword } }, - { "@ibl.scope.char.1", { fg = colors.keyword } }, - } - - for _, hl in ipairs(highlights) do - vim.api.nvim_set_hl(0, hl[1], hl[2]) - end - end -} diff --git a/nvim/lua/plugs/noice.lua b/nvim/lua/plugs/noice.lua index e15c16a..f31c47b 100644 --- a/nvim/lua/plugs/noice.lua +++ b/nvim/lua/plugs/noice.lua @@ -4,15 +4,6 @@ return { lazy = true, dependencies = { { "MunifTanjim/nui.nvim", lazy = true }, - { - "rcarriga/nvim-notify", - opts = { - background_colour = "#24273a", - fps = 1, - render = "compact", - stages = "static" - } - } }, opts = { lsp = { diff --git a/nvim/lua/plugs/smear_cursor.lua b/nvim/lua/plugs/smear_cursor.lua deleted file mode 100644 index 63984b1..0000000 --- a/nvim/lua/plugs/smear_cursor.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - "sphamba/smear-cursor.nvim", - opts = { - smear_between_buffers = true, - - min_horizontal_distance_smear = 3, - min_vertical_distance_smear = 2, - - scroll_buffer_space = true, - smear_insert_mode = false, - - cursor_color = "#FFCC66", - transparent_bg_fallback_color = "#303030", - - stiffness = 0.85, - trailing_stiffness = 0.7, - distance_stop_animating = 0.5, - }, -} diff --git a/nvim/lua/plugs/snacks.lua b/nvim/lua/plugs/snacks.lua new file mode 100644 index 0000000..27bed99 --- /dev/null +++ b/nvim/lua/plugs/snacks.lua @@ -0,0 +1,63 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + gitbrowse = { enabled = true, }, + picker = { enabled = true, }, + dashboard = { enabled = true, }, + debug = { enabled = true, }, + indent = { + enabled = true, + animate = { + enabled = false, + }, + }, + input = { enabled = true, }, + notifier = { enabled = true, }, + quickfile = { enabled = true, }, + scroll = { + enabled = true, + animate = { + duration = { step = 7, total = 250 }, + easing = "outCirc", + }, + animate_repeat = { + delay = 100, + duration = { step = 3, total = 50 }, + easing = "outCirc", + }, + }, + words = { + enabled = true, + debounce = 100, + }, + zen = { + enabled = true, + toggles = { dim = false, } + }, + }, + keys = { + { "z", function() Snacks.zen() end, }, + + { "to", function() Snacks.picker.smart() end, }, + { "ta", function() Snacks.picker.grep() end, }, + { "tg", function() Snacks.picker.git_log_file() end, }, + { "ts", function() Snacks.picker.lsp_workspace_symbols() end, }, + { "tn", function() Snacks.picker.notifications() end }, + }, + init = function() + vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + _G.inspect = function(...) + Snacks.debug.inspect(...) + end + _G.backtrace = function() + Snacks.debug.backtrace() + end + vim.print = _G.inspect + end, + }) + end +} From 9f358708703a4cbf1e51166e5284347beefc681e Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:31:43 +0000 Subject: [PATCH 073/100] Change gutter space from 1 > 2 --- nvim/lua/vim_opt.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/vim_opt.lua b/nvim/lua/vim_opt.lua index 80c2924..d76611a 100644 --- a/nvim/lua/vim_opt.lua +++ b/nvim/lua/vim_opt.lua @@ -22,7 +22,7 @@ opt.softtabstop = 4 opt.shortmess:append("sI") -- Signcolumn -opt.signcolumn = "yes:1" -- Adds a spacing to the left which can contain gutter icons +opt.signcolumn = "yes:2" -- Adds a spacing to the left which can contain gutter icons opt.fillchars = { eob = " " } -- Remove the fill character for empty lines which defaults to: "~" -- Search From 7b53280164dd69e6c533a044f4c10bbc0ef807c0 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:32:20 +0000 Subject: [PATCH 074/100] Local system stuff --- nix/local_home.nix | 4 ++-- nix/local_system.nix | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nix/local_home.nix b/nix/local_home.nix index 7882628..cad7a94 100644 --- a/nix/local_home.nix +++ b/nix/local_home.nix @@ -6,7 +6,7 @@ # accordingly, and then commit it. home = { # Stub values for demonstration. Override these in local branch. - username = "larssonmartin1998-mac"; - homeDirectory = "/Users/larssonmartin1998-mac"; + username = "nixos"; + homeDirectory = "/home/nixos"; }; } diff --git a/nix/local_system.nix b/nix/local_system.nix index fd440f0..6bdfb5f 100644 --- a/nix/local_system.nix +++ b/nix/local_system.nix @@ -3,8 +3,6 @@ }: { system = { - stateVersion = 5; + stateVersion = "24.11"; }; - - nix-homebrew.user = "larssonmartin1998-mac"; } From 72eb62b9cb35f9f3277e22687dd6a2018b2db51f Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:32:56 +0000 Subject: [PATCH 075/100] Change gutter space from 1 > 2 --- nvim/lua/vim_opt.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/vim_opt.lua b/nvim/lua/vim_opt.lua index 80c2924..d76611a 100644 --- a/nvim/lua/vim_opt.lua +++ b/nvim/lua/vim_opt.lua @@ -22,7 +22,7 @@ opt.softtabstop = 4 opt.shortmess:append("sI") -- Signcolumn -opt.signcolumn = "yes:1" -- Adds a spacing to the left which can contain gutter icons +opt.signcolumn = "yes:2" -- Adds a spacing to the left which can contain gutter icons opt.fillchars = { eob = " " } -- Remove the fill character for empty lines which defaults to: "~" -- Search From 43020a4d126302495604711667f19ba39e15a425 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:35:23 +0000 Subject: [PATCH 076/100] Large rewrite, simplify keymapping, utilize as much `keys` from Lazy as possible. Reduce manually setup plugins and utilize opts instead. --- nvim/lua/format_handler.lua | 16 +-- nvim/lua/keymaps.lua | 211 ++++++++++++------------------- nvim/lua/lsp/servers/clangd.lua | 46 +++---- nvim/lua/lsp/setup.lua | 31 +---- nvim/lua/plugs/codecompanion.lua | 68 ++++------ nvim/lua/plugs/codesnap.lua | 32 ++--- nvim/lua/plugs/copilot.lua | 28 ++-- nvim/lua/plugs/incline.lua | 151 +++++++++++----------- nvim/lua/plugs/leap.lua | 57 +++------ nvim/lua/plugs/lspsaga.lua | 87 +++++-------- nvim/lua/plugs/lualine.lua | 80 ++++++------ nvim/lua/plugs/neogit.lua | 16 +-- nvim/lua/plugs/nvim-dap.lua | 141 +++++++-------------- nvim/lua/plugs/rustaceanvim.lua | 26 +--- nvim/lua/terminal.lua | 19 +-- nvim/lua/utils.lua | 103 ++------------- nvim/lua/window_management.lua | 76 +++-------- 17 files changed, 408 insertions(+), 780 deletions(-) diff --git a/nvim/lua/format_handler.lua b/nvim/lua/format_handler.lua index 367c77f..fc539af 100644 --- a/nvim/lua/format_handler.lua +++ b/nvim/lua/format_handler.lua @@ -26,18 +26,10 @@ function M.setup() vim.api.nvim_command("command! " .. cmd[1] .. " " .. cmd[2]) end - utils.add_keymaps({ - n = { - ["ff"] = { - cmd = function() M.format(true) end - }, - ["fe"] = { - cmd = M.format_enable, - }, - ["fd"] = { - cmd = M.format_disable, - }, - }, + utils.set_keymap_list({ + { "ff", function() M.format() end }, + { "fe", function() M.format_enable() end }, + { "fd", function() M.format_disable() end }, }) end diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua index f3d871e..236ec9a 100644 --- a/nvim/lua/keymaps.lua +++ b/nvim/lua/keymaps.lua @@ -1,151 +1,98 @@ +local utils = require("utils") local g = vim.g g.mapleader = " " g.maplocalleader = " " -local move_up = { - cmd = "v:count || mode(1)[0:1] == \"no\" ? \"k\" : \"gk\"", - opts = { - expr = true - } -} +local move_up = { "v:count || mode(1)[0:1] == \"no\" ? \"k\" : \"gk\"", { expr = true } } +local move_down = { "v:count || mode(1)[0:1] == \"no\" ? \"j\" : \"gj\"", { expr = true } } -local move_down = { - cmd = "v:count || mode(1)[0:1] == \"no\" ? \"j\" : \"gj\"", - opts = { - expr = true - } -} +utils.foreach({ + { + "n", + { + -- Using lspsaga for hover doc + { "K", "", }, + -- Using lspsaga finder with gr which does references + { "grr", "", }, + { "gra", "", }, + { "grn", "", }, + { "gri", "", }, + -- Navigation + { "", "h", }, + { "", "j", }, + { "", "k", }, + { "", "l", }, + { "", "h", }, + { "", "j", }, + { "", "k", }, + { "", "l", }, + -- Window + { "", "q", }, -local utils = require("utils") + -- Disable current highlights + { "", " noh ", }, -utils.add_keymaps({ - n = { - -- Using lspsaga for hover doc - ["K"] = { - cmd = "", - }, - -- Using lspsaga finder with gr which does references - ["grr"] = { - cmd = "", - }, - ["gra"] = { - cmd = "", - }, - ["grn"] = { - cmd = "", - }, - ["gri"] = { - cmd = "", - }, - -- Navigation - [""] = { - cmd = "h", - }, - [""] = { - cmd = "j", - }, - [""] = { - cmd = "k", - }, - [""] = { - cmd = "l", - }, - [""] = { - cmd = "h", - }, - [""] = { - cmd = "j", - }, - [""] = { - cmd = "k", - }, - [""] = { - cmd = "l", - }, + -- Copies the entire file + { "", ":%y+", { silent = true } }, - -- Window - [""] = { - cmd = "q", - }, + -- Allow moving the cursor through wrapped lines with and + -- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/ + -- empty mode is same as using :map + -- also don't use g[j|k] when in operator pending mode, + -- so it doesn't alter d, y or c behaviour + { "", move_up[1], move_up[2], }, + { "", move_down[1], move_down[2], }, + { "j", move_down[1], move_down[2], }, + { "k", move_up[1], move_up[2], }, + -- Maps to remove + { "", "", }, - -- Disable current highlights - [""] = { - cmd = " noh ", - }, - - -- Copies the entire file - [""] = { - cmd = ":%y+", - opts = { - silent = true - } - }, - - -- Allow moving the cursor through wrapped lines with and - -- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/ - -- empty mode is same as using :map - -- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour - [""] = move_up, - [""] = move_down, - ["j"] = move_down, - ["k"] = move_up, - -- Maps to remove - [""] = { - cmd = "", - }, - - -- Marks are less frequently used than leaping, also, less relevant with arrow and fzf navigation. - -- Prioritize regular m for leaping, and m for setting marks. - ["m"] = { - cmd = "m", - }, - ["[d"] = { - cmd = function() + -- Marks are less frequently used than leaping, also, less relevant with arrow and fzf navigation. + -- Prioritize regular m for leaping, and m for setting marks. + { "m", "m", }, + { "[d", function() vim.diagnostic.jump({ count = -1, float = false }) - end - }, - ["]d"] = { - cmd = function() + end }, + { "]d", function() vim.diagnostic.jump({ count = 1, float = false }) - end - }, + end }, + } }, - i = {}, - v = { - [""] = move_up, - [""] = move_down, - ["j"] = move_down, - ["k"] = move_up, - [""] = { - cmd = ">gv", - }, - [""] = { - cmd = "", move_up[1], move_up[2], }, + { "", move_down[1], move_down[2], }, + { "j", move_down[1], move_down[2], }, + { "k", move_up[1], move_up[2], }, + { "", ">gv", }, + { "", "m for setting marks. - ["m"] = { - cmd = "m", + -- Marks are less frequently used than leaping, also, less relevant with arrow and fzf navigation. + -- Prioritize regular m for leaping, and m for setting marks. + { "m", "m", }, }, }, - x = { - [""] = move_up, - [""] = move_down, - ["j"] = move_down, - ["k"] = move_up, - ["p"] = { - cmd = "p:let @+=@0:let @\"=@0", - opts = { - silent = true - }, - }, + { + "x", + { + { "", move_up[1], move_up[2], }, + { "", move_down[1], move_down[2], }, + { "j", move_down[1], move_down[2], }, + { "k", move_up[1], move_up[2], }, + { "p", "p:let @+=@0:let @\"=@0", { silent = true }, }, + } }, - t = { - [""] = { - cmd = "", - }, + { + "t", + { + { "", "", }, + } }, -}) +}, function(mode_mapping) + local mode = mode_mapping[1] + local mappings = mode_mapping[2] + utils.set_keymap_list(mappings, mode) +end) diff --git a/nvim/lua/lsp/servers/clangd.lua b/nvim/lua/lsp/servers/clangd.lua index 45d55ce..f242c06 100644 --- a/nvim/lua/lsp/servers/clangd.lua +++ b/nvim/lua/lsp/servers/clangd.lua @@ -1,21 +1,23 @@ local utils = require("utils") -- https://clangd.llvm.org/extensions.html#switch-between-sourceheader -local function switch_source_header(bufnr) - bufnr = utils.validate_bufnr(bufnr) +local function switch_source_header() + local bufnr = utils.validate_bufnr(0) local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1] - local params = { uri = vim.uri_from_bufnr(bufnr) } if clangd_client then - clangd_client.request("textDocument/switchSourceHeader", params, function(err, result) - if err then - error(tostring(err)) - end - if not result then - print "Corresponding file cannot be determined" - return - end - vim.api.nvim_command("drop " .. vim.uri_to_fname(result)) - end, bufnr) + clangd_client.request( + "textDocument/switchSourceHeader", + { uri = vim.uri_from_bufnr(bufnr) }, + function(err, result) + if err then + error(tostring(err)) + end + if not result then + print "Corresponding file cannot be determined" + return + end + vim.api.nvim_command("drop " .. vim.uri_to_fname(result)) + end, bufnr) else print "method textDocument/switchSourceHeader is not supported by any servers active on the current buffer" end @@ -44,19 +46,9 @@ return { "compile_flags.txt", "configure.ac", }, - on_attach = function(_, bufnr) - local lsp_maps = { - { - "ko", - function() switch_source_header(0) end, - }, - } - - local keymaps = { n = {} } - for i, _ in ipairs(lsp_maps) do - local binding, cmd = unpack(lsp_maps[i]) - keymaps.n[binding] = { cmd = cmd, opts = { buffer = bufnr } } - end - utils.add_keymaps(keymaps) + on_attach = function() + utils.set_keymap_list({ + { "ko", switch_source_header, }, + }) end, } diff --git a/nvim/lua/lsp/setup.lua b/nvim/lua/lsp/setup.lua index 73f85b5..9192cfc 100644 --- a/nvim/lua/lsp/setup.lua +++ b/nvim/lua/lsp/setup.lua @@ -24,34 +24,9 @@ local function global_on_attach(client, bufnr) }) end - utils.add_keymaps({ - n = { - - ["gd"] = { - cmd = function() - vim.lsp.buf.definition({ - reuse_win = true, - }) - end, - opts = { - noremap = true, - silent = true, - buffer = bufnr - } - }, - ["gD"] = { - cmd = function() - vim.lsp.buf.declaration({ - reuse_win = true, - }) - end, - opts = { - noremap = true, - silent = true, - buffer = bufnr - } - }, - } + utils.set_keymap_list({ + { "gd", function() vim.lsp.buf.definition({ reuse_win = true, }) end, { noremap = true, buffer = bufnr } }, + { "gD", function() vim.lsp.buf.declaration({ reuse_win = true, }) end, { noremap = true, buffer = bufnr } }, }) end diff --git a/nvim/lua/plugs/codecompanion.lua b/nvim/lua/plugs/codecompanion.lua index 033cf67..8966ae2 100644 --- a/nvim/lua/plugs/codecompanion.lua +++ b/nvim/lua/plugs/codecompanion.lua @@ -3,53 +3,37 @@ return { dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter", - { 'echasnovski/mini.diff', version = false }, - { "stevearc/dressing.nvim", opts = {} }, }, - config = function() - require("codecompanion").setup({ - strategies = { - chat = { - adapter = "copilot", - }, - inline = { - adapter = "copilot", - }, - agent = { - adapter = "copilot", - }, + opts = { + strategies = { + chat = { + adapter = "copilot", }, - adapters = { - copilot = function() return require("codecompanion.adapters").extend("copilot", {}) end, + inline = { + adapter = "copilot", }, - display = { - diff = { - provider = "mini_diff", - }, + agent = { + adapter = "copilot", }, - opts = { - log_level = "DEBUG", + }, + adapters = { + copilot = function() return require("codecompanion.adapters").extend("copilot", {}) end, + }, + display = { + diff = { + provider = "mini_diff", }, - }) - - local keymaps = { - n = { - ["ci"] = { cmd = "CodeCompanion" }, - ["cc"] = { cmd = "CodeCompanionChat toggle" }, - ["cm"] = { cmd = "CodeCompanion /commit" }, - }, - v = { - ["ci"] = { cmd = "CodeCompanion" }, - ["ga"] = { cmd = "CodeCompanionAdd" }, - ["ce"] = { cmd = "CodeCompanion /explain" }, - ["cf"] = { cmd = "CodeCompanion /fix" }, - ["ct"] = { cmd = "CodeCompanion /tests" }, - } - } - local utils = require("utils") - utils.add_opts_to_all_mappings(keymaps, { silent = true }) - utils.add_keymaps(keymaps) - + }, + opts = { + log_level = "DEBUG", + }, + }, + keys = { + { "ci", "CodeCompanion" }, + { "cc", "CodeCompanionChat toggle" }, + { "ce", "CodeCompanion /explain", mode = "v" }, + }, + init = function() vim.cmd([[cab cc CodeCompanion]]) end } diff --git a/nvim/lua/plugs/codesnap.lua b/nvim/lua/plugs/codesnap.lua index 0966981..042e834 100644 --- a/nvim/lua/plugs/codesnap.lua +++ b/nvim/lua/plugs/codesnap.lua @@ -3,24 +3,16 @@ return { build = "make", event = "VeryLazy", lazy = true, - config = function() - require("codesnap").setup({ - mac_window_bar = true, - title = "codesnap.nvim", - code_font_family = "JetBrainsMono Nerd Font", - breadcrumbs_separator = "/", - has_breadcrumbs = true, - bg_theme = "grape", - watermark = "", - }) - - require("utils").add_keymaps({ - v = { - ["cs"] = { - cmd = ":CodeSnap", - opts = { silent = true }, - }, - } - }) - end, + opts = { + mac_window_bar = true, + title = "codesnap.nvim", + code_font_family = "JetBrainsMono Nerd Font", + breadcrumbs_separator = "/", + has_breadcrumbs = true, + bg_theme = "grape", + watermark = "", + }, + keys = { + { "cs", ":CodeSnap", mode = "v", silent = true, noremap = true }, + }, } diff --git a/nvim/lua/plugs/copilot.lua b/nvim/lua/plugs/copilot.lua index d3feadd..01d381a 100644 --- a/nvim/lua/plugs/copilot.lua +++ b/nvim/lua/plugs/copilot.lua @@ -1,18 +1,18 @@ return { "github/copilot.vim", - config = function() + event = "InsertEnter", + init = function() vim.g.copilot_no_tab_map = true - require("utils").add_keymaps({ - i = { - [""] = { - cmd = 'copilot#Accept("\\")', - opts = { - expr = true, - replace_keycodes = false, - silent = true, - } - } - } - }) - end + end, + keys = { + { + "", + 'copilot#Accept("\\")', + mode = "i", + expr = true, + replace_keycodes = false, + silent = true, + desc = "Copilot Accept with ", + }, + }, } diff --git a/nvim/lua/plugs/incline.lua b/nvim/lua/plugs/incline.lua index 3557bf1..081dfa0 100644 --- a/nvim/lua/plugs/incline.lua +++ b/nvim/lua/plugs/incline.lua @@ -1,95 +1,86 @@ return { "b0o/incline.nvim", dependencies = { - "lewis6991/gitsigns.nvim" + { + "lewis6991/gitsigns.nvim", + opts = {}, + keys = { + { "[g", function() require("gitsigns").nav_hunk("prev") end, }, + { "]g", function() require("gitsigns").nav_hunk("next") end, }, + } + } }, event = "VeryLazy", lazy = true, - config = function() - local gitsigns = require("gitsigns") - gitsigns.setup({}) - local devicons = require("nvim-web-devicons") - require("incline").setup({ - window = { - padding = 0, - }, - hide = { - cursorline = true, - }, - render = function(props) - local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t") - if filename == "" then - filename = "[No Name]" - end - local ft_icon, ft_color = devicons.get_icon_color(filename) + opts = { + window = { + padding = 0, + }, + hide = { + cursorline = true, + }, + render = function(props) + local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t") + if filename == "" then + filename = "[No Name]" + end + local ft_icon, ft_color = require("nvim-web-devicons").get_icon_color(filename) - local function get_git_diff() - local icons = { removed = "", changed = "", added = "" } - local signs = vim.b[props.buf].gitsigns_status_dict - local labels = {} - if signs == nil then - return labels - end - for name, icon in pairs(icons) do - if tonumber(signs[name]) and signs[name] > 0 then - table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name }) - end - end - if #labels > 0 then - table.insert(labels, { "┊ " }) - end + local function get_git_diff() + local icons = { removed = "", changed = "", added = "" } + local signs = vim.b[props.buf].gitsigns_status_dict + local labels = {} + if signs == nil then return labels end - - local function get_diagnostic_label() - local icons = { error = "", warn = "", info = "", hint = "" } - local label = {} - - for severity, icon in pairs(icons) do - local n = #vim.diagnostic.get(props.buf, - { severity = vim.diagnostic.severity[string.upper(severity)] }) - if n > 0 then - table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity }) - end + for name, icon in pairs(icons) do + if tonumber(signs[name]) and signs[name] > 0 then + table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name }) end - if #label > 0 then - table.insert(label, { "┊ " }) + end + if #labels > 0 then + table.insert(labels, { "┊ " }) + end + return labels + end + + local function get_diagnostic_label() + local icons = { error = "", warn = "", info = "", hint = "" } + local label = {} + + for severity, icon in pairs(icons) do + local n = #vim.diagnostic.get(props.buf, + { severity = vim.diagnostic.severity[string.upper(severity)] }) + if n > 0 then + table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity }) end - return label + end + if #label > 0 then + table.insert(label, { "┊ " }) + end + return label + end + + local function get_arrow_label() + local statusline = require("arrow.statusline") + if statusline.is_on_arrow_file(props.buf) == nil then + return "" end - local function get_arrow_label() - local statusline = require("arrow.statusline") - if statusline.is_on_arrow_file(props.buf) == nil then - return "" - end + return " " .. statusline.text_for_statusline_with_icons(props.buf) + end - return " " .. statusline.text_for_statusline_with_icons(props.buf) - end - - return { - guibg = "#1e2030", - guifg = "#cad3f5", - { " " }, - { get_diagnostic_label() }, - { get_git_diff() }, - { (ft_icon or "") .. " ", guifg = ft_color, guibg = "none" }, - { filename .. " ┊", gui = vim.bo[props.buf].modified and "bold,italic" or "bold" }, - { get_arrow_label() .. "  " .. vim.api.nvim_win_get_number(props.win), group = "DevIconWindows" }, - { " " } - } - end, - - require("utils").add_keymaps({ - n = { - ["[g"] = { - cmd = function() gitsigns.nav_hunk("prev") end - }, - ["]g"] = { - cmd = function() gitsigns.nav_hunk("next") end - } - } - }) - }) - end, + return { + guibg = "#1e2030", + guifg = "#cad3f5", + { " " }, + { get_diagnostic_label() }, + { get_git_diff() }, + { (ft_icon or "") .. " ", guifg = ft_color, guibg = "none" }, + { filename .. " ┊", gui = vim.bo[props.buf].modified and "bold,italic" or "bold" }, + { get_arrow_label() .. "  " .. vim.api.nvim_win_get_number(props.win), group = "DevIconWindows" }, + { " " } + } + end, + }, } diff --git a/nvim/lua/plugs/leap.lua b/nvim/lua/plugs/leap.lua index 1fe86c4..76ca034 100644 --- a/nvim/lua/plugs/leap.lua +++ b/nvim/lua/plugs/leap.lua @@ -1,3 +1,15 @@ +local function leap_across_windows() + require("leap").leap({ + target_windows = require("leap.user").get_focusable_windows() + }) +end + +local function leap_in_current_buffer() + require("leap").leap({ + target_windows = { vim.api.nvim_get_current_win() } + }) +end + local saved_hlsearch = false local saved_highlights = {} local colors = require("ayu.colors") @@ -19,7 +31,13 @@ return { }, event = "VeryLazy", lazy = true, - config = function() + opts = {}, + keys = { + { "m", function() leap_across_windows() end, mode = "n" }, + { "m", function() leap_in_current_buffer() end, mode = "v" }, + { "m", function() leap_in_current_buffer() end, mode = "o" }, + }, + init = function() local leap = require("leap") -- Disable auto jumping to the first match @@ -53,42 +71,5 @@ return { for _, cmd in ipairs(autocmds) do utils.create_user_event_cb(cmd.event_name, cmd.cb, leap_augroup_name) end - - local leap_user = require("leap.user") - local function leap_across_windows() - leap.leap({ - target_windows = leap_user.get_focusable_windows() - }) - end - - local function leap_in_current_buffer() - leap.leap({ - target_windows = { vim.api.nvim_get_current_win() } - }) - end - - utils.add_keymaps({ - n = { - ["m"] = { - cmd = function() - leap_across_windows() - end, - }, - }, - v = { - ["m"] = { - cmd = function() - leap_in_current_buffer() - end, - } - }, - o = { - ["m"] = { - cmd = function() - leap_in_current_buffer() - end, - } - } - }) end, } diff --git a/nvim/lua/plugs/lspsaga.lua b/nvim/lua/plugs/lspsaga.lua index f5f9578..54e23bb 100644 --- a/nvim/lua/plugs/lspsaga.lua +++ b/nvim/lua/plugs/lspsaga.lua @@ -7,59 +7,36 @@ return { dependencies = { "nvim-tree/nvim-web-devicons", }, - after = "nvim-lspconfig", - config = function() - require("lspsaga").setup({ - request_timeout = 750, - symbol_in_winbar = { - enable = false, - }, - implement = { - enable = false, - }, - outline = { - enable = false, - win_width = 52, - }, - ui = { - border = "rounded", - title = false, - }, - code_action = { - extend_gitsigns = true - }, - hover = { - jump_on_first_press = true - }, - }) - - local keymaps = { - n = { - ["K"] = { - cmd = ":Lspsaga hover_doc" - }, - ["rn"] = { - cmd = ":Lspsaga rename" - }, - ["gr"] = { - cmd = ":Lspsaga finder" - }, - ["lt"] = { - cmd = ":Lspsaga peek_type_definition" - }, - ["ld"] = { - cmd = ":Lspsaga peek_definition" - }, - ["ca"] = { - cmd = ":Lspsaga code_action" - }, - ["lc"] = { - cmd = ":Lspsaga incoming_calls" - }, - } - } - local utils = require("utils") - utils.add_opts_to_all_mappings(keymaps, { silent = true }) - utils.add_keymaps(keymaps) - end, + opts = { + request_timeout = 750, + symbol_in_winbar = { + enable = false, + }, + implement = { + enable = false, + }, + outline = { + enable = false, + win_width = 52, + }, + ui = { + border = "rounded", + title = false, + }, + code_action = { + extend_gitsigns = true + }, + hover = { + jump_on_first_press = true + }, + }, + keys = { + { "K", ":Lspsaga hover_doc", silent = true, }, + { "rn", ":Lspsaga rename", silent = true, }, + { "gr", ":Lspsaga finder", silent = true, }, + { "lt", ":Lspsaga peek_type_definition", silent = true, }, + { "ld", ":Lspsaga peek_definition", silent = true, }, + { "ca", ":Lspsaga code_action", silent = true, }, + { "lc", ":Lspsaga incoming_calls", silent = true, }, + }, } diff --git a/nvim/lua/plugs/lualine.lua b/nvim/lua/plugs/lualine.lua index d7c19bd..eec34b5 100644 --- a/nvim/lua/plugs/lualine.lua +++ b/nvim/lua/plugs/lualine.lua @@ -1,7 +1,5 @@ -local wm = require("window_management") - local function resize_mode() - if wm.is_in_resizing_mode() then + if require("window_management").is_in_resizing_mode() then return "▲ Resizing ▼" else return "" @@ -15,46 +13,44 @@ return { }, event = "VeryLazy", lazy = true, - config = function() - require("lualine").setup { - options = { - theme = "ayu", - section_separators = { - left = "", - right = "", - }, - component_separators = { - left = "", - right = "" - }, - icons_enabled = true, + opts = { + options = { + theme = "ayu", + section_separators = { + left = "", + right = "", }, - sections = { - lualine_a = { "mode" }, - lualine_b = { - "branch", - { - "diagnostics", - sources = { "nvim_lsp" }, - sections = { "error", "warn", "info", "hint" }, - update_in_insert = false, - }, - resize_mode, + component_separators = { + left = "", + right = "" + }, + icons_enabled = true, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { + "branch", + { + "diagnostics", + sources = { "nvim_lsp" }, + sections = { "error", "warn", "info", "hint" }, + update_in_insert = false, }, - lualine_c = { "buffers" }, - lualine_x = { "encoding", "fileformat", "filetype" }, - lualine_y = { "progress" }, - lualine_z = { "location" } + resize_mode, }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {}, - lualine_x = {}, - lualine_y = {}, - lualine_z = {} - }, - tabline = {}, - } - end + lualine_c = { "buffers" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" } + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + } } diff --git a/nvim/lua/plugs/neogit.lua b/nvim/lua/plugs/neogit.lua index a655912..e510511 100644 --- a/nvim/lua/plugs/neogit.lua +++ b/nvim/lua/plugs/neogit.lua @@ -14,16 +14,8 @@ return { }, event = "VeryLazy", lazy = true, - config = function() - local neogit = require("neogit") - neogit.setup() - - require("utils").add_keymaps({ - n = { - ["g"] = { - cmd = function() neogit.open({ kind = "vsplit" }) end, - }, - } - }) - end + opts = {}, + keys = { + { "g", function() require("neogit").open({ kind = "vsplit" }) end } + }, } diff --git a/nvim/lua/plugs/nvim-dap.lua b/nvim/lua/plugs/nvim-dap.lua index ea09c95..5756f97 100644 --- a/nvim/lua/plugs/nvim-dap.lua +++ b/nvim/lua/plugs/nvim-dap.lua @@ -5,81 +5,57 @@ local are_stepping_keymaps_active = false return { "mfussenegger/nvim-dap", dependencies = { - "rcarriga/nvim-dap-ui", - + { + "rcarriga/nvim-dap-ui", + opts = { + controls = { + enabled = false, + }, + layouts = { + { + elements = { + { + id = "watches", + size = 0.5 + }, + { + id = "stacks", + size = 0.5 + } + }, + position = "bottom", + size = 15 + } + }, + }, + }, -- Special adapters - "leoluz/nvim-dap-go", - "mfussenegger/nvim-dap-python", + { "leoluz/nvim-dap-go", opts = {} }, + { "mfussenegger/nvim-dap-python", }, - { "nvim-neotest/nvim-nio", lazy = true }, - "LiadOz/nvim-dap-repl-highlights", - "theHamsta/nvim-dap-virtual-text", - "Weissle/persistent-breakpoints.nvim", + { "nvim-neotest/nvim-nio", lazy = true }, + { "LiadOz/nvim-dap-repl-highlights", opts = {} }, + { "theHamsta/nvim-dap-virtual-text", opts = {} }, + { "Weissle/persistent-breakpoints.nvim", opts = { load_breakpoints_event = { "BufReadPost" } } }, }, config = function() local dap = require("dap") - local dapui = require("dapui") - -- Special adapters - require("dap-go").setup() + require("dap-python").setup("python3") - -- Special adapters - require("dap.ext.vscode").load_launchjs() - require("persistent-breakpoints").setup { - load_breakpoints_event = { "BufReadPost" } - } - - require("nvim-dap-repl-highlights").setup() - require("nvim-dap-virtual-text").setup() local virtual_text = require("nvim-dap-virtual-text/virtual_text") local breakpoint_api = require("persistent-breakpoints.api") - dapui.setup({ - controls = { - enabled = false, - }, - layouts = { - { - elements = { - { - id = "watches", - size = 0.5 - }, - { - id = "stacks", - size = 0.5 - } - }, - position = "bottom", - size = 15 - } - }, - }) - local stepping_keymaps = { - n = { - ["m"] = { - cmd = function() - dap.step_out() - end - }, - ["n"] = { - cmd = function() - dap.step_over() - end - }, - ["i"] = { - cmd = function() - dap.step_into() - end - }, - } + { "m", function() dap.step_out() end }, + { "n", function() dap.step_over() end }, + { "i", function() dap.step_into() end }, } local function enter_debug_mode() - dapui.open() + require("dapui").open() if not are_stepping_keymaps_active then - utils.add_temporary_keymaps(stepping_keymaps) + utils.set_keymap_list(stepping_keymaps) are_stepping_keymaps_active = true end @@ -87,9 +63,9 @@ return { end local function exit_debug_mode() - dapui.close() + require("dapui").close() if are_stepping_keymaps_active then - utils.remove_keymaps(stepping_keymaps) + utils.del_keymap_list(stepping_keymaps) are_stepping_keymaps_active = false end @@ -117,36 +93,17 @@ return { exit_debug_mode() end - utils.add_keymaps({ - n = { - ["dr"] = { - cmd = function() - dap.continue() - end - }, - ["bt"] = { - cmd = function() - breakpoint_api.toggle_breakpoint() - end - }, - ["bc"] = { - cmd = function() - breakpoint_api.set_conditional_breakpoint() - end - }, - ["br"] = { -- breakpoint remove - cmd = function() - breakpoint_api.clear_all_breakpoints() - end - }, - ["ds"] = { - cmd = function() - dap.disconnect({ terminateDebuggee = true }) - dap.close() - exit_debug_mode() - end - }, - } + local function dap_stop() + dap.disconnect({ terminateDebuggee = true }) + dap.close() + exit_debug_mode() + end + utils.set_keymap_list({ + { "dr", dap.continue }, + { "bt", breakpoint_api.toggle_breakpoint }, + { "bc", breakpoint_api.set_conditional_breakpoint }, + { "br", breakpoint_api.clear_all_breakpoints }, + { "ds", dap_stop }, }) end, } diff --git a/nvim/lua/plugs/rustaceanvim.lua b/nvim/lua/plugs/rustaceanvim.lua index c3de664..9dc473c 100644 --- a/nvim/lua/plugs/rustaceanvim.lua +++ b/nvim/lua/plugs/rustaceanvim.lua @@ -30,29 +30,9 @@ return { }) end - utils.add_keymaps({ - n = { - ["gd"] = { - cmd = function() - vim.lsp.buf.definition() - end, - opts = { - noremap = true, - silent = true, - buffer = bufnr, - } - }, - ["gD"] = { - cmd = function() - vim.lsp.buf.declaration() - end, - opts = { - noremap = true, - silent = true, - buffer = bufnr, - } - }, - } + utils.set_keymap_list({ + { "gd", function() vim.lsp.buf.definition({ reuse_win = true, }) end, { noremap = true, buffer = bufnr } }, + { "gD", function() vim.lsp.buf.declaration({ reuse_win = true, }) end, { noremap = true, buffer = bufnr } }, }) end, } diff --git a/nvim/lua/terminal.lua b/nvim/lua/terminal.lua index fd522f9..36ee757 100644 --- a/nvim/lua/terminal.lua +++ b/nvim/lua/terminal.lua @@ -1,10 +1,8 @@ -local utils = require("utils") -local wm = require("window_management") - local terminal_window = nil local terminal_bufnr = nil local function open_terminal_window() + local utils = require("utils") if terminal_bufnr and vim.api.nvim_buf_is_valid(terminal_bufnr) and utils.is_buf_buftype(terminal_bufnr, "terminal") then vim.cmd("botright split") terminal_window = vim.api.nvim_get_current_win() @@ -23,6 +21,7 @@ local function toggle_terminal() return end + local utils = require("utils") open_terminal_window() local term_height = vim.api.nvim_get_option("lines") @@ -37,13 +36,7 @@ local function toggle_terminal() vim.api.nvim_command("startinsert") end -utils.add_keymaps({ - n = { - ["h"] = { - cmd = function() - toggle_terminal() - wm.autosize_windows() - end, - } - } -}) +vim.keymap.set("n", "h", function() + toggle_terminal() + require("window_management").autosize_windows() +end) diff --git a/nvim/lua/utils.lua b/nvim/lua/utils.lua index ff806ba..d250a7b 100644 --- a/nvim/lua/utils.lua +++ b/nvim/lua/utils.lua @@ -1,10 +1,17 @@ local M = {} -local overridden_default_keymaps = {} +function M.set_keymap_list(keymap_list, mode) + mode = mode or "n" + M.foreach(keymap_list, function(mapping) + vim.keymap.set(mode, mapping[1], mapping[2], mapping[3] or {}) + end) +end -local function is_single_keymap_table(map_table) - assert(map_table) - return map_table.n or map_table.t or map_table.i or map_table.v or map_table.x or map_table.o +function M.del_keymap_list(keymap_list, mode) + mode = mode or "n" + M.foreach(keymap_list, function(mapping) + vim.keymap.del(mode, mapping[1]) + end) end function M.get_file_names_in_dir(dir, expr, strip_extension) @@ -75,94 +82,6 @@ function M.add_opts_to_all_mappings(mappings, opts) end end -local function pass_keymap_tbl_to_fn(maps, fn) - if is_single_keymap_table(maps) then - fn(maps) - else - for _, map_table in pairs(maps) do - fn(map_table) - end - end -end - -local function get_keymaps(mode, buffer) - if buffer then - return vim.api.nvim_buf_get_keymap(buffer, mode) - end - - return vim.api.nvim_get_keymap(mode) -end - -function M.add_temporary_keymaps(maps) - assert(maps) - - pass_keymap_tbl_to_fn(maps, function(map_table) - for mode, entries in pairs(map_table) do - -- We make an assumptino here which is that all the entries are buffers, or not buffers. - -- Meaning, we only check the first entry and trust that the rest are the same. - local result = get_keymaps(mode, (function() - for _, entry in pairs(entries) do - -- nil buffer is treated as a global keymap - return entry.buffer - end - end)()) - - for code, _ in pairs(entries) do - for _, map in ipairs(result) do - if map.lhs == code then - if not overridden_default_keymaps[mode] then - overridden_default_keymaps[mode] = {} - end - - overridden_default_keymaps[mode][code] = { - cmd = map.callback or map.rhs, - opts = { - noremap = map.noremap == 1, - expr = map.expr == 1, - silent = map.silent == 1, - nowait = map.nowait == 1, - script = map.script == 1, - buffer = type(map.buffer) == "number" and map.buffer or nil, - }, - } - end - end - end - end - end) - - M.add_keymaps(maps) -end - -function M.add_keymaps(maps) - assert(maps) - - pass_keymap_tbl_to_fn(maps, function(map_table) - for mode, entries in pairs(map_table) do - for code, info in pairs(entries) do - vim.keymap.set(mode, code, info.cmd, info.opts) - end - end - end) -end - -function M.remove_keymaps(maps) - assert(maps) - - pass_keymap_tbl_to_fn(maps, function(map_table) - for mode, entries in pairs(map_table) do - local overriden_mode = overridden_default_keymaps[mode] - for code, _ in pairs(entries) do - vim.keymap.del(mode, code) - - if overriden_mode and overriden_mode[code] then - vim.keymap.set(mode, code, overriden_mode[code].cmd, overriden_mode[code].opts) - end - end - end - end) -end - function M.is_buf_filetype(bufnr, filetype) return vim.api.nvim_buf_get_option(bufnr, "filetype") == filetype end diff --git a/nvim/lua/window_management.lua b/nvim/lua/window_management.lua index 5df5400..6adfbf3 100644 --- a/nvim/lua/window_management.lua +++ b/nvim/lua/window_management.lua @@ -189,75 +189,35 @@ end function M.setup() local resizing_mode_keymaps = { - n = { - [""] = { - cmd = function() resize_window(vim.api.nvim_get_current_win(), "h") end - }, - [""] = { - cmd = function() resize_window(vim.api.nvim_get_current_win(), "j") end - }, - [""] = { - cmd = function() resize_window(vim.api.nvim_get_current_win(), "k") end - }, - [""] = { - cmd = function() resize_window(vim.api.nvim_get_current_win(), "l") end - }, - [""] = { - cmd = function() exit_resizing_mode() end - }, - [""] = { - cmd = function() exit_resizing_mode() end - }, - ["="] = { - cmd = function() M.autosize_windows() end - }, - } + { "", function() resize_window(vim.api.nvim_get_current_win(), "h") end }, + { "", function() resize_window(vim.api.nvim_get_current_win(), "j") end }, + { "", function() resize_window(vim.api.nvim_get_current_win(), "k") end }, + { "", function() resize_window(vim.api.nvim_get_current_win(), "l") end }, + { "", function() exit_resizing_mode() end }, + { "", function() exit_resizing_mode() end }, + { "=", function() M.autosize_windows() end }, } local enter_resizing_mode_keymaps = { - n = { - [""] = { - cmd = function() enter_resizing_mode() end - } - }, + { "", function() enter_resizing_mode() end } } local window_shifting_keymaps = { - n = { - [""] = { - cmd = function() - swap_window("h") - end - }, - [""] = { - cmd = function() - swap_window("j") - end - }, - [""] = { - cmd = function() - swap_window("k") - end - }, - [""] = { - cmd = function() - swap_window("l") - end - }, - }, + { "", function() swap_window("h") end }, + { "", function() swap_window("j") end }, + { "", function() swap_window("k") end }, + { "", function() swap_window("l") end }, } - utils.add_keymaps({ - window_shifting_keymaps, - enter_resizing_mode_keymaps - }) + utils.set_keymap_list(window_shifting_keymaps) + utils.set_keymap_list(enter_resizing_mode_keymaps) local function on_resize_mode_enter() - utils.remove_keymaps(enter_resizing_mode_keymaps) - utils.add_keymaps(resizing_mode_keymaps) + M.del_keymap_list(enter_resizing_mode_keymaps) + M.set_keymap_list(resizing_mode_keymaps) end local function on_resize_mode_exit() - utils.remove_keymaps(resizing_mode_keymaps) - utils.add_keymaps(enter_resizing_mode_keymaps) + M.del_keymap_list(resizing_mode_keymaps) + M.set_keymap_list(enter_resizing_mode_keymaps) end local window_management_augroup = "WindowManagementEvents" From 28b21c23c81b9c61dd0d52750f6b691257be1205 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:36:39 +0000 Subject: [PATCH 077/100] Make sure plenary is on master --- nvim/lua/plugs/plenary.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/nvim/lua/plugs/plenary.lua b/nvim/lua/plugs/plenary.lua index 0c63989..6781ca7 100644 --- a/nvim/lua/plugs/plenary.lua +++ b/nvim/lua/plugs/plenary.lua @@ -1,4 +1,5 @@ return { "nvim-lua/plenary.nvim", + branch = "master", lazy = true, } From d7adf5fb7c2c062e52f72da22c768df4a02452ae Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:36:51 +0000 Subject: [PATCH 078/100] Remove dotfiles from ignore list in auto session --- nvim/lua/plugs/auto_session.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/nvim/lua/plugs/auto_session.lua b/nvim/lua/plugs/auto_session.lua index 488905d..660f348 100644 --- a/nvim/lua/plugs/auto_session.lua +++ b/nvim/lua/plugs/auto_session.lua @@ -11,7 +11,6 @@ return { "~/Dev", "~/Dev/Git", "~/.config", - "~/dev/git/.dotfiles", }, }, init = function() From 2fbadbb9ce5d30c8d5723d942641de04b5d770dc Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:37:04 +0000 Subject: [PATCH 079/100] Remove comment in codelldb dap --- nvim/lua/dap/adapters/codelldb.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nvim/lua/dap/adapters/codelldb.lua b/nvim/lua/dap/adapters/codelldb.lua index d193344..3c6484a 100644 --- a/nvim/lua/dap/adapters/codelldb.lua +++ b/nvim/lua/dap/adapters/codelldb.lua @@ -2,7 +2,7 @@ return { type = "server", port = "${port}", executable = { - command = vim.fn.exepath("codelldb"), -- Update with your codelldb binary path + command = vim.fn.exepath("codelldb"), args = { "--port", "${port}" }, }, } From 2c5fd36750ee3927499ec4bee7ab2292d4a7368c Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:37:24 +0000 Subject: [PATCH 080/100] Add codelldb and bottom to home manager packages --- nix/pkgs/home.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix index ae22cb7..2053ed0 100644 --- a/nix/pkgs/home.nix +++ b/nix/pkgs/home.nix @@ -49,6 +49,12 @@ let ] ]; + codelldb = pkgs.runCommand "codelldb" { } '' + mkdir -p $out/bin + cp ${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb $out/bin/codelldb + chmod +x $out/bin/codelldb + ''; + symlinkFiles = builtins.listToAttrs ( map (file: { name = builtins.elemAt file 0; @@ -111,6 +117,8 @@ in lldb nodejs tree-sitter + codelldb + bottom ]; file = symlinkFiles; From 33603aaff0ebafd076c88c534a2fb22bd6cbd707 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:37:41 +0000 Subject: [PATCH 081/100] Update vim plugins --- nvim/lazy-lock.json | 57 +++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 5fe2913..0350f70 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,47 +1,38 @@ { "arrow.nvim": { "branch": "master", "commit": "5438c977e729a29d96bd54c8da3103154e80dbd1" }, - "auto-session": { "branch": "main", "commit": "021b64ed7d4ac68a37be3ad28d8e1cba5bec582c" }, - "blink.cmp": { "branch": "main", "commit": "1cc3b1a908fbcfd15451c4772759549724f38524" }, - "codecompanion.nvim": { "branch": "main", "commit": "e3c528aab52f32513fdb771e3e27d93efe57e12a" }, + "auto-session": { "branch": "main", "commit": "9c3f977aafb56bd73ba0d082c4dcbdba5666faf3" }, + "blink.cmp": { "branch": "main", "commit": "18b352d12b35bca148427b607098df14b75a218f" }, + "codecompanion.nvim": { "branch": "main", "commit": "dd81bd9176daba9ea507cd0457f662c0a15c001f" }, "codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" }, - "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, + "copilot.vim": { "branch": "release", "commit": "cd7f01009fb7b30e22840cadc4faad88b05c6eef" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, - "fzf-lua": { "branch": "main", "commit": "6f7249741168c0751356e3b6c5c1e3bade833b6b" }, - "gitsigns.nvim": { "branch": "main", "commit": "76d88f3b584e1f83b2aa51663a32cc6ee8d97eff" }, - "incline.nvim": { "branch": "main", "commit": "16fc9c073e3ea4175b66ad94375df6d73fc114c0" }, - "indent-blankline.nvim": { "branch": "master", "commit": "7a698a1d7ed755af9f5a88733b23ca246ce2df28" }, - "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, - "leap.nvim": { "branch": "main", "commit": "c6bfb191f1161fbabace1f36f578a20ac6c7642c" }, - "lspsaga.nvim": { "branch": "main", "commit": "7dae6e92c82964a8889d3cd999dfd4f271e3a873" }, - "lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" }, - "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, - "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.diff": { "branch": "main", "commit": "00f072250061ef498f91ed226918c9ec31a416a4" }, - "neogit": { "branch": "master", "commit": "060a625660b2816649d83dbd6c7ab1b4345ea8bc" }, - "neorg": { "branch": "main", "commit": "29993a7bb8279ffa0ba473a3f393daa28c645825" }, + "gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" }, + "incline.nvim": { "branch": "main", "commit": "0eb5b7f6fc6636a4e7b2eb2800b7650fd6d164a2" }, + "lazy.nvim": { "branch": "main", "commit": "e5e9bf48211a13d9ee6c1077c88327c49c1ab4a0" }, + "leap.nvim": { "branch": "main", "commit": "8b826a9fc766bffd14288aee01847cb0d6c6c383" }, + "lspsaga.nvim": { "branch": "main", "commit": "4acafaf3455c57c94400e961636d979fb6ddd9fc" }, + "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, + "markview.nvim": { "branch": "main", "commit": "f1e2a57388b61fff8e9d7519ce05cee27a59a57e" }, + "neogit": { "branch": "master", "commit": "63124cf520ff24d09deb3b850e053908ab0fc66a" }, "neovim-ayu": { "branch": "master", "commit": "283badaa983234c90e857c12c1f1c18e1544360a" }, - "noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" }, + "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, - "nvim-dap-go": { "branch": "main", "commit": "1bacf2fa7d4dc6a8a4f6cc390f1544e5b34c35a4" }, + "nvim-dap": { "branch": "master", "commit": "6e0e8ab4d8ed520076971465a4388dfe54a91d83" }, + "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" }, "nvim-dap-repl-highlights": { "branch": "master", "commit": "a7512fc0a0de0c0be8d58983939856dda6f72451" }, - "nvim-dap-ui": { "branch": "master", "commit": "727c032a8f63899baccb42a1c26f27687e62fc5e" }, + "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, - "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" }, - "nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" }, - "nvim-treesitter": { "branch": "master", "commit": "984214ef8e4ca18d77639663319aabdfba89632f" }, - "nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" }, + "nvim-treesitter": { "branch": "master", "commit": "5774e7d3da4f681296a87fcd85d17779ad362a4f" }, + "nvim-treesitter-context": { "branch": "master", "commit": "198720b4016af04c9590f375d714d5bf8afecc1a" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, - "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, - "pathlib.nvim": { "branch": "main", "commit": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1" }, + "nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" }, "persistent-breakpoints.nvim": { "branch": "main", "commit": "4b199b1dcfd136cac8b0fa9c8dbbdeb81463f7a9" }, - "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, - "rustaceanvim": { "branch": "master", "commit": "0a1876b970ab946be3f4d341e9d743a5d62d646a" }, - "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "5922bb3dd691a2a37bd51e20d4a3dc7895221e51" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "rustaceanvim": { "branch": "master", "commit": "f03035fa03ccb36cd26d0792c946fbacba1d1a39" }, + "snacks.nvim": { "branch": "main", "commit": "b100c937177536cf2aa634ddd2aa5b8a1dd23ace" }, "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" } } From c353ae7e4a8c667d963e887a0c82feb70ec052ee Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 01:37:51 +0000 Subject: [PATCH 082/100] Update flake --- flake.lock | 53 +++++++++++++++++++++++++---------------------------- flake.nix | 3 ++- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/flake.lock b/flake.lock index 53c2949..859ce09 100644 --- a/flake.lock +++ b/flake.lock @@ -58,11 +58,11 @@ ] }, "locked": { - "lastModified": 1738275749, - "narHash": "sha256-PM+cGduJ05EZ+YXulqAwUFjvfKpPmW080mcuN6R1POw=", + "lastModified": 1740208222, + "narHash": "sha256-FqgPcK5BK+Mc4cGBCGz555UsVd/TQK9FvmuamBWu+ZY=", "owner": "nix-community", "repo": "home-manager", - "rev": "a8159195bfaef3c64df75d3b1e6a68d49d392be9", + "rev": "f4a07823a298deff0efb0db30f9318511de7c232", "type": "github" }, "original": { @@ -77,17 +77,14 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1738266384, - "narHash": "sha256-bElFR0jR2qRg0SrwWlm0CJJKGgPRLSoPN1N/26H4DNQ=", - "owner": "LarssonMartin1998", - "repo": "neovim-flake", - "rev": "75c20106d069de3f38b7c0c420e1836ac4681b18", - "type": "github" + "lastModified": 1740225052, + "narHash": "sha256-HZT4TXmTPueIjweb1VZmqdkFHuAeOBN1DuhCirWAFAw=", + "path": "/home/nixos/dev/git/neovim-flake", + "type": "path" }, "original": { - "owner": "LarssonMartin1998", - "repo": "neovim-flake", - "type": "github" + "path": "/home/nixos/dev/git/neovim-flake", + "type": "path" } }, "nix-darwin": { @@ -97,11 +94,11 @@ ] }, "locked": { - "lastModified": 1738277753, - "narHash": "sha256-iyFcCOk0mmDiv4ut9mBEuMxMZIym3++0qN1rQBg8FW0=", + "lastModified": 1739933872, + "narHash": "sha256-UhuvTR4OrWR+WBaRCZm4YMkvjJhZ1KZo/jRjE41m+Ek=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "49b807fa7c37568d7fbe2aeaafb9255c185412f9", + "rev": "6ab392f626a19f1122d1955c401286e1b7cf6b53", "type": "github" }, "original": { @@ -155,11 +152,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1736095716, - "narHash": "sha256-csysw/Szu98QDiA2lhWk9seYOyCebeVEWL89zh1cduM=", + "lastModified": 1740046902, + "narHash": "sha256-Xbhz8eEqBmNpvqaGFbF5JopmfNJccWUr8eExtU/iGX4=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "63c3b4ed1712a3a0621002cd59bfdc80875ecbb0", + "rev": "c4f6ae89468939d9fcf1a317c062cf5dd02004ea", "type": "github" }, "original": { @@ -171,11 +168,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1737110817, - "narHash": "sha256-DSenga8XjPaUV5KUFW/i3rNkN7jm9XmguW+qQ1ZJTR4=", + "lastModified": 1740019556, + "narHash": "sha256-vn285HxnnlHLWnv59Og7muqECNMS33mWLM14soFIv2g=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "041c867bad68dfe34b78b2813028a2e2ea70a23c", + "rev": "dad564433178067be1fbdfcce23b546254b6d641", "type": "github" }, "original": { @@ -216,27 +213,27 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1733384649, - "narHash": "sha256-K5DJ2LpPqht7K76bsxetI+YHhGGRyVteTPRQaIIKJpw=", + "lastModified": 1739624908, + "narHash": "sha256-f84lBmLl4tkDp1ZU5LBTSFzlxXP4926DVW3KnXrke10=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "190c31a89e5eec80dd6604d7f9e5af3802a58a13", + "rev": "a60651b217d2e529729cbc7d989c19f3941b9250", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.05", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_5": { "locked": { - "lastModified": 1738142207, - "narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", + "lastModified": 1739866667, + "narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9d3ae807ebd2981d593cddd0080856873139aa40", + "rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index da950d7..9e32cee 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,8 @@ }; nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; - neovim.url = "github:LarssonMartin1998/neovim-flake"; + # neovim.url = "github:LarssonMartin1998/neovim-flake"; + neovim.url = "path:/home/nixos/dev/git/neovim-flake"; nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; }; From 1cd86b9921359225dc1a314bd4d7ae0d26641f95 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 02:01:10 +0000 Subject: [PATCH 083/100] Remap leap keymappings as we exit debug mode --- nvim/lua/leap_keymap_handler.lua | 25 +++++++++++++++++++++++++ nvim/lua/plugs/leap.lua | 19 ++----------------- nvim/lua/plugs/nvim-dap.lua | 1 + 3 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 nvim/lua/leap_keymap_handler.lua diff --git a/nvim/lua/leap_keymap_handler.lua b/nvim/lua/leap_keymap_handler.lua new file mode 100644 index 0000000..55b791c --- /dev/null +++ b/nvim/lua/leap_keymap_handler.lua @@ -0,0 +1,25 @@ +local M = {} + +local function leap_across_windows() + require("leap").leap({ + target_windows = require("leap.user").get_focusable_windows() + }) +end + +local function leap_in_current_buffer() + require("leap").leap({ + target_windows = { vim.api.nvim_get_current_win() } + }) +end + +function M.set_leap_keymapping() + require("utils").foreach({ + { "n", "m", leap_across_windows }, + { "v", "m", leap_in_current_buffer }, + { "o", "m", leap_in_current_buffer } + }, function(mapping) + vim.keymap.set(mapping[1], mapping[2], mapping[3]) + end) +end + +return M diff --git a/nvim/lua/plugs/leap.lua b/nvim/lua/plugs/leap.lua index 76ca034..2ec7a66 100644 --- a/nvim/lua/plugs/leap.lua +++ b/nvim/lua/plugs/leap.lua @@ -1,15 +1,3 @@ -local function leap_across_windows() - require("leap").leap({ - target_windows = require("leap.user").get_focusable_windows() - }) -end - -local function leap_in_current_buffer() - require("leap").leap({ - target_windows = { vim.api.nvim_get_current_win() } - }) -end - local saved_hlsearch = false local saved_highlights = {} local colors = require("ayu.colors") @@ -32,11 +20,6 @@ return { event = "VeryLazy", lazy = true, opts = {}, - keys = { - { "m", function() leap_across_windows() end, mode = "n" }, - { "m", function() leap_in_current_buffer() end, mode = "v" }, - { "m", function() leap_in_current_buffer() end, mode = "o" }, - }, init = function() local leap = require("leap") @@ -71,5 +54,7 @@ return { for _, cmd in ipairs(autocmds) do utils.create_user_event_cb(cmd.event_name, cmd.cb, leap_augroup_name) end + + require("leap_keymap_handler").set_leap_keymapping() end, } diff --git a/nvim/lua/plugs/nvim-dap.lua b/nvim/lua/plugs/nvim-dap.lua index 5756f97..63afd26 100644 --- a/nvim/lua/plugs/nvim-dap.lua +++ b/nvim/lua/plugs/nvim-dap.lua @@ -67,6 +67,7 @@ return { if are_stepping_keymaps_active then utils.del_keymap_list(stepping_keymaps) are_stepping_keymaps_active = false + require("leap_keymap_handler").set_leap_keymapping() end inlay_hints_handler.restore() From 5fbf788a4044f2a470ee6f60c31e64c82c82ff15 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 02:01:37 +0000 Subject: [PATCH 084/100] Add keymap for gitbrowse and set it to browse to repo --- nvim/lua/plugs/snacks.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nvim/lua/plugs/snacks.lua b/nvim/lua/plugs/snacks.lua index 27bed99..1247d8a 100644 --- a/nvim/lua/plugs/snacks.lua +++ b/nvim/lua/plugs/snacks.lua @@ -3,7 +3,10 @@ return { priority = 1000, lazy = false, opts = { - gitbrowse = { enabled = true, }, + gitbrowse = { + enabled = true, + what = "repo", + }, picker = { enabled = true, }, dashboard = { enabled = true, }, debug = { enabled = true, }, @@ -38,6 +41,8 @@ return { }, }, keys = { + { "gB", function() Snacks.gitbrowse() end, }, + { "z", function() Snacks.zen() end, }, { "to", function() Snacks.picker.smart() end, }, From dcd14d7eecf7fd8f1cc48d9b490640c5b56f1fa0 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 02:01:58 +0000 Subject: [PATCH 085/100] Add Snacks as globals in lua lsp --- nvim/.luarc.json | 3 ++- nvim/lua/lsp/servers/lua_ls.lua | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nvim/.luarc.json b/nvim/.luarc.json index 1e1765c..f82b794 100644 --- a/nvim/.luarc.json +++ b/nvim/.luarc.json @@ -1,5 +1,6 @@ { "diagnostics.globals": [ "vim" + "Snacks" ] -} \ No newline at end of file +} diff --git a/nvim/lua/lsp/servers/lua_ls.lua b/nvim/lua/lsp/servers/lua_ls.lua index 4a9f57a..780383e 100644 --- a/nvim/lua/lsp/servers/lua_ls.lua +++ b/nvim/lua/lsp/servers/lua_ls.lua @@ -30,7 +30,7 @@ return { version = "LuaJIT" }, diagnostics = { - globals = { "vim" }, + globals = { "vim", "Snacks" }, }, -- Make the server aware of Neovim runtime files workspace = { From 334b18e3092dba9121c2ad9b979a6a175cc80c48 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 02:09:55 +0000 Subject: [PATCH 086/100] Fix so zen mode doesnt exit when leaping in normal mode. --- nvim/lua/leap_keymap_handler.lua | 10 +++++++++- nvim/lua/plugs/snacks.lua | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/nvim/lua/leap_keymap_handler.lua b/nvim/lua/leap_keymap_handler.lua index 55b791c..609d77f 100644 --- a/nvim/lua/leap_keymap_handler.lua +++ b/nvim/lua/leap_keymap_handler.lua @@ -12,9 +12,17 @@ local function leap_in_current_buffer() }) end +local function normal_mode_leap() + if _G["snacks_zen_mode"] then + leap_in_current_buffer() + else + leap_across_windows() + end +end + function M.set_leap_keymapping() require("utils").foreach({ - { "n", "m", leap_across_windows }, + { "n", "m", normal_mode_leap }, { "v", "m", leap_in_current_buffer }, { "o", "m", leap_in_current_buffer } }, function(mapping) diff --git a/nvim/lua/plugs/snacks.lua b/nvim/lua/plugs/snacks.lua index 1247d8a..418b207 100644 --- a/nvim/lua/plugs/snacks.lua +++ b/nvim/lua/plugs/snacks.lua @@ -37,7 +37,13 @@ return { }, zen = { enabled = true, - toggles = { dim = false, } + toggles = { dim = false, }, + on_open = function() + _G["snacks_zen_mode"] = true + end, + on_close = function() + _G["snacks_zen_mode"] = false + end, }, }, keys = { From 8a946cdf92d28516a9a6a3a3d30ec23b8b57290b Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 02:01:10 +0000 Subject: [PATCH 087/100] Remap leap keymappings as we exit debug mode --- nvim/lua/leap_keymap_handler.lua | 25 +++++++++++++++++++++++++ nvim/lua/plugs/leap.lua | 19 ++----------------- nvim/lua/plugs/nvim-dap.lua | 1 + 3 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 nvim/lua/leap_keymap_handler.lua diff --git a/nvim/lua/leap_keymap_handler.lua b/nvim/lua/leap_keymap_handler.lua new file mode 100644 index 0000000..55b791c --- /dev/null +++ b/nvim/lua/leap_keymap_handler.lua @@ -0,0 +1,25 @@ +local M = {} + +local function leap_across_windows() + require("leap").leap({ + target_windows = require("leap.user").get_focusable_windows() + }) +end + +local function leap_in_current_buffer() + require("leap").leap({ + target_windows = { vim.api.nvim_get_current_win() } + }) +end + +function M.set_leap_keymapping() + require("utils").foreach({ + { "n", "m", leap_across_windows }, + { "v", "m", leap_in_current_buffer }, + { "o", "m", leap_in_current_buffer } + }, function(mapping) + vim.keymap.set(mapping[1], mapping[2], mapping[3]) + end) +end + +return M diff --git a/nvim/lua/plugs/leap.lua b/nvim/lua/plugs/leap.lua index 76ca034..2ec7a66 100644 --- a/nvim/lua/plugs/leap.lua +++ b/nvim/lua/plugs/leap.lua @@ -1,15 +1,3 @@ -local function leap_across_windows() - require("leap").leap({ - target_windows = require("leap.user").get_focusable_windows() - }) -end - -local function leap_in_current_buffer() - require("leap").leap({ - target_windows = { vim.api.nvim_get_current_win() } - }) -end - local saved_hlsearch = false local saved_highlights = {} local colors = require("ayu.colors") @@ -32,11 +20,6 @@ return { event = "VeryLazy", lazy = true, opts = {}, - keys = { - { "m", function() leap_across_windows() end, mode = "n" }, - { "m", function() leap_in_current_buffer() end, mode = "v" }, - { "m", function() leap_in_current_buffer() end, mode = "o" }, - }, init = function() local leap = require("leap") @@ -71,5 +54,7 @@ return { for _, cmd in ipairs(autocmds) do utils.create_user_event_cb(cmd.event_name, cmd.cb, leap_augroup_name) end + + require("leap_keymap_handler").set_leap_keymapping() end, } diff --git a/nvim/lua/plugs/nvim-dap.lua b/nvim/lua/plugs/nvim-dap.lua index 5756f97..63afd26 100644 --- a/nvim/lua/plugs/nvim-dap.lua +++ b/nvim/lua/plugs/nvim-dap.lua @@ -67,6 +67,7 @@ return { if are_stepping_keymaps_active then utils.del_keymap_list(stepping_keymaps) are_stepping_keymaps_active = false + require("leap_keymap_handler").set_leap_keymapping() end inlay_hints_handler.restore() From 866eac631714d86b5264f0939d9c952ae0babeca Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 02:01:37 +0000 Subject: [PATCH 088/100] Add keymap for gitbrowse and set it to browse to repo --- nvim/lua/plugs/snacks.lua | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 nvim/lua/plugs/snacks.lua diff --git a/nvim/lua/plugs/snacks.lua b/nvim/lua/plugs/snacks.lua new file mode 100644 index 0000000..1247d8a --- /dev/null +++ b/nvim/lua/plugs/snacks.lua @@ -0,0 +1,68 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + gitbrowse = { + enabled = true, + what = "repo", + }, + picker = { enabled = true, }, + dashboard = { enabled = true, }, + debug = { enabled = true, }, + indent = { + enabled = true, + animate = { + enabled = false, + }, + }, + input = { enabled = true, }, + notifier = { enabled = true, }, + quickfile = { enabled = true, }, + scroll = { + enabled = true, + animate = { + duration = { step = 7, total = 250 }, + easing = "outCirc", + }, + animate_repeat = { + delay = 100, + duration = { step = 3, total = 50 }, + easing = "outCirc", + }, + }, + words = { + enabled = true, + debounce = 100, + }, + zen = { + enabled = true, + toggles = { dim = false, } + }, + }, + keys = { + { "gB", function() Snacks.gitbrowse() end, }, + + { "z", function() Snacks.zen() end, }, + + { "to", function() Snacks.picker.smart() end, }, + { "ta", function() Snacks.picker.grep() end, }, + { "tg", function() Snacks.picker.git_log_file() end, }, + { "ts", function() Snacks.picker.lsp_workspace_symbols() end, }, + { "tn", function() Snacks.picker.notifications() end }, + }, + init = function() + vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + _G.inspect = function(...) + Snacks.debug.inspect(...) + end + _G.backtrace = function() + Snacks.debug.backtrace() + end + vim.print = _G.inspect + end, + }) + end +} From 0a6c1b036897b17d8a716333b1c18fd2c79f8b46 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 02:01:58 +0000 Subject: [PATCH 089/100] Add Snacks as globals in lua lsp --- nvim/.luarc.json | 3 ++- nvim/lua/lsp/servers/lua_ls.lua | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nvim/.luarc.json b/nvim/.luarc.json index 1e1765c..f82b794 100644 --- a/nvim/.luarc.json +++ b/nvim/.luarc.json @@ -1,5 +1,6 @@ { "diagnostics.globals": [ "vim" + "Snacks" ] -} \ No newline at end of file +} diff --git a/nvim/lua/lsp/servers/lua_ls.lua b/nvim/lua/lsp/servers/lua_ls.lua index 4a9f57a..780383e 100644 --- a/nvim/lua/lsp/servers/lua_ls.lua +++ b/nvim/lua/lsp/servers/lua_ls.lua @@ -30,7 +30,7 @@ return { version = "LuaJIT" }, diagnostics = { - globals = { "vim" }, + globals = { "vim", "Snacks" }, }, -- Make the server aware of Neovim runtime files workspace = { From 65f4bfddecf1af082317659ee2815e26aff7e2a6 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Sun, 23 Feb 2025 02:09:55 +0000 Subject: [PATCH 090/100] Fix so zen mode doesnt exit when leaping in normal mode. --- nvim/lua/leap_keymap_handler.lua | 10 +++++++++- nvim/lua/plugs/snacks.lua | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/nvim/lua/leap_keymap_handler.lua b/nvim/lua/leap_keymap_handler.lua index 55b791c..609d77f 100644 --- a/nvim/lua/leap_keymap_handler.lua +++ b/nvim/lua/leap_keymap_handler.lua @@ -12,9 +12,17 @@ local function leap_in_current_buffer() }) end +local function normal_mode_leap() + if _G["snacks_zen_mode"] then + leap_in_current_buffer() + else + leap_across_windows() + end +end + function M.set_leap_keymapping() require("utils").foreach({ - { "n", "m", leap_across_windows }, + { "n", "m", normal_mode_leap }, { "v", "m", leap_in_current_buffer }, { "o", "m", leap_in_current_buffer } }, function(mapping) diff --git a/nvim/lua/plugs/snacks.lua b/nvim/lua/plugs/snacks.lua index 1247d8a..418b207 100644 --- a/nvim/lua/plugs/snacks.lua +++ b/nvim/lua/plugs/snacks.lua @@ -37,7 +37,13 @@ return { }, zen = { enabled = true, - toggles = { dim = false, } + toggles = { dim = false, }, + on_open = function() + _G["snacks_zen_mode"] = true + end, + on_close = function() + _G["snacks_zen_mode"] = false + end, }, }, keys = { From 3319ead7e7328c036e9b3e2c0e3fb0f0733bce9d Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Mon, 24 Feb 2025 14:28:25 +0000 Subject: [PATCH 091/100] Update from deprecated to modern functions --- nvim/lua/utils.lua | 6 +++--- nvim/lua/window_management.lua | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nvim/lua/utils.lua b/nvim/lua/utils.lua index d250a7b..8b221c7 100644 --- a/nvim/lua/utils.lua +++ b/nvim/lua/utils.lua @@ -83,11 +83,11 @@ function M.add_opts_to_all_mappings(mappings, opts) end function M.is_buf_filetype(bufnr, filetype) - return vim.api.nvim_buf_get_option(bufnr, "filetype") == filetype + return vim.api.nvim_get_option_value("filetype", { buf = bufnr }) == filetype end -function M.is_buf_buftype(bufnr, filetype) - return vim.api.nvim_buf_get_option(bufnr, "buftype") == filetype +function M.is_buf_buftype(bufnr, buftype) + return vim.api.nvim_get_option_value("buftype", { buf = bufnr }) == buftype end function M.lock_buf_to_window(win_id, bufnr, filetype) diff --git a/nvim/lua/window_management.lua b/nvim/lua/window_management.lua index 6adfbf3..0ec86f0 100644 --- a/nvim/lua/window_management.lua +++ b/nvim/lua/window_management.lua @@ -26,7 +26,7 @@ local function window_has_valid_buffer(window) return false end - local buf_type = vim.api.nvim_buf_get_option(buf, "buftype") + local buf_type = vim.api.nvim_get_option_value("buftype", { buf = buf }) if buf_type ~= "" then return false end From aa0b453a10265d0e3e8c590fb91820ffe1dfe7b0 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Mon, 24 Feb 2025 14:28:43 +0000 Subject: [PATCH 092/100] Fix accidentally commited local path to neovim-flake --- flake.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 9e32cee..da950d7 100644 --- a/flake.nix +++ b/flake.nix @@ -15,8 +15,7 @@ }; nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; - # neovim.url = "github:LarssonMartin1998/neovim-flake"; - neovim.url = "path:/home/nixos/dev/git/neovim-flake"; + neovim.url = "github:LarssonMartin1998/neovim-flake"; nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew"; }; From deba4a64a65904e8413f5b42d5291b4dc82c3618 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Mon, 24 Feb 2025 14:55:08 +0000 Subject: [PATCH 093/100] Add persistence session manager, remove auto-session, add keys to dashboard in snacks --- nvim/lua/plugs/auto_session.lua | 19 ------------------- nvim/lua/plugs/persistence.lua | 5 +++++ nvim/lua/plugs/snacks.lua | 15 ++++++++++++++- 3 files changed, 19 insertions(+), 20 deletions(-) delete mode 100644 nvim/lua/plugs/auto_session.lua create mode 100644 nvim/lua/plugs/persistence.lua diff --git a/nvim/lua/plugs/auto_session.lua b/nvim/lua/plugs/auto_session.lua deleted file mode 100644 index 660f348..0000000 --- a/nvim/lua/plugs/auto_session.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - "rmagatti/auto-session", - opts = { - log_level = "error", - auto_session_suppress_dirs = { - "/", - "~/", - "~/Projects", - "~/Downloads", - "~/Development", - "~/Dev", - "~/Dev/Git", - "~/.config", - }, - }, - init = function() - vim.o.sessionoptions = "localoptions" - end -} diff --git a/nvim/lua/plugs/persistence.lua b/nvim/lua/plugs/persistence.lua new file mode 100644 index 0000000..1ccfd38 --- /dev/null +++ b/nvim/lua/plugs/persistence.lua @@ -0,0 +1,5 @@ +return { + "folke/persistence.nvim", + event = "BufReadPre", -- this will only start session saving when an actual file was opened + opts = {} +} diff --git a/nvim/lua/plugs/snacks.lua b/nvim/lua/plugs/snacks.lua index 418b207..a430aa4 100644 --- a/nvim/lua/plugs/snacks.lua +++ b/nvim/lua/plugs/snacks.lua @@ -8,7 +8,20 @@ return { what = "repo", }, picker = { enabled = true, }, - dashboard = { enabled = true, }, + dashboard = { + enabled = true, + preset = { + keys = { + { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" }, + { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" }, + { icon = " ", key = "s", desc = "Restore Session", section = "session" }, + { icon = "󰒲 ", key = "L", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + }, + }, debug = { enabled = true, }, indent = { enabled = true, From c2a9c8ea2c2688116a6ea4eb6d498d0e7a57d682 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Mon, 24 Feb 2025 14:55:17 +0000 Subject: [PATCH 094/100] Fix missuse of module function that has been moved to utils in window window_management --- nvim/lua/window_management.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nvim/lua/window_management.lua b/nvim/lua/window_management.lua index 0ec86f0..e64525c 100644 --- a/nvim/lua/window_management.lua +++ b/nvim/lua/window_management.lua @@ -211,13 +211,13 @@ function M.setup() utils.set_keymap_list(enter_resizing_mode_keymaps) local function on_resize_mode_enter() - M.del_keymap_list(enter_resizing_mode_keymaps) - M.set_keymap_list(resizing_mode_keymaps) + utils.del_keymap_list(enter_resizing_mode_keymaps) + utils.set_keymap_list(resizing_mode_keymaps) end local function on_resize_mode_exit() - M.del_keymap_list(resizing_mode_keymaps) - M.set_keymap_list(enter_resizing_mode_keymaps) + utils.del_keymap_list(resizing_mode_keymaps) + utils.set_keymap_list(enter_resizing_mode_keymaps) end local window_management_augroup = "WindowManagementEvents" From f82e73ea97d6c5780e9977c7578d71a34065ccc0 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Mon, 24 Feb 2025 14:55:54 +0000 Subject: [PATCH 095/100] More deprecated update stuff --- nvim/lua/terminal.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nvim/lua/terminal.lua b/nvim/lua/terminal.lua index 36ee757..c95e852 100644 --- a/nvim/lua/terminal.lua +++ b/nvim/lua/terminal.lua @@ -24,19 +24,19 @@ local function toggle_terminal() local utils = require("utils") open_terminal_window() - local term_height = vim.api.nvim_get_option("lines") + local term_height = vim.api.nvim_get_option_value("lines", {}) local height_percentage = 0.225 local min_height = 15 local max_height = 25 local height = utils.calculate_split_size(term_height, height_percentage, min_height, max_height) vim.api.nvim_win_set_height(terminal_window, height) - vim.api.nvim_win_set_option(terminal_window, "winfixheight", true) + vim.api.nvim_set_option_value("winfixheight", true, { win = terminal_window }) utils.lock_buf_to_window(terminal_window, terminal_bufnr, "terminal") vim.api.nvim_command("startinsert") end -vim.keymap.set("n", "h", function() +vim.keymap.set("n", "h", function() toggle_terminal() require("window_management").autosize_windows() end) From 1b28c88f03b68fae80e1456ab6610a8a30900986 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Mon, 24 Feb 2025 15:04:36 +0000 Subject: [PATCH 096/100] Add python 11 and pcre to nix home packages --- nix/pkgs/home.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nix/pkgs/home.nix b/nix/pkgs/home.nix index 2053ed0..cda0f05 100644 --- a/nix/pkgs/home.nix +++ b/nix/pkgs/home.nix @@ -119,6 +119,8 @@ in tree-sitter codelldb bottom + python311 + pcre ]; file = symlinkFiles; From f2ec0816972bc6e5812318dd5ec25d71c008e2be Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Mon, 24 Feb 2025 15:06:32 +0000 Subject: [PATCH 097/100] Update flake input --- flake.lock | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 859ce09..c525362 100644 --- a/flake.lock +++ b/flake.lock @@ -58,11 +58,11 @@ ] }, "locked": { - "lastModified": 1740208222, - "narHash": "sha256-FqgPcK5BK+Mc4cGBCGz555UsVd/TQK9FvmuamBWu+ZY=", + "lastModified": 1740347597, + "narHash": "sha256-st5q9egkPGz8TUcVVlIQX7y6G3AzHob+6M963bwVq74=", "owner": "nix-community", "repo": "home-manager", - "rev": "f4a07823a298deff0efb0db30f9318511de7c232", + "rev": "12e26a74e5eb1a31e13daaa08858689e25ebd449", "type": "github" }, "original": { @@ -77,14 +77,17 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1740225052, - "narHash": "sha256-HZT4TXmTPueIjweb1VZmqdkFHuAeOBN1DuhCirWAFAw=", - "path": "/home/nixos/dev/git/neovim-flake", - "type": "path" + "lastModified": 1740326390, + "narHash": "sha256-fAT9H/sPTOyGR/L7HAKgEw270i6t0fYCay0WP39R2ho=", + "owner": "LarssonMartin1998", + "repo": "neovim-flake", + "rev": "03b2f8498cf44ca7ab6436f5a081772f3e378be4", + "type": "github" }, "original": { - "path": "/home/nixos/dev/git/neovim-flake", - "type": "path" + "owner": "LarssonMartin1998", + "repo": "neovim-flake", + "type": "github" } }, "nix-darwin": { @@ -229,11 +232,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1739866667, - "narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=", + "lastModified": 1740367490, + "narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680", + "rev": "0196c0175e9191c474c26ab5548db27ef5d34b05", "type": "github" }, "original": { From 2e6646dbb0b3210fdf6d9cbfce61a08994848736 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Tue, 25 Feb 2025 14:10:47 +0000 Subject: [PATCH 098/100] Add a command for creating launch.json templates --- nvim/lua/dap/setup.lua | 44 ++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/nvim/lua/dap/setup.lua b/nvim/lua/dap/setup.lua index 98ceff5..39f0caf 100644 --- a/nvim/lua/dap/setup.lua +++ b/nvim/lua/dap/setup.lua @@ -1,32 +1,34 @@ local utils = require("utils") local dap = require("dap") ---[[ -.vscode/launch.json: ----------------------------- -{ - "version": "0.2.0", - "configurations": [ - { - "type": "name_of_adapter", - "request": "launch/attach", - "name": "Friendly name", - "program": "${workspaceFolder}/path/to/executable", - "cwd": "${workspaceFolder}", - "args": [], - "stopOnEntry": false, - "environment": [] - } - ] -} ----------------------------- -]] - local dir_path = "dap/adapters" utils.foreach(utils.get_file_names_in_dir(dir_path, "*.lua", true), function(adapter) dap.adapters[adapter] = require(dir_path .. "/" .. adapter) end) +vim.api.nvim_create_user_command("LaunchTemplate", function() + local template = { + '{', + ' "version": "0.2.0",', + ' "configurations": [', + ' {', + ' "type": "codelldb",', + ' "request": "launch",', + ' "name": "Launch",', + ' "program": "${workspaceFolder}/build/binary",', + ' "cwd": "${workspaceFolder}",', + ' "args": [],', + ' "stopOnEntry": false,', + ' "environment": []', + ' }', + ' ]', + '}', + } + + local bufnr = vim.api.nvim_get_current_buf() + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, template) +end, {}) + -- Do not define default fallbacks until I have a better way of handling a default selected configuration. -- I never want to be prompted for a configuration, we should have ae serialized active config which is always run unless changed. -- -- Define configurations From 00a8c553535a1054ee32143b97bf2a89b8fd5fd5 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Tue, 25 Feb 2025 14:11:01 +0000 Subject: [PATCH 099/100] Tweak so only file buffers are saved in sessions --- nvim/lua/vim_opt.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvim/lua/vim_opt.lua b/nvim/lua/vim_opt.lua index d76611a..b434698 100644 --- a/nvim/lua/vim_opt.lua +++ b/nvim/lua/vim_opt.lua @@ -68,4 +68,7 @@ opt.scrolloff = 4 -- Whitespaces opt.list = false +-- Sessions +opt.sessionoptions = { "buffers", "curdir", "winsize", "winpos", "skiprtp" } + return opt From da76b3a0482291c95d3a15f19351e82af7b56f55 Mon Sep 17 00:00:00 2001 From: Martin Larsson Date: Tue, 25 Feb 2025 14:11:14 +0000 Subject: [PATCH 100/100] switch to dap-view from dap-ui. Plus some light refactoring. --- nvim/lua/plugs/nvim-dap.lua | 94 ++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 54 deletions(-) diff --git a/nvim/lua/plugs/nvim-dap.lua b/nvim/lua/plugs/nvim-dap.lua index 63afd26..3d56742 100644 --- a/nvim/lua/plugs/nvim-dap.lua +++ b/nvim/lua/plugs/nvim-dap.lua @@ -1,34 +1,11 @@ local utils = require("utils") local inlay_hints_handler = require("inlay_hints_handler") -local are_stepping_keymaps_active = false +local is_debug_mode_active = false return { "mfussenegger/nvim-dap", dependencies = { - { - "rcarriga/nvim-dap-ui", - opts = { - controls = { - enabled = false, - }, - layouts = { - { - elements = { - { - id = "watches", - size = 0.5 - }, - { - id = "stacks", - size = 0.5 - } - }, - position = "bottom", - size = 15 - } - }, - }, - }, + { "igorlfs/nvim-dap-view", opts = {} }, -- Special adapters { "leoluz/nvim-dap-go", opts = {} }, { "mfussenegger/nvim-dap-python", }, @@ -52,28 +29,6 @@ return { { "i", function() dap.step_into() end }, } - local function enter_debug_mode() - require("dapui").open() - if not are_stepping_keymaps_active then - utils.set_keymap_list(stepping_keymaps) - are_stepping_keymaps_active = true - end - - inlay_hints_handler.disable() - end - - local function exit_debug_mode() - require("dapui").close() - if are_stepping_keymaps_active then - utils.del_keymap_list(stepping_keymaps) - are_stepping_keymaps_active = false - require("leap_keymap_handler").set_leap_keymapping() - end - - inlay_hints_handler.restore() - virtual_text.clear_virtual_text() - end - local dap_signs = { { "DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" } }, { "DapBreakpointRejected", { text = "🔵", texthl = "", linehl = "", numhl = "" } }, @@ -84,21 +39,52 @@ return { vim.fn.sign_define(unpack(sign)) end - dap.listeners.after.event_initialized["dapui_config"] = function() - enter_debug_mode() + local function enter_debug_mode() + if is_debug_mode_active then + return + end + + utils.set_keymap_list(stepping_keymaps) + is_debug_mode_active = true + + inlay_hints_handler.disable() + require("dap-view").open() end - dap.listeners.before.event_terminated["dapui_config"] = function() - exit_debug_mode() + + local function exit_debug_mode() + if not is_debug_mode_active then + return + end + + utils.del_keymap_list(stepping_keymaps) + is_debug_mode_active = false + require("leap_keymap_handler").set_leap_keymapping() + + inlay_hints_handler.restore() + virtual_text.clear_virtual_text() + require("dap-view").close() end - dap.listeners.before.event_exited["dapui_config"] = function() - exit_debug_mode() + + for _, request in ipairs({ + { "attach", enter_debug_mode }, + { "launch", enter_debug_mode }, + }) do + dap.listeners.before[request[1]]["dapview"] = request[2] + end + + for _, event in ipairs({ + { "event_terminated", exit_debug_mode }, + { "event_exited", exit_debug_mode }, + }) do + dap.listeners.after[event[1]]["dapview"] = event[2] end local function dap_stop() - dap.disconnect({ terminateDebuggee = true }) + dap.terminate() dap.close() exit_debug_mode() end + utils.set_keymap_list({ { "dr", dap.continue }, { "bt", breakpoint_api.toggle_breakpoint },