Skip to content

Instantly share code, notes, and snippets.

@funasoul
Created July 10, 2023 04:39
Show Gist options
  • Save funasoul/baa7383eced59947387e9ad0b5ecd4bc to your computer and use it in GitHub Desktop.
Save funasoul/baa7383eced59947387e9ad0b5ecd4bc to your computer and use it in GitHub Desktop.
# backup my nvim config
# backup my neovim config. you can restore the config by using restore-nvim.zsh
backup-nvim() {
local timestamp=$(date "+%Y-%m-%d-%H%M")
echo "Backup following directories"
echo " ~/.config/nvim => ~/.config/nvim.${timestamp}"
echo " ~/.local/share/nvim => ~/.local/share/nvim.${timestamp}"
echo " ~/.local/state/nvim => ~/.local/state/nvim.${timestamp}"
echo " ~/.cache/nvim => ~/.cache/nvim.${timestamp}"
# required
mv ~/.config/nvim ~/.config/nvim.${timestamp}
# optional but recommended
mv ~/.local/share/nvim ~/.local/share/nvim.${timestamp}
mv ~/.local/state/nvim ~/.local/state/nvim.${timestamp}
mv ~/.cache/nvim ~/.cache/nvim.${timestamp}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment