I'm using Neovim 0.3.7. I have a default session file that loads up a number of files I'm working on at the moment. To save and load the sessions I have the following custom commands defined:
let sessionlocation = maindir.'/basetest.vim'
exe 'command Sdfs mks' sessionlocation
exe 'command Ldfs source' sessionlocation
This worked fine when I first saved the session. But now I have closed some tabs and opened some new ones and I want the current file layout to be the default session. When I try to run :Sdfs
I get the error message:
E189 "..." exists (add ! to overwrite)
where ...
is the session file directory. That makes sense. But when I run :Sdfs!
I get another error message:
E447: No ! allowed
How can I allow !
in my custom command so that I can overwrite my default session file?
exe 'command! Sdfs mks' sessionlocation
exe 'command! Ldfs source' sessionlocation