Skip to content

Commit

Permalink
runtime(netrw): Recursively delete directories by default with netrw …
Browse files Browse the repository at this point in the history
…delete command

closes: #14742

Signed-off-by: Nir Lichtman <nir@lichtman.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
  • Loading branch information
nir9 authored and chrisbra committed May 10, 2024
1 parent d3952e8 commit c16c4a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions runtime/autoload/netrw.vim
Expand Up @@ -11,6 +11,7 @@
" 2024 Apr 03 by Vim Project: detect filetypes for remote edited files
" 2024 May 08 by Vim Project: cleanup legacy Win9X checks
" 2024 May 09 by Vim Project: remove hard-coded private.ppk
" 2024 May 10 by Vim Project: recursively delete directories by default
" Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
Expand Down Expand Up @@ -11456,7 +11457,7 @@ fun! s:NetrwLocalRmFile(path,fname,all)
if !all
echohl Statement
call inputsave()
let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
let ok= input("Confirm *recursive* deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
call inputrestore()
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
if ok == ""
Expand All @@ -11469,7 +11470,7 @@ fun! s:NetrwLocalRmFile(path,fname,all)
let rmfile= substitute(rmfile,'[\/]$','','e')

if all || ok =~# 'y\%[es]' || ok == ""
if delete(rmfile,"d")
if delete(rmfile,"rf")
call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103)
endif
endif
Expand Down

0 comments on commit c16c4a2

Please sign in to comment.