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