]> git.rmz.io Git - dotfiles.git/commitdiff
alias: return error when no arguments given to vim within VIM_TERMINAL
authorSamir Benmendil <me@rmz.io>
Sat, 6 Feb 2021 12:18:25 +0000 (12:18 +0000)
committerSamir Benmendil <me@rmz.io>
Sat, 6 Feb 2021 12:18:25 +0000 (12:18 +0000)
aliases

diff --git a/aliases b/aliases
index f09cea4fd362215196152cf5cc46057d64e0caab..7163ca4078b2ea18690ae718b4d38af057acd82a 100644 (file)
--- a/aliases
+++ b/aliases
@@ -15,6 +15,10 @@ alias free='free -m'             # show sizes in MB
 
 if [[ -n "${VIM_TERMINAL}" ]]; then
     function vim() {
+        if (( ${#@} == 0 )); then
+            echo "Running in Vim's terminal, at least one file must be given!" >&2
+            return 22
+        fi
         for f in "$@"; do
             if [[ "${f:0:1}" == "-" ]]; then
                 echo "Running in Vim's terminal, not accepting options!" >&2