vimの下部の[converted]はどういう意味ですか?

vimの下部の[converted]はどういう意味ですか?

ログファイルがあり、vimで開くと読み込めないように見え、一番下に[変換]されています。 [変換] とはどういう意味ですか?

人が読めるようにフォーマットの問題を解決する方法はありますか?

ベストアンサー1

これはvim、ファイルとそのロケールによって提供される文字セットとの間の不一致が検出され変換されたことを意味します。:set内部でコマンドを実行する場合vim:

:set
--- Options ---
  autoindent          fileformat=dos      scroll=7            textwidth=70
  background=dark     filetype=asciidoc   shiftwidth=2        ttyfast
  cscopetag           helplang=en         softtabstop=2       ttymouse=sgr
  cscopeverbose       hlsearch            syntax=asciidoc
noendofline           list                tabpagemax=3
  expandtab           ruler               textmode
  backspace=indent,eol,start
  comments=s1:/*,ex:*/,://,b:#,:%,:XCOMM,fb:-,fb:*,fb:+,fb:.,fb:>
  cscopeprg=/usr/bin/cscope
  fileencoding=utf-8
  fileencodings=ucs-bom,utf-8,latin1

最後の2つのオプションfileencoding&を参照してくださいfileencodings

1つ目は現在のファイルで使用されているエンコーディング、2つ目は認識されたエンコーディングのカンマ区切りリストです。

したがって、このメッセージが表示されたら、vimファイル転送が完了したことを知らせます。fileencodingencoding

詳細を見るか調べ:help fileencodingてください:help encoding

引用する

この質問に答えたとき、ソースとして使用した以下のスレッドを見つけました。もともとサイトは消えたので(この回答の記録からアクセス可能)、子孫のためにこのスレッドの内容をここに移しました。これリンクはまだWayback Machineにあります。

#1 Eli the Bearded January 21st, 2004 - 06:51 pm ET | Report spam
In comp.os.linux.misc, Leon. wrote:
Hide the quote
"Gaétan Martineau" wrote in message
news:E9jLb.2903$
> [ system_notes]$ vi installation_chouette.txt
> What means the [converted] at the bottom of the screen, as in:
> "installation_chouette.txt" [converted] 2576L, 113642C

It means that vim detected that the file did not match the
charset given by your locale and made a conversion. What does

:set

Tell you about "fileencoding" and "fileencodings"? The first is
the encoding used for the current file, the second is a comma
separated list of recognized encodings.

Hide the quote
> This file has accented characters. How can I save the file so that if I
> reload if again, I do not see "converted"?



Figure out what charset you want, and then

:set fileencoding=[charset]
:w

Hide the quote
It means deleting the Microsoft Dos/ Windows CR LF end of lines, to just
LF - unix standard end of lines.

It does not. If you open a file with DOS line ends, vim reports [dos]
after the filename, not [converted]. If you do have a dos file that
you wish to convert to unix line ends, you can

:set fileformat=unix
:w

Elijah

おすすめ記事