Last active
July 8, 2022 14:52
-
-
Save RichardBronosky/16d90f304f5104648bd9220781edc367 to your computer and use it in GitHub Desktop.
Pseudonvim: vim pseudonyms for nvim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
set -eu | |
nym="$(basename $0)" | |
pseudonyms=( | |
"vim:nvim" | |
"vimdiff:nvim -d" | |
"view:nvim -R" | |
"ex:nvim -e" | |
"exim:nvim -E" | |
"rview:nvim -RZ" | |
"rvim:nvim -Z" | |
) | |
for pseudonym in "${pseudonyms[@]}"; do | |
vim_nym="${pseudonym%:*}" | |
nvim_nym="${pseudonym#*:}" | |
[[ $vim_nym != $nym ]] || break | |
unset {,n}vim_nym | |
done | |
[[ -z ${nvim_nym:-} ]] || exec $nvim_nym "$@" | |
## Test Cases ## | |
# | |
# vim 2 files vs vimdiff 2 files | |
# date|tee /tmp/1|sed 's/\s\+/_/g'>/tmp/2; vim -o /tmp/[12]; vimdiff /tmp/[12] | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment