Skip to content

Instantly share code, notes, and snippets.

@vczb
Last active June 21, 2024 10:51
Show Gist options
  • Save vczb/cb20cecfc517baa93ff82b98a92cb93d to your computer and use it in GitHub Desktop.
Save vczb/cb20cecfc517baa93ff82b98a92cb93d to your computer and use it in GitHub Desktop.
nvim backup/restore
# required
mv ~/.config/nvim{,.bak}
# optional but recommended
mv ~/.local/share/nvim{,.bak}
mv ~/.local/state/nvim{,.bak}
mv ~/.cache/nvim{,.bak}
#!/bin/bash
# Function to restore a directory
restore_directory() {
if [ -d "$1" ]; then
echo "Error: $1 already exists. Aborting restore."
exit 1
else
mv "$1.bak" "$1"
echo "Restored $1"
fi
}
# required
restore_directory ~/.config/nvim
# optional but recommended
restore_directory ~/.local/share/nvim
restore_directory ~/.local/state/nvim
restore_directory ~/.cache/nvim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment