If you ve really trashed the file by mistake, (Most popular web site)
If you ve really trashed the file by mistake, the :q! command is the best way to exit and abandon your changes. The file reverts to the most recently changed version. So, if you just did a :w, you are stuck with the changes up to that point. If you just want to undo a few bad edits, press u to back out of changes. You have learned a handful of vi editing commands. I describe many, many more commands in the following sections. However, before I do, here are a few tips to smooth out your first trials with vi: Esc Remember that Esc gets you back to command mode. (I ve watched people press every key on the keyboard trying to get out of a file.) Esc followed by ZZ gets you out of command mode, saves the file, and exits. u Press u to undo the previous change you made. Continue to press u to undo the change before that, and the one before that. Ctrl-r If you decide you didn t want to undo the previous command, use Ctrl-r for Redo. Essentially, this command undoes your undo. Caps Lock Beware of hitting the Caps Lock by mistake. Everything you type in vi has a different meaning when the letters are capitalized. You don t get a warning that you are typing capitals things just start acting weird. :! command You can run a command while you are in vi using :! followed by a command name. For example, type :!date to see the current date and time, type :!pwd to see what your current directory is, or type :!jobs to see if you have any jobs running in the background. When the command completes, press Enter and you are back to editing the file. You could even do that with a shell (:!bash) to run a few commands from the shell, then type exit to return to vi. (I recommend doing a save before escaping to the shell, just in case you forget to go back to vi.) — INSERT — When you are in insert mode, the word INSERT appears at the bottom of the screen. Other messages also appear at the line at the bottom of the screen. Ctrl+g If you forget what you are editing, pressing these keys prints the name of the file that you are editing and the current line that you are on. It also prints the total number of lines in the file, the percentage of how far you are through the file, and the column number the cursor is on. This just helps you get your bearings. Moving around the file Besides the few movement commands described earlier, there are other ways of moving around a vi file. To try these out, you may want to open a large file that you can t do much damage to. (How about copying /var/log/messages to /tmp?) Here are some possibilities: Ctrl+f Page ahead, one page at a time. Ctrl+b Page back, one page at a time.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision professional web hosting services