indentation

Vim auto-indentation: Align an array initialization which extends over multiple lines

Sometimes an array initialization in C extends over several lines, especially if the array is multidimensional. In Emacs the result of auto-indentation looks like this: int a[N][N] = {{0, 0, 6, 7, 0, 4, 0, 2, 0}, {0, 5, 0, 6, 0, 0, 0, 0, 1}, {2, 0, 0, 0, 0, 8, 0, 0, 4}, {4, 0, 9, 5, 0, 7, 0, ...

Dealing with code indentation in Vim?

Hello, I work on an engineering team of 4 people, mostly writing javascript while occasionally dabbling in ruby and python. So, as a team, we share code all the time, and as most programmers do, each member of the team has his favorite level of indentation & related settings. I am one of 2 members of the team who use and love Vim as my ...

How to deal with IndentationError?

Error Details: File "imp.py", line 55 key = get Key() ^ IndentationError: expected an indented block Below is the Code: # Caesar Cipher MAX_KEY_SIZE = 26 def getMode(): while True: print('Do you wish to encrypt or decrypt or brute force a message?') mode = raw_input().lower() if mode in 'encryp...

How to configure emacs to auto-indent with fixed spaces instead of align to the open parenthesis?

For example, I would like this style of indention: int expectedIndent(int param1, int param2){} instead of this style: int currentIndent(int param1, int param2){} Thanks in advance, Utoah ...

How to fix indentation in C, C++ and Fortran ?

Possible Duplicates: Code polisher / reformater for C, C++ or Fortran Best C++ Code Formatter/Beautifier I have code in C, C++ and Fortran (both f77 and f95) in a strong need for proper indentation (that is: they have none). I remember some tool to fix indentation, although I'm unable to find it, and as far as I recall, it j...

Text indenting in a csharp textbox control

Is there a simple way to indent a multiline selection by pressing the tab-key or shift-tab to remove tabs at the beginning of each selected line in a c# textbox control (VS2008)? ...

IndentationError: unexpected indent error

I am new to Python and am getting this error: Traceback (most recent call last): File "/usr/local/bin/scrapy", line 4, in <module> execute() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scrapy/cmdline.py", line 130, in execute _run_print_help(parser, _run_command, cmd, args, o...

Formatting of dynamically generated HTML - does no one care?

Possible Duplicate: Formatting of dynamically generated HTML - does no one care? I have very little experience in web development, so this may be a very basic question. It's just, from the limited experience I do have (a little PHP, and a little Ruby on Rails), it seems that the way dynamically generated HTML is formatted jus...

Formatting of dynamically generated HTML - does no one care?

I have very little experience in web development, so this may be a very basic question. It's just, from the limited experience I do have (a little PHP, and a little Ruby on Rails), it seems that the way dynamically generated HTML is formatted just "doesn't matter"; it ends up ugly, with weird indentation, and nobody cares because that i...

Python indentation when adding looping statements to existing code

In Python, what do you do when you write 100 lines of code and forget to add a bunch of loop statements somewhere? I mean, if you add a while statement somewhere, you've to now indent all the lines below it. It's not like you can just put braces and be done with it. Go to every single line and add tabs/spaces. What if you were adding n...

vim auto indenting lines without semicolons in Ruby

For some reason, in vim whenever there is a line of ruby code with a function including parentheses, eg: string = gets() without a semicolon the next line is indented a level. When there is a semicolon, it works fine. Any ideas as to why this is happening and how to fix it? Also, since it will probably be requested, here is my ~/.vimrc ...

How to automatically indent source code in visual studio 2010?

How to automatically indent source code in visual studio 2010? I have used Ctrl + K , Ctrl + F, but it does not works, is there any other way/plugin could do this work? ...

Indenting partially selected lines in TextMate

Is there any way to make TextMate indent an entire line when only part of it is selected? Currently, when I select several lines by dragging my mouse over them, or holding shift and pressing up/down, pressing the indent key (Opt-TAB) only shifts the selected portion of the line by one indent level. That is worse than useless to a progr...

How to change indentation in text-mode for emacs

I'm in text mode and want my tab key to indent a line to two spaces. The file looks like this: Line one Line two The cursor is situated before the 'L' : "Line two", and I hit TAB and it gets indented 6 spaces as opposed to the desired 2 spaces. Actions I've tried: I've tried updating the variable: tab-stop-list (setq tab-stop-li...

Pretty-print for shell script

I'm looking for something similiar to indent but for (bash) scripts. Console only, no colorizing, etc. Do you know of one ? ...

Whitespace and indentation in F#

I'm just learning about F# and plan to use it for my next project. One thing I find immediately confusing is the lack of support for tab characters in .fs files. I love how indentation is used to show scope/hierarchy, but using spaces just seems so antiquated. Do I have to press backspace four times just to get back to the parent block? ...

Reindenting HTML with Embeded Ruby Code (erb)

I'm wondering if there's an existent solution to the following problem: I have the following code: <div> <div> <div><%= {:something => 'abc', :else => 'abc', :nice => 'ok'} %> </div> </div> </div> As you can see it's unested and hard to read. I was wondering if there's an existent tool preferably in ruby which c...

Ruby.vim indent fails with each..do leading with regex containing a hash ('#')

I'm editing Ruby code in Vim. There is a failure in the Ruby.vim indentation which is bugging me. Here is a block of code with correct indentation: text.scan(/#/).each do |match| line1 line2 end Here is how Ruby.vim indents the code: text.scan(/#/).each do |match| line1 line2 end All lines subsequent to line2 are inden...

multi lines python indentation on emacs

Im an emacs newbie, I want emacs to be able to indent my code like this egg = spam.foooooo('vivivivivivivivivi')\ .foooooo('emacs', 'emacs', 'emacs', 'emacs') It's not possible to do this automatically by default (without manually inserting spaces or C-c >), since emacs always indents 4 spaces (unless Im splitting multiple a...