completely new tvim and reworked vimwiki

This commit is contained in:
Von Random 2018-07-06 00:32:25 +03:00
parent 0a79858b42
commit 3e89680a0b
2 changed files with 23 additions and 8 deletions

16
tvim
View file

@ -1,5 +1,15 @@
#!/usr/bin/env bash
TERM=$(command -v default-terminal-emulator)
VIM=$(command -v nvim) || VIM=$(command -v vim)
typeset -a vimopt=(
'--cmd' 'let g:tvim = 1'
'--cmd' "set tgc mouse=a title titlestring=[%F]%m\\ -\\ TVIM"
)
exec "$TERM" -e "$VIM" -c 'set mouse=a' "$@" &>/dev/null & disown
error() {
echo "$*" >&2
exit 1
}
termbin=$(command -v st) || termbin=$(command -v xterm) || error "No terminal found!"
vimbin=$(command -v nvim) || vimbin=$(command -v vim) || error "No vim binary found!"
exec "$termbin" -e "$vimbin" "${vimopt[@]}" "$@" &>/dev/null & disown

15
vimwiki
View file

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