indentation

How do I instruct emacs to use 4 spaces instead of the tab character for all indentation?

What do I put in my .emacs file to use four spaces instead of the tab character for all indentation? ...

Incorrect emacs indentation in a C++ class with DLL export specification

I often write classes with a DLL export/import specification, but this seems to confuse emacs' syntax parser. I end up with something like: class myDllSpec Foo { public: Foo( void ); }; Notice that the "public:" access spec is indented incorrectly, as well as everything that follows it. When I ask emacs to describe the syntax at ...

Gnu Emacs indenting of my typedef

Gnu Emacs is insisting on indenting my typedef as follows: typedef enum { horizontal, vertical, } shapes; I want it to indent as follows: typedef enum { horizontal, vertical, } shapes; What switch can I use to get that? ...

emacs, override indentation

hi. Hopefully simple question: I have multiply nested namespace: namespace first {namespace second {namespace third { // emacs indents three times // I want to intend here } } } so emacs indents to the third position. However I just want a single indentation. Is it possible to accomplish this effect simply? Thanks...

Preserving indentation when inserting HTML from MySQL

I am using MySQL and PHP to populate parts of a site, often with HTML stored in a TEXT field. I like to keep my HTML indented so that the source is neat and easy to read, for example: <body> <div> <p>Blahblah</p> </div> </body> However, when the HTML is pulled from MySQL, I end up with: <body> <div> <p>Blahblahblah</p>...

emacs indentation in asm mode

I am looking for the equivalent of c-indent-level and ruby-indent-level, for asm-mode. That is, I want to force the indentation to 4 spaces, and I want them to be replaced with blanks. What I've seen tells me it does not exist for asm-mode. Could someone please tell me this is wrong? I tried this also: http://stackoverflow.com/question...

PHP correct indentation?

I'm a beginner PHP coder, recently I've been told I indent my code not correctly. They say this is wrong: if($something) { do_something(); } else { something_more(); and_more(); } While this is right? if($something) { do_something(); } else { something_more(); ...

2 Spaces or 1 Tab, what's the standard for indentation in the Rails Community?

I've noticed that most of the HTML/XML/HAML that gets generated from plugins uses 2 spaces instead of 1 tab. I use textmate and have tabs set to 4 spaces for HAML/HTML/XML and 2 spaces for Javascript/Ruby, but I only have to press the tab key once to get nice indentation. Pressing the space bar twice and delete twice seems like too muc...

Haml - if-else with different identations

I'm trying to render a calendar with Rails and Haml. The dates used come from a variable called @dates. It is a Date range that contains the first and last days to be presented on the calendar. The first day is always Sunday and the last one is always Monday. I'm planning to render a typical calendar, with one column per weekday (Sunda...

Vim replacing tabs with double spaces

So I've written some code of an assignment and i forgot the universities polocy of indent with 2spaces. Normally I'ld have put a: vim: ts=2:tw=2: et: at the top of my files, but this time i forgot. How should I go about replacing all tabs with 2 space? would s// work? (repalcing and with the respectiove characters. ...

How to fix broken automatic indentation in vim

Hi, I am trying to use vim 7.2 (on Windows XP) to automatically indent and format some VHDL and Matlab code. To do so I am trying to use the "gg=G" command. However this does not work properly. The code is not properly indented at all. To give you an example, I had the following source code, which was already properly indented: % This...

Suppress indentation after environment in LaTeX

I'm trying to create a new environment in my LaTeX document where indentation in the next paragraph following the environment is suppressed. I have been told (TeXbook and LaTeX source) that by setting \everypar to {\setbox0\lastbox}, the TeX typesetter will execute this at the beginning of the next paragraph and thus remove the indentat...

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? ...

AutoIndent for JavaScript in Vim that understands Semicolon Insertion

I don't end my JavaScript statements with semicolons when newlines will work. No flames, please. My question is, is there an automatic indentation package for vim that will work? Here is an example of how dumb it is: $(function(){ var foo // code starts here, // The following line breaks things, but adding a comment to it fix...

#indent "off" in F#

I just started learning F#, and tried a code from the wiki: I prefer tabs to spaces, so I change the code a bit into this: #indent "off" open System open System.Windows.Forms let form = new Form(Visible=true, TopMost=true, Text="Welcome to F#") let label = let temp = new Label() let x = 3 + (4 * 5) temp.Text <- sprint...

Emacs enum indentation

I'm having a problem with Emacs's indentation of Java enums. While it indents the first member OK, it wants to give all of the rest of the static enum members an additional level of indentation. It looks like this: class MyClass { public enum MyEnum { ONE(1), //good TWO(2), // not good! THREE(3), ...

how to make Xcode indentation from beginning of previous line?

ok, possibly insanely n00b question or something i have overlooked in Xcode prefs: On pressing return, in stead of Xcode's syntax-aware indentation doing smart indent from whatever brackets i've used on the previous line, how can I make it so Xcode indents just from the beginning of the previous line? From the picture below, first block...

Can I customize the indentation of ternary operators in emacs' cperl-mode?

In emacs cperl-mode, ternary operators are not treated specially. If you break them over multiple lines, cperl-mode simply indents each line the same way it indents any continued statement, like this: $result = ($foo == $bar) ? 'result1' : ($foo == $baz) ? 'result2' : ($foo == $qux) ? 'result3' : ($foo == $quu...

Indent guide plugin for gedit (python).

See the indent guides? They're damn helpful when writing Python code. Any chance I could get something similar for gedit? I wouldn't mind having to write my own plugin, as long as it's in Python... So: Is there a plugin for this which works with gedit? If not, would it be possible to write one in Python. ...

How do you use indent in vim for web development?

I'm starting to use Linux and Vim at work. I'm started reading vims documentation and creating my own .vimrc file and such. I'm a web developer working with HTML, XML, CSS, JS, Python, PHP, ZPT, DTML and SQL. I would like to have an indent feature like this one: for each language/set, a corresponding indent solution. So, in js, writin...