Questions tagged [indent]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
37 views

How to re-indent nginx configuration based only on `{` and `}`?

I want to reindent an nginx configuration file with the following simple rudimentary rules: a { increases indentation a } decreases indentation The idea is cindent is just enough to do it. I have ...
1
vote
2answers
28 views

Where should I put filetype specific options for indentation?

At moment, mostly for random reasons, I have $ cat ~/.vim/ftplugin/c.vim set tabstop=2 softtabstop=2 expandtab shiftwidth=2 smarttab smartindent autoindent cinoptions=g2 and this $ cat ~/.vim/...
2
votes
1answer
20 views

text object for current indentation level? [duplicate]

Say I have an indented block like so int main(int argc, char **argv){ printf ("odd numbers between 1 and 10:\n"); // level 1 for (int i = 1; i <= 10 ; i ++) { // ...
0
votes
1answer
29 views

How to make a filetype behave exactly like C++?

I want the filetype .my_cpp and .my_cc to behave exactly like C++ files in Vim. I have the following set: autocmd BufNewFile,BufRead *.my_cc set syntax=cpp autocmd BufNewFile,BufRead *.my_cpp set ...
1
vote
1answer
238 views

Vim mapping to auto-indent when entering inside braces, brackets etc

Which vim mapping/ plugin will help me in auto-indenting when entering inside braces, brackets or any similar characters. For example: Input {press enter} Output { cursor here } I want ...
0
votes
1answer
29 views

Quick question about indentation

Just had a quick (and probably stupid) question about indentation. When I try editing a script, one of my settings seems to "freeze" the indentation several tabs in, and I can't figure out ...
2
votes
1answer
44 views

Creating a new indented line with a closing bracket below when hitting enter

I'm coming to Vim from VSCode. So far, it's been great although I've noticed I have some muscle memory movements that I've had trouble moving to Vim. When I write something like this (cursor is ...
0
votes
2answers
36 views

How to make the indentation more smart

I'm using vim to code and I set autoindent in my ~/.vimrc. Now, if I code as below: if (a == 1) {| // the cursor is here and I type ENTER } After typing the ENTER, the code becomes as below: ...
0
votes
1answer
53 views

Vim ignores `filetype indent off`

I don't have a personal vimrc. I use /etc/vimrc. The last 2 lines are: let testvar=999 filetype indent off I confirmed execution at the vim prompt using :echo testver, which displays 999. I tried ...
2
votes
2answers
57 views

Fix indentation in a file while keeping cursor on the same line

I'd like to use vim's builtin indent fix feature on an entire file. I have looked up answers, but all I found were suggestions to type gg=G, the only problem being that it brings your cursor to the ...
1
vote
1answer
146 views

How to disable intelligent indent for text/markdown files?

Since ever in my configuration of vim text and markdown-files are indented on following lines to align with open parenthesis. Text Text Text (e.g. Hello World) More Text This happens ...