Coder Social home page Coder Social logo

xml.vim's Introduction

Fix some bug by othree.

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1397

A plugin for editing xml. I used xml.vim (http://www.vim.org/scripts/script.php?script_id=301)
The script does retain most of the functionality of the original xml.vim 
 - closing tags while you type
 - optional adding attributes
 - and more
 - % matches end or begin tag
it adds:
 - fold tags, comments and Cdata 
 - add start tag
 - add end tags
 - add  tag around a visual blok or a tag,
 - join 2 adjacent same tags
 - delete tag
 - delete tag section
 - change a tag 
 - visual mode  (blocks, listitems
The documentation will be created once the script is loaded e.g edit a xml file.
Read the help documentation by typing from within vim  :help xml-plugin

xml.vim's People

Contributors

actionshrimp avatar bootleq avatar gpelouze avatar othree avatar spacewander avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xml.vim's Issues

Invalid Expression

Hi, your plugin works great with xml files but when i open a php-file i get the following error...transalted from german.

E15: invalid Expression: expand(':p:h')^M
Line 2:
E121: Undefined variable: s:path
E15: invalid expression: 'so ' . s:path . '/xml.vim'^M

Any hints?
greetz Andi

Define [[, ]], [], ][, [", ]" also for visual modes

In an xml file :map [[ will tell you that [[ is remapped by this plugin to

n [[ *@m':call <SNR>148_findOpenTag('bW')<CR>

I would like to adjust my visual selection with the motions defined by this plugin.

However, a :xmap [[ will say No Mapping Found.

I tried a naive approache to add them

~/.vim/pack/minpac/start/xml.vim master*
❯ g diff
diff --git a/ftplugin/xml.vim b/ftplugin/xml.vim
index fc67f1b..0990097 100644
--- a/ftplugin/xml.vim
+++ b/ftplugin/xml.vim
@@ -1479,10 +1479,16 @@ call s:unmapKeys()
   call <SID>mapKey('n', ']]', "m':call <SID>findOpenTag('W')<CR>")
   call <SID>mapKey('n', '[]', "m':call <SID>findCloseTag('bW')<CR>")
   call <SID>mapKey('n', '][', "m':call <SID>findCloseTag('W')<CR>")
+  call <SID>mapKey('x', '[[', "m':call <SID>findOpenTag('bW')<CR>")
+  call <SID>mapKey('x', ']]', "m':call <SID>findOpenTag('W')<CR>")
+  call <SID>mapKey('x', '[]', "m':call <SID>findCloseTag('bW')<CR>")
+  call <SID>mapKey('x', '][', "m':call <SID>findCloseTag('W')<CR>")

   " Move around comments                                                  {{{2
   call <SID>mapKey('n', ']"', substitute(':call search("^\(\s*<!--.*\n\)\@<!\(\s*-->\)", "W")<CR>', '"', "'", 'g'))
   call <SID>mapKey('n', '["', substitute(':call search("\%(^\s*<!--.*\n\)\%(^\s*-->\)\@!", "bW")<CR>', '"', "'", 'g'))
+  call <SID>mapKey('x', ']"', substitute(':call search("^\(\s*<!--.*\n\)\@<!\(\s*-->\)", "W")<CR>', '"', "'", 'g'))
+  call <SID>mapKey('x', '["', substitute(':call search("\%(^\s*<!--.*\n\)\%(^\s*-->\)\@!", "bW")<CR>', '"', "'", 'g'))

   " insert mode shortcuts                                                 {{{2
   call <SID>mapKey('i', b:suffix, ' ><Esc>db:call <SID>makeElement()<Cr>')

But this does not work.

Would you be interest in adding them?

Error on unload if matchit plugin is not used

I have xml.vim installed, but not the matchit plugin. Thus, b:match_ignorecase is not set, and when the plugin unloads, the unlet call gives an error. Other plugins use unlet! to ignore the errors during onload.

I will submit a PR shortly.

Error on first run in Windows and doesn't work afterwards

I'm getting the following error in Windows when I install xml.vim:
xml-vim-error

The error is showed only once, but the script does not work afterwards (no folding etc).

Install it as follows:

mkdir -p ~/vimfiles/ftplugin
cd ~/vimfiles/ftplugin
curl -O https://raw.githubusercontent.com/othree/xml.vim/master/ftplugin/xml.vim

Vim version:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 10 2013 14:38:33)

Improve xml.vim for jsx

The problem is we have arrow function in jsx, and > would trigger the tag expand, the solution is check the previous character and not expand if it's =.
I'm wondering if a PR like that would be acceptable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.