vim ... < /dev/null behaves differently for indentation?

16 views
Skip to first unread message

Peng Yu

unread,
Jul 31, 2021, 5:25:27 PM7/31/21
to vim_use
$ cat /tmp/mktemp/tmp.KBMEySQJEs.awk
BEGIN {
x = 1
y = 2
}

Suppose that I have the above file.

$ vim -n --cmd ':set t_ti= t_te=' -X -E -c 'normal gg=G' -c x /tmp/tmp.KBMEySQJEs.awk < /dev/null

The above command won't indent it correctly. The following command will indent it correctly.

$ vim -n --cmd ':set t_ti= t_te=' -X -E -c 'normal gg=G' -c x /tmp/tmp.KBMEySQJEs.awk < /dev/tty
5 lines indented
"/private/tmp/mktemp/tmp.KBMEySQJEs.awk" 5L, 27B written

But for the following file. Vim can indent it with /dev/null. Does anybody know why vim behaves differently on the two files? Thanks.

$ cat  /tmp//tmp.KBMEySQJEs.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

      declare -p BASH_SOURCE
$ vim -n --cmd ':set t_ti= t_te=' -X -E -c 'normal gg=G' -c x /tmp//tmp.KBMEySQJEs.sh < /dev/null
$ cat  /tmp/tmp.KBMEySQJEs.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

declare -p BASH_SOURCE
Reply all
Reply to author
Forward
0 new messages