ActiveState Community

language specific indentation

Posted by kristoph on 2007-02-04 00:43
OS: All / Any

Greetings,

How do I go about setting indentation on a language by language basis. I would like, for example, in indent ruby 2 spaces while C++ 4 spaces.

The manual suggests this is possible but I cannot figure it out.

Many Thanks,

Kristoph

kristoph | Sun, 2007-02-04 00:44

Greetings,

Is there some way to replace tab characters with some number of spaces.

Many Thanks,

Kristoph

toddw | Sun, 2007-02-04 12:36

We do not have separate language preferences as yet inside of Komodo, this is something we recognize and plan to address in the near future (a 4.x release).

You can set specific indentation per file through the file "Properties and Settings" context-menu.

Note: You can create a macro that does this specific functionality, example below, and set the macro "Triggers" tab to run after file open:

// Macro recorded on Sun Feb 04 2007 09?? GMT-0800 (PST)
komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus(); }

// If ruby document, set 2 space indentation
if (komodo.document && komodo.document.language == 'Ruby') {
    komodo.editor.indent = 2;
    // Set other options as needed
    //komodo.editor.tabWidth = 8;
    //komodo.editor.useTabs = false;
}

// Macro recorded on Sun Feb 04 2007 09?? GMT-0800 (PST)
komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus(); }

// If ruby document, set 2 space indentation
if (komodo.document && komodo.document.language == 'Ruby') {
    komodo.editor.indent = 2;
    // Set other options as needed
    //komodo.editor.tabWidth = 8;
    //komodo.editor.useTabs = false;
}

As for changing tab settings, there is the "tabify/untabify region commands, which are found under the "Code" menu.

kristoph | Mon, 2007-02-05 16:07

Awesome! Thank you very much.

Regards,

Kristoph

PS. Yes a per file type indent would definitely be helpful.

scoates | Thu, 2007-03-15 16:18

kristoph:

[toot horn="own"]
Check out Komode.
http://support.activestate.com/forum-topic/komode-modeline-support-f
[/toot]

S