indentation

Notepad++: disable auto-indent after empty lines

I find the autoindent style of Notepad++ a little weird: when I am typing on an indented line, I do want it to indent the next line after I press Enter (this it does properly). However, when I am on an empty line (no indentation, no characters) and I press Enter, it indents the next line, using the same indentation as the last non-empty ...

Why does Python pep-8 strongly recommend spaces over tabs for indentation?

I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain. Is there an underlying reason for spaces to be preferred? I would have thought that tabs were far easier to work with. ...

Changing Vim indentation behavior by file type

I have done some googling and I'm surprised that I haven't found this. COuld someone explain to me simply the easiest way to change the indentation behavior of vim based on the file type? For instance if I open a python file it would indent with 2 spaces, but if I open powershell it would use 4 spaces. ...

Tab versus space indentation in C#

I sometimes find myself discussing this issue with other C# developers and especially if we use different styles. I can see the advantage of tab indentation allowing different developers to browse the code with their favorite indent size. Nonetheless, I long ago went for two space indentation in my C# code and have stuck with it ever sin...

How would you format/indent this piece of code?

How would you format/indent this piece of code? int ID = Blahs.Add( new Blah( -1, -2, -3) ); or int ID = Blahs.Add( new Blah( 1,2,3,55 ) ); Edit: My class has lots of parameters actually, so that might effect your response. ...

Tool to convert python indentation from spaces to tabs?

I have a some .py files that use spaces for indentation, and I'd like to convert them to tabs. I could easily hack together something using regexes, but I can think of several edge cases where this approach could fail. Is there a tool that does this by parsing the file and determining the indentation level the same way the python inter...

sane tab in emacs

I want to override the insane default tabbing scheme in emacs so that it will work like most other editors (eclipse, notepad++). For some reason I can't get it to go. I found a tutorial online ( first google result ), but none of the things there seemed to work. I want to set it so that regardless of mode, tab will insert a tab, and...

How would you parse indentation (python style)?

How would you define your parser and lexer rules to parse a language that uses indentation for defining scope. I have already googled and found a clever approach for parsing it by generating INDENT and DEDENT tokens in the lexer. I will go deeper on this problem and post an answer if I come to something interesting, but I would like to...

Is there an alternative to hyper-indented code?

I often run into code that has to perform lots of checks and ends up being indented at least five or six levels before really doing anything. I am wondering what alternatives exist. Below I've posted an example of what I'm talking about (which isn't actual production code, just something I came up with off the top of my head). public ...

How can I make Eclipse CDT auto-indent properly when using BOOST_FOREACH?

I write this tiny C++ example in Eclipse 3.4.1 (CDT 5.0.1): #include <iostream> #include <vector> #include <boost/foreach.hpp> int foo() { std::vector<int> numbers; BOOST_FOREACH(int n, numbers) { std::cout << n << std::endl; } std::cout << numbers.size << std::endl; } Then I hit Shift+Ctrl+F to format my code, and it b...

How can I indent code in the Vim editor on Windows?

Duplicate: How to indent a selection in gvim (win32)? How do I indent multiple lines quickly in vi? Using vim under linux I can indent a block of code using the VISUAL mode and pressing ">". In vim under Windows this does not happen. This is what happens: Press V, the VIM enter in the VISUAL mode Press 'Down', the VIM exit ...

Keep indentation of wrapped lines in Visual Studio 2008

In Visual Studio 2008, is there a way to keep the indentation of automatically wrapped long lines? (Only need it for C#.) When word wrap is turned on, it looks like this: var a = SomeFunctionOrWhateverWithSuperLongName(parameter1, parameter2); I want it to look like this: var a = SomeFunctionOrWhateverWithSuperLong...

Notepad++ tabs to spaces

Does anyone know how to convert tabs to spaces in Notepad++? I found a webpage that suggests it's possible (http://www.texteditors.info/notepad-replacements-compared.php) but I couldn't find any information about how to do it. I like to be able to do that because some web forms don't respect code with tabs in it. ...

Correct indentation of HTML and PHP using Vim

I've been using Vim for a while, and I can't get proper HTML indentation working in PHP files. For example, what I want is for each child to be indented one tab more than it's parent, as shown below. <?php if(isset($sports)) { //Do something ?> <div> <label>Uniform Size</label> <ul> <li class="left"><label for="s" class="small">S<...

python: IndentationError: unindent does not match any outer indentation level

When I compile the code below, I get IndentationError: unindent does not match any outer indentation level   import sys def Factorial(n): # return factorial result = 0 for i in range (1,n): result = result * i print "factorial is ",result return result Any ideas why? ...

How do I fix the indentation of an entire file in Vi?

In Vim, what is the command to correct the indentation of all the lines? Often times I'll copy and paste code into a remote terminal and have the whole thing messed up. I want to fix this in one fell swoop. ...

Is there any IDE or Visual Studio/Mono/SharpDevelop plugin for braceless C#?

When I saw this article about using a python-like sintax (indentation based, without curly braces, syntax) for C#, I begun to wonder: can I have an IDE that parses and compiles it? ...

How to prevent Vim indenting wrapped text in parentheses

This has bugged me for a long time, and try as I might I can't find a way round it. When I'm editing text (specifically latex, but that doesn't matter) files, I want it to auto-wrap at 80 columns. It does this, except if I happen to be in the middle of a parenthetical clause, it indents the text which is very annoying. For example, this...

No indent for paragraphs after figures?

The default style for my document is that paragraphs are indented. That's fine. But I need no indentation for paragraphs that follow a figure or other objects. Using \noindent manually does not work well, because you don't know which paragraph will follow the figure in the final output (LaTeX places figures automatically). So I need pa...

How can I custom indent a file with vim ?

I recently read this article related to indenting source files in Vim . However , I would like to be able to custom indent some of them . Is there a way to specify which binary runs when I press = ? ...