mirror of
https://github.com/neovim/neovim.git
synced 2025-12-01 14:33:11 +00:00
feat: ":write ++p" creates parent dirs #20835
- `:write ++p foo/bar/baz.txt` should create parent directories `foo/bar/` if
they do not exist
- Note: `:foo ++…` is usually for options. No existing options have
a single-char abbreviation (presumably by design), so it's safe to
special-case `++p` here.
- Same for `writefile(…, 'foo/bar/baz.txt', 'p')`
- `BufWriteCmd` can see the ++p flag via `v:cmdarg`.
closes #19884
This commit is contained in:
@@ -4074,6 +4074,13 @@ static int getargopt(exarg_T *eap)
|
||||
return OK;
|
||||
}
|
||||
|
||||
// ":write ++p foo/bar/file
|
||||
if (strncmp(arg, "p", 1) == 0) {
|
||||
eap->mkdir_p = true;
|
||||
eap->arg = skipwhite(arg + 1);
|
||||
return OK;
|
||||
}
|
||||
|
||||
if (STRNCMP(arg, "ff", 2) == 0) {
|
||||
arg += 2;
|
||||
pp = &eap->force_ff;
|
||||
|
||||
Reference in New Issue
Block a user