On my last job, they used Visual Studio 2005 (and occasionally Visual Studio 97), and for command line convenience I used vim for editing things like Mercurial version control configuration files like hgrc and .hgignore
However my coworkers soon began to complain that vim would change the encoding of the files, and would cause a message to popup in Visual Studio telling them about the encoding difference.
After that I stopped using vim and just ended up editing the files in Visual Studio.
Are there any changes to vim's configuration I can make so that this does not occur?
I'd use notepad to edit my files but it always puts that pesky .txt extension on the ends of my files.
I'm also aware of solutions like Notepad++, but I just wondered if there was a solution for this in vim.
If it is because their VS files are being saved as UTF-8 by default and your vim is doing ISO-8859-1 or ASCII, try changing your file encoding:
" Encoding displayed
:set encoding=utf-8
" Encoding written to file.
:set fileencoding=utf-8
For new files
:set ff=dos
In the standard setup, vim will preserve the line-ending style of an already existing file.
Another option might be to use ViEmu, which is a plugin that provides vi emulation within Visual Studio. Please note that it is not a free plugin, but to me it's worth paying for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With