- Replace test -x / command -qv with command -q for consistency - Move mise/direnv/zoxide/fzf init to top of interactive block - Group related aliases into if blocks - Remove redundant vim/vi->v aliases (nvim handles EDITOR) - Fix fabric alias: fabric-ai -> fabric - Add config/mise/config.toml with tool definitions - Swap realpath/nvim check order in script/v
40 lines
677 B
Bash
Executable File
40 lines
677 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
required_tools=(realpath nvim)
|
|
missing=()
|
|
|
|
for tool in "${required_tools[@]}"; do
|
|
if ! command -v "$tool" &> /dev/null; then
|
|
missing+=("$tool")
|
|
fi
|
|
done
|
|
|
|
if [ "${#missing[@]}" -ne 0 ]; then
|
|
echo "$0: error: missing required tools: ${missing[*]}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
for arg in "$@"; do
|
|
if [ -d "$arg" ]; then
|
|
echo "$0: error: '$arg' is a directory" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
if [ ! -z "$NVIM" ]; then
|
|
# inside neovim
|
|
if [ "$#" -ne "0" ]; then
|
|
realpath --zero "$@" | xargs -0 -n1 nvim --server "$NVIM" --remote
|
|
fi
|
|
exit
|
|
fi
|
|
|
|
# outside neovim
|
|
|
|
if [ "$#" -eq "0" ]; then
|
|
nvim
|
|
exit
|
|
fi
|
|
|
|
nvim "$@"
|