There is a file that I have to use in iso-2022-jp encoding. I tried

:e ++enc=iso-2022-jp

in the hope of converting the fileencodings to "iso-2022-jp" permanantly. But the next time I opened the file, vim responds to me

:se fenc?

I have not written any curious things in my vimrc. Why is this happening?

  • 2
    1) fenc stands for "fileencoding", not "fileencodings" (fencs). 2) How do you expect Vim to remember ++enc=xxx "next time"?
    – Matt
    Jan 7 at 15:06

1 Answer 1


Vim does not remember any settings. It starts afresh every time. It will read your initialization scripts (not just ~/.vimrc but ALL ~/.vim/* files) upon startup. If what you want isn't happening automatically, you'll need to do something to make it happen. I recommend using a filetype plugin.

Let's say your filetype is taro-enc. You should write a file: ~/.vim/after/ftplugin/taro-enc.vim with your vimscript (enc=iso-2022-jp). Now open the file and manually set the filetype :set filetype=taro-enc. Now your single file plugin should be sourced!

Well, almost. Perhaps you need to enable this feature. Make sure this is in your vimrc: :filetype plugin on.

And ok 1 more issue - this is manual! If you want to automatically detect your file as of filetype=taro-enc, then you can use your ~/..vim/filetype.vim file. (Mine is linked).

Extra notes:

You can realistically put all of this stuff just inside your vimrc, but it's better to keep organized. Makes your code more semantic.

Btw, I recommend using full names of commands when communicating with people to avoid silly issues like fenc vs. fencs :)

  • 2
    Not quite all ~/.vim files; that’s only one directory on the rtp. Really any plugin files, as well as ftdetect (if enabled) and some other things, and that’s for all directories on the rtp :)
    – D. Ben Knoble
    Jan 8 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.