sukima / xmledit

A filetype plugin for VIM to help edit XML files
http://www.vim.org/scripts/script.php?script_id=301
259 stars 41 forks source link

Cannot work! #49

Closed ianyepan closed 6 years ago

ianyepan commented 6 years ago

I cloned the repo to .vim/bundle/xmledit and ran the command make in the folder. What I got back from the terminal is: _vim --cmd 'let g:pluginname="xmledit-1.9.1"' -S build.vim -cq! When I tried out in a random HTML file nothing happened. Sorry if this is a stupid question, I'm quite a newbie with plugins.

sukima commented 6 years ago
  1. Not sure why .vim/bundle/xmledit That path is typically associated with a plugin in manager like Vundle or Pathogen. To use it you would need to add it to the list of plugins depending on your choice of plugin manager your using. Considering your next step used make I am assuming you are not using a plugin manager and so .vim/bundle/xmledit is simply a name conflict when you really intended it to be the temporary source folder you downloaded (i.e. ~/Downloads/xmledit/).
  2. make on its own is meant to build a VBA archive file that you could use to install the plugin. See :help vimball for info. But since you did not describe the use of installing a Vimball I am assuming that also is not what you want.
  3. make install was designed to copy the files from the current directory into your ~/.vim directory manually. I am assuming you wanted this.
ianyepan commented 6 years ago

Dear Devin,

Thank you for your response. I am actually using Pathogen as my manager. According to you, I should never have used the "make" command then? So after "git cloning" the repo (and automatically created a xmledit directory in my bundle folder), what is the next step I do to activate it? I have cloned a few other repos (like vim-surround, vim-indent-guides...) to my .vim/bundle folder before and they all seem to work right out of the box. I wonder if I am missing something here and "xmledit" requires a special activation. Thanks in advance.

Ian

2018-05-23 1:28 GMT+08:00 Devin Weaver notifications@github.com:

  1. Not sure why .vim/bundle/xmledit That path is typically associated with a plugin in manager like Vundle or Pathogen. To use it you would need to add it to the list of plugins depending on your choice of plugin manager your using. Considering your next step used make I am assuming you are not using a plugin manager and so .vim/bundle/xmledit is simply a name conflict when you really intended it to be the temporary source folder you downloaded (i.e. ~/Downloads/xmledit/).
  2. make on its own is meant to build a VBA archive file that you could use to install the plugin. See :help vimball for info. But since you did not describe the use of installing a Vimball I am assuming that also is not what you want.
  3. make install was designed to copy the files from the current directory into your ~/.vim directory manually. I am assuming you wanted this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sukima/xmledit/issues/49#issuecomment-391074447, or mute the thread https://github.com/notifications/unsubscribe-auth/Ai_MNHtF8XlkPqBkPRvaaNsURrHXI0Vkks5t1EqjgaJpZM4UI3BW .

sukima commented 6 years ago

Ok then if I understand correctly you use pathogen, (cloned to .vim/bundle/xmledit). I believe this should work. Try editing an XML file (ex. foo.xml) and see if it is working.

You mentioned HTML. In that case I think the missing step your need is https://github.com/sukima/xmledit#using-with-other-file-types (:help xml-plugin-callbacks).

Let me know if that helps.

ianyepan commented 6 years ago

I think you're right! The plugin does work in XML file types but not in HTML. I have never done any symbolic linking before (nor hard linking) but I heard it's just a single command or two? in my .vim/bundle/xmledit/ftplugin folder I've got four files: namely html.vim, php.vim, xhtml.vim, and xml.vim What do you suggest that I do now? Thank you in advance.

Ian

2018-05-23 11:11 GMT+08:00 Devin Weaver notifications@github.com:

Ok then if I understand correctly you use pathogen, (cloned to .vim/bundle/xmledit). I believe this should work. Try editing an XML file (ex. foo.xml) and see if it is working.

You mentioned HTML. In that case I think the missing step your need is https://github.com/sukima/xmledit#using-with-other-file-types (:help xml-plugin-callbacks).

Let me know if that helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sukima/xmledit/issues/49#issuecomment-391206657, or mute the thread https://github.com/notifications/unsubscribe-auth/Ai_MNGs-dlWZpC1Pi_wOQFha5_Ok1Qt9ks5t1NNTgaJpZM4UI3BW .

sukima commented 6 years ago

Just copy the xml.vim to whatever.vim. You could symlink it if your on a unix-like OS and want to save a few bytes of disk space. Or in the case of HTML use the example strait from the docs (note the runtime call at the bottom where it simply proxies to xml.vim):

The following is a sample html.vim file type plugin you could use:
>
  " Vim script file                                       vim600:fdm=marker:
  " FileType:   HTML
  " Maintainer: Devin Weaver <vim (at) tritarget.com>
  " 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 responsibility.

  let b:html_mode = 1

  if !exists("*HtmlAttribCallback")
  function HtmlAttribCallback( xml_tag )
      if a:xml_tag ==? "table"
          return "cellpadding=\"0\" cellspacing=\"0\" border=\"0\""
      elseif a:xml_tag ==? "link"
          return "href=\"/site.css\" rel=\"StyleSheet\" type=\"text/css\""
      elseif a:xml_tag ==? "body"
          return "bgcolor=\"white\""
      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=\"0\" height=\"0\" border=\"0\" alt=\"\""
      elseif a:xml_tag ==? "a"
          if has("browse")
              " Look up a file to fill the href. Used in local relative file
              " links. typeing your own href before closing the tag with `>'
              " will override this.
              let cwd = getcwd()
              let cwd = substitute (cwd, "\\", "/", "g")
              let href = browse (0, "Link to href...", getcwd(), "")
              let href = substitute (href, cwd . "/", "", "")
              let href = substitute (href, " ", "%20", "g")
          else
              let href = ""
          endif
          return "href=\"" . href . "\""
      else
          return 0
      endif
  endfunction
  endif

  " On to loading xml.vim
  runtime ftplugin/xml.vim
<