" Vimball Archiver by Charles E. Campbell, Jr., Ph.D. UseVimball finish autoload/xmlexpander.vim [[[1 2 " Run XMLExpander :menu Plugin.&XMLExpander :call xmlexpander#expand() doc/xmlexpander.txt [[[1 204 " vim: filetype=help foldmethod=marker foldmarker=<<<,>>> nomodifiable readonly *xmlexpander.txt* For Vim version 7.4. Last change: 2015 Apr 18 VIM REFERENCE MANUAL by Data Statiker XMLExpander plugin "Pretty Printer" (xmlexpander.vim) manual xmlexpander.vim version 0.3 For instructions on installing this file, type :help add-local-help |add-local-help| inside Vim. Github: https://github.com/Data-Statiker/VIM-XML *xmlexpander* *xmlexpander.vim* *xml_expander* *xml_exp.vim* *xmlexp* 1. Getting Started |xmlexpander-getting-started| 2. Whats New |xmlexpander-new| 3. Overview |xmlexpander-overview| 4. Installation |xmlexpander-install| 5. Menu |xmlexpander-menu| 6. Example |xmlexpander-example| 7. Mapping |xmlexpander-mapping| {Vi does not have any of this} ============================================================================== 1. Getting Started *xmlexpander-getting-started* With the XMLExpander extension plugin for vim you can make your XML file clear. The XMLExpander is a pretty printer for XML. When you have the problem that your xml files are e.g. in one line or have not clear insertions this plugin could help you. After running the XMLExpander every opening and ending tag is in one line and have clear insertions. First install the plugin: |xmlexpander-install| To run the XMLExpander do the following: - load the input XML file - execute the XMLExpander: menu Plugin->XMLExpander Now you have a pretty printed XML file (in the same VIM window!). Warning: The XML File must be syntactical correct! The script do not check this. ============================================================================== 2. Whats New *xmlexpander-new* Version 0.3 * New name: xmlexpander * Redefine functions and variables (xmlexpander) * New function xmlexpander#isContentText(text) to check if a text has to be harmonized ============================================================================== 3. Overview *xmlexpander-overview* With the XMLExpander extension plugin for vim you can make your XML file clear. The XMLExpander is a pretty printer for XML. When you have the problem that your xml files are e.g. in one line or have not clear insertions this plugin could help you. After running the XMLExpander every opening and ending tag is in one line and have clear insertions. To run the XMLExpander do the following: - load the input XML file - execute the XMLExpander: menu Plugin->XMLExpander Now you have a pretty printed XML file (in the same VIM window!). The XML File must be syntactical correct! The script do not check this. You can start the XMLExpander in the menu (Plugin->XMLExpander) or you can call the function xmlexpander#expand(). :call xmlexpander#expand() The XMLExpander read the XML in the current window and override the original XML with the pretty printed XML. ============================================================================== 4. Installation *xmlexpander-install* VIMBALL: ********* Download the vimball file xmlexpander.vmb from: http://www.vim.org/ Install the vimball file with VIM 1 Download the file xmlexpander.vmb 2 vim path/xmlexpander.vmb 3 :so % 4 :q Now you have the menu Plugin->XMLExpander HELP FILE: *********** To activate the helpfile in VIM type in command mode: :helptags ~/.vim/doc OR (Windows) :helptags C:\Users\YourUsername\vimfiles\doc Then you can open the helpfile with ':help xmlexpander' GITHUB: ********* GITHUB Repository: https://github.com/Data-Statiker/VIM-XML When you have the files from GITHUB: Copy the files of the folders 'autoload', 'doc' and 'plugin' to your local vimfiles: ~/.vim/doc OR (Windows) C:\Users\YourUsername\vimfiles\doc ============================================================================== 5. Menu *xmlexpander-menu* Plugin->XMLExpander When the script is installed it exists the menu "Plugin->XMLExpander ". With this menu entry you can start the script. ============================================================================== 6. Example *xmlexpander-example* Example 1: *********** Example of an XML before running the XMLExpander: one | line 1 two onetwo | line 2 three | line 3 The XML after running the XMLExpander looks like this: | line 1 | line 2 | line 3 | line 4 one | line 5 two | line 6 | line 7 | line 8 one | line 9 two | line 10 | line 11 three | line 12 | line 13 | line 14 Example 2: *********** Example of an XML before running the XMLExpander: | line 1 | line 2 | line 3 | line 4 one | line 5 two | line 6 | line 7 | line 8 one | line 9 two | line 10 | line 11 three | line 12 | line 13 | line 14 The XML after running the XMLExpander looks like this: | line 1 | line 2 | line 3 | line 4 one | line 5 two | line 6 | line 7 | line 8 one | line 9 two | line 10 | line 11 three | line 12 | line 13 | line 14 ============================================================================== 7. Mapping *xmlexpander-mapping* You can define one key to start the XMLExpander Plugin. Add the following line to your configuration file _vimrc to set the key "-" for starting the script: nnoremap - :call xmlexpander#expand() When you want to define another key replace the "-" with your favourite key. ============================================================================== vim:tw=78:fo=tcq2:ts=8:ft=help:norl: plugin/xmlexpander.vim [[[1 154 " xmlexpander.vim: (plugin) Read a XML and give it out formatted " Last Change: Sat Apr 19 08:55 PM 2015 MET " Maintainer: Data-Statiker " Version: 0.3, for Vim 7.4+ " Whats New: " Version 0.3 " * New name: xmlexpander " * Redefine functions and variables (xmlexpander) " * New function xmlexpander#isContentText(text) to check if a text has to be harmonized " Function that writes the xml in the current window :function! xmlexpander#write(xmlContent) :execute "normal" "gg" :execute "normal" "dG" :let tb = "" :let z = 0 :let r = 0 :let za = 1 :for r in range (0,len(a:xmlContent)-1) " All tags starting with ' 1) && (strpart(a:xmlContent[r],0,2) != "") :let tb = tb."\t" :endif :if (strpart(a:xmlContent[r],0,2) == " is wrote without " insertion :if (z == 1) && (strpart(a:xmlContent[r],0,2) != "") :let a = 0 :for a in range (0, len(bufferLine)-1) :let repl = xmlexpander#harmonize(bufferLine[a]) :call add(buffer,repl.">") :unlet repl :endfor :unlet a :let i += 1 :endwhile :unlet i :call xmlexpander#write(buffer) :endf