Open slackhead opened 6 years ago
I believe macros would not be very difficult task to add. And very useful.
+1 for macros currently there is no binding to even increment or decrement integer values like vims <ctrl-a>
and <ctrl-x>
This was one of the first things which I came to sc-im for, sadly it isn't implemented yet.
But if/when it does I'd really like to be able to save my already made macros (in vim they get deleted when you close the file).
If the macros follow the same rules as keybindings then perhaps the code could be reused, then perhaps all that's needed is a way to interpret custom commands?
I saw the thread on macros that run external lua scripts, but I'm wondering if there could be a way of making purely internal macros (using normal sc-im commands not lua). If there isn't yet then I'd like to make a feature request, unless there's a better/easier way of doing the same thing.
Example:
The following is a key bind that I made:
nmap "Z" "=@nval(@coltoa(@mycol),@myrow-1)+1209600kxPv:format \"d%d/%m/%Y\"j"
If used when the cursor is under a date it will calculate the date +2 weeks from the date above and output it as a new date. Running '10Z' will repeat it 10 times etc. This is very helpful for adding new date ranges that continue in a column of dates.
It would be nice if I could define that as a macro or alias so that it isn't taking up valuable keybind space, since it's hard to remember all the custom binds when you make many, and also running a command like eg :extend_dates would be easier to remember and be more descriptive.
The date thing is just an example though. The ability to do this would be very nice and I wouldn't think that the required code would be too different to the current nmapping code (not that I've looked at it!)