From 4c5d9439420602b3ca3c45ef1c55dde7287e8a55 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Sun, 17 Jul 2022 22:38:47 +0100 Subject: [PATCH] Put the vim flatpak path in one place --- roles/home-cli/files/bashrc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/roles/home-cli/files/bashrc b/roles/home-cli/files/bashrc index 98817bb..4c375bd 100644 --- a/roles/home-cli/files/bashrc +++ b/roles/home-cli/files/bashrc @@ -74,27 +74,28 @@ then export GPG_TTY=$(tty) fi -# Set EDITOR to vim or vi. -if test -x ${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/app/org.vim.Vim/current/active/export/bin/org.vim.Vim +# Set up Vim. +vimflatpak=${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/app/org.vim.Vim/current/active/export/bin/org.vim.Vim +if test -x $vimflatpak then - export EDITOR="${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/app/org.vim.Vim/current/active/export/bin/org.vim.Vim -f" + export EDITOR="$vimflatpak -f" elif test -x /usr/bin/vim then export EDITOR="/usr/bin/vim -f" else export EDITOR=vi fi - -# Alias vi to vim if it is installed. -if test -x ${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/app/org.vim.Vim/current/active/export/bin/org.vim.Vim +if test -x $vimflatpak then - alias vi=${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/app/org.vim.Vim/current/active/export/bin/org.vim.Vim + alias vim=$vimflatpak + alias vi=$vimflatpak elif test -x /usr/bin/vim then alias vi=/usr/bin/vim else alias vim=vi fi +unset vimflatpak if [ ${XDG_CURRENT_DESKTOP:-unknown} == GNOME ] then