tags:

views:

323

answers:

5

Can VIM be used for XAML editing?

A: 

Sure. For a better experience try out some XML plugins (for folding and such) and turn on syntax highlighting.

Mohit Chakraborty
+3  A: 

Yeap. XAML is really just XML and thus plain text.

Here's a "Hello World" example.

<Canvas xmlns="http://schemas.microsoft.com/client/2007"  
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  <TextBlock>Hello World!</TextBlock>
</Canvas>

If you don't already have an XML plugin you may want to try xmledit

Andrew Grant
I have xml.vim already installed, but it does not recognize .xaml as .xml. Also it whould be cool to get xaml completion :-)
alex2k8
:set filetype=xml
rampion
+2  A: 

Throw this line at the bottom of your source file and you should be compatible with VS2008:

<!-- vim: tw=120 ts=4 sw=4 et enc=utf8 syn=xml -->
Paul Betts
For this to work, I had to move closing --> to the new line.
alex2k8
+2  A: 

If you want full intellisense etc... An option that may be worth exploring is ViEmu which brings vim keybindings to visual studio.

Sam Saffron
+1  A: 

Add the following to your filetype.vim (this will be in your $VIM/vim72 directory, or you can create one in your own personal .vim directory). This will tell Vim to automatically set the filetype for xaml files to xml.

" Xaml
au BufNewFile,BufRead *.xaml        setf xml
Kris Erickson