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

Mappings, filetype and autocommands not loading properly #120

Open
jlxz opened this issue Apr 25, 2023 · 4 comments
Open

Mappings, filetype and autocommands not loading properly #120

jlxz opened this issue Apr 25, 2023 · 4 comments

Comments

@jlxz
Copy link

jlxz commented Apr 25, 2023

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.

@tani
Copy link
Owner

tani commented Apr 25, 2023

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.

@jlxz
Copy link
Author

jlxz commented Apr 25, 2023

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

@tani
Copy link
Owner

tani commented Apr 25, 2023

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

@tani
Copy link
Owner

tani commented Apr 26, 2023

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

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

2 participants