====== XMLEdit ====== XML,HTML,SGML 편집 도우미 플러그인이다. * http://www.vim.org/scripts/script.php?script_id=301 ===== 단축키 ===== * ''%'' : 태그의 짝을 찾아 이동한다. * 태그를 쓰고 ''>'' 를 누르면 자동으로 닫힘 태그가 만들어진다. * 태그를 쓰고 ''>>'' 를 누르면 자동으로 닫힘 태그가 만들어지고, 태그의 중간에 한칸이 띄워지면서 커서가 글을 쓸 수 있는 위치로 이동한다. ===== HTML ===== * 이 기능을 HTML에서도 사용하려면, ftplug/html.vim 을 스스로 생성해서 넣어야 한다. * :help xml-plugin-html 로 html.vim 을 생성하는 방법을 알 수 있다. * ''HtmlAttribCallback'' 함수를 정의하면, 태그의 기본 attribute 들을 자동으로 완성해주게 할 수 있는데, [[vim:html|vim:html에서 소개한 Zen Coding]]을 사용할 경우 이 기능은 거의 불필요하다. * 나의 ftplugin/html.vim : 현재는 도움말에 있는 것과 거의 같음. * " Vim script file vim600:fdm=marker: " FileType: HTML " Maintainer: Devin Weaver " Location: http://www.vim.org/scripts/script.php?script_id=301 " This is a wrapper script to add extra html support to xml documents. " Original script can be seen in xml-plugin documentation. " Only do this when not done yet for this buffer if exists("b:did_ftplugin") finish endif " Don't set 'b:did_ftplugin = 1' because that is xml.vim's responsability. let b:html_mode = 1 if !exists("*HtmlAttribCallback") function HtmlAttribCallback( xml_tag ) if a:xml_tag ==? "table" return "id=\"\" class=\"\"" elseif a:xml_tag ==? "link" return "href=\"/site.css\" rel=\"StyleSheet\" type=\"text/css\"" elseif a:xml_tag ==? "frame" return "name=\"NAME\" src=\"/\" scrolling=\"auto\" noresize" elseif a:xml_tag ==? "frameset" return "rows=\"0,*\" cols=\"*,0\" border=\"0\"" elseif a:xml_tag ==? "img" return "src=\"\" width=\"\" height=\"\" alt=\"\"" elseif a:xml_tag ==? "a" return "href=\"\"" elseif a:xml_tag ==? "form" return "id=\"\" action=\"\" method=\"post\"" else return 0 endif endfunction endif " On to loading xml.vim runtime ftplugin/xml.vim