Last active
June 21, 2024 10:51
-
-
Save vczb/cb20cecfc517baa93ff82b98a92cb93d to your computer and use it in GitHub Desktop.
nvim backup/restore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# required | |
mv ~/.config/nvim{,.bak} | |
# optional but recommended | |
mv ~/.local/share/nvim{,.bak} | |
mv ~/.local/state/nvim{,.bak} | |
mv ~/.cache/nvim{,.bak} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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