Questions tagged [indentation]

Prefixing lines with whitespace to aid in readability.

Filter by
Sorted by
Tagged with
6
votes
1answer
369 views

equalprg to use for Python

Python is whitespace dependent, and it can't be totally autoindented for that reason, but there are a lot of extra stuff that should be possible to do automatically to comply with PEP8. Things like ...
108
votes
5answers
108k views

How to replace tabs with spaces?

Is it possible to convert tabs to spaces, while maintaining text alignment? Simply replacing only works usefully when there are no leading characters.
8
votes
1answer
190 views

Running cleanup commands only for edited lines possible?

Referring to clean-up tasks like (but not limited to) the ones detailed in these questions: Re-indenting badly indented code What's the simplest way to strip trailing whitespace from all lines in ...
10
votes
1answer
616 views

Incorrectly indents JavaScript chain calls

For example, if I have some JavaScript code like this: var widget = library() .chainCall1() .chainCall2() .chainCall3(); If I use the = command to auto indent it, it comes out looking this ...
42
votes
7answers
14k views

Re-indenting badly indented code

I like the smart-indent feature of Vim, it allows me to create well-indented code blocks. I regularly copy/paste code in to buffers, but that code is often poorly formatted. What would be ideal is ...
18
votes
3answers
17k views

How can I automatically indent on new lines?

I work on projects with varying levels of indentation. In many of these projects, because of how the files are typically structured, most lines are indented at least two levels (such as methods in ...
32
votes
8answers
2k views

How do I move vertically until reaching a non-whitespace character?

In a very long file with (accurately-) indented code, it may be helpful to move directly to a line of text above or below the cursor which delimits the indenting. (One way of doing this could be via ...
45
votes
2answers
8k views

How do I make Vim adapt to the current indenting style of the file I'm editing?

I work on a range of JavaScript projects. In most of these projects, the indentation of JavaScript files is 2 spaces, so I've set my default indentation width to that. However it becomes 1 or 4 in ...
41
votes
4answers
11k views

How can I change the default indentation based on filetype?

I'd like to have different indentations based on the type of file I am working on. For example, working on a .c file I'd like my indentation be 4 spaces. In .html files I'd like to (have to) work with ...

1
3 4 5 6
7