Questions tagged [indentation]

Prefixing lines with whitespace to aid in readability.

Filter by
Sorted by
Tagged with
7
votes
2answers
853 views

How do I prevent Vim from unindenting empty lines?

Vim keeps unindenting the lines I want to keep indented if I don't write anything on them... I'll give an example, where the | is the caret. Caret is indented and I press enter if expression: ...
0
votes
0answers
176 views

Using single quotes blows up syntax formatting in .js

Just noticed that using single quotes in javascript blows up automatic formatting sometimes: See the public/sass/*.sass line: Double quotes: gulp.task('compile-sass', function(){ gulp .src("...
5
votes
1answer
78 views

Auto-indenting copied text

I would like to auto-indent text blocks that I have just put. At a minimum, I would like to retab the new block of text, since otherwise I sometimes end up with tabs in files that shouldn't have tabs ...
1
vote
1answer
84 views

Search for continuation line

How to search for continuation line, as detected by c-indent in vim ? ie. the +N cinoption.
5
votes
1answer
714 views

Indentation of preprocessor directives

In my vimrc I have the following line, which figures all the indentation of my files. filetype plugin indent on When writing C programs sometimes I use preprocessor directives like #ifdef foo and #...
11
votes
1answer
547 views

How do I shift the line indent to a specific value?

Many times I run across a situation where a line is not indented properly. Ether through a paste, bad / not preferred indent plugin, or most often extra spaces offsetting the indent value. I usually ...
4
votes
1answer
1k views

Indenting VHDL as other programming languages

When I write VHDL Vim uses a mix of tabs and spaces which aim to align columns beneath the last parenthesis. For example, Vim will produce something like Inst_IMem: IMem PORT MAP( ...
6
votes
2answers
191 views

Deleting groups of autoindents in Insert mode

In my .vimrc I have set backspace=eol,start, which allows me to backspace over line breaks and the start of what I wrote since I entered Insert mode. This does not allow me to backspace over ...
3
votes
1answer
2k views

How to make auto-indent XML in vim?

I am thinking on a similar solution, which Eclipse also does: during the editing, the editor tries to always hold in a "well-indented" format of the edited textual data. Ideally, it would happen very ...
4
votes
1answer
289 views

Why does Vim force programming indentation when in “gitcommit” filetype?

I found that when I am using Vim to compose git commit messages (which I have been doing for a very long time now) that there are occasionally some quirks. For example today I wrote a commit message ...
6
votes
1answer
306 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 ...
4
votes
1answer
562 views

How can I specify a command-line command with options as an equalprg?

I am trying to set up the Node.js version of js-beautify as an equalprg command when I am editing a JavaScript file, so that the Vim = indent commands reflow my JavaScript at the same time. Initially,...
8
votes
1answer
180 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
575 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 ...
41
votes
2answers
6k 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 ...