Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to completely turn off vim's abilty to recode files?

Every encodings related question I've found is about how to recode files.

However, mine is quite contrary one - is it possible to make vim not to recode files at all? (and how, if so?)

Sometimes it is writing [converted] at the status line, and always miss. However, I have my terminal set at the same encoding as edited file, so, I don't need no recoding at all.

like image 845
Your Common Sense Avatar asked Feb 24 '23 16:02

Your Common Sense


2 Answers

Use

vim -b "myfile.type"

to edit in binary mode. You can also set

:set binary

or if you're lazy like me

:se bin

before editing a file in vim (applies to the current buffer)

:he `binary`


                     *'binary'* *'bin'* *'nobinary'* *'nobin'*
'binary' 'bin'      boolean (default off)
            local to buffer
            {not in Vi}
    This option should be set before editing a binary file.  You can also
    use the |-b| Vim argument.  When this option is switched on a few
    options will be changed (also when it already was on):
        'textwidth'  will be set to 0
        'wrapmargin' will be set to 0
        'modeline'   will be off
        'expandtab'  will be off
    Also, 'fileformat' and 'fileformats' options will not be used, the
    file is read and written like 'fileformat' was "unix" (a single <NL>
    separates lines).
    The 'fileencoding' and 'fileencodings' options will not be used, the
    file is read without conversion.
like image 83
sehe Avatar answered Mar 06 '23 03:03

sehe


If you are editing binary files you want what sehe suggests, binary.

If you're editing text files, then you probably need to change fileencodings, or if the problem is that vim hasn't detected the terminal encoding correctly, encoding.

like image 44
Andy Avatar answered Mar 06 '23 04:03

Andy