On Sat, Feb 07, 2015 at 12:26:46PM -0800, Toan Pham wrote: > > > Hi, i am not sure if this is a bug; but when i use vim, and depending on the > keyboard settings, i usually type the command below to exit. > > :wq! > > however, because of the keyboard settings, sometimes it will be entered as > > :;wq! > > > As the result of the later command, the content of the file will be > flushed/erased completely. It would not be possible to recover the original > content once the content is erased. It is very irritating, and I've been > given up using vim b/c of this bug.
This must be very frustrating. Hang in there, and don't give up on Vim yet! In my opinion, the very best thing for you to do in this case is to not execute the :wq command with the ! modifier. When you accidentally issue :;wq, you will still have an opportunity to avoid disaster. > Please let me know if this is an expected behavior or if it is a bug. If it > is an expected behavior, is there anyway (via configuration), that i can > always translate the ":;wq!" to ":wq!" command? The behavior you are experiencing is not due to a bug in Vim. Many commands in Vim can be prefixed with prefixed with one or two line numbers to specify a range of the file over which the commands operate. The :w and :wq commands use the range of lines to allow you to save only a portion of the file (perhaps under a different file name). Your lone semi-colon is interpreted as a range which indicates the line the cursor is presently on. So you are in fact replacing the contents of the entire current file with the single line containing your cursor. Obviously, this isn't a very useful application of this feature of Vim, but I hope that you can regard it as an example of the expressive power available to you as a Vim user. Given some time and experience, you'll become a text-editing power user! -- Erik Falor Registered Linux User #445632 http://linuxcounter.net -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
pgpHygqdYWvjC.pgp
Description: PGP signature
