install.fairie/home/.chezmoiscripts/universal/run_onchange_after_11-symlink-nvim.tmpl

31 lines
1.9 KiB
Cheetah
Raw Normal View History

2023-05-06 18:39:55 -07:00
{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
# @file Neovim Configuration
# @brief This script configures Neovim by applying the configuration stored in `${XDG_DATA_HOME:-$HOME/.config}/nvim-custom/init.lua` if the `nvim` application is available
# @description
# This script applies the Neovim configuration stored in `${XDG_DATA_HOME:-$HOME/.config}/nvim-custom/init.lua` if nvim is installed.
# The custom init configuration provides compatiblity between Volta and Neovim. This allows neovim to discover node modules installed by Volta. This script sets up
# init in such a way that the compatibility setting is applied even when Neovim is installed using Flatpak
#
# ## Links
#
# * [Default Neovim configuration](https://github.com/megabyte-labs/install.doctor/tree/master/home/dot_config/nvim-custom/init.lua)
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Symlink custom code for Neovim configuration
if [ ! -d "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom" ]; then
logg info "Linking ${XDG_CONFIG_HOME:-$HOME/.config}/nvim-custom to ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom"
logg info "Changes should go in ${XDG_CONFIG_HOME:-$HOME/.config}/nvim-custom"
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/nvim-custom" "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom"
2023-05-31 10:02:11 -07:00
elif flatpak list | grep 'io.neovim.nvim' > /dev/null && [ ! -d "~/.var/app/io.neovim.nvim/config/nvim/lua/custom" ]; then
2023-05-06 18:39:55 -07:00
logg info "Linking ${XDG_CONFIG_HOME:-$HOME/.config}/nvim-custom to ~/.var/app/io.neovim.nvim/config/nvim/lua/custom"
logg info "Changes should go in ${XDG_CONFIG_HOME:-$HOME/.config}/nvim-custom"
ln -s "${XDG_CONFIG_HOME:-$HOME/.config}/nvim-custom" "~/.var/app/io.neovim.nvim/config/nvim/lua/custom"
else
logg info "${XDG_CONFIG_HOME:-$HOME/.config}/nvim-custom appears to already be symlinked to ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom"
fi
{{ end -}}