Skip to content

Instantly share code, notes, and snippets.

@koturn
Last active January 6, 2020 01:55
Show Gist options
  • Save koturn/32bc7c679b909b872125 to your computer and use it in GitHub Desktop.
Save koturn/32bc7c679b909b872125 to your computer and use it in GitHub Desktop.
Vim Scriptをコマンドラインで実行して,結果を見たいときのためのシェルスクリプトとバッチファイル
#!/bin/sh
if [ $# -lt 1 ]; then
echo 'Invalid arguments' 1>&2
echo '[USAGE]'
echo ' vs [FILE]'
exit 1
fi
for file in $@; do
\vim -X -N -u NONE -i NONE -V1 -e --cmd "source $file | qall!" 2>&1
done
@echo off
if "%~1" == "" goto error
:LOOPSTART
if "%~1" == "" (
goto LOOPEND
)
for %%i in (%1) do (
if exist %%i (
vim -X -N -u NONE -i NONE -e --cmd "source %%i | qall!" 2>&1
echo.
) else (
echo not exist: %%i 2>&1
)
)
shift
goto LOOPSTART
:LOOPEND
goto END
:ERROR
echo Invalid arguments 1>&2
echo [USAGE]
echo vs [FILE]
goto END
:END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment