1

I changed vim backup directory to be stored on .backup folder in my dotfiles local repo

set undodir=$HOME/.dotfiles/backup//.

it works well as expected but i want to separate actual dotfiles backups to be saved in a new directory named dot-files inside of .backup( .backup/dot-files)

eg: if the file is .tmux.conf, .vimrc, .bashrc etc.. it will be saved in the backup/dot-files but if it is an ordinary file just save it in the backup directory.

is this doable with vimscript?

  • Can you explain a bit more about what you're trying to achieve here. If you want backups for your dotfiles stored separately so it's easier to revert changes if you change your mind then you may be better off using a version control system such as Git to store your dotfiles. That way you'd be able to revert changes back as far as you like, while also being able to better examine the differences. – Haegin Aug 13 '18 at 17:30
  • Sorry im not clear in my question, im already using git in a local repo named dotfiles ~/Projects/dotfiles what i want is to store backup files in the subdirectory of dotfiles which is categorized as ~/dotfiles/.backup/dot-files(for files starting with (.) ) and ~/dotfiles/.backup/( for all files without (.)) Btw ~/.backup is ignored in version control.. what i want is a separate backups for (.)files so i can easily find them when i need it – John Fred Fadrigalan Aug 14 '18 at 2:23
0

You can test expand('%:p') against the directory you're looking for.

Check the help from expand(), from there, follow the link to the filename modifiers.

  • Hi, thanks for the reply.. I'm on mobile right now I'll try this when I get to my PC – John Fred Fadrigalan Aug 14 '18 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.