indentation

completely lucid tabs and spaces in emacs?

The title of my question is a reference to sane tabs in emacs. Basically what I want is to globally set tabs and indention to work in some uniform way. I feel like emacs is so much better than TextMate or BBEdit but really the way they handle indention is simple and great for my purposes. In emacs if you use some tab/space scheme that'...

Reformat C++ braces without changing indentation?

We would like to make our C++ brace style more consistent. Right now, our code contains a mix of: if (cond) { // ... } else { // ... } ...and: if (cond) { // ... } else { // ... } We want to use the latter style exclusively. However, we don't want to change the indentation of our code. I've tried using astyle,...

Any Emacs command like paste-mode in vim?

When i'm trying to paste some code from browser to Emacs, it will indent code automatically, is there any way to stop Emacs from indenting temporarily like :set paste in vim? ...

What are the names of the different Bracing/Indenting styles in C/PHP/Java etc?

In languages that use 'curly braces' for code blocks, and where whitespace isn't a concern (C, Java, PHP) - What are the names for the different bracing/indenting styles? I remember reading about 'KNF' and 'Flag', but it'd be great to have the most recognized names, along with some simple examples of each. ...

Change Visual Studio 2008 HTML indentation style

Visual Studio 2008 insists on indenting HTML like this: <h1> title</h1> <h2> subtitle</h2> where for me, this is much nicer: <h1>title</h1> <h2>subtitle</h2> Is there any way to tell Visual Studio 2008 to use the later indentation style when doing auto-formating? ...

indent XML text with Transformer

I'm writing an XML file with the following code: Source source = new DOMSource(rootElement); Result result = new StreamResult(xmlFile); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.transform(source, result); and this is the output file...

Python error when running script - "IndentationError: unindent does not match any outer indentation"

I'm getting an error when I try to run my script Error:"IndentationError: unindent does not match any outer indentation" Code snipet that throws the error: def update(): try: lines = open("vbvuln.txt", "r").readlines() except(IOError): print "[-] Error: Check your phpvuln.txt path and permissions" ...

Python 4 whitespaces indention. Why?!

Hi All. While coding python I'm using only 2 spaces to indent, sure PEP-8 really recommend to have 4 spaces, but historically for me it's unusual. So, can anyone convince me to use 4 spaces instead of 2? What pros and cons? P.S. And finally, what's easy way to convert all existing codebase from 2 spaces to 4 spaces? P.P.S. PEP-8 Al...

Setting initial indent level for PHP in Emacs?

I typically code my PHP with one level of indentation after the initial <?php, but I'm having trouble finding a setting for this in Emacs with php-mode. To be clear, here's what Emacs is doing: <?php echo "Hello."; if (something) do_something(); And here's how I usually code: <?php echo "Hello."; if (something) ...

Can vim be made to only expand tabs to the left of text?

Using vim, I would like to effectively have expandtabs off if I'm to the left of any text on the line and on if I'm to the right of any non-whitespace character. (I would like to use tabs for indentation and spaces for alignment.) Can this be done? ...

How to properly indent PHP/HTML mixed code?

When mixing PHP and HTML, what is the proper indentation style to use? Do I indent so that the outputted HTML has correct indentation, or so that the PHP/HTML mix looks properly formatted (and is thus easier to read)? For example, say I have a foreach loop outputting table rows. Which one below is correct? PHP/HTML mix looks correct: ...

Highlight Indentation in Visual Studio IDE 2005

I want to HighLight Indentation in Visual Studio IDE 2005. I want to replace space with periods(.) for e.g:- This is what I want main .{ ..Print("hello World"); .} ...

Visual Studio, per solution indentation settings

I'm working on a couple of different things and some use tabs, some use 2 spaces for indents, another users 4 spaces for indents etc. The option to set this in Visual Studio is in Tools->Options->Text Editor-><language>->Tabs Is there some way to override these settings on a per solution bases? ...

AutoIndent in Eclipse possible?

I have been wracking my brain trying to figure this out. For the first time I used jEdit the other day and I was pleasantly surprised that it auto indented my code (meaning that I'd put in the following code: int method () { _ //<-- and it put me here automatically I've tried to get the same thing working with eclipse but with no ...

Indenting CSS in emacs

So emacs's auto-indentation for CSS is driving me batty. Here is what I like CSS to look like: #foo ul.bar { .... } #foo ul.bar li { .... } #foo ul.bar li a { .... } This is what emacs gives me with its auto-indentation: #foo ul.bar { .... } #foo ul.bar li { .... } #foo ul....

Can all language constructs be first-class in languages with offside-rules?

In LISP-like languages all language constructs are first-class citizens. Consider the following example in Dylan: let x = if (c) foo(); else bar(); end; and in LISP: (setf x (if c (foo) (bar))) In Python you would have to write: if c: x = foo(); else: x = bar(); Because Python desting...

Objective-C indentation in emacs

I'm using Emacs to edit my Objective-C code. The default indentation looks like this: NSTimer *timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(callback:) userInfo:nil repeats:YES]; I would like Emacs to indent the code like XCod...

Not indent the first paragraph of a LaTeX document

In the standard LaTeX article class (and probably others as well), paragraph indentation follows standard American publishing norms of not indenting the first paragraph after a section{} or subsection{}. I've redefined \maketitle in a LaTeX document and put the actual title left-aligned as the last line, fairly close to the actual text...

Indentation problem in f# (vs2010 beta1)

Hi, I'm just learning f# so possibly I'm doing something very silly. Feel free to point me to the relevant documentation, I've searched but wasn't able to find. I am using Visual Studio 2010 beta on windows 7 (.Net 4.0). Everything is going well with my first f# project. Well.. almost everything. In particular I'm writing a very simpl...

How do I autoident in Netbeans?

In eclipse you can click Ctrl+I at any line, and it'll automatically indent the line or group of lines according to the indentation scheme you chose in the settings. I'm really missing this feature in Netbeans. Is there any equivalent feature? I'm aware of Alt+Shift+F but it's not good enough. I want to indent a group of lines, and not...