targets.vim
targets.vim copied to clipboard
[Bug Report] Why does targets.vim reset my filetype?
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.