Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get gedit to auto-indent code

I'm trying to get gedit to auto-indent my code. The auto-indent check-box in preferences doesn't work. Is there a way to get gedit to auto-indent code? (By the way, I only really care about C++ indentation. I don't need indentation for any other language.)

like image 997
Linuxios Avatar asked Nov 23 '11 16:11

Linuxios


People also ask

What is the fastest way to indent a code?

Indenting once with the tab key means just pressing the tab key once. Indenting once with the space bar means pressing the space bar 4 times.


Video Answer


2 Answers

gedit has an auto indentation feature, go to

Edit -> Preferences -> Editor -> 3rd line

like image 145
HarshaNadimpalli Avatar answered Sep 19 '22 18:09

HarshaNadimpalli


The plugin 'intelligent text completion' for gedit does exactly what you describe: https://github.com/nymanjens/gedit-intelligent-text-completion

For those who are trying to find out how to copy the files intelligent_text_completion.plugin and intelligent_text_completion.py to.local/share/gedit/plugins, please do the following:

user@example:~/.local/share$ cd ~/.local/share/ user@example:~/.local/share$ mkdir gedit user@example:~/.local/share$ cd gedit/ user@example:~/.local/share/gedit$ mkdir plugins user@example:~$ cp intelligent_text_completion.plugin intelligent_text_completion.py ~/.local/share/gedit/plugins/ 
like image 22
Jens Nyman Avatar answered Sep 20 '22 18:09

Jens Nyman