Last Line Commands In VIM Editor

By | September 27, 2011

In previous posts we saw Cursor Movement commands, Text Modification commands, and commands used in Input Mode. In this post I would like to share the last line mode commands used in a VIM editor.
So following are the last line commands of VIM editor.
w – this command is used to save the file with the same name when you opened it to edit it.
w filename –  This command works as same as we use ‘save as’ with windows applications, which allows you to save the new copy of a file with your desired name. The substitute command to ‘w filename’ is ‘sav filename’, the same task of saving a copy of file with other name can be achieved by using ‘sav filename’ command.
n.m w filename –  this command is used for saving the content of line number ‘n’ to ‘m’ to the given file name. If you want to refer to the last line number (whatever it may be) then you should use ‘$’ instead of ‘m’.
e filename – This command is used to edit another file than the current one. It’s handy for toggling among the multiple files when used with the following ‘e#’ command.
e# – After using ‘e filename’ when you want to come back to previous file then you should use ‘e#’ command.
e! – This command is used to discard the changes made to a file.
r filename – This command reads the contents from a file and inserts it below the current line.

So these were last line VIM commands used to operate a Linux hosting server.