Whenever I use the :sav
command, it saves the file with a new name and opens the new file open in Vim.
Is it possible to save the file with a new name but keep the original one open for editing?
The command to save a file in Vim is :w . To save the file without exiting the editor, switch back to normal mode by pressing Esc , type :w and hit Enter . There is also an update command :up , which writes the buffer to the file only if there are unsaved changes.
2 Answers. edit the file by pressing i and then save and exit by pressing Esc and then either :wq or :x or just :w to save.
Using windows. Ctrl-W w to switch between open windows, and Ctrl-W h (or j or k or l ) to navigate through open windows. Ctrl-W c to close the current window, and Ctrl-W o to close all windows except the current one. Starting vim with a -o or -O flag opens each file in its own split.
Use the :w
command with a filename:
:w other_filename
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With