-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: make 'rm -rf foo/' be a bit harder #14749
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11454,24 +11454,29 @@ fun! s:NetrwLocalRmFile(path,fname,all) | |
|
||
else | ||
" attempt to remove directory | ||
let rmfile= substitute(rmfile,'[\/]$','','e') | ||
if !all | ||
echohl Statement | ||
call inputsave() | ||
let ok= input("Confirm *recursive* deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") | ||
" make it be a bit harder to make mistake by inputting upper case | ||
let ok= input("Confirm *recursive* deletion of directory<".rmfile."> ","[{Y(ES)},n(o),A(LL),q(uit)] ") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now you are unexpectedly changing the key-bindings. This will break peoples habits. I don't think this is appreciated by long-time users. (besides, it actually looks funny, that some keys need to be upper-cased and others not). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, i am not against just back out the #14742, then kept the appreciated long-time users' habits, or you had better idea not to so easy or high possibility to make mistake to rm all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What mistake, there is still a confirmation dialog There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
call inputrestore() | ||
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') | ||
let ok= substitute(ok,'\[{Y(ES)},n(o),A(LL),q(uit)]\s*','','e') | ||
if ok == "" | ||
let ok="no" | ||
endif | ||
if ok =~# 'a\%[ll]' | ||
if ok =~# 'a\%[ll]'->toupper() | ||
let all= 1 | ||
endif | ||
endif | ||
let rmfile= substitute(rmfile,'[\/]$','','e') | ||
|
||
if all || ok =~# 'y\%[es]' || ok == "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also please note: i removed this |
||
if delete(rmfile,"rf") | ||
call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103) | ||
if all || ok =~# 'y\%[es]'->toupper() | ||
if delete(rmfile,"rf") | ||
call netrw#ErrorMsg(s:ERROR,"failed to *recursive* delete directory <".rmfile.">!",103) | ||
endif | ||
endif | ||
let ok = ok->tolower() | ||
else | ||
if delete(rmfile,"d") | ||
call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile."> -- is it empty?",103) | ||
endif | ||
endif | ||
endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave the directory indicator. That is actually useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was there before this PR and #14742
i guess it was remained there for judging if it was a dir or not, i just kept it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this was not touched by #14742
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, so i didnot plan to touch it either.
// please notice that if/else