On Tue, 8 Dec 2020 at 16:47, Bram Moolenaar <[email protected]> wrote: > > > Albert Wik wrote: > > > > Why does "set fencs=utf8" matter for the "%!cat" operation if Vim is > > not going to change the "fenc" accordingly? > > When reading a file (or filter output) the values in 'fencs' are tried > one by one. Normally when something fails then the next one is tried, > but since reading filter output from a pipe doesn't allow for a retry, > it will always use the first one.
Thanks, that is useful to know. > The real problem is that 'fencs' was set to "latin1" at first, thus Vim > didn't even try to use another encoding. Perhaps it also works if you > do that on the command line: > somecommand | vim - -c 'set fencs=utf8,latin1' No, because (according to --help) the command is run after loading the first file. Meanwhile, "--cmd <command>" does not work because it runs the command before sourcing any vimrc file, and so, the new fencs setting gets overwritten by the vimrc. It would be useful to have an option to run a command just *before* loading the first file but after any rc-files. I don't include utf8 in my default fencs setting because that has the side effect of using utf8 for any newly created files. -aw -- -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CALPW7mSgAFud82k-rEv4_MjWkPZQy84VRGFm1Yy79ZROEATppw%40mail.gmail.com.
