4 votes

Make Vim _really_ work with both spaces and tabs

When I press >>, it will indent code with 2 spaces setlocal shiftwidth=2 When I press Tab in Insert mode, it will insert the tab character setlocal noexpandtab When I press Backspace and ...
Matt's user avatar
  • 19.5k
3 votes
Accepted

Neovim keep html tags indented in react/jsx files

I just found an solution after a lot more searching on google. using treesiter and adding this into the treesitter config got my desired behaviour: require'nvim-treesitter.configs'.setup { indent =...
user44767's user avatar
3 votes
Accepted

Autoindent uses tabs after paste mode

The issue you're having is due to the 'paste' option having an effect on a series of other options and not simply disabling auto-indent. (See :help 'paste' for a list of all options that are affected ...
filbranden's user avatar
  • 27.5k
2 votes
Accepted

Make Vim _really_ work with both spaces and tabs

As you described in your question, and as Matt confirmed in his answer, you cannot do this using only Vim's options. We are, therefore, going to have to set up a mapping. There are several ways you ...
Rich's user avatar
  • 30.4k
2 votes
Accepted

How to stop vim from indent template in C/C++?

You can control the cindent indentation using the cinoptions (:help cinoptions). To not have the return type indented you can do: set cinoptions=t0 More information with :help cino-t
Vivian De Smedt's user avatar
2 votes
Accepted

Multiple "1 line >ed" messages

The messages are due to custom :h 'report' option setting. Just keep it set to default set report&.
Matt's user avatar
  • 19.5k
2 votes
Accepted

How to indent C function parameters like curly braces and not with cino-(

According to the documentation, the indentation is added from the line with the unclosed parenthesis (not with respect to the opening bracket), and that seems to be the behavior you're seeing in your ...
r_31415's user avatar
  • 556
1 vote
Accepted

How to turn off auto indenting while editing a LaTeX file?

To disable auto indentation you can do: :set noautoindent :set indentexpr= If you want to make automatic for all LaTeX files you could add a tex.vim file within ~/.vim/after/indent/ folder with the ...
Vivian De Smedt's user avatar
1 vote
Accepted

change behaviour of > / < and >> / << to insert / remove only leading tabs

Here's the code that does the job (only > and <, but you can easily add >> or <<). Assuming you have preserveindent set, it works in visual mode, as well as range motions e.g. >2j ...
Hoblovski's user avatar
  • 283
1 vote

What's the Vim option to make indentation matches source file?

My suggestion would be to install vim-sleuth that guess the indentation settings of the file and adapt the Vim configuration accordingly.
Vivian De Smedt's user avatar
1 vote

Neovim keep html tags indented in react/jsx files

The reason is that the indentexpr of react file is indenting the file as a javascript (javascriptreact is merely javascript for standard vim) file and not like an html file. You could force react file ...
Vivian De Smedt's user avatar
1 vote
Accepted

How do I determine the indentlevel to customize showbreak?

Set breakindent along with showbreak=…. You can control the indent with breakindentopt.
D. Ben Knoble's user avatar
  • 23.9k
1 vote
Accepted

How to get the right indent size in python lists?

Found this section in the python indentation file (/usr/share/vim/vim82/indent/python.vim on my machine): " When inside parenthesis: If at the first line below the parenthesis add " two '...
Burrito's user avatar
  • 121
1 vote
Accepted

Place cursor on opening brace, press "=%", why does the closing brace get indented (in addition to desired indentation of lines between the braces)?

The automatic indentation of the file generated by the = command (e.g. =% or =G) depend on your file type and your file type implementation. I can reproduce your problem when the filetype of the text (...
Vivian De Smedt's user avatar
1 vote
Accepted

Indent changes when using CoC, how do I stop this?

Vim loads multiple files as described in :h :runtimepath. In ftplugin/, you can add files like rust.vim where you define options for this filetype only. You may need to put the config in after/...
Biggybi's user avatar
  • 2,649

Only top scored, non community-wiki answers of a minimum length are eligible