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

Cannot define default indentation for an empty file #847

Open
mildred opened this issue Apr 9, 2024 · 0 comments
Open

Cannot define default indentation for an empty file #847

mildred opened this issue Apr 9, 2024 · 0 comments

Comments

@mildred
Copy link

mildred commented Apr 9, 2024

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
  • open an empty file
  • indent is set to tabs
  • enable the set sw=2 sts=0 ts=8 et line on the vimrc
  • open a file with tabs
  • indent is not detected and stays to two spaces
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

1 participant