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
:)
fenc
stands for "fileencoding", not "fileencodings" (fencs
). 2) How do you expect Vim to remember++enc=xxx
"next time"?