-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditional auto-indent not working as expected #2754
Comments
I tried to reproduce: # 1. create test dir
mkdir test
cd test
# 2. create files (contents below)
ls -1
# test.tex
# test.vim
# 3. start neovim
nvim --clean -u test.vim test.tex
# 4. Do "gg=G" to reindent the file - everything works as expected for me The contents of the test files: set nocompatible
set runtimepath^=~/.local/plugged/vimtex
set runtimepath+=~/.local/plugged/vimtex/after
filetype plugin indent on
syntax enable Clearly, you would have to change the I believe you are not doing a proper minimal test, e.g. perhaps you forget the |
Thanks for your quick response! Sorry for overlooking the I modified my I did some additional testing:
So, in sum, Thanks again! |
Sorry, should have added that indenting with |
Thanks, I see. I think I understand the problem now. So, given your example, The reason is because the implementation is built using state. This is done to prevent a possibly long "backward search" on every call to the indent function. It actually helps a lot to reduce delay, but it does have this specific side effect. |
Ok, I believe I've fixed this now by avoiding the use of the state. I realize the only "state" we need is the assumption that the previous line is correctly indented. |
Amazing, thanks so much! |
My pleasure; thanks for opening the issue. The previous implementation was clearly not so well thought out :) |
Description
Hello,
Conditional auto-indent isn't working as expected for me anymore.
Thanks for your help!
Steps to reproduce
Here is my minimal example:
Here is my minimal vimrc:
(Since I'm using vim-plug, syntax enable and filetype plugin indent on are automatically executed).
Expected behavior
I would expect 'True' and 'False' to be automatically indented as I am typing. Or, if for some reason they are not already automatically indented correctly, I would expect them to be correctly indented if I navigate to the line and type
==
.Actual behavior
As it is, the text does not automatically indent, either while I'm typing or if I use the
=
command.I can confirm that
g:vimtex_indent_enabled
is set to 1, and thatg:vimtex_indent_conditionals
is set to the default. I use Neovim, so autoindent is set to 'on' by default, but turning off autoindent makes no difference.Do you use a latexmkrc file?
Yes
VimtexInfo
The text was updated successfully, but these errors were encountered: