Dou*_*son 28
您还可以使用netrw(默认文件资源管理器)重命名功能.
:E/(例如/bar.txt)搜索它R.然后,系统将提示您输入新的文件路径.完成后输入文件路径命中<CR><CR>虽然此解决方案可能不如使用vim-eunch快,但它允许您在重命名文件时查看项目的结构.这也允许您一次移动多个文件.
进一步阅读运行 :help netrw-move
没有原子方法来移动这样的文件,但这应该是关闭的:
function! MoveFile(newspec)
let old = expand('%')
" could be improved:
if (old == a:newspec)
return 0
endif
exe 'sav' fnameescape(a:newspec)
call delete(old)
endfunction
command! -nargs=1 -complete=file -bar MoveFile call MoveFile('<args>')
Run Code Online (Sandbox Code Playgroud)
现在你可以说:
:MoveFile file2.txt
Run Code Online (Sandbox Code Playgroud)
要重命名为file2.txt
:MoveFile %.0
Run Code Online (Sandbox Code Playgroud)
将file2.txt移动到file2.txt.0
如果您在 bar.txt 缓冲区中:
:w bar2.txt
:!rm bar.txt
Run Code Online (Sandbox Code Playgroud)
如果当前目录中已经存在bar2.txt,则使用:w!.
| 归档时间: |
|
| 查看次数: |
9362 次 |
| 最近记录: |