From 975cd5d27f1a055c59b46a3f14be80392b4717fa Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 Jan 2025 20:23:01 +0000 Subject: [PATCH 1/3] add git-workree plugin to nixvim --- home/common/core/nixvim/plugins/git-workree.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 home/common/core/nixvim/plugins/git-workree.nix diff --git a/home/common/core/nixvim/plugins/git-workree.nix b/home/common/core/nixvim/plugins/git-workree.nix new file mode 100644 index 0000000..3c2bbff --- /dev/null +++ b/home/common/core/nixvim/plugins/git-workree.nix @@ -0,0 +1,11 @@ +{ + programs.nixvim.plugins.git-worktree = { + enable = true; + enableTelescope = true; + autopush = true; + changeDirectoryCommand = "cd"; + clearJumpsOnChange = true; + updateOnChange = true; + updateOnChangeCommand = "e ."; + }; +} From 8be8c217d3397e8681f3dfa4474acb8d2f8f81c7 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 Jan 2025 20:57:37 +0000 Subject: [PATCH 2/3] change git-worktree to polarmutex version --- home/common/core/nixvim/plugins/default.nix | 1 + .../core/nixvim/plugins/git-workree.nix | 51 +++++++++++++++---- home/common/core/nixvim/plugins/telescope.nix | 7 +++ 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/home/common/core/nixvim/plugins/default.nix b/home/common/core/nixvim/plugins/default.nix index 0397ee1..bc87197 100644 --- a/home/common/core/nixvim/plugins/default.nix +++ b/home/common/core/nixvim/plugins/default.nix @@ -23,6 +23,7 @@ in { ./todo-comments.nix ./oil.nix ./comment.nix + ./git-workree.nix ]; programs.nixvim.plugins.web-devicons.enable = true; diff --git a/home/common/core/nixvim/plugins/git-workree.nix b/home/common/core/nixvim/plugins/git-workree.nix index 3c2bbff..53cc72e 100644 --- a/home/common/core/nixvim/plugins/git-workree.nix +++ b/home/common/core/nixvim/plugins/git-workree.nix @@ -1,11 +1,44 @@ +{pkgs, ...}: { - programs.nixvim.plugins.git-worktree = { - enable = true; - enableTelescope = true; - autopush = true; - changeDirectoryCommand = "cd"; - clearJumpsOnChange = true; - updateOnChange = true; - updateOnChangeCommand = "e ."; - }; + programs.nixvim.keymaps = [ + # Switching worktrees + { + mode = ["n"]; + key = "fws"; + action = "lua require('telescope').extensions.git_worktree.git_worktrees()"; + options = {noremap = true;}; + } + { + mode = ["n"]; + key = "fwc"; + action = "lua require('telescope').extensions.git_worktree.create_git_worktree()"; + options = {noremap = true;}; + } + ]; + + programs.nixvim.extraPlugins = [ + + (pkgs.vimUtils.buildVimPlugin + { + name = "git-worktree.nvim"; + src = pkgs.fetchFromGitHub { + owner = "glow.nvim"; + repo = "git-worktree.nvim"; + rev = "bac72c2"; + sha256 = ""; + }; + }) + ]; + + programs.nixvim.extraConfigLua = '' + ''; + # programs.nixvim.plugins.git-worktree = { + # enable = true; + # enableTelescope = true; + # autopush = true; + # changeDirectoryCommand = "cd"; + # clearJumpsOnChange = true; + # updateOnChange = true; + # updateOnChangeCommand = "e ."; + # }; } diff --git a/home/common/core/nixvim/plugins/telescope.nix b/home/common/core/nixvim/plugins/telescope.nix index e35310a..728a828 100644 --- a/home/common/core/nixvim/plugins/telescope.nix +++ b/home/common/core/nixvim/plugins/telescope.nix @@ -46,5 +46,12 @@ action = "Telescope oldfiles"; options = {noremap = true;}; } + { + # show recently opened files + mode = ["n"]; + key = "fk"; + action = "Telescope keymaps"; + options = {noremap = true;}; + } ]; } From cc4c6467aa9454959e08b6dc800bfbff3eb6fb6d Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 16 Jan 2025 21:15:38 +0000 Subject: [PATCH 3/3] restore git-worktree --- .../core/nixvim/plugins/git-workree.nix | 36 +++++-------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/home/common/core/nixvim/plugins/git-workree.nix b/home/common/core/nixvim/plugins/git-workree.nix index 53cc72e..b0085d1 100644 --- a/home/common/core/nixvim/plugins/git-workree.nix +++ b/home/common/core/nixvim/plugins/git-workree.nix @@ -1,4 +1,3 @@ -{pkgs, ...}: { programs.nixvim.keymaps = [ # Switching worktrees @@ -15,30 +14,13 @@ options = {noremap = true;}; } ]; - - programs.nixvim.extraPlugins = [ - - (pkgs.vimUtils.buildVimPlugin - { - name = "git-worktree.nvim"; - src = pkgs.fetchFromGitHub { - owner = "glow.nvim"; - repo = "git-worktree.nvim"; - rev = "bac72c2"; - sha256 = ""; - }; - }) - ]; - - programs.nixvim.extraConfigLua = '' - ''; - # programs.nixvim.plugins.git-worktree = { - # enable = true; - # enableTelescope = true; - # autopush = true; - # changeDirectoryCommand = "cd"; - # clearJumpsOnChange = true; - # updateOnChange = true; - # updateOnChangeCommand = "e ."; - # }; + programs.nixvim.plugins.git-worktree = { + enable = true; + enableTelescope = true; + autopush = true; + changeDirectoryCommand = "cd"; + clearJumpsOnChange = true; + updateOnChange = true; + updateOnChangeCommand = "e ."; + }; }