vim-jetpack icon indicating copy to clipboard operation
vim-jetpack copied to clipboard

Mappings, filetype and autocommands not loading properly

Open jlxz opened this issue 1 year ago • 4 comments

SO: Windows 10 GVim: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jun 28 2022 13:09:53) MS-Windows 32-bit GUI version with OLE support

I migrated from vim-plug to jetpack and many things stopped working properly. I couldn't analyze all of them, but I'll try to share some examples.

Jetpack is properly configured according the instructions in the README file.

I have this plugin Jetpack 'dahu/vim-help'

that define some mappings for help files among other things When loaded like that, the mappings are not working.

If I load it like this: Jetpack 'dahu/vim-help', {'for': 'help'}

The mappings are working.

If I load it like this:

packad vim-help
Jetpack 'dahu/vim-help', {'opt': 1}

The mappings are working.

I have the same issues with aucommands and augroups I have defined in my vimrc:

autocmd BufNewFile,BufRead *.csv   set filetype=csv
autocmd BufNewFile,BufRead *.dat   set filetype=csv_pipe
augroup ft_txt
  au!
  au BufNewFile,BufRead *.txt set filetype=log
augroup END

That are not working anymore.

Besides other strange things like loading an Untitled tab when opening Gvim without any buffer. Things that never happened before with vim-plug and I haven't modified anything in my vimrc or add something new besides changing Plug by Jetpack.

Thanks.

jlxz avatar Apr 25 '23 05:04 jlxz

Thank you. This issue is caused by the order of runtimepath. vim-plugin might put the plugin's path in front of the built-in plugin's one. Vim-jetpack didn't do it in main branch. I have created the 120-ftpluin branch for this issue. Please try it as follows:

call jetpack#begin()
Jetpack 'tani/vim-jetpack', { 'branch': '120-ftplugin', 'opt': 1 }
Jetpack 'dafu/vim-help'
call jetpack#end()

I am looking forward to reading your feedback. Thanks.

tani avatar Apr 25 '23 07:04 tani

Hi,

Thanks for your quick response. Now the vim-help plugin is working fine, but the loading of augroups and autocmd in my vimrc keeps failing.

Thanks

jlxz avatar Apr 25 '23 13:04 jlxz

Thanks for the feedback. I am glad to here that the issue is partially solved. Hmm, it's curious. I check it tomorrow.

tani avatar Apr 25 '23 13:04 tani

Hi, I have checked your problem. I am sorry that I cannot confirm your problem in the following configuration. Please share with me a "minimum" reproducible example.

let s:jetpackfile = expand('<sfile>:p:h') .. '/pack/jetpack/opt/vim-jetpack/plugin/jetpack.vim'
let s:jetpackurl = "https://raw.githubusercontent.com/tani/vim-jetpack/120-ftplugin/plugin/jetpack.vim"
if !filereadable(s:jetpackfile)
  call system(printf('curl -fsSLo %s --create-dirs %s', s:jetpackfile, s:jetpackurl))
endif

packadd vim-jetpack
call jetpack#begin()
call jetpack#add('tani/vim-jetpack', { 'branch': '120-ftplugin', 'opt': 1 })
call jetpack#end()

autocmd BufRead,BufNewFile *.csv set filetype=csv
autocmd BufRead,BufNewFile *.dat set filetype=csv_pipe

augroup ft_txt
 au!
 au BufNewFile,BufRead *.txt set filetype=log
augroup END

tani avatar Apr 26 '23 01:04 tani