Skip to content
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

Polyglot is wrongly setting tabstop to 2 on several file types #648

Closed
ianliu opened this issue Dec 14, 2020 · 5 comments
Closed

Polyglot is wrongly setting tabstop to 2 on several file types #648

ianliu opened this issue Dec 14, 2020 · 5 comments

Comments

@ianliu
Copy link

ianliu commented Dec 14, 2020

Does this bug happen when you install plugin without vim-polyglot?
Don't know, because this happens on several file types, so I cannot pinpoint a single plugin. It also happens on files without a file type.

Describe the bug:
When Polyglot is enabled, tabstop is set to 2 on at least these files:

  • Makefiles
  • Text files
  • C/C++
  • Files without a type

On C/C++ is specially troublesome because shiftwidth is still 8, thus vim is adding 4 tab characters on every indentation level.

To Reproduce:
Enable Polyglot master (73c5187) and open vim. Now inspect the value of tabstop with set ts?.

@enzosaracen
Copy link

the default tabstop was set to 2 with commit 29ec69ffa095a16fe15e4c63c1a6ba90974efd74
deleting the code there that changes the tabstop to 2 fixes this for me

@ianliu
Copy link
Author

ianliu commented Dec 21, 2020

I've managed to circumvent the issue by setting let g:polyglot_disabled = ["autoindent"] before polyglot is loaded. Nonetheless, I think the default behavior is wrong and should be fixed; I don't really understand the purpose of the commit 29ec69f.

@sheerun
Copy link
Owner

sheerun commented Dec 29, 2020

Shiftwidth should now also be automatically set to 2 (or whatever tabstop is) which should fix this issue. If you really like 8 spaces tabstop, you can use let g:polyglot_disabled = ["sensible"]. If you wish to use custom tabstop, just write something like set ts=4 at the top of .vimrc (before vim-polyglot is loaded)

wangzq added a commit to wangzq/vim-polyglot that referenced this issue Apr 1, 2021
use 4 instead

sheerun#648
already setting tabstop to 4 but it still resets ps1 file type to 2 at random time

so decided to create a fork and stop the behavior
@shtrom
Copy link

shtrom commented Jun 25, 2021

The problem is still present. I found it as it messed up the indentation of files when seen on different systems. I don't think unconditionally changing such a default without a very specific configuration option to not do it is a good idea :

@rch77
Copy link

rch77 commented Jul 11, 2022

The problem is still present. Disabling "autoindent" or "sensible" creates other problems, like syntax not fully loaded for .blade.php, i.e. % key doesn't jump as it should on @if. Or Visual line not changing background if you have :set bg=dark
I don't think it is sensible to change tabstop=8 ever. It makes source unreadable without special tab decoding and can't work for anything but one-person projects. Even then you can't read it without any other editor/viewer.
And all I wanted just quick syntax highlighting for .blade.php.

~/.vimrc

set noexpandtab tabstop=8 shiftwidth=4 softtabstop=4 background=dark ignorecase textwidth=0 nocompatible modeline
set backup backupdir=~/tmp
set encoding=utf-8
set undofile updatecount=50 history=1000
" to prevent polyglog messing up with tabstop
"let g:polyglot_disabled = ["sensible"]
call plug#begin()
" The default plugin directory will be as follows:
"   - Vim (Linux/macOS): '~/.vim/plugged'
"   - Vim (Windows): '~/vimfiles/plugged'
Plug 'sheerun/vim-polyglot'
"
" Initialize plugin system
call plug#end()
set noexpandtab tabstop=8 shiftwidth=4 softtabstop=4 ignorecase textwidth=0 nocompatible modeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants