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 ...
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 =...
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 ...
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 ...
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
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&.
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 ...
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 ...
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 ...
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.
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 ...
1
vote
Accepted
How do I determine the indentlevel to customize showbreak?
Set breakindent along with showbreak=…. You can control the indent with breakindentopt.
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 '...
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 (...
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/...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
indentation × 407vimrc × 43
formatting × 26
tab-characters × 21
key-bindings × 19
vimscript × 17
filetype-html × 17
filetype × 16
whitespace × 13
neovim × 12
cut-copy-paste × 11
filetype-python × 10
cursor-movement × 9
filetype-tex × 9
filetype-c × 9
syntax-highlighting × 8
filetype-c++ × 8
alignment × 8
visual-mode × 7
comments × 7
wrapping × 7
filetype-javascript × 6
filetype-php × 6
insert-mode × 5
folding × 5