edit VIM Command

How to use edit Command in Linux VIM editor?

Explanation


edit command is used to edit or update the existing file without opening a new file. Vim editor will close the current file and opens the new file while using this command. If any changes are made in the current file, then the editor will display message to save the changes before opening the next file.

Usage:

:edit <filename>

Example:

  • Open the file one.txt using the command
    $vim one.txt
  • Now open 'two.txt' file to edit.
    Enter :two.txt
    edit vim command
  • 'one.txt' file will be closed and 'two.txt' file will be opened to update.
    Edit / Update a File Vim

Ask Questions

Ask Question