(New page: Category:File_Handling {{Tip |title=mkdir on edit if needed |created=2007/11/08 |complexity=intermediate |author=<!-- Your name or User:Name --> |version=<!-- minimal vim version ...) |
(Insert TipProposed template + manual clean) |
||
Line 1: | Line 1: | ||
+ | {{TipProposed |
||
⚫ | |||
+ | |id=0 |
||
− | |||
+ | |previous=0 |
||
− | {{Tip |
||
+ | |next=0 |
||
− | |title=mkdir on edit if needed |
||
− | |created=2007 |
+ | |created=November 8, 2007 |
|complexity=intermediate |
|complexity=intermediate |
||
+ | |author=Anon |
||
− | |author=<!-- Your name or [[User:Name]] --> |
||
+ | |version=7.0 |
||
− | |version=<!-- minimal vim version that can be used --> |
||
⚫ | |||
− | |text= |
||
⚫ | |||
+ | <pre> |
||
⚫ | |||
⚫ | |||
+ | </pre> |
||
⚫ | |||
⚫ | |||
− | |||
⚫ | |||
+ | ---- |
||
⚫ | |||
⚫ |
Revision as of 04:02, 5 January 2008
Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).
created November 8, 2007 · complexity intermediate · author Anon · version 7.0
When opening a new file with :edit or :split, you may want to create the directory the file will reside in. This can be done in autocommand BufNewFile (add to ~/.vimrc in any Unix-like system with mkdir that accepts -p switch). Wanted: versions for Windows/old Unices.
au BufNewFile * :exe ': !mkdir -p ' . escape(fnamemodify(bufname('%'),':p:h'),'#% \\')