sheetkeys
sheetkeys copied to clipboard
Should commands which delete (e.g. `x`, `dd`) also yank?
In vim, commands which delete text also yanks (copies) it into the unnamed register, ready to be put (pasted) back into the document with p
. This enables neat sentences such as ddp
to swap two lines at the cursor, xp
to swap two characters, and generally e.g. ddjjjp
to move a line further down in the document.
In sheetkeys, deleting commands currently don't copy the deleted text in any way.
- On one hand, this makes sense; there's not any concept of multiple registers/pasteboards in Sheets, and it might be considered aggressive for sheetkeys to clobber the system clipboard all the time.
- On the other hand, copying the contents of deleted cells/rows would be mightily convenient in certain workflows, enabling such sentences as described above.
I personally find myself reaching for this functionality particularly when I want to take the contents of a cell and move it lower down in the document. My vim-brain tells me to use x
to grab the cell, move to the target location, and p
to pop the cell back down. (This is similar behaviour to cut, i.e. ctrl+x
or cmd+x
.) However, this doesn't work, because the deleted cell isn't copied. My vim-brain also expects this to work with a visual selection.
@philc, Is this something that would fit the design goals of sheetkeys, or is this overstepping? Because the behaviour may be confusing to some, is it something we would gate within a user setting?
I would be interested in implementing this feature one way or another, if there's an acceptable way to fit the feature in. It should be technically fairly trivial to implement. If a setting-gate is desired, I'd be happy to try to implement the settings page (also mentioned in #38) as well.