When I select a block of text in Geany (editing a bash script) and hit Ctrl + E to comment, Geany inserts #~
at the beginning of every line, instead of just #
. Why?
Asked
Active
Viewed 960 times
7

a06e
- 18,594
- 33
- 93
- 169
-
Anything after `#` is not of any significance. A matter of style, perhaps. – P.P Mar 24 '15 at 12:59
-
@BlueMoon If it's a matter of style, it shouldn't be imposed. I prefer the `#` alone, it's simpler. Is there a setting where I can change this? – a06e Mar 24 '15 at 13:12
-
2I haven't use Geany, but it sounds like your [NOPing](https://en.wikipedia.org/wiki/NOP) a block of code (which puts the `#` in front). I suspect that Geany has a reverse function which removes the comment blocks and reactivates the code. The `#~` may allow Geany to tell the difference between blocks of code it NOPed, and your regular comments. – David W. Mar 24 '15 at 13:30
-
@DavidW. Good assuming ;) See my answer – frlan Mar 25 '15 at 09:14
1 Answers
5
Geany is adding the ~
after the #
to mark these lines as been toggled. Ctrl + E is toggeling the comment in default so
# Original Comment
print ("Hello world")
becomes
#~ # Original Comment
#~ print ("Hello world")
And back again
# Original Comment
print ("Hello world")
Without some special marker it would might be hard to recognize what has been comment and what has been normal code.

frlan
- 6,950
- 3
- 31
- 72
-
1+1 That makes sense. However, Geany is the first editor that I've seen that does this. Sublime Text, gEdit, and others, just use `#` and work fine. Do you know if there is a way to tell Geany to use `#` instead of `#~`? – a06e Mar 25 '15 at 12:08
-
2At least you can configure it at Preferences->Editor. Keeping the field blank might would do the trick. – frlan Mar 25 '15 at 12:34
-
1Yes, Preferences->Editor->Comment Toggle Marker -- if you make the Comment Toggle Marker "empty" (remove the ~) then it marks with the regular # which I really prefer. – Jamil Said Nov 15 '20 at 00:35
-