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.

365 questions
14
votes
4 answers

Can VIM autoindent SQL?

"SQL Statement indentation good practice" appears to be the accepted format for writing SQL blocks. Is there a Vim indent/syntax file that would adhere to this standard, or at least be close? Currently my Vim left alights pretty much everything and…
Mike
  • 3,818
  • 10
  • 28
  • 44
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
  • 7,741
  • 7
  • 28
  • 42
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
  • 486
  • 1
  • 4
  • 12
13
votes
1 answer

Make verbatim string literals auto-indent to stay aligned with nearby code

In C#, I often use verbatim string literals (e.g., @"Arrr!") to break long strings across multiple lines while preserving the layout. For example, I use it to break up inline SQL like this: var sqlString = @" SELECT Column1 ,…
RSW
  • 1,517
  • 1
  • 16
  • 36
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,186
  • 4
  • 29
  • 34
12
votes
2 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
  • 857
  • 1
  • 6
  • 20
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
  • 16,068
  • 19
  • 81
  • 128
11
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,148
  • 1
  • 10
  • 21
10
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)?
10
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,009
  • 1
  • 10
  • 25
10
votes
2 answers

How to auto format code indentations in VS2012?

How to auto format code in VS2012 to save time typing and deleting spaces and tabs?
mitaka
  • 2,069
  • 1
  • 27
  • 30
9
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
  • 9,453
  • 7
  • 55
  • 101
9
votes
4 answers

Sublime text comment indentation issue with Ruby

I use SublimeText since a few months with ruby, and I have a issue with comment auto-indentation. Indentation uses the comment's indentation, and indent all the following code using this indentation. I expect auto-indentation to ignore(at least) or…
9
votes
3 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
  • 855
  • 2
  • 10
  • 23
8
votes
4 answers

How to automatically indent the JavaScript code in Aptana Studio?

Previously I used Eclipse for PHP and Java development, and I liked the command Ctrl + i to automatically indent the code. Now am I using Aptana Studio that is based on Eclipse, for JavaScript development. I would like to automatically indent my…
Jonas
  • 97,987
  • 90
  • 271
  • 355
1 2
3
24 25