Questions tagged [indentation]
92 questions
71
votes
8 answers
emacs: how to indent/unindent region of python code by 4 spaces?
I have a region of python code selected in emacs. What are the most efficient ways to indent and unindent every line in it by 4 spaces?
Ideally I'd like something that's not context sensitive (eg. it'll allow me to indent passages within docstrings…
Ian Mackinnon
- 5,924
19
votes
4 answers
Autoindentation in Sublime 2 text editor
Is there an auto indentation option in Sublime 2?
In Visual Studio I can press Ctrl+K+D to indent everything so the code is structured nicely.
Is there a shortcut in Sublime 2 to do the same?
Kim
- 191
18
votes
1 answer
VisualStudio: Automatically turn tabs into spaces
It's weird that Google did not bring up an answer to this question:
I am using Visual Studio 1.56.0 (user setup) and would like to configure an editor to input the appropriate number of spaces when I press the tab key, instead of inserting a…
user1934428
- 980
16
votes
6 answers
Vim copy/paste messing up indentaton
Whenever I copy something from another application and then go to paste it into vim, it messes up the indentation.
For example, just now I tried to copy the manifest.json file from the hello-world tutorial for creating chrome extensions.
It looks…
Luke
- 395
- 2
- 6
- 22
16
votes
4 answers
How can I show vertical indentations markers with Emacs?
I'm looking for an Emacs package or configuration that makes it possible to mark indentations with vertical lines, like those shown in the following screenshot of Sublime Text:
mfaerevaag
- 293
15
votes
4 answers
Re-indent shell script
I have a large shell script that uses a mixture of spaces and tabs. I want to re-indent
the whole file based on syntax, like Eclipse's Format. Is there a program (beautify ?) that will do this ?
I'm having a hard time figuring out the logic with…
jsymolon
- 296
14
votes
2 answers
How do I un-indent code?
I occasionally realise that I need to remove one level of indentation when coding (such as moving code out of loop). The problem is I end up with a bunch of lines all indented more than I want it to be and the only way to indent it the way I want is…
shortstheory
- 347
- 1
- 3
- 15
9
votes
1 answer
Correct indentation for selected code with BBEdit
Can I correct the indention of selected code (not my whole page) with BBEdit?
So if I had this:
It colud become this:
…
Evanss
- 1,358
9
votes
1 answer
How to format a XML file with long list of attributes?
I am currently working with XML files that contain elements with a long list of attributes. When I try to re-indent the whole XML file using xmllint --format myfile.xml only the elements are indented, the attributes still remain in one single…
blerontin
- 292
8
votes
2 answers
How to add indent in Python 3.4 interactive mode Terminator Linux?
I'm starting Python from basics.
The Python 3.4 Tutorial has an example for interactive mode:
>>> the_world_is_flat = True
>>> if the_world_is_flat:
... print("Be careful not to fall off!")
blablabla
I'm on Linux, using Terminator, default…
Hiperon43
- 283
8
votes
4 answers
Find and replace in Notepad++: How to insert above line with same amount of indents?
I need to replace, in a large number of Python files with many function definitions, all occurrences of
def some_func(foo, bar):
with
@jit(parallel=True)
def some_func(foo, bar):
with whatever level of indentation def some_func(foo, bar)…
srhslvmn
- 259
- 2
- 12
8
votes
3 answers
How do I make vim's autoindent not drop trailing spaces?
In some text editors (e.g. Kate, gedit), when auto indent is enabled, pressing return twice will leave a trailing whitespace (which I want):
if (code) {
....
....|
}
While others cater to the coding standard where trailing spaces (even in blank…
Joey Adams
- 2,318
7
votes
1 answer
How to improve Adobe Brackets auto indentation
I'm looking for a way to auto-indent my html code using Adobe Brackets.
Currently when I selected the whole code (Ctrl+A) and use the inbuilt indent option using Ctrl+],
The entire text moves a tab forward. What I'm looking for is to properly auto…
T J
- 172
7
votes
1 answer
How to select the currently indented lines in VIM
How I can selected the lines with the same indent?
For example:
if true:
line 1
line 2
...
line n
If the cursor is over line 2, how I can selected from line 1 to line n?
juanpablo
- 7,424
7
votes
2 answers
Enter insert mode indented in VIM
See above picture. My cursor is on line 23 at the start of the line in normal mode. What is a quick command to begin inserting at the correct indentation level?
brianc
- 173