Friday, January 30, 2015

Re: Any poets here?

On 2015-01-30 21:11, kouzennoki@gmail.com wrote:
> Personally I think Vim is the antithesis of something poetic,
> because of the vast difficulty in doing simple things :p.

Only to the untrained user.

> Sometimes hating the day I (or it) was born when I accidentily
> delete a piece of text and I cannot revert the change for some
> reason. I had this keyboard or computer where I was that didn't do
> CTRL-R.

Fortunately, Vim allows you work around that. I've had a keyboard go
bad mid-editing, and there are numerous work-arounds:

- use ":redo" instead of ^R

- map it to another key: ":nnoremap Q <c-r>".

- compose the desired command elsewhere and then paste it into
your terminal as a command for vim to interpret.

> Yes, only Vim can perform such a feat.

Frankly, other than perhaps emacs, I can't think of any other editor
that *gives you the power* to remap every bit of functionality across
the board just to work around a broken keyboard. My limited emacs
experience is what prevents me from confirming this, but my
understanding is that it could be done with little trouble as well.

> Press two wrong buttons and lose your entire file.

The closest I could come up with to recreate your scenario is
"ZQ" (quit without saving, possibly discarding edits you want) or
"ZZ" (quit with saving, possibly overwriting a good file with bad
changes).

Same would go for just about any other editor. In Windows, Alt+F4
followed by the wrong answer would lose data in most editors. In
nano, ^X followed by the wrong answer would lose data. In
ed(1), "wq" or "Q" could lose data. Again, I can't speak to emacs.

You do stupid stuff, you lose data. The remedies are:

1) learn to use the editor so you don't make mistakes like that.
Fortunately, the possibility that you *accidentally* type "ZQ" or
"ZZ" in normal mode when you don't intend to is pretty unlikely.

2) save often

3) don't use a broken keyboard that prevents you from recovering from
your mistakes (or map around the broken key(s))

4) keep your documents in revision control (git, mercurial, bazaar,
subversion, rcs, cvs, whatever) so that you can always go back in
time. Combined with #2, it's almost impossible to lose data.


Over the past 10+ years of using vim, the *only* time that I've ever
lost data (other than power outages, where sometimes-but-not-always I
can use the swap-file to recover unlike many other editors) was a
particular scenario:

:new
:set buftype=nofile
{make edits}
:saveas some_filename.txt
{get a "E676: No matching autocommands for acwrite buffer"}
{get confused and try to re-open the file I just wrote}
:e!
{all changes were lost}

Other than that, either I've intentionally added a "!" to my quitting
efforts, I've always had undo/redo available, or I've intentionally
cut my support (disabling the swapfile or undo).

-tim




--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: