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

vim-polyglot unsets b:is_bash in *.bash files #823

Open
openjck opened this issue Nov 9, 2022 · 1 comment
Open

vim-polyglot unsets b:is_bash in *.bash files #823

openjck opened this issue Nov 9, 2022 · 1 comment

Comments

@openjck
Copy link
Contributor

openjck commented Nov 9, 2022

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

No, it does not. This bug appears to be related to logic in vim-polyglot's autoload/polyglot/ft.vim file.

Describe the bug:

When vim-polyglot is installed, b:is_bash is unset in [filename].bash files. This causes the undesired behavior described in dense-analysis/ale#3988, where ALE treats Bash files as sh files.

To Reproduce:

Steps to reproduce
  1. mv ~/.vim ~/.vim.bak.vim-polyglot-issue-823.$(date '+%s')
  2. git clone --depth 1 https://github.com/sheerun/vim-polyglot ~/.vim/pack/plugins/start/vim-polyglot
  3. vim example.bash
  4. On Vim's command line, run :echo b:is_bash.
Actual results

E121: Undefined variable: b:is_bash

Expected results

1

@openjck
Copy link
Contributor Author

openjck commented Nov 10, 2022

If anyone needs a workaround, I've found that this does the trick:

after/ftplugin/sh.vim:

" Work around the following bug in vim-polyglot, which causes ALE to treat files
" with the "bash" file extension as POSIX shell scripts.
"
" https://github.com/sheerun/vim-polyglot/issues/823
if expand('%:e') ==? 'bash'
  let b:is_bash = 1
endif

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