Wiki

by yszheda

View project onGitHub

Tip 44: Save Files to Nonexistent Directories

Return to the top: <<Practical Vim>>

Press <C-g> and check the file status:

  • "new file": can use :write directly
  • "new DIRECTORY": filepath contains nonexistent directories
    :!mkdir -p %:h
    :write
    

References

# If you open the file in vim,
# then you can \"ayy@a the next line to execute the vim command: 
:h ctrl-G