Saturday, July 31, 2021

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

$ 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

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/40ce7b1a-fa06-4f0b-95b1-9bdfe005ea19n%40googlegroups.com.

No comments:

Post a Comment