autoResetWidth doesn't work when shiftwidth/tabstop value is changed by an autocommand.
Steps to reproduce:
create neovim config .vimrc given below
create python file file.py given below
open nvim with nvim -u .vimrc file.py
inside nvim type :source .vimrc
nvim config .vimrc:
call plug#begin('~/.vim/plugged')
Plug 'Yggdroot/indentline'
call plug#end()
set shiftwidth=2
set tabstop=2
set softtabstop=2
set expandtab
augroup vimrc
autocmd!
autocmd FileType python setlocal ts=4 sts=4 sw=4
autocmd SourcePost * set filetype+=
augroup END
python file file.py:
import json
def nsum(x):
if isinstance(x, int):
return x
if isinstance(x, dict):
if 'red' in x.values():
return 0
s = 0
for i in x:
if isinstance(x, (list, tuple)):
s += nsum(i)
elif isinstance(x, dict):
s += nsum(x[i])
return s
with open('../input/12.txt') as fp:
data = json.load(fp)
print nsum(data)
Doing :setlocal sw+=0 reverts indentLine to what it should be.
I tried changing the autocmd SourcePost * set filetype+= line in the .vimrc to many variations to accomodate IndentLinesReset like:
autocmd SourcePost * set filetype+= | IndentLinesReset
autocmd SourcePost * set filetype+= | if has_key(plugs, 'indentline') | call IndentLinesReset(&shiftwidth) | endif
but I've only been running into errors:
E492: Not an editor command: IndentLinesResetE117: Unknown function: IndentLinesResetE521: Number required: '(&shiftwidth) | endif'
Can this be patched or do you have an idea for a dirty workaround?
autoResetWidth doesn't work when shiftwidth/tabstop value is changed by an autocommand.
Steps to reproduce:
.vimrc
given belowfile.py
given belownvim -u .vimrc file.py
:source .vimrc
nvim config
.vimrc
:python file
file.py
:after opening nvim with
nvim -u .vimrc file.py
:after doing
:source .vimrc
:setlocal shiftwidth?
->shiftwidth=4
:setlocal tabstop?
->tabstop=4
Doing
:setlocal sw+=0
reverts indentLine to what it should be. I tried changing theautocmd SourcePost * set filetype+=
line in the .vimrc to many variations to accomodateIndentLinesReset
like:autocmd SourcePost * set filetype+= | IndentLinesReset
autocmd SourcePost * set filetype+= | if has_key(plugs, 'indentline') | call IndentLinesReset(&shiftwidth) | endif
but I've only been running into errors:
Can this be patched or do you have an idea for a dirty workaround?