Comments (6)
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.
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.
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.
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.
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.
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)
- [BUG][CRASH] ctags-search crashes kakoune after trying to browse autocomplete options. HOT 2
- [BUG] %val{buflist} does not produce quoted output by default HOT 1
- [BUG] :w write paste wl-clipboard contents HOT 4
- [BUG] mv operation should not interfere with HOT 3
- [QUESTION] Text file busy make: *** [Makefile:181: install] Error 1 HOT 1
- [QUESTION] Cursor up/down navigation in soft-wrapped text (gj/gk in Vim) HOT 7
- Adding keybinding for `<c-/>` does not work HOT 2
- [BUG] Command completion stops to work when command is invoked in user-mode HOT 2
- [BUG] markdown highlighting cannot parse `` correctly
- [BUG] cannot use <ret> in *lint-output* buffer HOT 2
- [REQUEST] `close-daemonized-session` command HOT 4
- [BUG] Receiving `'vfork' is deprecated:` warnings while compiling Kakoune from source HOT 2
- [BUG] 2024.05.09 tests failing on Alpine Linux HOT 16
- [BUG] Tests failing on OpenBSD HOT 10
- [BUG] Files getting created when using autocomplete HOT 3
- [BUG] HOT 1
- [REQUEST] revert f26d4ea4 for putting tmux into background again HOT 7
- [BUG] Viewport motion no longer takes scrolloff into account
- [BUG] WhitespaceIndent face overridden by language highlighting HOT 1
- [BUG] setting a face to itself in kakrc causes hang HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kakoune.