File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ PRINT_ALL=1
4
4
DISABLE_VIMRC=0
5
5
MODE=none
6
6
7
+ # This creates an array to store vim commands to run:
7
8
set -- " $@ " ' ---vims-end---'
8
9
while : ; do
9
10
case " $1 " in
@@ -17,6 +18,10 @@ while :; do
17
18
-t|--turn-off-mode) MODE=none;;
18
19
* )
19
20
case " $MODE " in
21
+ # Each of these store a single command. For example,
22
+ # -l makes MODE=line-exe, which then stores the command:
23
+ # `-c :"%g/.*/exe "norm {CMD}"`, where {CMD} is the string
24
+ # the user passes after `-l`.
20
25
none) set -- " $@ " -c " $1 " ;;
21
26
simple) set -- " $@ " -c " :exe \" norm gg" " $1 " " \" " ;;
22
27
line-exe) set -- " $@ " -c " :%g/.*/exe \" norm " " $1 " " \" " ;;
@@ -38,4 +43,5 @@ if [ "$DISABLE_VIMRC" -eq "1" ]; then
38
43
set -- -u NONE " $@ "
39
44
fi
40
45
46
+ # Finally, we execute the stored array of vim commands:
41
47
vim - -nes " $@ " -c ' :q!' | tail -n +2
You can’t perform that action at this time.
0 commit comments