Skip to content

Commit

Permalink
appimage.sh: detect vim/gvim self name (#68)
Browse files Browse the repository at this point in the history
appimage.sh: detect vim/gvim self name
related: #67 

Signed-off-by: Christian Brabandt <[email protected]>
  • Loading branch information
mralusw authored Mar 28, 2024
1 parent ccdc450 commit cf936b4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions scripts/appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ make_appimage()

pushd ${APP}.AppDir
cat <<'EOF' > AppRun
#!/bin/bash
HERE="$(dirname "$(readlink -f "${0}")")"
#!/bin/sh
set -ue
: "${ARGV0:=$0}" # run without AppImage too
this_dir=$(readlink -f "$0")
this_dir=${this_dir%/*} # empty for '/'
VIMRUNTIME=${this_dir}/usr/share/vim/vim91; export VIMRUNTIME
test -x "${this_dir}/usr/bin/gvim" || ARGV0=/vim
case "${ARGV0##*/}" in
(vim*) set -- "${this_dir}/usr/bin/vim" "$@" ;;
(*) set -- "${this_dir}/usr/bin/gvim" "$@" ;;
esac
unset ARGV0
export VIMRUNTIME=${HERE}/usr/share/vim/vim91
test -L "${HERE}/usr/bin/gvim" && exec "${HERE}/usr/bin/gvim" "${@+"$@"}"
exec "${HERE}/usr/bin/vim" "${@+"$@"}"
exec "$@"
EOF
popd

Expand Down

0 comments on commit cf936b4

Please sign in to comment.