checkpoint

This commit is contained in:
Dan Anglin 2023-09-23 14:51:31 +01:00
parent 7a6f80cf69
commit 65ac818a43
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
3 changed files with 41 additions and 18 deletions

View file

@ -1,10 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -o errexit
set -o nounset
set -o pipefail
CONFIG_ROOT="${XDG_CONFIG_HOME:-null}"
if [[ "${CONFIG_ROOT}" == "null" ]]; then
CONFIG_ROOT="${HOME}/.config"
fi
ROOT_DIR="$( cd "$( dirname $0 )/.." && pwd )" ROOT_DIR="$( cd "$( dirname $0 )/.." && pwd )"
NEOVIM_CONFIG_SOURCE_DIR="${ROOT_DIR}/nvim" NEOVIM_CONFIG_SOURCE_DIR="${ROOT_DIR}/nvim"
NEOVIM_CONFIG_DESTINATION_DIR="${XDG_CONFIG_HOME}/nvim" NEOVIM_CONFIG_DESTINATION_DIR="${CONFIG_ROOT}/nvim"
VERSION="$( git describe --tags | tr -d '\n' )" VERSION="$( git describe --tags | tr -d '\n' )"
PROJECT_NAME="nvim.d" PROJECT_NAME="nvim.d"
CODEFLOW_GROUP="linux-home" CODEFLOW_GROUP="linux-home"
@ -14,26 +22,26 @@ action="$1"
function backup { function backup {
if [ -d "${NEOVIM_CONFIG_DESTINATION_DIR}" ]; then if [ -d "${NEOVIM_CONFIG_DESTINATION_DIR}" ]; then
echo "[INFO] backing up existing config..." echo "[INFO] backing up existing config..."
timestamp=$( date +"%Y.%m.%dT%H.%M.%S" ) TIMESTAMP=$( date +"%Y.%m.%dT%H.%M.%S" )
backup_dir="${ROOT_DIR}/backup" BACKUP_DIR="${ROOT_DIR}/backup"
mkdir -p ${backup_dir} mkdir -p "${BACKUP_DIR}"
cd ${NEOVIM_CONFIG_DESTINATION_DIR} cd "${NEOVIM_CONFIG_DESTINATION_DIR}"
tar czf "${backup_dir}/neovim-config-${timestamp}.tar.gz" . tar czf "${BACKUP_DIR}/neovim-config-${TIMESTAMP}.tar.gz" .
fi fi
} }
function clean { function clean {
rm -f ${NEOVIM_CONFIG_DESTINATION_DIR}/init.lua rm -f "${NEOVIM_CONFIG_DESTINATION_DIR}/init.lua"
find ${NEOVIM_CONFIG_DESTINATION_DIR} -maxdepth 1 -mindepth 1 -type d -not -iwholename "*/plugin" | xargs rm -rf find "${NEOVIM_CONFIG_DESTINATION_DIR}" -maxdepth 1 -mindepth 1 -type d -not -iwholename "*/plugin" | xargs rm -rf
} }
function update { function install {
mkdir -p ${NEOVIM_CONFIG_DESTINATION_DIR} mkdir -p "${NEOVIM_CONFIG_DESTINATION_DIR}"
# Syncing the neovim configuration files # Syncing the neovim configuration files
echo "[INFO] Syncing ${NEOVIM_CONFIG_SOURCE_DIR} to ${NEOVIM_CONFIG_DESTINATION_DIR}..." echo "[INFO] Syncing ${NEOVIM_CONFIG_SOURCE_DIR} to ${NEOVIM_CONFIG_DESTINATION_DIR}..."
rsync -avh ${NEOVIM_CONFIG_SOURCE_DIR}/ ${NEOVIM_CONFIG_DESTINATION_DIR} rsync -avh "${NEOVIM_CONFIG_SOURCE_DIR}/" "${NEOVIM_CONFIG_DESTINATION_DIR}"
chmod a-rwx,u+rwx ${NEOVIM_CONFIG_DESTINATION_DIR} chmod a-rwx,u+rwx "${NEOVIM_CONFIG_DESTINATION_DIR}"
# Ensuring the state directories are present # Ensuring the state directories are present
mkdir -p ${XDG_STATE_HOME}/nvim/{backup,swap,undo,view} ${XDG_STATE_HOME}/logs/nvim ${XDG_DATA_HOME}/nvim/spell mkdir -p ${XDG_STATE_HOME}/nvim/{backup,swap,undo,view} ${XDG_STATE_HOME}/logs/nvim ${XDG_DATA_HOME}/nvim/spell
@ -64,8 +72,8 @@ case ${action} in
clean) clean)
clean clean
;; ;;
update) install)
update install
;; ;;
package) package)
package package

View file

@ -3,8 +3,8 @@
backup: backup:
@bash ./.helpers/config backup @bash ./.helpers/config backup
update: install:
@bash ./.helpers/config update @bash ./.helpers/config install
clean: backup clean: backup
@bash ./.helpers/config clean @bash ./.helpers/config clean

View file

@ -1,4 +1,4 @@
= Nvim.d = nvim.d
My Neovim configuration for neovim version 0.9.0+. My Neovim configuration for neovim version 0.9.0+.
@ -6,6 +6,21 @@ My Neovim configuration for neovim version 0.9.0+.
== Installation == Installation
- clone repo or download the latest release
- if you have eisting neovim config you can take a backup of this. Timestamped tar file created in backup dir within the current dir.
```
make backup
```
- install config with your XDG_CONIFIG_HOME dir (default is ~/.config)
```
make install
```
- install the lazy package manager
```
make install_lazy
```
- start neovim. when first launched the lazy package manager will proceed to install all missing plugins.
== Plugins == Plugins
[%header,cols=3*] [%header,cols=3*]