diff --git a/pkgbuilds/omarchy-nvim/PKGBUILD b/pkgbuilds/omarchy-nvim/PKGBUILD index e4fb762..5e8ad05 100644 --- a/pkgbuilds/omarchy-nvim/PKGBUILD +++ b/pkgbuilds/omarchy-nvim/PKGBUILD @@ -33,27 +33,30 @@ build() { cp -r "$startdir/plugin" "$XDG_CONFIG_HOME/nvim/" cp "$startdir/lazyvim.json" "$XDG_CONFIG_HOME/nvim/" - # Add custom option to disable relative numbers echo "vim.opt.relativenumber = false" >>"$XDG_CONFIG_HOME/nvim/lua/config/options.lua" - # Prime LazyVim - download all plugins and TreeSitter parsers in one session - # Run for minimum 60 seconds to ensure everything completes - echo ":: Installing LazyVim plugins and TreeSitter parsers (minimum 60 seconds)..." + echo "Installing LazyVim plugins..." nvim --headless \ "+Lazy! sync" \ "+qa!" || true + + echo "Ensuring critical TreeSitter parsers are compiled..." + nvim --headless \ + "+TSInstall bash c diff dtd html javascript jsdoc lua luadoc markdown markdown_inline python regex toml tsx typescript vim vimdoc xml yaml" \ + "+qa!" || true } package() { cd "$srcdir" - # Install everything to /usr/share/omarchy-nvim install -dm755 "$pkgdir/usr/share/$pkgname" - # Copy all the built artifacts cp -a "$XDG_CONFIG_HOME/nvim" "$pkgdir/usr/share/$pkgname/config" cp -a "$XDG_DATA_HOME/nvim" "$pkgdir/usr/share/$pkgname/data" - cp -a "$XDG_CACHE_HOME/nvim" "$pkgdir/usr/share/$pkgname/cache" + + # Remove broken symlinks from queries directory + # These will be recreated at runtime by the setup script + find "$pkgdir/usr/share/$pkgname/data/site/queries" -type l -delete # Fix permissions to be readable by all users chmod -R 755 "$pkgdir/usr/share/$pkgname" diff --git a/pkgbuilds/omarchy-nvim/omarchy-nvim-setup b/pkgbuilds/omarchy-nvim/omarchy-nvim-setup index a89322d..042b3c6 100755 --- a/pkgbuilds/omarchy-nvim/omarchy-nvim-setup +++ b/pkgbuilds/omarchy-nvim/omarchy-nvim-setup @@ -37,25 +37,28 @@ rm -rf $DATA_DIR $CACHE_DIR $STATE_DIR # Create directories if needed mkdir -p "$(dirname "$CONFIG_DIR")" mkdir -p "$(dirname "$DATA_DIR")" -mkdir -p "$(dirname "$CACHE_DIR")" -# Copy files +# Copy files (cache will be regenerated on first use) cp -r "$PACKAGE_DIR/config" "$CONFIG_DIR" cp -r "$PACKAGE_DIR/data" "$DATA_DIR" -cp -r "$PACKAGE_DIR/cache" "$CACHE_DIR" # Ensure proper ownership of all nvim directories chown -R "${USER}:${USER}" "$CONFIG_DIR" chown -R "${USER}:${USER}" "$DATA_DIR" -chown -R "${USER}:${USER}" "$CACHE_DIR" # Create link for current theme ln -snf "${HOME}/.config/omarchy/current/theme/neovim.lua" "${CONFIG_DIR}/lua/plugins/theme.lua" +# Restore git working trees for dir in $DATA_DIR/lazy/*/; do if [ -d "$dir/.git" ]; then git --git-dir="$dir/.git" --work-tree="$dir" restore . fi done +# Recreate TreeSitter query symlinks +for query_lang in "$DATA_DIR/lazy/nvim-treesitter/runtime/queries"/*; do + ln -sf "$query_lang" "$DATA_DIR/site/queries/$(basename "$query_lang")" +done + echo "Neovim setup complete!"