indentation

Emacs modes for flex and bison, or removing auto indent for these modes?

Emacs has poor handling of auto-indentation in Flex and Bison. In fact, it seems to have no support for flex mode. So, how does an emacs user cope with these? I like VIm but I would prefer not to switch because I am much faster and more comfortable in Emacs. I had a third party elisp module for Bison a few months ago but when its inden...

Adding indentation

I'm trying to make a parser for a made-up programming language. I'm now at the part of the exercise where we're required to make sure the parser's output is a conversion in C of the input. So things like... STARTMAIN a=b+2; return a ENDMAIN ...must become... int main () { a=b+2; return a; } So far so good, almost. The exercise als...

"Tab" in the middle of line. Indent instead of making a tab. (VS 2010)

Hi, I think the headline says it all. But when I'm hitting the tab button in the middle of a line of code I want it to indent the whole line instead of making a tab which is not very useful - I never use tab in the code besides indenting and if I have to use a tab in a string I use \t. I know it´s only saving me two buttons each time (o...

How can I make emacs' cperl-mode indent all statement continuations by only one level?

In emacs' cperl-mode, lines that continute a statement from a previous line are indented by one level: my $var = (1+1) * (2+2) / (3+3); However, if the statement does not begin at zero indentation because it is inside a block, then if you break your statement onto a third line, you get another level of indentation, and so on: s...

How to avoid wasting screen space writing sparse C# code?

The commonly accepted way to format C# code seems to be as follows: namespace SomeNamespace { namespace SomeSubNamespace { class SomeClass { void SomeFunction() { using (var someFile = new StreamWriter(somePath)) { try ...

Tidying PHP and HTML Code?

I wonder if anyone could please help me I have been using HTML tidy and eclipses built-in function to tidy up my code. I am having great trouble with the following situations... when HTML is split between files via includes, having result structured with correct indentations helps with debugging via browser tools. PHP and HTML when use...

Setting indentation for specific file types in Netbeans

I'd like to specifically set the number of spaces per indent for HTML files in Netbeans. In Options->Editor->Formatting, there are settings for "Number of Spaces per Indent" and "Tab Size", but the only granularity available seems to be either "All Languages" or "Java". Is there a way to specify settings for specific editors/file types ...

itextSharp.PdfPTable - changing indentation of series of tables

I am have to print out a series of data objects where each consists of a changing number of label-value pairs so the ideal structure for that is obviously the PdfPTable. And so far everything works fine with it. But the data objects are in a hierarchical relationship to each other and the hierarchy level needs to be expressed by differen...

Indent, pretty-print code including Django template tags, HTML, CSS, and JavaScript

In dealing with a bunch of crufty Django template files, I want to indent them. The files contain: HTML, the bulk of the file. Maybe a pre tag or two. JavaScript, inside script tags. CSS inside the style tags Django template directives inside {% ... %} pairs. Surely there is a tool to do this. Most of the tools do silly things whe...

XMLSerializer & Indentation [SOLVED]

Hi guys, im having a hard time trying to indent .xml files using XMLSerializer. I've tried serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);. I've tried to append \n into FileWriter but the output is the \n's and \t's at the beginning of the file and not in the right place. I've tried setPropery with t...

How to use only tab (not space) in vim

I prefer to use tab than white space(may be a little different from most of others) But I found, when I hit Enter at the end of line, it will add some white spaces, but not tab. So, I have to delete them and press tab. I want to know how to set vim as: use only tab to indent the lines a tab looks like 4-spaces, but actually is a tab ...

How do I indent a single line multiple times in vi or vim?

I've found several answers on how to indent multiple lines in vim, I want to know how to take a single line and indent it more than once. In effect, I want a shorter version of the following command: ">>>>>>>>>>" (That is 10 right bracket "greater-than" signs.) ...

CKEditor Compact HTML code

Hello! Is there anyway to tell CKEditor to not indent the code it generates from user input? It would be great if it would just add no extra spaces or tabs. Thank you. ...

Vim: Indent current (blank) line and insert

Say I have the current text in the buffer, where _ marks the cursor int main(int argc, char **argv) { printf("Hello, world!\n"); _ } I have indentexpr on (though a solution with cindent or autoindent will probably work, too). How do I begin inserting so my cursor is placed at the appropriate column to follow the indention rules,...

Is there any way to make Visual Studio stop indenting namespaces?

Visual Studio keeps trying to indent the code inside namespaces. For example: namespace Test { void Testing(); void Testing() { } } Now, if I un-indent it manually then it stays that way. But unfortunately if I add something right before void Testing(); - such as a comment - VS will keep trying to indent it. This is s...

C# Blank else to escape if bad practice?

I mean would it be bad practice if I want an if statement to have an else, but there is a nested if statement "in my way" so I use a blank else statement such as "else ;" or "else { }" to escape it? ex: if (lsvAddons.SelectedItems.Count > 0) foreach (ListViewItem A in lsvAddons.SelectedItems) if (Addons[A.Index] != null) Ad...

Why are certain bracket style/formats prefered in c/c++?

I've gotten the gist that the following <T> my_function(...) { .... } is preferred by most, compared to: <T> my_function(...) { .... } Likewise for: if (...) { ... } being preferred over if (...) { ... } Is this true and if so, why is the former style preferred over the latter? ...

Loop thru a directory and seach in all pre-filtered XML files for a word

Hello everyone, I would like to loop thru a given directory and seach in all pre-filtered files for a search word. I prepared this code, but it is not looping thru all files, only the last file which was found is analyzed. Ideally all files should be analyzed and the output should be saved in a textfile. Could someone help? Thank you in...

Risky to choose a non-standard Java code indentation style?

Does it make a difference if you choose a non-standard indent style? This is the style I see most often: import java.io.FileInputStream; import java.io.FileOutputStream; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class Test { static public void main(String args[]) throws Exception { FileInputStream ...

Is there a version of GNU indent which supports Objective C?

If so where can I get it? ...