Vi change file name




















Your browser may include features that can help translate the text. This content is not available in your preferred language. Reported In. Reported In shows products that are verified to work for the solution described in this article. This solution might also apply to other similar products or applications. However, for the new location, provide the same location, but with a different file name.

Wire the newly formed full path to the Target Path terminal of the Move function. Zaar Hai Zaar Hai 1 1 bronze badge. Welcome to Vi and Vim! Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.

Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related Hot Network Questions.

Question feed. Asked 12 years, 5 months ago. Active 3 months ago. Viewed k times. How should I rename my current file in Vim? For example: I am editing person. Matthias Braun Sam Saffron Sam Saffron k 76 76 gold badges silver badges bronze badges. Add a comment. Active Oldest Votes. EDIT: Most vim installations have an integrated file explorer, which you can use for such operations. Instead you have to go the file manager of your choice, rename the file, and go back to your editor.

You might also like :Sex shorthand for split explore :- — Peter Jankuliak. Also, :e will open explore in the current pane. Less exciting than :Sex but more efficient ;. For the intrepid, vertical :Sex is :Vex. Josh :E works for me, :e it does not work for me. I use :e to edit other file in the same window.

Show 9 more comments. Rename the file in git repo. Reload the file into the current buffer. Preserve undo history. If your file was not yet added to a git repo then first add it: :Gwrite. Tears coming out of my eyes. The perfect answer! I sacrificed two goats in honour of this answer! But I have a small problem with it, because you have to type the path from the root of the working tree; and this often gets rather lengthy in any project. Is there a solution to this?

That's great! I keep finding new things fugitive can do. To combine a few comments here: :Gmove requires the relative path for the new filename. Show 2 more comments.

This one works really well. Definitely recommend it. Love the idea. See VimTip for more details. You can use any Vim features here macros are useful , as long as each line results in a valid shell command. The reason this works is Vim writes a file line-by-line.

So if you started with a list of file names, it will execute mv commands. Sure there are utilities that may do this better, but Vim is always available and that's one less thing you have to remember. This will pipe the whole buffer to the system command bash , thus executing all of the move commands. This will also replace the file with the command's output, which is useful for commands besides mv.



0コメント

  • 1000 / 1000