Questions tagged [auto-indent]

Auto-indentation is used in programming tools (IDEs and source code beautifiers) to automatically adjust the amount of leading white space on a line.

Auto-indentation is used in programming tools (IDEs and source code beautifiers) to automatically adjust the amount of leading white space on a line. In certain programming languages, such as Python, Haskell, and Occam, indentation is crucial for to demarcating the programming structure, and so auto-indentation plays an important role in facilitating this.

402 questions
16
votes
2 answers

Indenting Objective-C literals with Xcode

Xcode think that this: NSArray *persons = @[ @{ @"name": @"Bob", @"pet": @"cat" }, @{ @"name": @"Alice", @"pet": @"dog" } ]; would be better indented like so: NSArray *persons = @[ @{ @"name":…
Tyilo
  • 28,998
  • 40
  • 113
  • 198
15
votes
3 answers

Put break before colon and after comma in constructor

I'm trying to create a constructor initializer format like: Constructor() : initializer1(), initializer2() According the documentation, I tried to set BreakConstructorInitializers to BeforeColon (the description says: "Break constructor…
Ádám Bakai
  • 159
  • 1
  • 5
15
votes
3 answers

Disable auto indent globally in Emacs

How to disable auto indent in Emacs globally or only for some modes? I have a number of packages installed for RubyOnRails (ruby, html, js, css). Let's say I want to disable autoindent for css-mode.
msorc
  • 907
  • 1
  • 7
  • 20
15
votes
1 answer

How do you enable file specific tab indent settings in VIM?

I believe there is a method to write a comment in a file that vim will use to override default tabbing and indent values. Can someone point me to information about this feature and how to use it?
cmcginty
  • 113,384
  • 42
  • 163
  • 163
14
votes
4 answers

Auto-indent after pressing `Enter` between tags

Please see the GIF below: I am using Visual Studio Code. By pressing Enter and Ctrl + Shift + Enter. I can make the auto indent in the next line. So, I guess there is a more convenient way or package which can accomplish that by just pressing…
xianshenglu
  • 4,943
  • 3
  • 17
  • 34
14
votes
2 answers

Can I fix Groovy indenting in Vim?

I am trying to use Vim for some Groovy code at work. It doesn't seem to handle autoindents well when semicolons are not used. I've found a few questions related to Ruby and JavaScript with the same issues, but none of the fixes I find work for me.…
DuckPuppy
  • 1,336
  • 1
  • 12
  • 21
14
votes
2 answers

Auto indent method chaining in Sublime Text 3

As I type the following javascript code (exact keystrokes): myObject .doSomething() .doSomethingElse(); I'd expect it to automatically become the following... myObject .doSomething() .doSomethingElse(); ... as would any other programmer,…
eye_mew
  • 8,855
  • 7
  • 30
  • 50
13
votes
4 answers

How to Autoindent Ruby source code in Vim

suppose I have set cindent in .vimrc def func() followed by Enter, and then type end, it is indented(not aligned to the def) How to reindent the end keyword(align it to the def). Even using endwise.vim plugin doesn't fix the problem…
user815693
  • 516
  • 1
  • 6
  • 12
12
votes
3 answers

Vim: How to indent to an open paren or bracket when hitting enter?

I've been programming Python with Vim for a while but one thing I haven't been able to figure out how to do it set it to auto indent to the level of the last open paren. According to pep8 if you have an open paren and you need to break the line to…
William
  • 6,338
  • 4
  • 32
  • 36
11
votes
5 answers

Visual Studio 2005 : Is there an easy way to indent correctly in an ASPX file?

In Visual Studio 2005, is there a way to indent correctly the tags in the aspx file (not in .cs files but really in ASPX files which contain HTML/ASP code)?
11
votes
1 answer

How to set autoindent after open parenthesis

When I type an open parenthesis followed by a newline, I'd like the cursor to autoindent one tab value--the same way it does with an open curly brace or open square bracket. For some reason, it indents two tab values. I'm particularly interested in…
rampatowl
  • 1,722
  • 1
  • 17
  • 38
11
votes
4 answers

Automated indentation cleaner for MATLAB or Octave?

Does anyone know of an existing method of automatically cleaning the indentation of a MATLAB/Octave script? I've got someone else's code (no, really!), and it's horrible - none of the loops or functions are indented, and half of the other lines are…
naught101
  • 18,687
  • 19
  • 90
  • 138
11
votes
4 answers

How to tell Vim to auto-indent before saving

I have recently started using Vim for my graduate level projects. The main problem I face is that sometimes I check in unindented code. I feel if I can somehow create a shortcut of auto-indent+save+close then that should solve my problem. My .vimrc…
Amey Jah
  • 913
  • 3
  • 11
  • 24
10
votes
2 answers

Vim: Indent with tabs, align with spaces

I've already read several questions and answers: Vim: Use tabs for indentation, spaces for alignment with C source files Vim: Align continous lines with spaces But none of them offers a solution for me. I really want to apply the "Indent with…
Dmitry Frank
  • 10,417
  • 10
  • 64
  • 114
10
votes
1 answer

How to get auto indent (not smart indent) in emacs in all modes

I'm new to emacs, and its indenting is driving me up the walls. It's too smart for its own good; it (incorrectly) thinks it knows how I want to format my source, but I don't have time to chase down every setting for every mode for every different…
Barry Kelly
  • 41,404
  • 5
  • 117
  • 189
1 2
3
26 27