Renaming the current file in Vim

前端 未结 21 695
轻奢々
轻奢々 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:56

    Another way is to just use netrw, which is a native part of vim.

    :e path/to/whatever/folder/
    

    Then there are options to delete, rename, etc.

    Here's a keymap to open netrw to the folder of the file you are editing:

    map e :e =expand("%:p:h") . '/'
    

提交回复
热议问题