indentation

Is it possible to display Indentation guides in Vim?

I'm a longtime Vim user (3 or 4 years) who has recently started dealing with some deeply nested code. This code is indented with spaces, not tabs. I would like some clean and non-distracting indication of indentation to help with keeping track of which block of code I'm in when I'm looking at something many levels deep. :set list ...

Do you indent your HTML code?

I am almost obsessed with perfect indentation and alignment when writing code, but for some reason I don't feel comfortable indenting HTML markup. Maybe because some times the level of indentation gets too deep, but I usually just (ab)use VIM's folding feature. Is this considered bad practice? What's your style with markup indentation? ...

Need tool to format html (indent, add whitespace)

I am working on a .net project that generates html. When the html string is generated, the is no whitespace or indenting. This makes understanding the generated html difficult. Is there a tool that will take my string of generated html and format it so that it looks nice? ...

Parsing "off-side" (indentation-based) languages

An off-side language is the one where ...the scope of declarations (a block) in that language is expressed by their indentation. Examples of such languages are Python, Boo, Nemerle, YAML and several more. So my question is this: how do I actually parse these? How do I resolve tabs vs spaces problem (are two tabs or 8 spaces equiv...

how to draw <Bar> on each 4th space

I'd like (g)vim to draw pipe symbol '|' on each 4th space of indentation to show something like vertical indentation line. I found this plugin: http://vim.sourceforge.net/scripts/script.php?script_id=628 but it works only for 'tab'. I'm using spaces instead of the tabs. My .vimrc contains: set ts=4 set sw=4 set expandtab set softtab...

Visual Studio Macro to Indent C/C++ Braces

We have an old project that we maintain that uses brace indenting. Rather than having to change my Visual Studio options every time I switch projects, I'd like to be able to do this quickly and easily. I'm trying to write a macro in Visual Studio to turn Brace Indenting on and off. The checkbox is under Text Editor -> C/C++ -> Forma...

Sql indentation in SQL Server Management Studio

Folks, is there a tool to format/indent SQL Server queries in query window ? TIA ...

XML : tools for re-indenting XML in batch mode

I have a whole lot of XML files, badly indented. I wish to write a script or use a tool which re-indents all the files. Is there such a tool, or a nice library in a mainstream scripting language (preferred are Ruby and Python), or in Java ? ...

Is it possible to change the way Xcode indents comment blocks?

By default, Xcode automatically indents multiple lines of code within C-style comment blocks by one space: /* this is a comment block line 1 line 2 */ Is it possible to modify this behaviour? I would prefer to have no indentation within comment blocks. ...

Crazy haskell indentation

This the entire program: import Data.Char (digitToInt) myInt :: String -> Int myInt [] = error "bad input: empty string" myInt (x:xs) | x == '-' = -1 * myInt xs | otherwise = foldl convert 0 (x:xs) where convert acc x | x `elem` ['0'..'9'] = 10 * acc + digitToInt x | otherwise = error ("bad input: not a...

Way to get VS 2008 to stop forcing indentation on namespaces?

I've never really been a big fan of the way most editors handle namespaces. They always force you to add an extra pointless level of indentation. For instance, I have a lot of code in a page that I would much rather prefer formatted as namespace mycode{ class myclass{ void function(){ foo(); } void foo(){ bar(); } v...

(python) docstring is causing indentation error

def getText(nodelist): """Extracts the text between XML tags I took this directly from http://docs.python.org/library/xml.dom.minidom.html. For example, if I have a tag <Tag>525</Tag> this method returns me '525' """ rc = "" for node in nodelist: if node.nodeType == node.TEXT_NODE: rc = rc + n...

Why do I get "expected an indented block" when I try to run my Python script ?

I have an error which says "expected an indented block" Could you please guide me on how to deal with this error. Thank you:) Code example: for ch in f: ( translatedToken = english_hindi_dict[ch] ) if (ch in english_hindi_dict) else (translatedToken = ch) ...

Grab a line's whitespace/indention with Python

Basically, if I have a line of text which starts with indention, what's the best way to grab that indention and put it into a variable in Python? For example, if the line is: \t\tthis line has two tabs of indention Then it would return '\t\t'. Or, if the line was: this line has four spaces of indention Then it would return four...

Is there a way to enforce using tabs instead of spaces?

StyleCop offers to check for consistent use of spaces, but sadly lacks the opposite idea: Force source code to use tabs. Is there some way to add this functionality? It does not have to be StyleCop, other tools are welcome as well. ...

What is the proper indentation for bash scripts?

What is the proper indentation for a bash script? As a java/c++ monkey I religiously indent my code. But it seems you are not allowed to indent this code: #! /bin/bash if [ $# = 0 ] then # there was no arguments => just do to standard output. echo "there are no parameters" else cat << EOF =============================...

HTML Indentation in the mVc World

Here is a question that has been bugging me for a while, nowadays it's considered a good practice to indent HTML code but I've some reservations indenting code in a MVC pattern, here is a (silly) example: HTML Code: <!DOCTYPE html> <html> <head> <title>Testing MVC Indentation</title> </head> <body> <?php View('h1', 'I am a Level 1 He...

Can git automatically switch between spaces and tabs?

I use tabs for indentation in my python programs, but I would like to collaborate (using git) with people who use spaces instead. Is there a way for git to automatically convert between spaces and tabs (say, 4 spaces = 1 tab) on pushing/fetching? (similar to the CR/LF conversion) ...

indenting a bunch of lines in VIM

Is there a way to indent a selection of lines in vim, like we have in text editors where we select a bunch of lines and press tab (or shift tab) to indent/unindent the selected lines? I am talking about general indentation and not related to code indentation. ...

Vim automatically removes indentation on Python comments

I'm using Vim and editing Python scripts. Autoindent works pretty well in general, but when I start a new line and type '#' to type a comment, Vim unindents that line for me. For example, if have def foo(): and I press enter, Vim will indent properly def foo(): pass but, if instead of typing pass, I type '#', it unindents au...