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

[Bug Report] Why does targets.vim reset my filetype? #266

Open
laggardkernel opened this issue May 25, 2021 · 0 comments
Open

[Bug Report] Why does targets.vim reset my filetype? #266

laggardkernel opened this issue May 25, 2021 · 0 comments

Comments

@laggardkernel
Copy link

laggardkernel commented May 25, 2021

I have a file without any extension set ft=bash with modeline. Cause bash filetype is directed to sh in /usr/local/share/nvim/runtime/ftplugin/bash.vim.

" /usr/local/share/nvim/runtime/ftplugin/bash.vim

" Setting 'filetype' here directly won't work, since we are being invoked
" through an autocommand.  Do it later, on the BufWinEnter event.
augroup bash_filetype
  au BufWinEnter * call SetBashFt()
augroup END

func SetBashFt()
  au! bash_filetype
  set ft=sh
endfunc

When I open the file, filetype is set sh. (Basically modeline is overridden by runtime ftplugin/bash.vim.

Using targets.vim causes the ft set back to bash at the first time xmap i targets#e('o', 'i', 'i') being triggered.

Any ideas why does targets.vim reset my ft, what's the point?

Environments

  • Nvim: v0.4.4
  • targets.vim: 8d6ff29

Update 1:

Damn, a problem only exists with neovim 0.4.4. On latest vim 8, runtime ftpluign/bash.vim is changed to

" /usr/local/share/nvim/runtime/ftplugin/bash.vim

runtime! ftplugin/sh.vim ftplugin/sh_*.vim ftplugin/sh/*.vim

Not sure if it's related.

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