Giter VIP home page Giter VIP logo

Comments (6)

mawww avatar mawww commented on August 17, 2024 5

I do not remember how I decided to just paste the last value for extra selections, I suspect I needed something that would work when pasting a single copied value to many selections and this is the first behaviour that came to mind. It seems to me that rotating would be a slightly more consistent behaviour than just duplicating the last entry, I am not sure it would make such a big difference in usability but it does feel "cleaner" so I am tempted to change that.

Any opinions on this ? Workflow that actually relies on the last entry being repeated ?

from kakoune.

ftonneau avatar ftonneau commented on August 17, 2024 3

Rotating and last-value repetition give the same results when pasting 1 value over n slots. Rotating has the advantage of being potentially more useful than last-value repetition when pasting 2 values over n slots, 3 values over n slots, etc.

As a matter of fact, rotating (called "recycling") is what the statistical language, R, always does when pasting vectors of different lengths. For example, pasting (1, 2) and (1, 2, 3, 4) horizontally gives a two-row matrix:

1 2 1 2
1 2 3 4

where (1, 2) is recycled up to 4 slots.

from kakoune.

schragge avatar schragge commented on August 17, 2024

I do see why this feature may be useful in principle, but not in this particular case. Copying the header line is easy:

xyPPCCs\w<ret>"ad<a-d>CCxs<ret>do<c-r>a:<space><esc>P<a-f>,bdggd<space>q

However, I'd rather do it differently:

xd%<a-s>PCs\W<ret>r<ret><a-h><a-k>\d<ret>d_k<a-o><c-o>pk<a-J>i:<esc><space>q

I'd take a similar approach to solve the latest VimGolf challenge (Truth Table to ModelSim):

x`d%<a-s>PChdy%s<space>+<ret>R<a-h><a-k>\d<ret>d<a-d><c-o>_pk<a-j>iforce<space><end><space>@<space>0<esc>]p<a-,>"#p3+d<a-.><a-s>bP%arun<space>80<esc><space>q

TBH, in real life I'd use an external tool. This list includes quite a few tools to work with structured text, particularly with CSV and friends. My tool of choice would be Miller, but there are many others as well

%|mlr --c2x cat<ret><a-s>bhi:<esc><space>q

or even

%|mlr --c2x --ps ': ' cat<ret><space>q

from kakoune.

jameschensmith avatar jameschensmith commented on August 17, 2024

Wow, I really like your approach (the second example) to the usecase. That is fair that there are other ways to solve the problem, especially through an external tool. I may have to think of some other good usecases. But I'm also having a hard time finding good usecases for the current state of repeating the last value in the register. To me (subjective opinion alert), it would make more sense if the values kept rotating if the end of the list was hit.

from kakoune.

schragge avatar schragge commented on August 17, 2024

I was trying to find another use case for this beyond flattening/converting tabular data to vertical linear format, but was not very successful. VimGolf has the challenge Label grid cells (6x6). Currently, I'd solve it like this:

5O<a-;>CABCDEF<esc>bs.<ret>6+y<a-+>Pll_i<space><esc><space>q

If selections were reused in the round-robin fashion, this could be rewritten differently. E.g.

5O<a-;>CABCDEF<esc>,bs.<ret>y5<a-C>Pll_i<space><esc><space>q

Perhaps, there are more efficient ways of doing this, but the only gain I see now is that + and <a-+> are more awkward to type than , and <a-C> (on American and French keyboard layouts, that is; on German keyboard + is located more handily).

And again, I'd rather do it in Bash, anyway:

printf %s\\n {A..F}{A..F}|pr -6Tts' '

from kakoune.

schragge avatar schragge commented on August 17, 2024

Ah sorry, I've totally messed up. The correct "recycling" solution would be something like

cABCDEF<esc>QbS.<ret>i<ret><esc><a-C>Qy5p<a-o>q<a-j>pgld<space>q

from kakoune.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.