I have used gedit
with Ubuntu a lot and now transitioning on Macos. I noticed that some of the plugins in the Macos version are missing. For instance, there is no (AFAIK) an out-of-the-box option to comment/uncomment code. However, there is the possibility to define an external tool to basically have whatever you want.
I want to just comment the text selection in R/python style (prepending a #
before each line of the input). I went to Tools -> Manage External Tools and defined a "Comment Code" tool in this way:
#!/bin/bash
awk '{print "#" $0}'
and set Input as "Current Selection" and output as "Replace Current Selection".
It works if you select a text; however if you don't select anything, it stalls forever, since (for what I understood) awk
is waiting for an input.
How can I avoid this problem? Of course I don't need a awk
(or whatever) solution, whatever works is fine. I'm not much expert of bash
tools like awk
or sed
, so very likely I'm missing something very simple.