-
Notifications
You must be signed in to change notification settings - Fork 0
Nvim migrate dir #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nvim migrate dir #371
Changes from all commits
b301fe7
57fe015
10c9d74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -474,8 +474,8 @@ neovim-dev: ## Set up local Neovim development environment. | |
| rm "$(HOME)/.config/nvim"; \ | ||
| fi | ||
| @mkdir -p "$(HOME)/.config/nvim" | ||
| @ln -sf "$(PWD)/config/nvim/init.lua" "$(HOME)/.config/nvim/init.lua" | ||
| @ln -sf "$(PWD)/config/nvim/nvim-pack-lock.json" "$(HOME)/.config/nvim/nvim-pack-lock.json" | ||
| @ln -sf "$(PWD)/home-manager/programs/neovim/init.lua" "$(HOME)/.config/nvim/init.lua" | ||
| @ln -sf "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json" "$(HOME)/.config/nvim/nvim-pack-lock.json" | ||
| @echo "✅ Local Neovim development environment ready" | ||
| @echo "🚧 To restore the Nix-managed version, run 'make switch'" | ||
|
|
||
|
|
@@ -489,13 +489,13 @@ neovim-update: ## Update Neovim plugins. | |
| neovim-sync: ## Sync Neovim plugins. | ||
| @echo "🔄 Syncing neovim plugins..." | ||
| @nvim --headless +"lua vim.cmd('source ' .. vim.fn.stdpath('config') .. '/init.lua')" +qa | ||
| @if [ -f "$(PWD)/config/nvim/nvim-pack-lock.json" ]; then \ | ||
| @if [ -f "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json" ]; then \ | ||
| if [ "$$(uname)" = "Darwin" ]; then \ | ||
| sed -i '' -e '$$ { /^$$/d; }' "$(PWD)/config/nvim/nvim-pack-lock.json"; \ | ||
| sed -i '' -e '$$ { /^$$/d; }' "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \ | ||
| else \ | ||
| sed -i -e '$$ { /^$$/d; }' "$(PWD)/config/nvim/nvim-pack-lock.json"; \ | ||
| sed -i -e '$$ { /^$$/d; }' "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \ | ||
| fi && \ | ||
| printf '\n' >> "$(PWD)/config/nvim/nvim-pack-lock.json"; \ | ||
| printf '\n' >> "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \ | ||
| fi | ||
|
Comment on lines
+492
to
499
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The path to |
||
| @echo "✅ Neovim plugins synced" | ||
|
|
||
|
|
@@ -512,18 +512,18 @@ lua-check-neovim: ## Check Neovim configuration. | |
| echo "⚠️ Neovim is not installed or not in PATH"; \ | ||
| exit 1; \ | ||
| fi | ||
| @NVIM_CONFIG="$(PWD)/config/nvim/init.lua"; \ | ||
| @NVIM_CONFIG="$(PWD)/home-manager/programs/neovim/init.lua"; \ | ||
| if [ ! -f "$$NVIM_CONFIG" ]; then \ | ||
| echo "⚠️ Could not find Neovim configuration at $$NVIM_CONFIG"; \ | ||
| exit 1; \ | ||
| fi | ||
| @echo "📝 Validating Neovim configuration syntax..." | ||
| @mkdir -p ~/.config/nvim | ||
| @ln -sf "$(PWD)/config/nvim/init.lua" ~/.config/nvim/init.lua | ||
| @if [ -f "$(PWD)/config/nvim/nvim-pack-lock.json" ]; then \ | ||
| ln -sf "$(PWD)/config/nvim/nvim-pack-lock.json" ~/.config/nvim/nvim-pack-lock.json; \ | ||
| @ln -sf "$(PWD)/home-manager/programs/neovim/init.lua" ~/.config/nvim/init.lua | ||
| @if [ -f "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json" ]; then \ | ||
| ln -sf "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json" ~/.config/nvim/nvim-pack-lock.json; \ | ||
| fi | ||
| @nvim --headless -c "lua dofile('$(PWD)/config/nvim/init.lua')" -c "qa" 2>&1; \ | ||
| @nvim --headless -c "lua dofile('$(PWD)/home-manager/programs/neovim/init.lua')" -c "qa" 2>&1; \ | ||
|
Comment on lines
+515
to
+526
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This target defines a shell variable |
||
| EXIT_CODE=$$?; \ | ||
| if [ $$EXIT_CODE -eq 0 ]; then \ | ||
| echo "✅ Neovim configuration is valid"; \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ | |
| ./ghostty | ||
| ./hammerspoon | ||
| ./karabiner | ||
| ./nvim | ||
| ./opencode | ||
| ./serena | ||
| ./starship | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,13 @@ | ||
| { pkgs, ... }: | ||
| { | ||
| config, | ||
| lib, | ||
| pkgs, | ||
| ... | ||
| }: | ||
| let | ||
| nvimInitLua = ./init.lua; | ||
| nvimPackLockJson = ./nvim-pack-lock.json; | ||
| in | ||
| { | ||
| programs.neovim = { | ||
| enable = true; | ||
|
|
@@ -7,4 +16,15 @@ | |
| vimAlias = true; | ||
| vimdiffAlias = true; | ||
| }; | ||
|
|
||
| home.file.".config/nvim/init.lua" = { | ||
| source = config.lib.file.mkOutOfStoreSymlink nvimInitLua; | ||
|
||
| force = true; | ||
| }; | ||
|
|
||
| home.activation.copyNvimPackLock = lib.hm.dag.entryAfter [ "writeBoundary" ] '' | ||
| $DRY_RUN_CMD mkdir -p "$HOME/.config/nvim" | ||
| $DRY_RUN_CMD cp -f ${nvimPackLockJson} "$HOME/.config/nvim/nvim-pack-lock.json" | ||
| $DRY_RUN_CMD chmod 644 "$HOME/.config/nvim/nvim-pack-lock.json" | ||
| ''; | ||
|
Comment on lines
+25
to
+29
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path to the Neovim configuration directory is repeated. To improve maintainability and reduce redundancy, you can combine these commands into a single logical line and use a shell variable for the directory path.