When filetype-indent is on and opening more than one xml file, cpoptions
is reset to the default value. This is because the xml indent file
finish prematurely when the XmlIndentGet() function has already been
defined. At that point the cpoptions is not restored.

The command below shows the problem. When vim finishes startup the
cpoptions contains the default value.

$ vim --noplugin -u NONE -N     \
        -c 'filetype indent on' \
        -c 'set cpo+=y$W'       \
        -c 'set ft=xml'         \
        test.xml                \
        -c 'set ft=xml'         \
        test2.xml               \
        -c 'set cpo?'

-- 
    Rick

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff --git i/runtime/indent/xml.vim w/runtime/indent/xml.vim
index 319dc39..7373932 100644
--- i/runtime/indent/xml.vim
+++ w/runtime/indent/xml.vim
@@ -32,7 +32,11 @@ if !exists('b:xml_indent_close')
 endif
 
 " [-- finish, if the function already exists --]
-if exists('*XmlIndentGet') | finish | endif
+if exists('*XmlIndentGet')
+  let &cpo = s:keepcpo
+  unlet s:keepcpo
+  finish
+endif
 
 fun! <SID>XmlIndentWithPattern(line, pat)
     let s = substitute('x'.a:line, a:pat, "\1", 'g')

Raspunde prin e-mail lui