Evaluating the cost to type something in vim

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Evaluating the cost to type something in vim

Peng Yu
Hi,

I'd like to evaluate the cost of typing in vim. It should not just
simply counting the number of characters or words.

For example, the metric should capture things like the following and more.

- If there are two lines that are the same, people would type the
first line and copy-paste to generate the 2nd line. So the number of
keystrokes would be less than the total number of characters.
- If two strings are similar, people would make a copy and edit the copy.
- Repeatedly type something would be considered of less cost than type
non-repetitive characters of the same length.
- ctrl-P/N to save keystrokes for the words already typed before.
etc.

Is there a tool to evaluate the least cost to type something in vim as
accurately as possible? Thanks.

--
Regards,
Peng

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Evaluating the cost to type something in vim

Shlomi Fish-2
Hi Peng,

On Tue, 22 Jan 2019 14:20:50 -0600
Peng Yu <[hidden email]> wrote:

> Hi,
>
> I'd like to evaluate the cost of typing in vim. It should not just
> simply counting the number of characters or words.
>
> For example, the metric should capture things like the following and more.
>
> - If there are two lines that are the same, people would type the
> first line and copy-paste to generate the 2nd line. So the number of
> keystrokes would be less than the total number of characters.
> - If two strings are similar, people would make a copy and edit the copy.
> - Repeatedly type something would be considered of less cost than type
> non-repetitive characters of the same length.
> - ctrl-P/N to save keystrokes for the words already typed before.
> etc.
>
> Is there a tool to evaluate the least cost to type something in vim as
> accurately as possible? Thanks.
>

well, vi (and ergo vim) keystrokes are
https://en.wikipedia.org/wiki/Turing_completeness (also see
https://stackoverflow.com/questions/7284/what-is-turing-complete ). As a
result, finding the minimal user input that yields a buffer with the input
falls under https://en.wikipedia.org/wiki/Code_golf or perhaps
https://en.wikipedia.org/wiki/Kolmogorov_complexity . Also see
http://www.vimgolf.com/ for vim golf.

Regards,

        Shlomi

--
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Parody of "The Fountainhead" - http://shlom.in/towtf

     <rindolf>  We have a saying: “We survived Pharaoh - we’ll survive this.”
 <sorabji5252>  I suppose it’s all cake after Pharaoh.
    — Freenode’s #reddit channel

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Evaluating the cost to type something in vim

Peng Yu
> well, vi (and ergo vim) keystrokes are
> https://en.wikipedia.org/wiki/Turing_completeness (also see
> https://stackoverflow.com/questions/7284/what-is-turing-complete ). As a
> result, finding the minimal user input that yields a buffer with the input
> falls under https://en.wikipedia.org/wiki/Code_golf

This kind of competition is not relevant to what I am not talking
about. One has to spend extra effort to come up with the absolute
shortest code. That effort must be considered into the cost as well.
What I am talking about is "cost", which ultimately map to all
programmer's time involved in typing and thinking about what to type.
(But not include thinking about algorithm, data structure, etc.)

> or perhaps
> https://en.wikipedia.org/wiki/Kolmogorov_complexity . Also see
> http://www.vimgolf.com/ for vim golf.

--
Regards,
Peng

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Evaluating the cost to type something in vim

Timothy Rice
> What I am talking about is "cost", which ultimately map to all
> programmer's time involved in typing and thinking about what to type.
> (But not include thinking about algorithm, data structure, etc.)

Hi Peng,

It sounds like you are measuring cost as equal to time. If you want to know
the answer to that, you would need a study that somehow compares time taken
between one or more people using Vim, and some number of other people using
various other editors. You can use google to see whether such studies have
been done and what their conclusions were ;)

Note that, different tools could be more optimal for different text. For an
extremely silly example, if you want to write out "lorem ipsum" text, you
can do it many times more efficiently with a lorem-ipsum generator than by
typing it out in Vim.

A less silly example is the difference between natural language and
programming code. Code is often line-based, and can thus take advantage of
Vim's linewise mappings; for natural language, new sentences do not
necessarily induce line-break (as you can see in the current email). So,
Vim is optimised for coders, and might appear less efficient when used for
natural language.

In other words, first define what type of text you are measuring the cost
for.

I would furthermore claim there exist other "costs" to consider, in
addition to the naive metric of "how long does it take to type something or
other".

I exclusively use Linux, and my work involves a lot of sshing around
between various servers. And all my workstations, laptops, raspberry pis
and NAS run Linux and can be accessed with ssh. For this ecosystem, Vim is
ubiquitous, fast, rock-solid, bandwidth-friendly, and integrates well with
other command-line tools. Regardless of whether I could save a few seconds
on writing this email by using some other editor, that would not stop Vim
from being the overwhelmingly correct choice for me.

In other words, it is not sensible to measure the "cost" of just one tool
as though it exists in isolation; it is better to focus on the pros and
cons of different working ecosystems of tools.

Eg, I would not recommend Vim to someone who has the unfortunate type of
job where they need to work a lot in Windows writing VBA apps (as I did in
a past life). For that kind of work, you are better off using the VBA
editor.

~ 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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Evaluating the cost to type something in vim

meine van essen
In reply to this post by Peng Yu
On Tue, Jan 22, 2019 at 02:20:50PM -0600, Peng Yu wrote:
> Is there a tool to evaluate the least cost to type something in vim as
> accurately as possible? Thanks.

'cost' best can be measured with two variables: time and
keystrokes/mouse distance. for both there must be software to keep
record of typing time, the number of keystrokes and the distance and
number of clicks with a mouse.

I don't know of any comparisons that quantify the vim statement 'editing
with the speed of thought', but you could do a test with a few
writers/programmers to make quasi accurate, but comparable measurements.
just ask people to reproduce the same text/code with their favourite editor,
make measurements and then compare.

I think it is important to let your testers work with _their_ favourite
tool. that way you make use of their high(er) level skills, which should
give more accurate time/keystroke measurements on the long run. it is
not realistic to ask a Word user to try the same text in Vim, or ask a
profound Vimmer to use a GUI editor -- both get lost (the Word user will
never quit ;-)

will be a nice experiment, maybe you can ask more people over the net to
participate and make your 'n' bigger.

//meine

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Evaluating the cost to type something in vim

Eli the Bearded
In reply to this post by Peng Yu
On Thu, 24 Jan 2019, Peng Yu <[hidden email]> wrote:
>> finding the minimal user input that yields a buffer with the input
>> falls under https://en.wikipedia.org/wiki/Code_golf
> This kind of competition is not relevant to what I am not talking
> about. One has to spend extra effort to come up with the absolute
> shortest code. That effort must be considered into the cost as well.
> What I am talking about is "cost", which ultimately map to all
> programmer's time involved in typing and thinking about what to type.
> (But not include thinking about algorithm, data structure, etc.)

Speaking from my own experiences, I use vi and vim differently under
those (increasingly rare, but not never) circumstances where I have a
slow connection. When I can type, say, a half line ahead of where the
system has echoed back my keystrokes, I find myself looking for ways
to optimize the effectiveness of what I type.

If I'm copying something from the line above on a fast connection, I'm
likely to just hit <ctrl-Y> in insert mode a lot. On a slower connection
I'll <esc>ky5f,jpa (as an example, to copy up to the fifth comma).

I'm well aware of the "cost" differences, as you put it. Keeping my
fingers in one location and repeating a single keystroke is very fast
mentally and fairly fast in action on a good system. Over a bad network
link, it's a lot slower because I can't get the immediate visual
feedback. But I have the time to reason out the exact sequence of
movements that will minimize my typing and that increases my effective
speed over the link in two ways: each packet of TCP connection can hold
more response from the server, and I rely on fewer packets sent to the
remote end.

Vi is highly adapted to needs of such slow connection thoughtful
editing. I find the same action optimization skills useful in
constructing macros, too. Explictly separation of searching for a string
anywhere or a character within a line means I can efficiently mix "n"
and ";" searches for finding a matching line and a matching position on
that line (which might not be the start of my match string). Then add in
a "@" action and I can make tail recursive macros easily.

Consider a CSS file with a bunch of inlined images, and other
stuff nearby:

.svg {
background-image:url(data:image/svg+xml;base64,PHN2Zy....)
}
.png {
   background-image: url(data:image/png;base64,iVBORw....)
}
.jpg {
background-image:url(data:image/jpeg;base64,/9j/45....); color:#FFF
}
.gif {
border:0;background-image:url(data:image/gif;base64,R0lGOD....)
}

Let's pretend there are zillions of them and we want to replace
all of those with regular https URLs.

First key up a search:
        /background-image: *url *(data:
Then find the ( with "f("
Now create a temporary line in the file:
        (https://static.example.com/image.png)
And then capture the contents to register c (sans newline):
        0"cD
Now reuse that temporary line to write a macro:
        n;d%"cp@q
And then capture the contents to register q (sans newline), then
delete the line:
        0"qDdd
Finally run the macro with @q

Presto, all instances changed! (And a single 'u' will undo all of the
changes at once.) All because of the same optimizations that help me on
slow links. (And resorting to no vim-isms.)

Elijah

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.