Replies: 3 comments 8 replies
-
I think this is a good idea, and I had thought about it. I want to make the selection behaviors as close to the behaviors in normal state as possible. I'll probably find a time to work on it. I'm missing some motivation because I believe these use cases are too few. |
Beta Was this translation helpful? Give feedback.
-
This may be outside the scope of what meow beacons are, or should be, but bare with me. I've been thinking about what beacon could be, what would be an "intuitive" interface, and what incoming users would expect it to be. The first thing that seem to happen when new users come in contact with the beacon state is that they compare it to multiple-cursors, then get confused when it doesn't work the same way. Naturally this is the case because the meow beacon state is quite a different thing, but in many ways, I don't think it needs to be. @DogLooksGood mentioned making the selection behaviors closer to how things work in normal mode. I think this is a great idea as it would allow a smoother transition between normal editing and multi-editing. An extension of this would be to separate out placing cursors from the normal motion and editing functionality. Maybe a transient prefix could be used for beacon manipulation functions, like placing or removing beacons, maybe some stepping function for stepping through the beacons allowing for viewing them if they are outside the window. This would allow normal mode to function like you would expect, but every action is also run on all the beacons. I think this would make it easier to understand as it would do the same as normal, only everywhere. I have glazed over a lot of implementation related details here, partly because I don't think I'm good enough at hacking elisp yet to gauge how difficult this would be to implement. But I can see some areas that might need some careful thought. First is that of performance. On a large region, say a full source file, with a large amount of beacons; how would cycling through and repeating every key-press in a macro impact the editing experience? This probably needs to be tested to be sure, but we already have an escape hatch if recording macros works the same as today. Then the edits would be batched and executed with less overhead. Then there is overlapping beacons. This is a problem with my first proposal as well and would need to be dealt with if any form of extending selections could be done in beacon mode. We would need to go through the beacons and merge the selections so that we get a single beacon for that area. Either that or have the beacons block each other so that they end up next to but not overlapping. There are probably a lot of edge cases that I've missed. Sorry for the long winded post, I've been looking a bit at how helix handles multi-editing and while it is in many ways quite a different thing, I think there are interesting ideas to borrow from it. |
Beta Was this translation helpful? Give feedback.
-
I don't have that many in store. A recent one that I ran into was extracting connection info out to a json object. snowflake_conn = snowflake.connector.connect(
account="snowflake_acount",
user="snowflake_user",
private_key_file="path/to/key_file",
private_key_file_pwd="key_password",
role="snowflake_role",
database="snowflake_database",
warehouse="snowflake_warehouse",
schema="snowflake_schema",
) Into this: "snowflake":{
"account":"snowflake_acount",
"user":"snowflake_user",
"private_key_file":"path/to/key_file",
"private_key_file_pwd":"key_password",
"role":"snowflake_role",
"database":"snowflake_database",
"warehouse":"snowflake_warehouse",
"schema":"snowflake_schema"
}, and this: snowflake_conn = snowflake.connector.connect(
account=config["snowflake"]["account"],
user=config["snowflake"]["user"],
private_key_file=config["snowflake"]["private_key_file"],
private_key_file_pwd=config["snowflake"]["private_key_file_pwd"],
role=config["snowflake"]["role"],
database=config["snowflake"]["database"],
warehouse=config["snowflake"]["warehouse"],
schema=config["snowflake"]["schema"],
) If I remember correctly I did a lot of it by recording macros and executing them on beacons per line. The biggest problem I faced was was that I sometimes moved by word instead of symbol which broke when it applied to the other lines. That and that I was weirdly confused about the record- and the end- macro buttons. The last thing I solved for myself by just making a dwim macro button that does both based on context for me. I've also thought that it would be nice to have Sometimes I also use beacon mode for renaming things, but I'm not sure it is the best for it. I made a grab-word and grab-symbol function that calls |
Beta Was this translation helpful? Give feedback.
-
I've had this thought floating around for a while that if we had some way to manipulate the beacons and their selections, maybe we could lessen the need to record as many macros while doing edits in structured text.
I don't really know how feasible this is to do, or if it is as useful as it seems in my head.
The idea is that we have commands that place beacons and commands that manipulate the selections of those beacons. This would allow us to do something like "t = ] l" to place a beacon at each equal sign, then make a selection from each beacon to the end of the line.
There are probably a bunch of edge cases that I'm not thinking of, but I think this could be good to prototype.
Beta Was this translation helpful? Give feedback.
All reactions