Questions tagged [filetype-xml]

Questions about the xml file type.

Filter by
Sorted by
Tagged with
2 votes
1 answer
106 views

How do I prevent Vim from indenting lines containing <screen/> XML tags?

I edit a lot of Docbook files. <screen/> blocks are normally unindented in Docbook source code. How do I tell Vim to shift the <screen> tag to the very left when entering such tag? After ...
Tomáš Bažant's user avatar
0 votes
0 answers
89 views

How to run vimscript function on visually selected lines of text?

I'm editing DocBook XML files and sometimes I need to format the using an external xmlformat command. it is easy to run do this on the whole buffer of text, but how can i achieve the same only for a ...
Tomáš Bažant's user avatar
1 vote
1 answer
195 views

Vim autoindent and xml self-closing

(previously posted on https://stackoverflow.com/q/62000643/3206025 before I get that there is a Vi's SE) Here my vimrc filetype plugin indent on set autoindent set tabstop=2 set shiftwidth=2 set ...
Maïeul's user avatar
  • 121
1 vote
0 answers
122 views

XML syntax folding and custom tag spell checking

I have the following in my ~/vim/syntax/xrc.vim to spell check contents of specific tags when editing XRC files that are just XML files with predefined schema: runtime syntax/xml.vim " check ...
VZ.'s user avatar
  • 111
2 votes
2 answers
515 views

Is there an instant way of editing matching inner tags?

In Vim, using the text object i>, you can edit an inner tag, and using the built-in matchit plugin, you can even use % to jump between matching opening and closing tags. Let's say you want to ...
lpf's user avatar
  • 43
0 votes
2 answers
137 views

Return cursor to an initial position after pasting text from a function

in my plugin, i am joining XML tags together depending on a mapping a use. It also uses so i can make XML snippets repetitive. After inserting the text into a buffer, i would like the cursor to ...
Tomáš Bažant's user avatar
0 votes
1 answer
207 views

Run vimscript function only once although v:count1 > 1

I have a function that accepts a count of iterations, its command is defined with -range: command -nargs=1 -range DocbkPrintTag :call s:DocbkPrintTag(<f-args>) and to output <listitem> &...
Tomáš Bažant's user avatar
0 votes
1 answer
110 views

How do I move to the beginning of a visual block from a vimscript function?

Suppose i have several lines of text: line1 line1 line2 line2 line3 line3 I want to create a vimscript function that has the following result: <itemizedlist> <listitem><para>line1 ...
Tomáš Bažant's user avatar
0 votes
1 answer
170 views

Vim does not spellcheck the content of <title> element in my DocBook files

I have initiated online spell checking in .vimrc with autocmd FileType docbk set spell spelllang=en autocmd FileType docbk highlight SpellBad cterm=underline ctermfg=red ctermbg=none in my plugin's ...
Tomáš Bažant's user avatar
-1 votes
2 answers
649 views

Increase numbers by one in a visual block

I edit DocBook XML files. In my plugin, i want to implement a function that would increase or decrease the section numbers recursively, assuming that cursor is at the toplevel section. For example, ...
Tomáš Bažant's user avatar
3 votes
5 answers
3k views

Replace all self-closing xml tags with open and close tags

I have an XML document with many (dozens) of the following tags: <item prop1="val1" prop2="val2" /> I would like to change this to: <item prop1="val1" prop2="val2"> <sometihng>...
Seth's user avatar
  • 43
1 vote
1 answer
630 views

Find and replace in XML file in vi

I have an .xml file which contains many times the following web beacon <span lang="EN" class="multilang">ANY TEXT TOTO</span> I would like to make a "Find&Replace": each web beacon ...
Smilia's user avatar
  • 115
1 vote
1 answer
299 views

xml ftplugin overrides textwidth

I would like to hard wrap XML files during editing. In every other filetype my set textwidth=80 works fine. But in XML something overrides the insertion of line breaks. I tried adding t to ...
musarithmia's user avatar
0 votes
1 answer
47 views

Why is my XML filetype configuration overridding my PHP filetype configuration?

I'm using Vundle and have othree/xml.vim installed, as well as my own bundle for working with PHP. My PHP bundle has the following code: if exists('b:did_ftplugin') && 1 == b:did_ftplugin ...
magnus's user avatar
  • 427
2 votes
1 answer
1k views

How do I remove newlines inside arbitrary xml tags matching a pattern?

I'm working with large xml files that have tags, and some are spread across multiple lines, and some are on a single line. I'd like them to all be on a single line. There are other tags in the files ...
JHiant's user avatar
  • 123
1 vote
1 answer
307 views

Jump from tag-to-tag in xml?

I'm using emmet-vim which says that it can work in xml files but I can't seem to navigate between tags. Say I have this structure: <dependency> <groupId>com.google</groupId> &...
theonlygusti's user avatar
  • 2,189
1 vote
1 answer
84 views

Make UltiSnips perform XML encoding on tabstop text

I'm writing an XML document where I frequently produce markup like this: We can exit Terminal mode by pressing <keystroke>&lt;C-\&gt;&lt;C-n&gt;</keystroke>. I'd like to ...
nelstrom's user avatar
  • 289
4 votes
2 answers
126 views

Linewise inner tag without the tag lines?

An example HTML, with the cursor where the brackets are: <foo> <bar> baz quux [] </bar> </foo> I would like to outdent the text inside <...
Amadan's user avatar
  • 684
1 vote
3 answers
434 views

Conversion from XML to KML

I have an XML file with this format (there could be some leading spaces): <Latitude>23.1138</Latitude> <Longitude>8.2898</Longitude> ... <Latitude>19....
Jeff Diederiks's user avatar
1 vote
0 answers
47 views

Why does Vim treat the `<link>` tag in XML files differently?

I've noticed that omnicomplete and keyboard motions don't work in XML files with a <link> tag as expected. For example <related-links scope="external" format="html"> <link href="...
Scribblemacher's user avatar
0 votes
2 answers
1k views

How to remove line breaks in xml tags?

I often have to write XML where text-width has been manually set by another editor: <context> <p>Here is a paragraph about some stuff that happened and someone did a nice ...
Scribblemacher's user avatar
2 votes
0 answers
456 views

Make vim version 7 edit xml files

I'm using old Debian linux an vim version 7.1.314. I would like to edit eclipse .cproject file that build using XML syntax. Currently vim shows not colored information. I found vim plugin that I hope ...
vico's user avatar
  • 141
7 votes
2 answers
11k views

How to format xml or html's attributes into multiple lines instead of lining up on one line?

I'm using plugin Chiel92/vim-autoformat auto formatting xml files. So the default format program used for xml file is tidy. The way it formats xml file is like below: <List id='list' items='{/sss}'...
Aaron Shen's user avatar
  • 2,479
4 votes
2 answers
1k views

Highlight XML errors based on this XML file's XML Schema

I have an XML file that must conform to a particular XML Schema: <?xml version="1.0" encoding="UTF-8"?> <myroot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Nicolas Raoul's user avatar
2 votes
2 answers
543 views

Tips for quickly formatting a single line of XML?

I have a log file with lots of web service XML data (example follows). Ideally I would like to just go to a line and type ,x to create pretty formatted XML for readability. Response XML: <...
roblogic's user avatar
  • 707
68 votes
4 answers
24k views

How to jump between matching HTML/XML tags?

How to jump between matching tags (such as <div>, <span>, etc.) when editing HTML/XHTML/XML documents similarly as % is used to jump between matching parentheses?
kenorb's user avatar
  • 18k
4 votes
1 answer
2k views

How to make auto-indent XML in vim?

I am thinking on a similar solution, which Eclipse also does: during the editing, the editor tries to always hold in a "well-indented" format of the edited textual data. Ideally, it would happen very ...
peterh's user avatar
  • 1,147