indentation

Combined HTML, PHP and Javascript indenting and syntax highlighting in vim

Hi all, I use vim for web development. These are almost always .php files, which also contain HTML and sometimes Javascript. While working in a block of PHP, indenting works fine. The syntax highlighting is okay, but only really useful for the PHP-code. When I want to edit an HTML block, I usually switch: :set ft=html, so that highlight...

How do I configure indentation in vim in a specific way?

If I type the following void main(int blah, and then press enter, I want to continue here: float blah); How can I achieve this? ...

Indenting Bash Script Output

Hello all, I am attempting to write a bash script and I am having difficulty making the output look neat and organized. I could fall back on just using newlines, but I would much rather have output that was easy to read. For instance, when I run git clone ..., I want to first echo "Cloning repository" and then have the output of git ind...

Why are my script tags rendered outside my body tag?

This is my nhaml code ^ var title="" !!! XML !!! Strict %html{xmlns="http://www.w3.org/1999/xhtml"} %head %title Nhaml Master #{title} _styles %body .page %h1 = "hello world" _ _scripts The resulting HTML renders the last tags as such: </div> </body> <script src="http://ajax....

Is there a text editor that will automatically determine whether to indent with spaces or tabs?

It's very easy to set a text editor to use spaces or tab characters with each press of the tab key. However, I'm working with a grip of Python code maintained by a large team of developers in my company, and some use spaces and some use tabs. I cannot simply make them all conform with each other, because 1) it would break git blame, 2) i...

Python: "Indentation Error: unindent does not match any outer indentation level"

I just can't figure out what's wrong with this... #!/usr/bin/env python # # Bugs.py # from __future__ import division # No Module! if __name__ != '__main__': print "Bugs.py is not meant to be a module" exit() # App import pygame, sys, random, math pygame.init() # Configuration Vars conf = { "start_energy": ...

XmlWriter.WriteRaw indentation

Hey I have a similar question like http://stackoverflow.com/questions/858630/xml-indenting-when-injecting-an-xml-string-into-an-xmlwriter. I also use XmlWriter.WriteRaw to output an XML fragment into an xml node. This document fragment does not follow the idention which would be nice. The answer given on the post above does not work fo...

Is there a utility to indent C++ programs

I am trying to use "indent" program to indent C++ programs. But it does not seem to work fine. It is messing up the indentation much more. It is a Class file. Can you please suggest the right options for it or another program that works? Thanks ...

How to handle widespread code format changes in a git repository

We have a project with around 500,000 lines of code, managed with git, much of it several years old. We're about to make a series of modifications to bring the older code into conformance with the developer community's current standards and best practices, with regards to naming conventions, exception handling, indentation, and so forth...

C macro/#define indentation?

I'm curious as to why I see nearly all C macros formatted like this: #ifndef FOO # define FOO #endif Or this: #ifndef FOO #define FOO #endif But never this: #ifndef FOO #define FOO #endif (moreover, vim's = operator only seems to count the first two as correct.) Is this due to portability issues among compilers, or is it ...

Is automatic bracket indenting in Gedit possible?

Hi, May anyone please help me if there are any auto indenting plugins/functions for the brackets in gedit(v2.22.3, Ubuntu 8.04) - specifically for C? I've tried the 'csmartindent' plugin however that doesn't seem to be working. On the href="http://live.gnome.org/Gedit/Plugins?action=AttachFile&amp;do=view&amp;target=csmartindent.tar.gz"t...

messy css indentation in vim

When editing an html file in vim, the indentation for css inside style tags is messy. For instance, this is how it would indent this sample css code without any manual intervention to fix the indentation on my part: div.class { color: white; backgroung-color: black; } Why is this happening? how can I fix it? ...

Django Templates: Wordwrap and indent block text

I'm a bit compulsive about having clean, readable and perfectly indented HTML. With Django’s template engine I almost have been able to achieve this with the exception of block text, or rather HTML generated by TinyMCE through the admin panel. The closest I could get is using the wordwrap filter; however this tag does not take any argume...

php: auto indent the whole code?

isnt there any software/plugin to netbeans/eclipse that auto indent the whole code after i've inserted it? not just indent when i press ENTER for new function. i want to paste in a code for example without indents and it will auto indent everything automatically since it can recognize what language is used. should save a lot of time. ...

Override TAB inside a Browser

If I'm typing text in a input field and press ENTER the default behavior of all the browsers I know is to submit the form, however if I press ENTER inside a textarea a new line is added. Is there any way to mimic this behavior (indent, not submit the form) whenever I press TAB inside a textarea? Bespin seems to do it, but in a canvas el...

Why Unexpected Indent?

Why does this happen? def LoadPackageList(): try: #Attempts to load package list... Adds each neccessary attribute into array print("Loading Package List... please wait") packages = [] packagelisturl = os.getcwd() + "packages.list" dom = minidom.parse(urllib.urlopen(packagelisturl)) tr...

Python's interpretation of tabs and spaces to indent

I decided, that I learn a bit of Python. The first introduction says that it uses indentation to group statements. While the best habit is clearly to use just one of these what happens if I interchange them? How many spaces will be considered equal to one tab? Or will it fail to work at all if tabs and spaces are mixed? ...

How to save XmlDocument with multiple indentation settings?

I need to save one XmlDocument to file with proper indentation (Formatting.Indented) but some nodes with their children have to be in one line (Formatting.None). How to achieve that since XmlTextWriter accept setting for a whole document? Edit after @Ahmad Mageed's resposne: I didn't know that XmlTextWriter settings can be modified ...

Can't change Emacs's default indentation between HTML tags

I'm confused about the Emacs indentation paradigm. I have this in my .emacs file: (setq-default tab-width 4) If I press TAB in the following situation <ul> (caret) </ul> it end up like this <ul> (caret) </ul> (with 2 spaces indent...

Indention in C++ Builder

In C++ Builder, how can I make sure that even correctly nested code like: void func () { ... .. ) C++ Builder correctly nested only doing so: void func () { ... ... } This is very stressful, because I always have to correct by hand. So how can I make which indents code as well in the first instance? ...