49

How can I stay tab free in Geany on Ubuntu?

When I am coding in Python, tabs have always annoyed me. And the TAB is invisible. So strange.

When I open my code by gedit, those TABs are visible.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Josh Morrison
  • 7,488
  • 25
  • 67
  • 86

6 Answers6

63

You are looking for 'soft tabs'

http://www.geany.org/manual/dev/index.html#editor-indentation-preferences

Edit > Preferences > Editor > Indentation > Type > Spaces

After changing the setting, close and reopen the file.

To apply the tab settings to every document in the current session, also click:
Project->Apply Default.

Henke
  • 4,445
  • 3
  • 31
  • 44
dting
  • 38,604
  • 10
  • 95
  • 114
  • 21
    After changing the setting, close and reopen the file as Martin notes. – Dave Jarvis May 24 '13 at 04:17
  • 6
    Thanks @DaveJarvis. Restarting Geany wasn't enough. – berbt Mar 03 '15 at 09:54
  • 1
    Mmmmh, it seems that doesn't work. It continues to generate tabs even though this "space" checkbox is set. Either this functionality is buggy or improperly described (tested with geany 1.23.1) – Cyan Nov 23 '15 at 15:02
  • 7
    @Cyan, after making the change, you must then enforce it by going to "Project --> Apply Default Indentation." Took me a few minutes to figure this out too. – Gabriel Staples Sep 06 '17 at 03:33
  • Close **all** tabs if you have more than one. In such cases, reopening the file in the active tab does **not** help. Closing Geany does **not** replace closing all tabs. Also, do "Project -> Apply Default Indentation" does **not** exclude you from reopening all tabs! – HongboZhu Sep 13 '18 at 15:25
  • Keyword here is "close the **file**". Not geany, the **file** tab. For a minute I though the setting didn't work. – Telmo Marques Oct 26 '18 at 10:39
37

DTing is right but on thing to remember: You have to close all files (tabs) in Geany and open them up again to have the new settings work in each file. It took me days to figure out that I not only have to close geany and open it up again but that I also have to re-open each file seperately.

Martin Fake
  • 559
  • 5
  • 10
  • 4
    I guess that's why they call it Geany. Your wish is its command, but you have to be very careful and precise about how you express your wish. – Lori Feb 07 '16 at 17:01
  • Alternatively, after making the change, you must then enforce it by going to "Project --> Apply Default Indentation." Took me a few minutes to figure this out too. – Gabriel Staples Sep 06 '17 at 03:34
13

I know I'm a bit late on this, but hopefully this answer might help someone else. With Geany closed, edit ~/.config/geany/geany.conf with some other editor, changing the lines:

use_tab_to_indent=true
indent_type=1

to:

use_tab_to_indent=false
indent_type=0

and the settings will "take".

Emmet
  • 6,192
  • 26
  • 39
  • I tried everything else recommended (Using the 'Preferences > Editor > Indent' settings, then 'Project > Apply Default Indentation'), but this is what it took to actually have those settings apply. The settings did not work in a project file or otherwise. Thank you! – Derek Foulk Mar 22 '15 at 11:01
  • While setting the preferences changed that file containing the global configuration for me automatically, it didn't change some of the Project configurations, which are stored in a [project_name].geany file containing a localized copy of some of those global configurations to be applied to a limited set of files. – Ubuntourist Sep 30 '15 at 01:11
6

To take effect on opened documents has to go to:

  • Document-> indent_type -> spaces.

The document configuration has prevalence over the global.

5

Here's another tip I like that works in almost any editor. Enable view whitespace, and never get confused again about what's in the file:

Preferences > Editor > Display > ✔ Show Whitespace

Then restart Geany.

I use the the syntax highlighting features to make these symbols very subtle, a low contrast greyscale, so one has to look to see them. The tab is still somewhat easy to see in scintilla editors because it it will be a multi-character long arrow.

Gringo Suave
  • 29,931
  • 6
  • 88
  • 75
0

I faced the same problem, but documents opened as part of project.

In this case the tab/spaces setting is overriden by project->preferences

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Kapitan
  • 73
  • 8