Home Download Buy Blog Forum Support

Automatic Indentation with Ruby?

Automatic Indentation with Ruby?

Postby fdiv_bug on Thu Oct 22, 2009 6:54 pm

I like what I've seen so far of Sublime, and I want to like it more, but I can't do that until I can find a way to get Ruby autoindent working. It's highly probable I'm simply missing something since I know Sublime can do what I want as it works out of the box with Python. If I type:

Code: Select all
5.times do |x|
puts x
end

I would very much like for Sublime to automatically indent the "puts x" line for me, and then automatically deindent the "end" line, when I type them.

What am I doing wrong that this doesn't simply happen? Thanks in advance!
fdiv_bug
 
Posts: 1
Joined: Thu Oct 22, 2009 6:48 pm

Re: Automatic Indentation with Ruby?

Postby jps on Fri Oct 23, 2009 11:19 am

Sublime Text's autoindent won't handle this yet - it's not configurable. I've added it to the list of things to fix.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Automatic Indentation with Ruby?

Postby vim on Fri Oct 23, 2009 7:05 pm

jon, do you intend to support textmate Indentation Rules (tmPreferences)?
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Automatic Indentation with Ruby?

Postby jps on Fri Oct 23, 2009 9:43 pm

That's the plan at this stage, yes.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Automatic Indentation with Ruby?

Postby joshuaalan on Sat Jan 09, 2010 11:50 am

Hi Jps, do you know when this feature might be released?
joshuaalan
 
Posts: 4
Joined: Thu Jan 07, 2010 8:52 pm

Re: Automatic Indentation with Ruby?

Postby willi297 on Fri Feb 05, 2010 5:56 pm

I do a lot of Ruby and Lua currently. This feature should work similarly for these languages. When will this be available?
Greg Williams
Atomic Embedded, USA
http://atomicembedded.com
willi297
 
Posts: 121
Joined: Wed Nov 18, 2009 8:29 pm
Location: Grand Rapids, MI, USA

Re: Automatic Indentation with Ruby?

Postby dogmeat on Wed Sep 15, 2010 11:55 am

Hey, just wanted to ask if there is auto-indentation in Ruby, now that 1.4 has rolled out.
I'm pretty sure there was auto-indentation yesterday, but today there is none. Not in ANY language. Which is kinda strange.
I've searched the forum but didn't find anything useful. I also can't see anything wrong with my configuration. Is there something I'm missing? Thanks in advance.

Here is my config file:
Code: Select all
# While you can edit this file, it's generally best to put your changes in
# User File Type.sublime options, which overrides the settings in here.
# Settings may also be placed in file type specific options files, for example,
# in Packages/Python/Python.sublime-options for python files.

# Sets the colors used within the text area
colorscheme Packages/user/Sublimey.tmTheme

# The menu that pops up when you right click
contextMenu Packages/Default/Context.sublime-menu

# Font to draw with. To override the system antialiasing settings, append
# :noantialias to the end of the line.
font Consolas 11

# What characters are considered to separate words when using ctrl+arrows etc
wordSeparators ./\\()"'-:,.;<>~!@#$%^&*|+=[]{}`~?

# Set to false to prevent line numbers being drawn in the gutter
lineNumbers true

# Set to false to hide the gutter altogether
gutter true

# Columns in which to display vertical rulers, space separated
rulers

# Set to true to turn spell checking on by default
spellCheck false

# The number of spaces a tab is considered equal to
tabSize 2

# Set to true to insert spaces when tab is pressed
translateTabsToSpaces true

# If translateTabsToSpaces is true, useTabStops will make tab and backspace to
# insert/delete up to the next tabstop
useTabStops true

# Set to false to disable automatic indentation
autoIndent true

# Set to false to not trim whitespace added by autoIndent
trimAutomaticWhitespace true

# Set to false for horizontal scrolling
wordWrap true

# Set to a value other than 0 to force wrapping at that column rather than the
# window width
wrapWidth 0

# Set to false to prevent word wrapped lines from being indented to the same
# level
indentSubsequentLines true

# Set to true to draw text centered in the window rather than left aligned
drawCentered false

# Set to false to stop auto pairing quotes, brackets etc
autoMatchEnabled true

# Word list to use for spell checking
dictionary Packages/Language - English/en_US.dic

# Set to true to never prompt to reload when a file is changed on disk
ignoreChanged false

# Set to true to always reload changed files on disk, instead of prompting
autoReloadChanged true

# Set to false to disable highlighting any line with a cursor
highlightLine true

# Set to false to disable underlining the brackets surrounding the cursor
matchBrackets true

# Set to false if you'd rather only highlight the brackets when the cursor is
# next to one
matchBracketsContent true

# Set to false to not highlight square brackets. This only takes effect if
# matchBrackets is true
matchBracketsSquare true

# Set to false to not highlight curly brackets. This only takes effect if
# matchBrackets is true
matchBracketsBraces true

# Set to false to not highlight angle brackets. This only takes effect if
# matchBrackets is true
matchBracketsAngle false

# Set to false to disable detection of tabs vs. spaces on load
detectIndentation true

# Additional spacing at the top of each line, in pixels
linePaddingTop 0

# Additional spacing at the bottom of each line, in pixels
linePaddingBottom 0

# What should happen when the minimap is clicked outside of the view rectangle.
# Valid values are 'none', 'position' or 'text'.
clickToScroll text

# Set to false to hide the vertical and horizontal scroll bars
wantVerticalScrollBar true
wantHorizontalScrollBar true

# Set to false to disable scrolling past the end of the buffer
scrollPastEnd true

# Set to 'none' to turn off drawing whitespace, 'selection' to draw only the
# whitespace within the selection, and 'all' to draw all whitespace
drawWhiteSpace selection

# Set to true to removing trailing whitespace on save
trimTrailingWhiteSpaceOnSave false

# The encoding to use when the encoding can't be determined automatically.
# ASCII, UTF-8 and UTF-16 encodings will be automatically detected.
fallbackEncoding Western (Windows 1252)

# Determines what character(s) are used to terminate each line in new files.
# Valid values are 'system' (whatever the OS uses), 'windows' (CRLF) and
# 'unix' (LF only).
defaultLineEnding system

# Set to true to copy the selection to the clipboard whenever text is selected
# with the mouse
copyOnMouseSelect false
dogmeat
 
Posts: 5
Joined: Mon Sep 13, 2010 11:24 pm

Re: Automatic Indentation with Ruby?

Postby jps on Wed Sep 15, 2010 12:12 pm

There is automatic indentation for Ruby, and it should be working fine out of the box with 1.4.

To see if auto indent is turned on for you in Ruby files, open one, and in the console, enter:

Code: Select all
view.options().get('autoIndent')
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Automatic Indentation with Ruby?

Postby dogmeat on Wed Sep 15, 2010 1:19 pm

jps wrote:There is automatic indentation for Ruby, and it should be working fine out of the box with 1.4.

To see if auto indent is turned on for you in Ruby files, open one, and in the console, enter:

Code: Select all
view.options().get('autoIndent')


It comes out 'True'. But still no auto-indent. And not just in .rb files. Everywhere. As I said, I'm pretty sure I had auto-indentation when I installed. I guess I'll reinstall the app. Hope that fixes it.
dogmeat
 
Posts: 5
Joined: Mon Sep 13, 2010 11:24 pm

Re: Automatic Indentation with Ruby?

Postby jps on Wed Sep 15, 2010 1:22 pm

Perhaps you have a key binding that's taking effect on enter, and thus overriding the auto indent.

To reset to a vanilla installation, close Sublime Text and delete the %APPDATA%/Sublime Text directory, all settings and customizations are stored within there - a reinstall alone won't reset them.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Next

Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Gary King, Yahoo [Bot] and 13 guests