Why VIM backup filenames are not correct? 'backupdir' option not performing as expected

前端 未结 5 335
刺人心
刺人心 2021-01-04 04:15

I\'m building a custom vimrc to improve my workflow, and I really liked the idea of setting a centralized directory to keep all backup, swap and undo files together, like th

5条回答
  •  时光说笑
    2021-01-04 04:50

    In addition to the answer of Victor Schröder, I suggest using this autocommand instead :

    autocmd BufWritePre * if filereadable(@%) | :call SaveBackups() | endif
    

    Unless this, it won't work in the case you are openning a new file directly with vim. And it doesn't make sense to save an empty backup...

提交回复
热议问题