Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just came across a problem that I seemed to have found a solution, but was a little surprised by the issue.

In gVim, when I save a new document (new from "within" gVim), ala

:w afile 

I realized it saves with I guess no file format, and thus is not visible in iPhone's PlainText app. Solution seems to be, save using

:w afile.txt 

then the problem seems solved. Is this a good way to solve it? Should I change a default somewhere, either in Windows or _gvimrc file?

I may consider doing some TeX'ing in vim at some point, so perhaps a default that allows for overriding in saving, and doesn't force txt when opening "any of all" documents.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Different platforms have different notions of file types and their detection. On Windows, mostly only the file extension (e.g. .doc for a Word document) is considered. Unix / Linux traditionally place less emphasis on that, and instead often look for characteristic sequences inside the file. Then there are file systems that place meta data beside the file itself. And you have MIME, a classification scheme for email attachments and Internet downloads.

As Vim is a general-purpose text editor, it doesn't have a "default filetype" like Word and Excel have. You can edit plain text, HTML, XML, config files, whatever (as long it's not indecipherable binary). Therefore, there's nothing to configure. If you have another application where it's easier to have a certain file extension, then by all means supply it.

Vim itself can detect various (mostly programming) languages, and then supplies syntax highlighting and other filetype-specific settings. It also uses a combination of file pattern and content matches. See :help filetypes for more information.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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