vim / vim-appimage

AppImage for gVim
115 stars 20 forks source link

Bad runtimepath on session loading #28

Closed crash5 closed 3 years ago

crash5 commented 3 years ago

Because the appimage uses different path for the vim runtime on every start the runtimepath that saved in the Session.vim is wrong. Because of that the scripts from the default vim runtime path not loaded.

Error:

Error detected while processing command line..script <cut-out>/Session.vim[19]..BufRead Autocommands for "*.sh":
E117: Unknown function: dist#ft#SetFileTypeSH

Steps to reproduce:

$ wget https://github.com/vim/vim-appimage/releases/download/v8.2.2771/GVim-v8.2.2771.glibc2.15-x86_64.AppImage
$ ln -s GVim-v8.2.2771.glibc2.15-x86_64.AppImage vim
$ chmod u+x vim

$ ./vim -u NONE +"filetype plugin on" +"set rtp+=." test.sh
# insert something eg.: test-message
:w
:mks
:q

# now the runtime path in the Session.vim contains:
# runtimepath=~/.vim,/tmp/.mount_vimoFbdm6/usr/share/vim/vimfiles,/tmp/.mount_vimoFbdm6/usr/share/vim/vim82,/tmp/.mount_vimoFbdm6/usr/share/vim/vimfiles/after,~/.vim/after,.

./vim -u NONE +"filetype plugin on" +"set rtp+=." -S
> "test.sh" 1L, 18B
> Error detected while processing command line..script Session.vim[19]..BufRead Autocommands for "*.sh":
> E117: Unknown function: dist#ft#SetFileTypeSH
> Press ENTER or type command to continue

:set rtp?
> runtimepath=~/.vim,/tmp/.mount_vimoFbdm6/usr/share/vim/vimfiles,/tmp/.mount_vimoFbdm6/usr/share/vim/vim82,/tmp/.mount_vimoFbdm6/usr/share/vim/vimfiles/after,~/.vim/after,.

:echo $VIMRUNTIME
> /tmp/.mount_vimh7YdOt/usr/share/vim/vim82

Expected result: On session loading vim use the new runtime path.

I found a dirty workaround. Always have to create a Sessionx.vim file with every session but the file reload can be problematic.

set rtp+=$VIMRUNTIME
windo e!
brammool commented 3 years ago

I assume this can't be fixed in the appimage construction. I can add an item in 'sessionoptions', then in this version it can be included by default somehow.

crash5 commented 3 years ago

My only idea is some appimage only patch which is add a replacement functionality for a specific pattern in the runtimepath like .mount_vimXXX/ with the $VIMRUNTIME content on start/source command. I don't know if it is possible or how much work to do something like this.

Upd: I don't know if it's worth a new option in the sessionoptions setting.

brammool commented 3 years ago

8.2.2772 adds the option. It's questionable if 'runtimepath' should be in the session file at all, but since it's been there until now I hesitate to just remove it. You can at least try adding "skiprtp' to 'sessionoptions' to see if that completely fixes your problem.

crash5 commented 3 years ago

Thank you, I will take a look.

crash5 commented 3 years ago

I checked it with appimage v8.2.2772 and it looks good to me.

NOTE: It's look like the packpath has the old path too, but I don't see anything that is broken because of it (at least in my scenario) so I close this issue. Thank you again!