Renaming the current file in Vim

前端 未结 21 725
轻奢々
轻奢々 2021-01-29 17:15

How should I rename my current file in Vim?

For example:

  • I am editing person.html_erb_spec.rb
  • I would like it renamed to person
21条回答
  •  春和景丽
    2021-01-29 17:46

    There's a sightly larger plugin called vim-eunuch by Tim Pope that includes a rename function as well as some other goodies (delete, find, save all, chmod, sudo edit, ...).

    To rename a file in vim-eunuch:

    :Move filename.ext

    Compared to rename.vim:

    :rename[!] filename.ext

    Saves a few keystrokes :)

提交回复
热议问题