#!/usr/bin/bash index="$HOME/vimwiki/index.wiki" typeset -a vimopts=( '-c' 'set titlestring=vimwiki' '-c' 'packadd vimwiki' '-c' "e $index" ) case $1 in -g) vimbin=$(command -v gvim);; -n) vimbin=$(command -v nvim) || vimbin=$(command -v vim);; *) vimbin=$(command -v tvim);; esac exec flock -w0 "$index" "$vimbin" "${vimopts[@]}"