Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save as a new file and keep working on the original one in Vim?

Tags:

vim

save

save-as

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?

like image 487
vimguy Avatar asked Feb 12 '11 19:02

vimguy


People also ask

How do I save in vim without quitting?

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.

How do I override and save in vim?

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.

How do I switch between files in vim?

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.


1 Answers

Use the :w command with a filename:

:w other_filename 
like image 180
wilhelmtell Avatar answered Sep 20 '22 22:09

wilhelmtell