Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #1469 - Ctrl-N completion for XML/XSLT attributes

Created: January 12, 2007 10:55 Complexity: basic Author: Erik Falor Version: n/a Karma: 7/7 Imported from: Tip#1469

I found myself switching back into lisp mode just to get Ctrl-N to complete really long attribute names containing hyphens. However, that has the undesirable side-effect of goofing up my indentation. I decided to dig in a little deeper and fix Ctrl-N such that it wouldn't take a hypen to be a word boundary. As an added bonus, it'll include XSL namespace prefixes in its list of words .


Add this to your .vimrc so that hyphens and colons:


if has("autocmd")

autocmd BufRead *.xsl,*.xslt,*.xml :set iskeyword=@,-,\:,48-57,_,128-167,224-235 

endif "has("autocmd")

Comments

Here�s a better way to do that:

autocmd FileType {xml,xslt} setlocal iskeyword=--AT--,-,\:,48-57,_,128-167,224-235 

Firstly, this does not rely on extensions; instead it works on any file which the filetype detection identifies correctly.

Secondly, it only changes the 'iskeyword' value for that buffer, not globally.

pagaltzis--AT--gmx.de , January 13, 2007 0:52


Advertisement