Text editing - insert comments (#) in Ubuntu with gedit or other text editor

11,432

Solution 1

Possibly need # apt-get install gedit-plugins.

Then go to edit > preferences > plugins > enable "code comment".

Then use ctrl-m to comment and ctrl-shift-m to uncomment.

(Technically, I think this would go in SuperUser though.)

Solution 2

There is a plugin for gedit, which should help for your needs. You can get this from github:

https://github.com/jessevdk/gedit-multi-edit

Share:
11,432
André Miguel Monteiro
Author by

André Miguel Monteiro

Updated on June 07, 2022

Comments

  • André Miguel Monteiro
    André Miguel Monteiro almost 2 years

    I am programming in a dedicated language called macro language.

    To comment I need to add # at the beginning of the line.

    What I want is, in order to spare time, to comment several lines of code at same time with gedit or other program (gedit is nice in terms of the colors, which make the code more readable).

    How can I do it?

    Thank you in advance.

  • David X
    David X over 9 years
    That is... really overkill for commenting out code blocks.
  • Admin
    Admin over 9 years
    Yes you are right i was just thinking about multiple editing points, but just for the comment stuff ur way is much easier to do ;)
  • André Miguel Monteiro
    André Miguel Monteiro over 9 years
    for me doesn't because the comment character is a # and with that plugin is a %... is there a way to turn around this?
  • André Miguel Monteiro
    André Miguel Monteiro over 9 years
    how do I install the plugin?
  • David X
    David X over 9 years
    @AndréMiguelMonteiro, see my other answer for how to specify a correct line-comment-start for gtksourceview (gedits source code parsing engine).
  • André Miguel Monteiro
    André Miguel Monteiro over 9 years
    I can't find the folder gtksourceview
  • André Miguel Monteiro
    André Miguel Monteiro over 9 years
    I am not getting it right it is really overkill like David said! But thank you sLy
  • David X
    David X over 9 years
    @AndréMiguelMonteiro, if you mean ~/.local/share/gtksourceview-3.0/, you might have to create it (and language-specs/), since I don't think they get created by default. If you mean /usr/share/gtksourceview-3.0/, then your system is probably completely different from what I can usefully give advice on.