Thursday, March 16, 2017

Re: Wierdness in vim

On 2017-03-16 13:12, o1bigtenor wrote:
> Trying to find the cheat sheet where I found the +GP command for
> pasting. Of course cannot find it now!

Count your blessings. If it mis-instructed you on the clipboard
copy/paste, it's not a very good cheat sheet ;-)

> I haven't tried using your suggested command sequence yet but I'm
> wondering
> - - - been using V for line based select and then scrolling to the
> end of the needed lines (anywhere from the one line to about 10)
> and then doing the +y.

These sorts of things are great for letting Vim do the hard work.

While I've prodded ledger-cli to see what it was about, it wasn't for
me. But from what I recall, each transaction is in a blank-line
delimited block. So I'd start with

yap

to "yank a paragraph". This works from anywhere inside the paragraph
you're in and puts it in the unnamed clipboard register. You can
then use

}

as a motion to get to the bottom of current block, and then

p

to paste it after the block.

> The suggesting in ledger-cli was that emacs (or vim) would reduce
> keystrokes and moving fromt he keyboard to the mouse and back again
> like when using ctrl-c (etc). With adding even more keystrokes I'm
> wondering about that efficiency - - - I just don't see it. (Not
> trying to complain I'm just looking for a quick entry system that
> is easy to edit that works well with ledger-cli (wanting to add
> some in-line programs to make things even easier and that AIUI is
> where vim and emacs shine) but its looking like one needs to be
> real familiar with either vim or emacs BEFORE this happens.

Indeed, learning either editor (or both and see which fits your brain
better) is likely a prerequisite for the speed-ups they hint at. If
you do it frequently, you could map hot-keys/macros to do most of the
work. It does look like there's a vim+ledger plugin that automates a
large bit of the work:

https://github.com/ledger/vim-ledger

> I might decide to learn all the twists and turns of one of these
> two but if I hire someone to do the entry of information for me - -
> - well that just doesn't fly for any 'bookkeeper' types.

I'm not sure how well most "bookkeeper" types work with ledger-cli
regardless of which text editor you use to manage the file. If they
do, I imagine that they would know how to deal with the text file in
their favorite editor, regardless of your local configuration.

> >> Used +GP a couple more times not understanding why the 2 lines
> >> were not placed and then I looked at the doc.I had gone from
> >> 6814 lines to 12 877 lines and all of the lines were the 2
> >> yanked (with a blank line before and after each iteration).
> >
> > I suspect something got omitted and you ended up yanking from your
> > current location to the end of the file, and then pasting that
> > content. If your cursor was at the beginning of the file to start,
> > that would double the size of the file.
>
> Sort of but it was only lines that had gotten yanked but there were
> about 2000 copies of those 3 lines!

It's possible you did something like

2000p

which would paste 2000 copies. Or, if you'd just pasted and that
you're working with financial numbers, typing a financial amount such
as

2000.10

in normal-mode would be treated as a count (2000) followed by a
period which is Vi's "do the last thing I did". The "10" would then
get treated as a count to the next command you issued.

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

Post a Comment