diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-05-19 11:15:10 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-05-19 11:15:10 +0900 |
| commit | b4b9266564d91a6d5b8bcbda0e3e3df5e60c108c (patch) | |
| tree | 345803f1853865049246bf59ac790c64d5269055 /linux/.local/bin/openfiles | |
| parent | 043a5608aa442206b939cd5d4feff6454e431781 (diff) | |
updates
Diffstat (limited to 'linux/.local/bin/openfiles')
| -rwxr-xr-x | linux/.local/bin/openfiles | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/linux/.local/bin/openfiles b/linux/.local/bin/openfiles new file mode 100755 index 0000000..f35aef1 --- /dev/null +++ b/linux/.local/bin/openfiles @@ -0,0 +1,34 @@ +#!/bin/sh + +if ! command -v vim >/dev/null 2>&1; then + echo "Error: 'vim' is not installed." >&2 + exit 1 +fi + +IFS=' +' + +files=$* + +for file in $files; do + files_list="$files_list \"$(realpath "$file")\"" +done + +eval "set -- $files_list" + +count=$# + +case "$count" in +2) + ${EDITOR:-vim} -O +'silent! normal g;' "$@" -c 'wincmd t' + ;; +3) + ${EDITOR:-vim} -O "$1" -c 'wincmd j' -c "silent! vsplit $2" -c "silent! split $3" -c 'wincmd t' + ;; +4) + ${EDITOR:-vim} -O "$1" -c "silent! vsplit $2" -c "silent! split $3" -c 'wincmd h' -c "silent! split $4" -c 'wincmd t' + ;; +*) + ${EDITOR:-vim} "$@" + ;; +esac |
