Saturday, January 31, 2015

Oh no! Vim eats my text - Naughty Vim. [Was: Any poets here?]

On 30.01.15 21:11, kouzennoki@gmail.com wrote:
> 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.

Accidental deletion becomes less frequent with increasing competence in
the use of an editor ... here, often awareness of the current mode. Lack
of concentration can lead to loss of mode awareness, and result in
clumsy mis-edits. PEBKAC. Vim removes any painful consequences, whatever
the cause though, through its marvellous multi-level undo facility. If
you have used vim for more than a day or two, and _still_ muck up the
undo, then:

:h undo

and _practice_! ("Do, or do not; there is no try.")

On 30.01.15 22:59, kouzennoki@gmail.com wrote:
> Learning or reading documentation to do simple things is not exactly my
> favourite pastime, eventually especially when you forget how to do a certain
> thing again because it never quite makes it to muscle memory.

The basic problem was already evident in the prior post. ;-)

(Note: I keep a set of personal "help" notes, which over the years has
accumulated to nearly 400 pages, though only 29 of them relate to vim.
Vim's folding capability presents all 400 pages as one - the first level
headings. But keyword searching takes me directly to what I want in
seconds. Most doco describes "how" to do a thing - but initially we
don't know "what" to look for. For my own use, I document "how" under
"what" I'm trying to do, so the method is rapidly found later, even if
it's years before I need it again.)

> So Vim is for me 80% frustration and 80% delight, if such a thing were
> possible :p.

Not only possible, but understandable - yet entirely self-created by
a learning laziness, as you show yourself at the first opportunity:

> Even writing this email in Alpine (Pico) is just amazingly relaxing compared
> to having to do such a thing in Vi. Arrow keys always do what they should, I
> don't have to remember HJKL keys

The arrow keys work fine in vim, and there is no need to use HJKL.
If you have a terminal problem which miscodes those keys, so that they
are not recognised by vim, then why do you not:

a) Fix it in the terminal config, or
b) Fix it in .vimrc, or
c) Google for a fix, or
d) Post a message for information, rather than just a moan.

Vim is powerful, but does demand a learning commitment, because of
that. If the failing mode awareness is due to ageing wetware (and
therefore more difficult to overcome), then one of many useful vim
configurations might help.

In addition to displaying the mode on the status line:

set showmode

I change the cursor colour in insert mode:

" Cursor Appearance: (Insert_Mode == Green, Normal_Mode == Red)
if &term =~ "xterm"
let &t_SI = "\<Esc>]12;green\x7"
let &t_EI = "\<Esc>]12;red\x7"
endif

and if muscle memory prefers:

" These days I expect to be out of insert mode, after a line change:
inoremap <Up> ^[<Up>
inoremap <Down> ^[<Down>

If you can be more specific about the precise clumsiness you're using to
defeat vim's undo, we can be more specific in the documentation we
advise you to read, and the exercises which could improve your
competence. (Then keep notes, so you do not forget.)

All the best,

Erik
(Who uses only vim - every day - and cannot remember losing any text
during an edit session, at least not in the last twenty years. (Some of
that might have been vi, where the risk of losing a paragraph was greater.))

--
Women love to play the victim because it attracts three of the things they love
the most: attention, sympathy and special treatment. Conversely, men who act
like victims receive suspicion, ridicule and no sex, ever. - Mike J

--
--
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: