39 lines
2.6 KiB
Cheetah
39 lines
2.6 KiB
Cheetah
{{- 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/.local/share}/nvchad/init.lua` if the `nvim` application is available
|
|
# @description
|
|
# NVIM is a visual text editor for the terminal. It is like a fancy, improved version of VIM with compatibility
|
|
# for the same plugins and some other ones as well. The default configuration of Install Doctor integrates
|
|
# a well-received and popular shared NVIM configuration called [NvChad](https://github.com/NvChad/NvChad).
|
|
#
|
|
# To make it easy to update NVIM to the latest version as well as introduce custom configuration parameters for NvChad,
|
|
# this script symlinks the custom configuration from `${XDG_DATA_HOME:-$HOME/.local/share}/nvchad` to `${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom`
|
|
# which is the location that NvChad's documentation recommends placing custom settings in.
|
|
#
|
|
# This script applies the Neovim configuration stored in `${XDG_DATA_HOME:-$HOME/.local/share}/nvchad/init.lua` if nvim is installed.
|
|
# The custom configuration was adapted from [linuxmobile/nvchad-v2](https://github.com/linuxmobile/nvchad-v2).
|
|
#
|
|
# ## 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 "Changes should go in ${XDG_DATA_HOME:-$HOME/.local/share}/nvchad"
|
|
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua"
|
|
logg info "Linking ${XDG_DATA_HOME:-$HOME/.local/share}/nvchad to ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom"
|
|
ln -s "${XDG_DATA_HOME:-$HOME/.local/share}/nvchad" "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom"
|
|
elif command -v flatpak && flatpak list | grep 'io.neovim.nvim' > /dev/null && [ ! -d "~/.var/app/io.neovim.nvim/config/nvim/lua/custom" ]; then
|
|
logg info "Changes should go in ${XDG_DATA_HOME:-$HOME/.local/share}/nvchad"
|
|
mkdir -p "$HOME/.var/app/io.neovim.nvim/config/nvim/lua"
|
|
logg info "Linking ${XDG_DATA_HOME:-$HOME/.local/share}/nvchad to ~/.var/app/io.neovim.nvim/config/nvim/lua/custom"
|
|
ln -s "${XDG_DATA_HOME:-$HOME/.local/share}/nvchad" "$HOME/.var/app/io.neovim.nvim/config/nvim/lua/custom"
|
|
else
|
|
logg info "${XDG_DATA_HOME:-$HOME/.local/share}/nvchad appears to already be symlinked to ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/lua/custom"
|
|
fi
|
|
|
|
{{ end -}}
|