Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Vim to edit Microsoft Word files

Tags:

I've found ViEmu, a vi emulator for microsoft word. However, I wanted to use vim to edit DOC or even rtf files. Is this possible ?

Are they any other formats that preserve page/paragraph layout compatible with both Microsoft Word and Vim? I am also open to OpenOffice formats.

like image 452
Kilon Avatar asked Sep 23 '10 12:09

Kilon


People also ask

Can I use Vim on Microsoft Word?

ViEmu for Word and Outlook is an innovative new product that provides vi/vim emulation for document processing in Microsoft Word, and for mail composing in Microsoft Outlook. ViEmu for Visual Studio is compatible with Microsoft Word and Outlook from Office versions 2002 (XP) to Office 2016.

Can you open a docx with vim?

vim is just a wrapper around OS X's textutil command, which supports docx in recent versions of OS X, so it would just involve adding a few lines to the script.

How do I use Vim as word processor?

Vim comes with a built-in spellcheck ability. You can make your “WordProcessor” function use that ability by using the command setlocal spell spelllang=en_us . You can define multiple languages here in a comma-separated list. Find more language files at this Vim FTP site.

How do I edit a Word document in Linux?

If you need to create, open, and edit Microsoft Word documents in Linux, you can use LibreOffice Writer or AbiWord. Both are robust word processing applications that read and write files in Word . doc and . docx formats.


2 Answers

That’s not possible. Vim is by its very nature a plain text editor and doesn’t offer Microsoft Word style WYSIWYG. You cannot edit formatted documents.

To be sure, you can edit the source code of an RTF file (RTF is a fairly simple formatting language so editing it manually is theoretically possible) but I don’t think this is what you’re after.

If you want to edit using Vim but still produce documents with formatting, your best shot is LaTeX. This allows you to create professional documents via a macro programming language.

like image 66
Konrad Rudolph Avatar answered Sep 22 '22 15:09

Konrad Rudolph


If you are willing to install a plugin called textutil.vim you can do this. The caveat is that when you open the program in vi/vim it converts the .rtf or .doc file to plain text and then converted back when you save it back.

As with all conversions you are liable to lose something in it, but at least it allows you to edit something in a pinch.

like image 39
stygma Avatar answered Sep 23 '22 15:09

stygma