Sublime Forum

Macros don't record Find/Replace?

#19

Itā€™s 8:51AM now and still! Gasp!

ā€¦ but honestly, I think the ā€œshockā€ of the lack of this feature quickly diminished and caused me to just not use macros. They were more useful in Textmate 1 when we didnā€™t have multiple cursors and Emmet.

I also took the lack of the feature as an opportunity to hone my regex skills.

0 Likes

#20

Iā€™ve been using ST for years and never had cause to use a macroā€¦

0 Likes

#21

Agreed. I used to use them all the time in TM1, but donā€™t even think about them in ST3.

They are handy for quickly cleaning up pasted in code or markup that require a lot of manual cursor movement, but this is something I do very infrequently, and multiple cursors + regex find/replace have been a more-than-suitable replacement.

2 Likes

#22

Who currently is in charge of Sublime Text development? Is there a single person?

How do feature requests get prioritized?

0 Likes

#23

The author and owner of Sublime Text is @jps (Jon Skinner). @wbond (Will Bond), long-time Sublime community member, plugin developer and author of Package Control, is now working with Jon and is officially on-board at Sublime HQ. Major development priorities are, so far as I am aware, set by Jon although Will seems to be actively involved in Sublimeā€™s development as well.

Traditionally Jon has been tight-lipped about Sublimeā€™s roadmap and development has happened in fits and starts. With Will coming on-board, it seems that development efforts are ramping up again and I get the sense that this (new) forum will play a reasonably major part in defining priorities for Will and Jon.

nb. The above are opinions only. I donā€™t work for Sublime but have been an active part of the community since ST2, and an interested onlooker from some time before that :wink:

0 Likes

#24

Back on-topic :wink: I think @natebeaty sums it up nicely, but for power users some editing tasks require the flexibility to define a regex search as part of a compound, possibly repetitive, operation across a large file. I could give examples, but those whoā€™ve requested this and chimed in on this subject know where Iā€™m coming from. Most of them I would assume - and myself included - come from traditional power-user text editors like Emacs and VI. I myself came originally from Brief, via Crisp, Vim and Emacs.

Macros that can record and script anything the editor can do are crucial and having a macro system that can script many things (ie. TextCommands) but not all editor operations which can affect the buffer or view is both confusing and frustrating. As a result, like @natebeaty I just avoid using macros for anything but the most trivial caret and text manipulation convenience functions.

In Crisp, I would routinely record a macro that would find a regex, then move the cursor from the found string, do some edits, go down and to the beginning of the next line. Iā€™d then hit F8 (playback macro) multiple times to perform the same operation on repeat across the file. Or I could hit Ctrl+Y (repeat), then type 20 and hit F8, which would repeat the macro playback 20 times. Or I could hit Ctrl+Y+0 (repeat to EOF) and hit F8, which would repeat the macro playback until the Find operation would cause a wrap. You get the idea.

In truth, I would use Replace rarely in this context, but Find often. For the above workflow, Sublime misses the ability to record & script Find/Replace, but also a ā€˜repeatā€™ function. For simpler operations, Iā€™ve found ways of getting to the same place with multi-cursors, but itā€™s slow, more restrictive and inappropriate with particularly large files. You want see whats being changed linearly and in a stepwise fashion. You want to ā€˜pause and resumeā€™ as you go, making other edits in-between. I donā€™t argue this as an alternative to multi-cursors, which are awesome, but theyā€™re not suitable in every situation.

One improvement that could help a lot is the ability to define a regex match parameter for Ctrl+D style matching. Find & Replace allows find next and highlight all, but not selective highlighting. It still means weā€™re in multi-cursor land (with the same disadvantages outlined above) but it would get me closer to solving many of the situations where Iā€™d be having to fire up another editor.

Itā€™s probably fair to say that I would use this sort of thing rarely when purely coding, but often when doing transformations of large text files laid out in a particular way, like SQL dumps, tabulated text and CSV files. The ability to compound editing procedures into macros and play them back or repeat them is still essential for at least a part of my text-editing life Iā€™m afraid, and feels like a real weakness of Sublime.

3 Likes

SublimeText macros are no good
#25

Thanks for the informative response.

Sublime Text is already a superb product ā€“ with great potential for further development and innovation. It would be nice to see it quickly evolve into the overall best text editor on the planet, incorporating all the best features of its competitors. (Some people may argue that it is already the best overall text editor out there.)

0 Likes

#26

Agree completely on this. I will continue to use Notepad++ and Textpad in tandem with Sublime Text because they provide robust macro recording features which I use on a regular basis. It would be nice to have a single text editor that does it all.

0 Likes

#27

Borrowing from @JeffWay who (iirc) likened Sublime to a sports car. Itā€™s lean, slick, light and fast, and a very ā€˜nice place to beā€™, but there are a growing list of things which people expect from a modern editor which blur the lines between traditional text editing and IDE, which are either missing from Sublime or difficult to implement due to restrictions in Sublimes API, Core, or UI manipulation via API. A good example being PHPstorm, and some newcomers like Atom and Brackets.

Sublime is indeed one of those pieces of software which you can ā€˜fall in love withā€™ and as a result itā€™s easy to get hung up on perfection. But letā€™s not forget, Sublime is slick, stable and dependable professional tool now, despite its beta status. The frustrating thing for many is the slow pace of development especially in modern times. I too would like to see that quicken along with generally better responsiveness especially with niggly, easy to reproduce and fix bugs - and there are quite a few.

The ā€˜bestā€™ is always a subjective call. For me whatā€™s important is does it facilitate what I do or get in the way? Jeff loves PHPstorm, but I found it got in the way too much of the time for me, because I have to wear a lot of different programming hats beyond webdev. That doesnā€™t make Sublime better, itā€™s just a better fit for my needs. Others will have different and equally valid opinions; no doubt a seasoned webdev familiar with PHPstorm will get more done in less time than I but may find the tool gets in the way when working in C, C++, ASM, Python and Java (and more). I need one editor across Linux, Mac and Win, that disappears no matter what Iā€™m doing, remains a nice place to be for the journey and doesnā€™t let me down. Despite some limitations, Sublime still meets that requirement easily, four years in :slightly_smiling:

1 Like

#28

This is a critical issue, hope we will have this feature shortly.

1 Like

#29

Just bought a license after a long evaluation time and immediately stumbled upon this issue :slightly_smiling:
Really, if we could use find and replace in macros there would be no need for some of the plugins and it would greatly improve the workflow.

0 Likes

#30

This issue has been bothering me for quite a while as well. Today, I ran into a refactoring task that warranted finally coming up with a solution, so I wrote a small wrapper around xmacro for linux.

Edit: I did some research, since my implementation has weird bugs (maybe because xmacro is 16 years old?). There really arenā€™t a lot of options, but linux-keyboard-macros looks promising (itā€™s a ruby repo on github; the forum wonā€™t let me post more than 2 links).

0 Likes

#31

Wow. I actually got ST3 for my macro plans and because I love the column options. But before I get to the former, I needed to do some work first thing tonight, so I dumped TextPad and pulled stuff into ST3. And canā€™t for the life of me figure out how to get a regex output of \i{1,1} that iterates integers in textpad, for some perl regex equivalent in ST3. But in searching ST forum I found this (unrelated) threadā€¦ and I see that all my macro dreams are dead! Everything I need to do with a few exceptions is a regex search/replace for the macros. Man. Iā€™m so sad!! But Iā€™m so glad I found this thread before I spent my super limited money on a license, I guess. Thanks to people for sharing about it, at least. :frowning:

0 Likes

#32

As a former gvim user, I generally love Sublime; however, I fell victim to this shortcoming as well. Iā€™m grateful for the notes on this forum and look forward to an enhancement of ST so that I donā€™t have to fall back on gvim for more sophisticated macros.

0 Likes

#33

Perhaps you could use an external macro program like Keyboard Mastero (macOS) or AutoHotKey (Windows) to use the find and replace feature? Obviously not ideal, but hopefully it can save a few workflows.

0 Likes

#34

Most of the search & replace functionality is exposed as methods of the view object, so with a little bit of extra work you can do lots of complex stuff. Itā€™s not going to be a macro then, but a python script (that you then invoke with a key binding).

0 Likes

#35

Honestly Iā€™m quite surprised personally that find and replace isnā€™t supported. I switched over from Atom and was absolutely thrilled by Sublime Textā€™s macro functionalityā€¦ but alas! The macros Iā€™d use would need find and replace. What a great pity.

0 Likes

#36

Canā€™t wait till this is fixed.

0 Likes

#37

Still an issue as of May 27 2017

I recorded a macro to implement certain aspects of my current coding style on my old code and found nothing occursā€¦ Notepad++ has this feature but the UI and everything is in a single thread it seemsā€¦ I prefer the basic layout of Notepad++ to ST3 and ST3 has the same features strewn about the ui instead of being nicely organized and it is missing a ton of basic featuresā€¦

Luckily there are addons available for most of the missing features, and at least you can search while being able to edit at the same time, but this is an important issueā€¦

Operations I am using are to convert a decrementing number of spaces from 5 to 2 to tabs, adding spaces between [, ], (, ), ā€œ,ā€, {, and } chars then removing duplicates so _x = {func = function(a,b,c) end,[ā€œabcā€] = true} becomes _x = { func = function( a, b, c ) end, [ ā€œabcā€ ] = true } ā€“ not how Iā€™d formulate it but to the pointā€¦

0 Likes

#38

Probably because your work doesnā€™t involve using macros? I mean, I totally understand if you donā€™t use them, but a lot of people do!

0 Likes