Questions tagged [indentation]

Prefixing lines with whitespace to aid in readability.

39 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
0answers
462 views

Is there a setting to force a hanging indent on bulleted/numbered lists WITHOUT hard wrapping?

Basically, I'd like to have long entries for bulleted / numbered lists that automatically indent like so: 1. Congress shall make no law respecting an establishment of religion, or prohibiting the ...
5
votes
0answers
577 views

Mixed PHP and HTML indenting

Is there a way to have mixed indenting more like Sublime Text (left) than Vim does it? I would like the nested UL to follow the (line 10) to follow along the (main indentation).
5
votes
0answers
679 views

What is the best practice in vim8 for wrapping with indentation aka breakindent

To have proper paragraph wrapping with indentation in vim (after vim7.4) we could use this: " Wrap the text with identation isntead of the old way set breakindent set showbreak=\ \\_ Since vim8 ...
4
votes
0answers
53 views

Make Vim ignore first character in line while indenting

Whenever I have to edit Perl Mason files, I always have problems indenting lines due to Perl code starting with %. For example: <div> <div> % if( !$something ) { <...
3
votes
0answers
151 views

Why does Vim smartindent on one computer and not another?

I have the following in my .vimrc on both machines: filetype plugin indent on syntax on And yet, for some reason I only see the expected behavior on my Mac, and not on the other computer (which is a ...
3
votes
0answers
299 views

Is it possible to get the rule (cinoption) that govern the indentation for a specific line in vim

I have the following code: namespace { template<typename T> struct One // This is the odd line { // impl details } template<typename T> struct Two { // impl details } }...
3
votes
0answers
111 views

Formatting blocks of “commented out” text

I would like to be able to edit and format blocks of comments (in different markup and programming languages) as if the commenting characters (generally in the beginning of the lines) are ignored. ...
3
votes
0answers
206 views

Is there a way to add handlebars to html.vim?

I'm working with handlebars right now and I'd like to get tags like: {{#component 'whatever'}} {{/component}} and {{#if}} {{else}} {{/if}} to increase the indent count. Unfortunately, it doesn'...
2
votes
1answer
40 views

Format / Indent c++ as you type inside expressions

In visual studio, that code : for(int x=0;x<10;x++) {} becomes that code : for (int x = 0; x < 10; x++) { } as soon as you hit enter. I was wondering, is it possible, and if so, how can I ...
2
votes
0answers
169 views

vim auto indent suddenly stopped working

Recently, neovim auto indent was working fine, but suddenly it stopped working. here is my ~/.config/nvim/init.vim:- call plug#begin('~/.local/share/nvim/plugged') Plug 'townk/vim-autoclose' Plug ...
2
votes
0answers
204 views

Is it possible to color vim vertical indentation lines depending on the indentation level?

I'm using vim 8. In the attached picture you see yellow vertical lines that indicate the indentations of a code. Is it possible to color depending on their indentation level? E.g. all vertical ...
2
votes
0answers
109 views

Can someone explain the strange behaviour with indenting during reformatting?

Recently, someone noticed a strange behaviour with indenting during formatting with my LaTeX plugin, vimtex. I've researched it, and I've ended up creating a minimal example. Load the following code ...
2
votes
0answers
271 views

How do I fix indentation after multiline c++ initialization list?

When I have a long constructor that forces me to put initialization list items on separate lines, my indentations look like this after gg=G. Really_Long_Class_Name::Really_Long_Class_Name(int _arg1, ...
2
votes
0answers
241 views

Make vim version 7 edit xml files

I'm using old Debian linux an vim version 7.1.314. I would like to edit eclipse .cproject file that build using XML syntax. Currently vim shows not colored information. I found vim plugin that I hope ...
1
vote
0answers
23 views

Where can I find good indentation file for lex filetype?

I checked and found only a syntax file for lex filetypes in /usr/share/nvim/runtime/syntax, but found no indent file in /usr/share/nvim/runtime/indent I want my lex files to be properly indented; one ...
1
vote
0answers
33 views

How to indent HTML5 with omitted closing tags properly?

I try writing some HTML5 with omitted closing tags in NVIM v0.3.4, and get this: <ol> <li>3 <li>4 <li>8 <li>9 </ol> This ...
1
vote
1answer
31 views

How to stop auto indent for some file with particular suffix

In my .vimrc file, I add few lines to it so that some file could have nice auto indent, such as .f90 and .c file, but it also cause autoindent for .plt file. Is there some way like if statement that ...
1
vote
0answers
31 views

expandtab tab as 2 spaces show visually as 6 columns

How can 2-space indenting be shown as 6 column tab-style indents when editing, while remaining as 2-spaces? Background: a team uses a convention of 2 spaces for indenting code I prefer indenting of ...
1
vote
0answers
58 views

How to get html tag auto completion?

I can't seem to figure out how to implement auto tag completion for html. Is there a plug-in or something else you guys use that works? Is there just one thing I can download that will handle ...
1
vote
1answer
64 views

Dynamically toggle formatoptions based on input

Question: Is there a way to control the indentation + comment leader input, when adding a new line? Details: I am trying to set formatoptions-=cro when inserting a new line (in specific syntax region)...
1
vote
0answers
245 views

How to prevent Vim to collapse a fold with foldmethod=indent on a text paste?

I have the foldmethod=indent setting, the problem with it is that when I'm pasting a line or lines before the first line of a fold and all of these lines have the same or a greater level of ...
1
vote
0answers
40 views

Autoindent with minimal indentation

For some reason, Vim started to indent JavaScript in this crazy manner. I bet it's related to some settings in my syntax plugins, but I can't seem to figure out which ones are causing this behavior: ...
1
vote
0answers
550 views

vim autoindent not working correctly

This is what I have in my vimrc: if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/...
1
vote
1answer
69 views

equalprg with lisp (clojure) and custom indent settings

How do I make equalprg match my custom indent settings? They are like: let b:did_indent = 1 set expandtab set shiftwidth=2 set softtabstop=2 set autoindent And they format the code to this (...
1
vote
0answers
117 views

Vim enum indent for C++

When I use auto indent in vim, it almost working correctly, but in C++ 's enum, it have some problem like this: It should be like this: My indent settings: set expandtab set tabstop=4 ...
1
vote
0answers
41 views

How to ensure smarter indentation after multiline function header?

I am using Javascript with typescript if it matters (I don't think it does for this question for reasons that I will explain later) and I have the following code: veryLongFunctionName(arg1: type, ...
1
vote
0answers
253 views

Fix indentation after a multiline HTML tag

I have the following in .vimrc: set tabstop=2 softtabstop=-1 shiftwidth=0 expandtab filetype plugin indent on When I type the following in an HTML file: <html id="somethingverylong" > <...
1
vote
0answers
142 views

Why does cindent align statements to closing } in switch case?

I prefer this indentation style for switch cases with local variables: switch (expr) { case CONST_BLAH1: { int decl; // scope local to this case stmt; break; case CONST_BLAH2: ...
1
vote
0answers
91 views

What controls (de)indenting when inserting a brace character?

Working on a C file, Vim correctly indents as I type. In Objective-C, however, it gets indentation right, but deindentation wrong for instance methods, unless I exit insert mode and use the = operator....
1
vote
0answers
25 views

Parentheses off the page stop being recognized

I am using a recorded macro to manually wrap an extremely long string in a python script, like this: blah = ('blahblah ... blah blah') to blah = ('blahblah...' 'blahblah...' ... ...
1
vote
0answers
47 views

filetype plugin not loaded on files opened with edit command

I've turned on filetype indent and plugins on with the following in my vimrc file: filetype indent plugin on Everything is fine when I open a file from terminal, but if I open another buffer ...
1
vote
1answer
416 views

Vim indentation for html files

Most of my edits are done in .html files. However, I write a lot of jinja code and css in these html files. Problem 1: Jinja Indentation whenever I have a bloc such as this: {{ my_macro(arg1, ...
0
votes
1answer
19 views

How to have the cursor at the right indentation when editing PHP/HTML

When I'm working with HTML in a PHP file and I press enter while in INSERT mode, my cursor goes to the start of the next line instead of going at the right positive therefore I have to press tab to ...
0
votes
0answers
27 views

vim disable behavior special tags (eg script)

When editing html, vim applies different rules when inside certain tags (like script/pre/style). I want to have the normal html rules when inside a script tag (using handlebars, and I don't write any ...
0
votes
0answers
26 views

How do I get Vim (with TComment) to do proper block comments in OCaml?

(I have TComment installed, and I'm on NeoVim 0.4.0.) Given this code, for example: let mem key st = let is_matching_key = function | Positional _ -> false | Flag f -> f.name == key ...
0
votes
0answers
42 views

In PHP files, how can I auto close HTML tag pairs and indent the new line?

I have been a Vim user for several years now and I haven't been able to find a solution to this issue. There have been a lot of questions on the internet that try to address it, but none of the ...
0
votes
0answers
91 views

indentation different on different computers

If I indent the following script with gg=G: #!/usr/bin/env bash while true; do case "${1}" in -h) usage; exit 0;; -b) branch="${2}"; shift 2;; -t) build="${2}"; shift 2;; ...
0
votes
0answers
568 views

vim doesn't auto indent php files with html in it

In relation to this question: Auto indent turns off itself automatically on php files Vim has a php auto indent script; it behaves in following way: When autoindent is ON - if you open a php script, ...
0
votes
0answers
172 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("...