Sublime Forum

Sublime text 3 build certain lines

#1

Does anyone know how to run only highlighted lines? Or which package I should install to add on this function?

Has been really enjoy using Sublime but only this part is annoying.

Thanks.

0 Likes

#2

Depending on the language that you’re working in there may be a dedicated package for running portions of files on Package Control; Eval seems to be an example of something that does that, though I’ve never used it personally so I don’t know how configurable it might be. If you can provide more details on what you’re working with that may help to narrow it down a bit.

It’s also possible to create a sublime-build that uses a custom build target that does this; in that case you could easily switch between running entire programs or just sections of them based on a keypress.

An example of that can be found as the last sample in this video. It’s part of a playlist that also covers build systems and how this overall mechanism works as well, if you’re unfamiliar.

There’s a link in the video description to a copy of the plugin code so that you don’t have to enter it yourself if you want to try it out.

0 Likes