sheerun / vim-polyglot

A solid language pack for Vim.
5.59k stars 295 forks source link

Cannot define default indentation for an empty file #847

Open mildred opened 7 months ago

mildred commented 7 months ago

Does this bug happen when you install plugin without vim-polyglot?

yes, tested with a minimal vimrc

Describe the bug:

With vim-polyglot autoindent feature enabled, but sensible feature disabled, when I open a new file, the default indentation is set to tabs. i'd like it to have set to two spaces unless the file opened already has a different indentation.

I tried to set set sw=2 sts=0 ts=8 et in my vimrc/init.vim thinking it would be overwritten by the autoindent feature when I opened a non empty file, but it makes the autoindent feature not working at all. I then always get two spaces of indent.

Also it would be great to have a vim command to re-detect the indentation of a file.

To Reproduce:

Running neovim 0.9.5

With the following vimrc

" vim: ft=vim

set nocompatible

" --------------------------------

" Automatic install of plug-vim
if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
if empty(glob('~/.config/nvim/autoload/plug.vim'))
  silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall | source $MYVIMRC
endif

let g:polyglot_disabled = ['sensible']

call plug#begin('~/.vim/bundle')

Plug 'sheerun/vim-polyglot'

call plug#end()

" default indent : 2 spaces
" set sw=2 sts=0 ts=8 et