For .py files, NeoVim defaults to tabstop=8. This completely breaks the cursor positioning in vscode-neovim for tab-indented files.
This can be reproduced with a simple file with .py extension without modeline. My init.vim does not contain any settings related to indentation.
Does something like this fix the problem?
autocmd FileType python :setlocal tabstop=1
Yes, running the command from VSCode fixes the issue for newly opened Python files. Adding it to init.vim doesn't have any effect (neither in vscode-neovim nor in plain nvim).
@schiffermtq Did you reload the init.vim so $MYVIMRC after change ?
Also try autocmd FileType * ...
autocmd FileType * .... I assume that nvim already registers an autocmd that changes this by default, but after loading init.vim?FileType should be executed after default filetype handler, so it should work. Curious.
Try autocmd WinEnter,WinNew,BufAdd * ... then
With autocmd WinEnter,WinNew,BufAdd * ..., vscode-neovim works as expected. In plain nvim, I need to change out of the buffer and back until tabstop=1 is applied.
I also found the command let g:python_recommended_style = 0. Adding this to init.vim disables the tabstop override (and some other settings) from ftplugin/python.vim, which seems to be a better solution: all autocmds work as expected now, and vscode-neovim behaves correctly even without any of the autocmds.
Most helpful comment
With
autocmd WinEnter,WinNew,BufAdd * ..., vscode-neovim works as expected. In plain nvim, I need to change out of the buffer and back untiltabstop=1is applied.I also found the command
let g:python_recommended_style = 0. Adding this to init.vim disables the tabstop override (and some other settings) fromftplugin/python.vim, which seems to be a better solution: all autocmds work as expected now, and vscode-neovim behaves correctly even without any of the autocmds.